]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/commitdiff
AM335XEVM: Volume Keys Support Added.
authorGoutam Kumar <goutam.kumar@ti.com>
Wed, 28 Sep 2011 08:47:51 +0000 (14:17 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:36 +0000 (00:44 +0530)
         1. GPIO Keys Support Enabled for volume up/down push bottons.
         2. Correction in Matrix Keypad for DB boot mode.

Signed-off-by: Goutam Kumar <goutam.kumar@ti.com>
Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
arch/arm/mach-omap2/board-am335xevm.c
arch/arm/mach-omap2/mux33xx.c

index f35d65ea10987dc8ed2952559778d2ebb6fbeffb..231faa5c0f3adfea3d5418a31d7c853ff3c3eb0f 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
+#include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/mtd/mtd.h>
@@ -662,6 +663,57 @@ static void matrix_keypad_init(int evm_id, int profile)
        }
 }
 
+
+/* pinmux for keypad device */
+static struct pinmux_config volume_keys_pin_mux[] = {
+       {"spi0_sclk.gpio0_2",  OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+       {"spi0_d0.gpio0_3",    OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+       {NULL, 0},
+};
+
+/* Configure GPIOs for Volume Keys */
+static struct gpio_keys_button am335x_evm_volume_gpio_buttons[] = {
+       {
+               .code                   = KEY_VOLUMEUP,
+               .gpio                   = GPIO_TO_PIN(0, 2),
+               .active_low             = true,
+               .desc                   = "volume-up",
+               .type                   = EV_KEY,
+               .wakeup                 = 1,
+       },
+       {
+               .code                   = KEY_VOLUMEDOWN,
+               .gpio                   = GPIO_TO_PIN(0, 3),
+               .active_low             = true,
+               .desc                   = "volume-down",
+               .type                   = EV_KEY,
+               .wakeup                 = 1,
+       },
+};
+
+static struct gpio_keys_platform_data am335x_evm_volume_gpio_key_info = {
+       .buttons        = am335x_evm_volume_gpio_buttons,
+       .nbuttons       = ARRAY_SIZE(am335x_evm_volume_gpio_buttons),
+};
+
+static struct platform_device am335x_evm_volume_keys = {
+       .name   = "gpio-keys",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &am335x_evm_volume_gpio_key_info,
+       },
+};
+
+static void volume_keys_init(int evm_id, int profile)
+{
+       int err;
+
+       setup_pin_mux(volume_keys_pin_mux);
+       err = platform_device_register(&am335x_evm_volume_keys);
+       if (err)
+               pr_err("failed to register matrix keypad (2x3) device\n");
+}
+
 /*
 * @evm_id - evm id which needs to be configured
 * @dev_cfg - single evm structure which includes
@@ -1289,6 +1341,7 @@ static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
        {wl12xx_init,   DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 | PROFILE_5)},
        {d_can_init,    DEV_ON_DGHTR_BRD, PROFILE_1},
        {matrix_keypad_init, DEV_ON_DGHTR_BRD, PROFILE_0},
+       {volume_keys_init,  DEV_ON_DGHTR_BRD, PROFILE_0},
        {NULL, 0, 0},
 };
 
index 4a43fc1a2bed041bb584406200d286fc6ea0d537..ead79f4f60481b21e75bd066b7d173caf9ed0127 100644 (file)
@@ -286,10 +286,10 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
                "mmc0_sdwp", "mmc1_clk", "mmc2_clk", NULL),
        _AM33XX_MUXENTRY(SPI0_SCLK, 0,
                "spi0_sclk", NULL, NULL, NULL,
-               NULL, NULL, NULL, NULL),
+               NULL, NULL, NULL, "gpio0_2"),
        _AM33XX_MUXENTRY(SPI0_D0, 0,
                "spi0_d0", NULL, NULL, NULL,
-               NULL, NULL, NULL, NULL),
+               NULL, NULL, NULL, "gpio0_3"),
        _AM33XX_MUXENTRY(SPI0_D1, 0,
                "spi0_d1", "mmc1_sdwp", "i2c1_sda", NULL,
                NULL, NULL, NULL, NULL),