Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d0f9b55ece0ec1ffc9e2e57fd7a79200994aead4
Commit:     d0f9b55ece0ec1ffc9e2e57fd7a79200994aead4
Parent:     cdf95c73694e464cf9877cb5aa51df77f42815bc
Author:     Andrew Victor <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 4 08:41:59 2007 +0100
Committer:  Russell King <[EMAIL PROTECTED]>
CommitDate: Thu Jul 12 11:11:21 2007 +0100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
---
 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 579b41f..42e172c 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -28,6 +28,8 @@
 #include <linux/spi/ads7846.h>
 #include <linux/dm9000.h>
 #include <linux/fb.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 
 #include <video/atmel_lcdc.h>
 
@@ -333,6 +335,68 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data;
 #endif
 
 
+/*
+ * GPIO Buttons
+ */
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+static struct gpio_keys_button ek_buttons[] = {
+       {
+               .gpio           = AT91_PIN_PA27,
+               .keycode        = BTN_0,
+               .desc           = "Button 0",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = AT91_PIN_PA26,
+               .keycode        = BTN_1,
+               .desc           = "Button 1",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = AT91_PIN_PA25,
+               .keycode        = BTN_2,
+               .desc           = "Button 2",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = AT91_PIN_PA24,
+               .keycode        = BTN_3,
+               .desc           = "Button 3",
+               .active_low     = 1,
+       }
+};
+
+static struct gpio_keys_platform_data ek_button_data = {
+       .buttons        = ek_buttons,
+       .nbuttons       = ARRAY_SIZE(ek_buttons),
+};
+
+static struct platform_device ek_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &ek_button_data,
+       }
+};
+
+static void __init ek_add_device_buttons(void)
+{
+       at91_set_gpio_input(AT91_PIN_PB27, 0);  /* btn0 */
+       at91_set_deglitch(AT91_PIN_PB27, 1);
+       at91_set_gpio_input(AT91_PIN_PB26, 0);  /* btn1 */
+       at91_set_deglitch(AT91_PIN_PB26, 1);
+       at91_set_gpio_input(AT91_PIN_PB25, 0);  /* btn2 */
+       at91_set_deglitch(AT91_PIN_PB25, 1);
+       at91_set_gpio_input(AT91_PIN_PB24, 0);  /* btn3 */
+       at91_set_deglitch(AT91_PIN_PB24, 1);
+
+       platform_device_register(&ek_button_device);
+}
+#else
+static void __init ek_add_device_buttons(void) {}
+#endif
+
 static void __init ek_board_init(void)
 {
        /* Serial */
@@ -360,6 +424,8 @@ static void __init ek_board_init(void)
 #endif
        /* LCD Controller */
        at91_add_device_lcdc(&ek_lcdc_data);
+       /* Push Buttons */
+       ek_add_device_buttons();
 }
 
 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to