diff options
author | Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> | 2010-10-27 08:40:52 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-11-24 03:57:12 -0500 |
commit | fcbd0c5f20918c6db0c72d4e7546880833713f9c (patch) | |
tree | 6c4199914f522143a75ecbca9f7717236d404781 /arch/arm/mach-mx5/board-mx51_efikamx.c | |
parent | 9d2c0ef76f429c038de27e1b734d65a67dbc8088 (diff) |
efikamx: add support for power key
This patch adds support for power key button of the efika mx. It's connected
on GPIO 2 31.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5/board-mx51_efikamx.c')
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_efikamx.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c index 386bf2af6c04..4d102ea22e70 100644 --- a/arch/arm/mach-mx5/board-mx51_efikamx.c +++ b/arch/arm/mach-mx5/board-mx51_efikamx.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
22 | #include <linux/input.h> | ||
22 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
24 | #include <linux/fsl_devices.h> | 25 | #include <linux/fsl_devices.h> |
@@ -48,10 +49,13 @@ | |||
48 | #define EFIKAMX_GREEN_LED (2*32 + 14) | 49 | #define EFIKAMX_GREEN_LED (2*32 + 14) |
49 | #define EFIKAMX_RED_LED (2*32 + 15) | 50 | #define EFIKAMX_RED_LED (2*32 + 15) |
50 | 51 | ||
52 | #define EFIKAMX_POWER_KEY (1*32 + 31) | ||
53 | |||
51 | /* the pci ids pin have pull up. they're driven low according to board id */ | 54 | /* the pci ids pin have pull up. they're driven low according to board id */ |
52 | #define MX51_PAD_PCBID0 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) | 55 | #define MX51_PAD_PCBID0 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) |
53 | #define MX51_PAD_PCBID1 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) | 56 | #define MX51_PAD_PCBID1 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) |
54 | #define MX51_PAD_PCBID2 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) | 57 | #define MX51_PAD_PCBID2 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) |
58 | #define MX51_PAD_PWRKEY IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE) | ||
55 | 59 | ||
56 | static iomux_v3_cfg_t mx51efikamx_pads[] = { | 60 | static iomux_v3_cfg_t mx51efikamx_pads[] = { |
57 | /* UART1 */ | 61 | /* UART1 */ |
@@ -90,6 +94,9 @@ static iomux_v3_cfg_t mx51efikamx_pads[] = { | |||
90 | MX51_PAD_CSI1_D9__GPIO_3_13, | 94 | MX51_PAD_CSI1_D9__GPIO_3_13, |
91 | MX51_PAD_CSI1_VSYNC__GPIO_3_14, | 95 | MX51_PAD_CSI1_VSYNC__GPIO_3_14, |
92 | MX51_PAD_CSI1_HSYNC__GPIO_3_15, | 96 | MX51_PAD_CSI1_HSYNC__GPIO_3_15, |
97 | |||
98 | /* power key */ | ||
99 | MX51_PAD_PWRKEY, | ||
93 | }; | 100 | }; |
94 | 101 | ||
95 | /* Serial ports */ | 102 | /* Serial ports */ |
@@ -219,6 +226,22 @@ static struct platform_device mx51_efikamx_leds_device = { | |||
219 | }, | 226 | }, |
220 | }; | 227 | }; |
221 | 228 | ||
229 | static struct gpio_keys_button mx51_efikamx_powerkey[] = { | ||
230 | { | ||
231 | .code = KEY_POWER, | ||
232 | .gpio = EFIKAMX_POWER_KEY, | ||
233 | .type = EV_PWR, | ||
234 | .desc = "Power Button (CM)", | ||
235 | .wakeup = 1, | ||
236 | .debounce_interval = 10, /* ms */ | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | static const struct gpio_keys_platform_data mx51_efikamx_powerkey_data __initconst = { | ||
241 | .buttons = mx51_efikamx_powerkey, | ||
242 | .nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey), | ||
243 | }; | ||
244 | |||
222 | static void __init mxc_board_init(void) | 245 | static void __init mxc_board_init(void) |
223 | { | 246 | { |
224 | mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, | 247 | mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, |
@@ -235,6 +258,7 @@ static void __init mxc_board_init(void) | |||
235 | } | 258 | } |
236 | 259 | ||
237 | platform_device_register(&mx51_efikamx_leds_device); | 260 | platform_device_register(&mx51_efikamx_leds_device); |
261 | imx51_add_gpio_keys(&mx51_efikamx_powerkey_data); | ||
238 | } | 262 | } |
239 | 263 | ||
240 | static void __init mx51_efikamx_timer_init(void) | 264 | static void __init mx51_efikamx_timer_init(void) |