diff options
author | Simon Horman <horms+renesas@verge.net.au> | 2013-07-29 21:59:00 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-08-06 05:18:52 -0400 |
commit | 5c6db1a421c6ceef199a956c7e0c1244ea6dfef7 (patch) | |
tree | 57d4a16f58f50124b2630f4579ca4c04284e8983 | |
parent | f79d68da510bf1b95beff4d556b78d06801f11dc (diff) |
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>
-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 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/gpio_keys.h> | ||
23 | #include <linux/input.h> | ||
22 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
23 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
24 | #include <linux/mfd/tmio.h> | 26 | #include <linux/mfd/tmio.h> |
@@ -37,6 +39,24 @@ | |||
37 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
38 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
39 | 41 | ||
42 | /* GPIO KEY */ | ||
43 | #define GPIO_KEY(c, g, d, ...) \ | ||
44 | { .code = c, .gpio = g, .desc = d, .active_low = 1 } | ||
45 | |||
46 | static struct gpio_keys_button gpio_buttons[] = { | ||
47 | GPIO_KEY(KEY_0, 324, "S16"), | ||
48 | GPIO_KEY(KEY_MENU, 325, "S17"), | ||
49 | GPIO_KEY(KEY_HOME, 326, "S18"), | ||
50 | GPIO_KEY(KEY_BACK, 327, "S19"), | ||
51 | GPIO_KEY(KEY_VOLUMEUP, 328, "S20"), | ||
52 | GPIO_KEY(KEY_VOLUMEDOWN, 329, "S21"), | ||
53 | }; | ||
54 | |||
55 | static struct __initdata gpio_keys_platform_data ape6evm_keys_pdata = { | ||
56 | .buttons = gpio_buttons, | ||
57 | .nbuttons = ARRAY_SIZE(gpio_buttons), | ||
58 | }; | ||
59 | |||
40 | /* Dummy supplies, where voltage doesn't matter */ | 60 | /* Dummy supplies, where voltage doesn't matter */ |
41 | static struct regulator_consumer_supply dummy_supplies[] = { | 61 | static struct regulator_consumer_supply dummy_supplies[] = { |
42 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | 62 | REGULATOR_SUPPLY("vddvario", "smsc911x"), |
@@ -172,6 +192,9 @@ static void __init ape6evm_add_standard_devices(void) | |||
172 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, | 192 | platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, |
173 | sdhi1_resources, ARRAY_SIZE(sdhi1_resources), | 193 | sdhi1_resources, ARRAY_SIZE(sdhi1_resources), |
174 | &sdhi1_pdata, sizeof(sdhi1_pdata)); | 194 | &sdhi1_pdata, sizeof(sdhi1_pdata)); |
195 | platform_device_register_data(&platform_bus, "gpio-keys", -1, | ||
196 | &ape6evm_keys_pdata, | ||
197 | sizeof(ape6evm_keys_pdata)); | ||
175 | } | 198 | } |
176 | 199 | ||
177 | static const char *ape6evm_boards_compat_dt[] __initdata = { | 200 | static const char *ape6evm_boards_compat_dt[] __initdata = { |