ar71xx: use the gpio_keys_polled driver instead of gpio_buttons
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-db120.c
index 3e4af40bdbb81c7d20f07913a084e62bba5e0f0e..56c2bf7526dbea69e6fa77ccde7ef92516749fee 100644 (file)
@@ -19,7 +19,8 @@
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
 #include "dev-usb.h"
-#include "dev-ar934x-wmac.h"
+#include "dev-ar9xxx-wmac.h"
+#include "dev-db120-pci.h"
 
 #define DB120_GPIO_LED_USB     11
 #define DB120_GPIO_LED_WLAN_5G 12
 #define DB120_GPIO_BTN_SW1     16
 
 #define DB120_CALDATA_OFFSET   0x1000
-#define DB120_WMAC_MAC_OFFSET  0x1003
+#define DB120_WMAC_MAC_OFFSET  0x1002
 
-#define DB120_BUTTONS_POLL_INTERVAL    20
+#define DB120_KEYS_POLL_INTERVAL       20      /* msecs */
+#define DB120_KEYS_DEBOUNCE_INTERVAL   (3 * DB120_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition db120_partitions[] = {
@@ -97,12 +99,12 @@ static struct gpio_led db120_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button db120_gpio_buttons[] __initdata = {
+static struct gpio_keys_button db120_gpio_keys[] __initdata = {
        {
                .desc           = "sw1",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = DB120_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DB120_GPIO_BTN_SW1,
                .active_low     = 1,
        }
@@ -119,12 +121,14 @@ static void __init db120_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio),
                                        db120_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, DB120_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(db120_gpio_buttons),
-                                       db120_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(db120_gpio_keys),
+                                        db120_gpio_keys);
 
-       ar934x_add_device_wmac(art + DB120_CALDATA_OFFSET,
+       ar9xxx_add_device_wmac(art + DB120_CALDATA_OFFSET,
                                art + DB120_WMAC_MAC_OFFSET);
+
+       db120_pci_init();
 }
 
 MIPS_MACHINE(AR71XX_MACH_DB120, "DB120", "Atheros DB120", db120_setup);