ar71xx: use the gpio_keys_polled driver instead of gpio_buttons
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-tew-632brp.c
index 9816f0336a9aa96c29be39e983c649d0cb186cea..14deb982b3880ac6ee5645618d1681861c125f0a 100644 (file)
@@ -28,7 +28,8 @@
 #define TEW_632BRP_GPIO_BTN_WPS                12
 #define TEW_632BRP_GPIO_BTN_RESET      21
 
-#define TEW_632BRP_BUTTONS_POLL_INTERVAL       20
+#define TEW_632BRP_KEYS_POLL_INTERVAL  20      /* msecs */
+#define TEW_632BRP_KEYS_DEBOUNCE_INTERVAL (3 * TEW_632BRP_KEYS_POLL_INTERVAL)
 
 #define TEW_632BRP_CONFIG_ADDR 0x1f020000
 #define TEW_632BRP_CONFIG_SIZE 0x10000
@@ -88,18 +89,18 @@ static struct gpio_led tew_632brp_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tew_632brp_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tew_632brp_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TEW_632BRP_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TEW_632BRP_GPIO_BTN_RESET,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TEW_632BRP_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TEW_632BRP_GPIO_BTN_WPS,
        }
 };
@@ -139,9 +140,9 @@ static void __init tew_632brp_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tew_632brp_leds_gpio),
                                        tew_632brp_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TEW_632BRP_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tew_632brp_gpio_buttons),
-                                       tew_632brp_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TEW_632BRP_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tew_632brp_gpio_keys),
+                                        tew_632brp_gpio_keys);
 
        ar9xxx_add_device_wmac(eeprom, wlan_mac);
 }