diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-01-23 03:28:27 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:00:32 -0500 |
commit | 6d2a8401d27e3eb8b71d09dd67e0e7d0085b5e29 (patch) | |
tree | 0290f68d89b6724b81b2ccff304bd6e78a8c9c19 /arch/arm/mach-at91 | |
parent | a04ff1af9723607f5901b79c559357e37cee6823 (diff) |
[ARM] 4759/1: [AT91] Buttons on CSB300
Support for the 3 GPIO-connected buttons on the CSB300 board.
Based on wakeup testing code from David Brownell.
Signed-off-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/board-csb337.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index d0aa20c9383e..51cb3c8cc601 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/input.h> | ||
29 | #include <linux/gpio_keys.h> | ||
28 | 30 | ||
29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
30 | #include <asm/setup.h> | 32 | #include <asm/setup.h> |
@@ -156,6 +158,63 @@ static struct platform_device csb_flash = { | |||
156 | .num_resources = ARRAY_SIZE(csb_flash_resources), | 158 | .num_resources = ARRAY_SIZE(csb_flash_resources), |
157 | }; | 159 | }; |
158 | 160 | ||
161 | /* | ||
162 | * GPIO Buttons (on CSB300) | ||
163 | */ | ||
164 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
165 | static struct gpio_keys_button csb300_buttons[] = { | ||
166 | { | ||
167 | .gpio = AT91_PIN_PB29, | ||
168 | .code = BTN_0, | ||
169 | .desc = "sw0", | ||
170 | .active_low = 1, | ||
171 | .wakeup = 1, | ||
172 | }, | ||
173 | { | ||
174 | .gpio = AT91_PIN_PB28, | ||
175 | .code = BTN_1, | ||
176 | .desc = "sw1", | ||
177 | .active_low = 1, | ||
178 | .wakeup = 1, | ||
179 | }, | ||
180 | { | ||
181 | .gpio = AT91_PIN_PA21, | ||
182 | .code = BTN_2, | ||
183 | .desc = "sw2", | ||
184 | .active_low = 1, | ||
185 | .wakeup = 1, | ||
186 | } | ||
187 | }; | ||
188 | |||
189 | static struct gpio_keys_platform_data csb300_button_data = { | ||
190 | .buttons = csb300_buttons, | ||
191 | .nbuttons = ARRAY_SIZE(csb300_buttons), | ||
192 | }; | ||
193 | |||
194 | static struct platform_device csb300_button_device = { | ||
195 | .name = "gpio-keys", | ||
196 | .id = -1, | ||
197 | .num_resources = 0, | ||
198 | .dev = { | ||
199 | .platform_data = &csb300_button_data, | ||
200 | } | ||
201 | }; | ||
202 | |||
203 | static void __init csb300_add_device_buttons(void) | ||
204 | { | ||
205 | at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */ | ||
206 | at91_set_deglitch(AT91_PIN_PB29, 1); | ||
207 | at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */ | ||
208 | at91_set_deglitch(AT91_PIN_PB28, 1); | ||
209 | at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */ | ||
210 | at91_set_deglitch(AT91_PIN_PA21, 1); | ||
211 | |||
212 | platform_device_register(&csb300_button_device); | ||
213 | } | ||
214 | #else | ||
215 | static void __init csb300_add_device_buttons(void) {} | ||
216 | #endif | ||
217 | |||
159 | static void __init csb337_board_init(void) | 218 | static void __init csb337_board_init(void) |
160 | { | 219 | { |
161 | /* Serial */ | 220 | /* Serial */ |
@@ -177,6 +236,8 @@ static void __init csb337_board_init(void) | |||
177 | at91_add_device_mmc(0, &csb337_mmc_data); | 236 | at91_add_device_mmc(0, &csb337_mmc_data); |
178 | /* NOR flash */ | 237 | /* NOR flash */ |
179 | platform_device_register(&csb_flash); | 238 | platform_device_register(&csb_flash); |
239 | /* Switches on CSB300 */ | ||
240 | csb300_add_device_buttons(); | ||
180 | } | 241 | } |
181 | 242 | ||
182 | MACHINE_START(CSB337, "Cogent CSB337") | 243 | MACHINE_START(CSB337, "Cogent CSB337") |