diff options
author | Andrew Victor <andrew@sanpeople.com> | 2007-06-04 03:41:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-07-12 06:11:21 -0400 |
commit | d0f9b55ece0ec1ffc9e2e57fd7a79200994aead4 (patch) | |
tree | da67cbf9d0bf6850e4ba98e642ebdf0821c21f91 /arch/arm | |
parent | cdf95c73694e464cf9877cb5aa51df77f42815bc (diff) |
[ARM] 4420/2: AT91: GPIO buttons on SAM9261-EK board
Register the GPIO-connected buttons on the SAM9261-EK board as a
"gpio-keys" platform device.
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/board-sam9261ek.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 579b41f0c328..42e172cb0f49 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/spi/ads7846.h> | 28 | #include <linux/spi/ads7846.h> |
29 | #include <linux/dm9000.h> | 29 | #include <linux/dm9000.h> |
30 | #include <linux/fb.h> | 30 | #include <linux/fb.h> |
31 | #include <linux/gpio_keys.h> | ||
32 | #include <linux/input.h> | ||
31 | 33 | ||
32 | #include <video/atmel_lcdc.h> | 34 | #include <video/atmel_lcdc.h> |
33 | 35 | ||
@@ -333,6 +335,68 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data; | |||
333 | #endif | 335 | #endif |
334 | 336 | ||
335 | 337 | ||
338 | /* | ||
339 | * GPIO Buttons | ||
340 | */ | ||
341 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
342 | static struct gpio_keys_button ek_buttons[] = { | ||
343 | { | ||
344 | .gpio = AT91_PIN_PA27, | ||
345 | .keycode = BTN_0, | ||
346 | .desc = "Button 0", | ||
347 | .active_low = 1, | ||
348 | }, | ||
349 | { | ||
350 | .gpio = AT91_PIN_PA26, | ||
351 | .keycode = BTN_1, | ||
352 | .desc = "Button 1", | ||
353 | .active_low = 1, | ||
354 | }, | ||
355 | { | ||
356 | .gpio = AT91_PIN_PA25, | ||
357 | .keycode = BTN_2, | ||
358 | .desc = "Button 2", | ||
359 | .active_low = 1, | ||
360 | }, | ||
361 | { | ||
362 | .gpio = AT91_PIN_PA24, | ||
363 | .keycode = BTN_3, | ||
364 | .desc = "Button 3", | ||
365 | .active_low = 1, | ||
366 | } | ||
367 | }; | ||
368 | |||
369 | static struct gpio_keys_platform_data ek_button_data = { | ||
370 | .buttons = ek_buttons, | ||
371 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
372 | }; | ||
373 | |||
374 | static struct platform_device ek_button_device = { | ||
375 | .name = "gpio-keys", | ||
376 | .id = -1, | ||
377 | .num_resources = 0, | ||
378 | .dev = { | ||
379 | .platform_data = &ek_button_data, | ||
380 | } | ||
381 | }; | ||
382 | |||
383 | static void __init ek_add_device_buttons(void) | ||
384 | { | ||
385 | at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ | ||
386 | at91_set_deglitch(AT91_PIN_PB27, 1); | ||
387 | at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ | ||
388 | at91_set_deglitch(AT91_PIN_PB26, 1); | ||
389 | at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ | ||
390 | at91_set_deglitch(AT91_PIN_PB25, 1); | ||
391 | at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ | ||
392 | at91_set_deglitch(AT91_PIN_PB24, 1); | ||
393 | |||
394 | platform_device_register(&ek_button_device); | ||
395 | } | ||
396 | #else | ||
397 | static void __init ek_add_device_buttons(void) {} | ||
398 | #endif | ||
399 | |||
336 | static void __init ek_board_init(void) | 400 | static void __init ek_board_init(void) |
337 | { | 401 | { |
338 | /* Serial */ | 402 | /* Serial */ |
@@ -360,6 +424,8 @@ static void __init ek_board_init(void) | |||
360 | #endif | 424 | #endif |
361 | /* LCD Controller */ | 425 | /* LCD Controller */ |
362 | at91_add_device_lcdc(&ek_lcdc_data); | 426 | at91_add_device_lcdc(&ek_lcdc_data); |
427 | /* Push Buttons */ | ||
428 | ek_add_device_buttons(); | ||
363 | } | 429 | } |
364 | 430 | ||
365 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") | 431 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") |