diff options
author | Simon Horman <horms+renesas@verge.net.au> | 2013-07-30 10:59:00 +0900 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-08-06 18:18:52 +0900 |
commit | 5c6db1a421c6ceef199a956c7e0c1244ea6dfef7 (patch) | |
tree | 57d4a16f58f50124b2630f4579ca4c04284e8983 /arch/arm | |
parent | f79d68da510bf1b95beff4d556b78d06801f11dc (diff) | |
download | linux-stable-5c6db1a421c6ceef199a956c7e0c1244ea6dfef7.tar.gz linux-stable-5c6db1a421c6ceef199a956c7e0c1244ea6dfef7.tar.bz2 linux-stable-5c6db1a421c6ceef199a956c7e0c1244ea6dfef7.zip |
ARM: shmobile: ape6evm: support GPIO switches
The ape6evm board has switches S16 - S23 wired up to GPIO pins.
This patch allows access to those pins as gpio-keys.
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-shmobile/board-ape6evm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c index ccf8b0429083..677752cc796a 100644 --- a/arch/arm/mach-shmobile/board-ape6evm.c +++ b/arch/arm/mach-shmobile/board-ape6evm.c @@ -19,6 +19,8 @@ */ #include <linux/gpio.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/tmio.h> @@ -37,6 +39,24 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> +/* GPIO KEY */ +#define GPIO_KEY(c, g, d, ...) \ + { .code = c, .gpio = g, .desc = d, .active_low = 1 } + +static struct gpio_keys_button gpio_buttons[] = { + GPIO_KEY(KEY_0, 324, "S16"), + GPIO_KEY(KEY_MENU, 325, "S17"), + GPIO_KEY(KEY_HOME, 326, "S18"), + GPIO_KEY(KEY_BACK, 327, "S19"), + GPIO_KEY(KEY_VOLUMEUP, 328, "S20"), + GPIO_KEY(KEY_VOLUMEDOWN, 329, "S21"), +}; + +static struct __initdata gpio_keys_platform_data ape6evm_keys_pdata = { + .buttons = gpio_buttons, + .nbuttons = ARRAY_SIZE(gpio_buttons), +}; + /* Dummy supplies, where voltage doesn't matter */ static struct regulator_consumer_supply dummy_supplies[] = { REGULATOR_SUPPLY("vddvario", "smsc911x"), @@ -172,6 +192,9 @@ static void __init ape6evm_add_standard_devices(void) platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, sdhi1_resources, ARRAY_SIZE(sdhi1_resources), &sdhi1_pdata, sizeof(sdhi1_pdata)); + platform_device_register_data(&platform_bus, "gpio-keys", -1, + &ape6evm_keys_pdata, + sizeof(ape6evm_keys_pdata)); } static const char *ape6evm_boards_compat_dt[] __initdata = { |