diff options
-rw-r--r-- | arch/arm/configs/rx51_defconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 82 |
2 files changed, 83 insertions, 1 deletions
diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index e7e31332c62a..155973426025 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig | |||
@@ -784,7 +784,7 @@ CONFIG_INPUT_KEYBOARD=y | |||
784 | # CONFIG_KEYBOARD_XTKBD is not set | 784 | # CONFIG_KEYBOARD_XTKBD is not set |
785 | # CONFIG_KEYBOARD_NEWTON is not set | 785 | # CONFIG_KEYBOARD_NEWTON is not set |
786 | # CONFIG_KEYBOARD_STOWAWAY is not set | 786 | # CONFIG_KEYBOARD_STOWAWAY is not set |
787 | # CONFIG_KEYBOARD_GPIO is not set | 787 | CONFIG_KEYBOARD_GPIO=m |
788 | # CONFIG_INPUT_MOUSE is not set | 788 | # CONFIG_INPUT_MOUSE is not set |
789 | # CONFIG_INPUT_JOYSTICK is not set | 789 | # CONFIG_INPUT_JOYSTICK is not set |
790 | # CONFIG_INPUT_TABLET is not set | 790 | # CONFIG_INPUT_TABLET is not set |
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 | |||
51 | static 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 | |||
97 | static struct gpio_keys_platform_data rx51_gpio_keys_data = { | ||
98 | .buttons = rx51_gpio_keys, | ||
99 | .nbuttons = ARRAY_SIZE(rx51_gpio_keys), | ||
100 | }; | ||
101 | |||
102 | static 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 | |||
110 | static void __init rx51_add_gpio_keys(void) | ||
111 | { | ||
112 | platform_device_register(&rx51_gpio_keys_device); | ||
113 | } | ||
114 | #else | ||
115 | static void __init rx51_add_gpio_keys(void) | ||
116 | { | ||
117 | } | ||
118 | #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ | ||
119 | |||
39 | static int board_keymap[] = { | 120 | static 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 | ||