aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-rx51-peripherals.c
diff options
context:
space:
mode:
authorJani Nikula <ext-jani.1.nikula@nokia.com>2009-11-06 01:59:47 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:09:35 -0500
commitf014ee320e8779c1798998f75bfc3cef2b46286f (patch)
tree5f43b1d3820fd14122a9cba66866bd96d7dc2a2b /arch/arm/mach-omap2/board-rx51-peripherals.c
parent76b5c84f77c3abc92a3c4e185e7b78f17a0ed204 (diff)
ARM OMAP3: RX-51 board - add initialization of gpio keys
Initialize some of the RX-51 input GPIO lines as gpio keys. Enable gpio keys as a module in rx51_defconfig. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'arch/arm/mach-omap2/board-rx51-peripherals.c')
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index cf4583a5d284..fb5988c1a884 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -20,6 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
23#include <linux/mmc/host.h> 24#include <linux/mmc/host.h>
24 25
25#include <plat/mcspi.h> 26#include <plat/mcspi.h>
@@ -36,6 +37,86 @@
36#define SYSTEM_REV_B_USES_VAUX3 0x1699 37#define SYSTEM_REV_B_USES_VAUX3 0x1699
37#define SYSTEM_REV_S_USES_VAUX3 0x8 38#define SYSTEM_REV_S_USES_VAUX3 0x8
38 39
40#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
41
42#define RX51_GPIO_CAMERA_LENS_COVER 110
43#define RX51_GPIO_CAMERA_FOCUS 68
44#define RX51_GPIO_CAMERA_CAPTURE 69
45#define RX51_GPIO_KEYPAD_SLIDE 71
46#define RX51_GPIO_LOCK_BUTTON 113
47#define RX51_GPIO_PROXIMITY 89
48
49#define RX51_GPIO_DEBOUNCE_TIMEOUT 10
50
51static struct gpio_keys_button rx51_gpio_keys[] = {
52 {
53 .desc = "Camera Lens Cover",
54 .type = EV_SW,
55 .code = SW_CAMERA_LENS_COVER,
56 .gpio = RX51_GPIO_CAMERA_LENS_COVER,
57 .active_low = 1,
58 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
59 }, {
60 .desc = "Camera Focus",
61 .type = EV_KEY,
62 .code = KEY_CAMERA_FOCUS,
63 .gpio = RX51_GPIO_CAMERA_FOCUS,
64 .active_low = 1,
65 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
66 }, {
67 .desc = "Camera Capture",
68 .type = EV_KEY,
69 .code = KEY_CAMERA,
70 .gpio = RX51_GPIO_CAMERA_CAPTURE,
71 .active_low = 1,
72 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
73 }, {
74 .desc = "Lock Button",
75 .type = EV_KEY,
76 .code = KEY_SCREENLOCK,
77 .gpio = RX51_GPIO_LOCK_BUTTON,
78 .active_low = 1,
79 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
80 }, {
81 .desc = "Keypad Slide",
82 .type = EV_SW,
83 .code = SW_KEYPAD_SLIDE,
84 .gpio = RX51_GPIO_KEYPAD_SLIDE,
85 .active_low = 1,
86 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
87 }, {
88 .desc = "Proximity Sensor",
89 .type = EV_SW,
90 .code = SW_FRONT_PROXIMITY,
91 .gpio = RX51_GPIO_PROXIMITY,
92 .active_low = 0,
93 .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
94 }
95};
96
97static struct gpio_keys_platform_data rx51_gpio_keys_data = {
98 .buttons = rx51_gpio_keys,
99 .nbuttons = ARRAY_SIZE(rx51_gpio_keys),
100};
101
102static struct platform_device rx51_gpio_keys_device = {
103 .name = "gpio-keys",
104 .id = -1,
105 .dev = {
106 .platform_data = &rx51_gpio_keys_data,
107 },
108};
109
110static void __init rx51_add_gpio_keys(void)
111{
112 platform_device_register(&rx51_gpio_keys_device);
113}
114#else
115static void __init rx51_add_gpio_keys(void)
116{
117}
118#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
119
39static int board_keymap[] = { 120static int board_keymap[] = {
40 KEY(0, 0, KEY_Q), 121 KEY(0, 0, KEY_Q),
41 KEY(0, 1, KEY_O), 122 KEY(0, 1, KEY_O),
@@ -541,5 +622,6 @@ void __init rx51_peripherals_init(void)
541 rx51_i2c_init(); 622 rx51_i2c_init();
542 board_onenand_init(); 623 board_onenand_init();
543 board_smc91x_init(); 624 board_smc91x_init();
625 rx51_add_gpio_keys();
544} 626}
545 627