diff options
author | Alejandro Sierra <b18039@freescale.com> | 2011-12-22 08:37:13 -0600 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-01-19 12:41:23 +0800 |
commit | ba06ad06d40a7108b225d18f1f7644ad4831f03c (patch) | |
tree | 83d06af9d7296c6a29828a9a7e33a6a01052453a /arch | |
parent | 19be3d2ec3d146c4cc33d5f246ac7d8062483858 (diff) |
ENGR00170880 Add gpio key support
Adding gpio keys to support Android buttons. Button
functionality are back, menu, home, vol up, vol down
Signed-off-by: Alejandro Sierra <b18039@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabreauto.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabreauto.c b/arch/arm/mach-mx6/board-mx6q_sabreauto.c index b7b8a031f61e..f5b2f6bca779 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabreauto.c +++ b/arch/arm/mach-mx6/board-mx6q_sabreauto.c @@ -119,6 +119,12 @@ #define MX6Q_SABREAUTO_PMIC_INT IMX_GPIO_NR(5, 16) +#define ARD_ANDROID_HOME IMX_GPIO_NR(1, 11) +#define ARD_ANDROID_BACK IMX_GPIO_NR(1, 12) +#define ARD_ANDROID_MENU IMX_GPIO_NR(2, 12) +#define ARD_ANDROID_VOLUP IMX_GPIO_NR(2, 15) +#define ARD_ANDROID_VOLDOWN IMX_GPIO_NR(5, 14) + void __init early_console_setup(unsigned long base, struct clk *clk); static struct clk *sata_clk; static int esai_record; @@ -170,6 +176,13 @@ static iomux_v3_cfg_t mx6q_sabreauto_pads[] = { MX6Q_PAD_GPIO_3__I2C3_SCL, MX6Q_PAD_GPIO_3__I2C3_SCL, + /* Android GPIO keys */ + MX6Q_PAD_SD2_CMD__GPIO_1_11, /* home */ + MX6Q_PAD_SD2_DAT3__GPIO_1_12, /* back */ + MX6Q_PAD_SD4_DAT4__GPIO_2_12, /* prog */ + MX6Q_PAD_SD4_DAT7__GPIO_2_15, /* vol up */ + MX6Q_PAD_DISP0_DAT20__GPIO_5_14, /* vol down */ + /* SD1 */ MX6Q_PAD_SD1_CLK__USDHC1_CLK, MX6Q_PAD_SD1_CMD__USDHC1_CMD, @@ -247,7 +260,6 @@ static iomux_v3_cfg_t mx6q_sabreauto_pads[] = { MX6Q_PAD_DISP0_DAT17__IPU1_DISP0_DAT_17, MX6Q_PAD_DISP0_DAT18__IPU1_DISP0_DAT_18, MX6Q_PAD_DISP0_DAT19__IPU1_DISP0_DAT_19, - MX6Q_PAD_DISP0_DAT20__IPU1_DISP0_DAT_20, MX6Q_PAD_DISP0_DAT21__IPU1_DISP0_DAT_21, MX6Q_PAD_DISP0_DAT23__IPU1_DISP0_DAT_23, /*PMIC INT*/ @@ -357,6 +369,49 @@ enum sd_pad_mode { SD_PAD_MODE_HIGH_SPEED, }; +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) +#define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \ +{ \ + .gpio = gpio_num, \ + .type = EV_KEY, \ + .code = ev_code, \ + .active_low = act_low, \ + .desc = "btn " descr, \ + .wakeup = wake, \ +} + +static struct gpio_keys_button ard_buttons[] = { + GPIO_BUTTON(ARD_ANDROID_HOME, KEY_HOME, 1, "home", 0), + GPIO_BUTTON(ARD_ANDROID_BACK, KEY_BACK, 1, "back", 0), + GPIO_BUTTON(ARD_ANDROID_MENU, KEY_MENU, 1, "menu", 0), + GPIO_BUTTON(ARD_ANDROID_VOLUP, KEY_VOLUMEUP, 1, "volume-up", 0), + GPIO_BUTTON(ARD_ANDROID_VOLDOWN, KEY_VOLUMEDOWN, 1, "volume-down", 0), +}; + +static struct gpio_keys_platform_data ard_android_button_data = { + .buttons = ard_buttons, + .nbuttons = ARRAY_SIZE(ard_buttons), +}; + +static struct platform_device ard_android_button_device = { + .name = "gpio-keys", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &ard_android_button_data, + } +}; + +static void __init imx6q_add_android_device_buttons(void) +{ + platform_device_register(&ard_android_button_device); +} +#else +static void __init imx6q_add_android_device_buttons(void) {} +#endif + + + static int plt_sd3_pad_change(int clock) { static enum sd_pad_mode pad_mode = SD_PAD_MODE_LOW_SPEED; @@ -1337,6 +1392,7 @@ static void __init mx6_board_init(void) imx6q_add_ldb(&ldb_data); imx6q_add_v4l2_output(0); imx6q_add_v4l2_capture(0); + imx6q_add_android_device_buttons(); imx6q_add_imx_snvs_rtc(); |