ar71xx: use the gpio_keys_polled driver instead of gpio_buttons
authorGabor Juhos <juhosg@openwrt.org>
Tue, 12 Apr 2011 09:29:21 +0000 (09:29 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Tue, 12 Apr 2011 09:29:21 +0000 (09:29 +0000)
SVN-Revision: 26603

38 files changed:
target/linux/ar71xx/Makefile
target/linux/ar71xx/base-files/lib/preinit/05_enable_reset_button_ar71xx
target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c
target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-db120.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-eap7660d.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-nbg460n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd-v2.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-zcn-1523h.c

index 1ab408d544206542c7c347048354831900adbf6c..b223c40dd8863595997ac82f6806c7d716ad9428 100644 (file)
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/target.mk
 
 DEFAULT_PACKAGES += \
        kmod-leds-gpio kmod-input-core kmod-input-polldev \
-       kmod-input-gpio-buttons kmod-button-hotplug swconfig
+       kmod-input-gpio-keys-polled kmod-button-hotplug swconfig
 
 define Target/Description
        Build firmware images for Atheros AR71xx/AR913x/AR934x based boards.
index 2b4e4adb53f30d17fb0a957a6af9586d45c741e3..305fe0018be7d23143cb9af292e058e75e4a68c7 100644 (file)
@@ -8,7 +8,7 @@
 preinit_enable_reset_button() {
        insmod input-core
        insmod input-polldev
-       insmod gpio_buttons
+       insmod gpio_keys_polled
        insmod button-hotplug
 }
 
index 85ba33e50f5a01121fe9751d02a4e5fac226c7c4..c22e652f190e7be1286076f444a7e5bf286bb7c5 100644 (file)
 
 #include "dev-gpio-buttons.h"
 
-void __init ar71xx_add_device_gpio_buttons(int id,
-                                          unsigned poll_interval,
-                                          unsigned nbuttons,
-                                          struct gpio_button *buttons)
+void __init ar71xx_register_gpio_keys_polled(int id,
+                                            unsigned poll_interval,
+                                            unsigned nbuttons,
+                                            struct gpio_keys_button *buttons)
 {
        struct platform_device *pdev;
-       struct gpio_buttons_platform_data pdata;
-       struct gpio_button *p;
+       struct gpio_keys_platform_data pdata;
+       struct gpio_keys_button *p;
        int err;
 
        p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
@@ -31,7 +31,7 @@ void __init ar71xx_add_device_gpio_buttons(int id,
 
        memcpy(p, buttons, nbuttons * sizeof(*p));
 
-       pdev = platform_device_alloc("gpio-buttons", id);
+       pdev = platform_device_alloc("gpio-keys-polled", id);
        if (!pdev)
                goto err_free_buttons;
 
@@ -44,7 +44,6 @@ void __init ar71xx_add_device_gpio_buttons(int id,
        if (err)
                goto err_put_pdev;
 
-
        err = platform_device_add(pdev);
        if (err)
                goto err_put_pdev;
index 97e9fe59917825a86cb76b633ffd25b2ffd3a73f..5ed86348934d5a0be9182133fcf4ea870be6ce59 100644 (file)
 #define _AR71XX_DEV_GPIO_BUTTONS_H
 
 #include <linux/input.h>
-#include <linux/gpio_buttons.h>
+#include <linux/gpio_keys.h>
 
-#include <asm/mach-ar71xx/platform.h>
-
-void ar71xx_add_device_gpio_buttons(int id,
-                                   unsigned poll_interval,
-                                   unsigned nbuttons,
-                                   struct gpio_button *buttons) __init;
+void ar71xx_register_gpio_keys_polled(int id,
+                                     unsigned poll_interval,
+                                     unsigned nbuttons,
+                                     struct gpio_keys_button *buttons);
 
 #endif /* _AR71XX_DEV_GPIO_BUTTONS_H */
index a8d1818ae7def294fc3cda605d46ab0f57615dfe..66c57ed308eeee706c75235c916a14f8e1a1ad42 100644 (file)
@@ -30,7 +30,8 @@
 #define AP81_GPIO_BTN_SW4      12
 #define AP81_GPIO_BTN_SW1      21
 
-#define AP81_BUTTONS_POLL_INTERVAL     20
+#define AP81_KEYS_POLL_INTERVAL                20 /* msecs */
+#define AP81_KEYS_DEBOUNCE_INTERVAL    (3 * AP81_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition ap81_partitions[] = {
@@ -87,19 +88,19 @@ static struct gpio_led ap81_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button ap81_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ap81_gpio_keys[] __initdata = {
        {
                .desc           = "sw1",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP81_GPIO_BTN_SW1,
                .active_low     = 1,
        }, {
                .desc           = "sw4",
                .type           = EV_KEY,
                .code           = BTN_1,
-               .threshold      = 3,
+               .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP81_GPIO_BTN_SW4,
                .active_low     = 1,
        }
@@ -131,9 +132,9 @@ static void __init ap81_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio),
                                        ap81_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ap81_gpio_buttons),
-                                       ap81_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, AP81_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ap81_gpio_keys),
+                                        ap81_gpio_keys);
 
        ar9xxx_add_device_wmac(eeprom, NULL);
 }
index 964fac55d5c55f2bec3340e6a2913ec27aa425a7..bcd2faeb5f926c18295a9b1834441d546e712df7 100644 (file)
@@ -38,7 +38,8 @@
 #define AP83_050_GPIO_VSC7385_MOSI     16
 #define AP83_050_GPIO_VSC7385_SCK      17
 
-#define AP83_BUTTONS_POLL_INTERVAL     20
+#define AP83_KEYS_POLL_INTERVAL                20      /* msecs */
+#define AP83_KEYS_DEBOUNCE_INTERVAL    (3 * AP83_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition ap83_flash_partitions[] = {
@@ -115,19 +116,19 @@ static struct gpio_led ap83_leds_gpio[] __initdata = {
        },
 };
 
-static struct gpio_button ap83_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ap83_gpio_keys[] __initdata = {
        {
                .desc           = "soft_reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = AP83_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP83_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "jumpstart",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = AP83_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP83_GPIO_BTN_JUMPSTART,
                .active_low     = 1,
        }
@@ -216,9 +217,9 @@ static void __init ap83_generic_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap83_leds_gpio),
                                        ap83_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, AP83_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ap83_gpio_buttons),
-                                       ap83_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, AP83_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ap83_gpio_keys),
+                                        ap83_gpio_keys);
 
        ar71xx_add_device_usb();
 
index c8d86ef78c9b86912e21cf6ed18db7ade4d2ea06..a43631ff29d6c1f9c54b62f9fcc3f603f942f66f 100644 (file)
@@ -37,7 +37,8 @@
 /* WPS button - next to a led on right */
 #define AP96_GPIO_BTN_WPS              8
 
-#define AP96_BUTTONS_POLL_INTERVAL    20
+#define AP96_KEYS_POLL_INTERVAL                20      /* msecs */
+#define AP96_KEYS_DEBOUNCE_INTERVAL    (3 * AP96_KEYS_POLL_INTERVAL)
 
 #define AP96_WMAC0_MAC_OFFSET          0x120c
 #define AP96_WMAC1_MAC_OFFSET          0x520c
@@ -116,19 +117,19 @@ static struct gpio_led ap96_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button ap96_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ap96_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = AP96_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP96_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = AP96_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AP96_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -166,9 +167,9 @@ static void __init ap96_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap96_leds_gpio),
                                        ap96_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, AP96_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ap96_gpio_buttons),
-                                       ap96_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, AP96_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ap96_gpio_keys),
+                                        ap96_gpio_keys);
 
        ap94_pci_init(art + AP96_CALDATA0_OFFSET,
                      art + AP96_WMAC0_MAC_OFFSET,
index a6c317ea606dd280da8ca4f2c9279ae4d5341900..96cae553408dd9dd3f94bf1e24e2a287c34219f8 100644 (file)
@@ -31,7 +31,8 @@
 #define AW_NR580_GPIO_BTN_WPS          3
 #define AW_NR580_GPIO_BTN_RESET                11
 
-#define AW_NR580_BUTTONS_POLL_INTERVAL 20
+#define AW_NR580_KEYS_POLL_INTERVAL    20      /* msecs */
+#define AW_NR580_KEYS_DEBOUNCE_INTERVAL        (3 * AW_NR580_KEYS_POLL_INTERVAL)
 
 static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
        {
@@ -57,19 +58,19 @@ static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button aw_nr580_gpio_buttons[] __initdata = {
+static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AW_NR580_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = AW_NR580_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -92,9 +93,9 @@ static void __init aw_nr580_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
                                        aw_nr580_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, AW_NR580_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(aw_nr580_gpio_buttons),
-                                       aw_nr580_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(aw_nr580_gpio_keys),
+                                        aw_nr580_gpio_keys);
 }
 
 MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
index c6fb642454055de91732e7c733ba29379e653eb1..56c2bf7526dbea69e6fa77ccde7ef92516749fee 100644 (file)
@@ -33,7 +33,8 @@
 #define DB120_CALDATA_OFFSET   0x1000
 #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[] = {
@@ -98,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,
        }
@@ -120,9 +121,9 @@ 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);
 
        ar9xxx_add_device_wmac(art + DB120_CALDATA_OFFSET,
                                art + DB120_WMAC_MAC_OFFSET);
index c076489bfb3f3f4435c1d579dd3be0f1f4809b4d..34f77dde3e03422d7016de29a27e3bc143a585ef 100644 (file)
@@ -28,7 +28,8 @@
 #define DIR_600_A1_GPIO_BTN_RESET              8
 #define DIR_600_A1_GPIO_BTN_WPS                        12
 
-#define DIR_600_A1_BUTTONS_POLL_INTERVAL       20
+#define DIR_600_A1_KEYS_POLL_INTERVAL  20      /* msecs */
+#define DIR_600_A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_600_A1_KEYS_POLL_INTERVAL)
 
 #define DIR_600_A1_NVRAM_ADDR  0x1f030000
 #define DIR_600_A1_NVRAM_SIZE  0x10000
@@ -91,19 +92,19 @@ static struct gpio_led dir_600_a1_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button dir_600_a1_gpio_buttons[] __initdata = {
+static struct gpio_keys_button dir_600_a1_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = DIR_600_A1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR_600_A1_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = DIR_600_A1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR_600_A1_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -128,9 +129,9 @@ static void __init dir_600_a1_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir_600_a1_leds_gpio),
                                        dir_600_a1_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, DIR_600_A1_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(dir_600_a1_gpio_buttons),
-                                       dir_600_a1_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, DIR_600_A1_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(dir_600_a1_gpio_keys),
+                                        dir_600_a1_gpio_keys);
 
        ar71xx_eth1_data.has_ar7240_switch = 1;
        ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
index e7431c5d2422a391ec9676d988113c647b241270..2b1a8e24b106eb28ecbf8a02b1be5e6b19851d39 100644 (file)
@@ -35,7 +35,8 @@
 #define DIR_615C1_GPIO_BTN_WPS         12
 #define DIR_615C1_GPIO_BTN_RESET       21
 
-#define DIR_615C1_BUTTONS_POLL_INTERVAL        20
+#define DIR_615C1_KEYS_POLL_INTERVAL   20      /* msecs */
+#define DIR_615C1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_615C1_KEYS_POLL_INTERVAL)
 
 #define DIR_615C1_CONFIG_ADDR          0x1f020000
 #define DIR_615C1_CONFIG_SIZE          0x10000
@@ -112,18 +113,18 @@ static struct gpio_led dir_615c1_leds_gpio[] __initdata = {
 
 };
 
-static struct gpio_button dir_615c1_gpio_buttons[] __initdata = {
+static struct gpio_keys_button dir_615c1_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = DIR_615C1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR_615C1_GPIO_BTN_RESET,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = DIR_615C1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR_615C1_GPIO_BTN_WPS,
        }
 };
@@ -163,9 +164,9 @@ static void __init dir_615c1_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir_615c1_leds_gpio),
                                        dir_615c1_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, DIR_615C1_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(dir_615c1_gpio_buttons),
-                                       dir_615c1_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, DIR_615C1_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(dir_615c1_gpio_keys),
+                                        dir_615c1_gpio_keys);
 
        ar9xxx_add_device_wmac(eeprom, wlan_mac);
 }
index 6b4bc7608571108941182b9dfa0d595c1ee1576c..84fb184c0bc424343050654e9d46c28ff0bec58b 100644 (file)
@@ -39,7 +39,8 @@
 #define DIR825B1_GPIO_RTL8366_SDA              5
 #define DIR825B1_GPIO_RTL8366_SCK              7
 
-#define DIR825B1_BUTTONS_POLL_INTERVAL         20
+#define DIR825B1_KEYS_POLL_INTERVAL            20      /* msecs */
+#define DIR825B1_KEYS_DEBOUNCE_INTERVAL                (3 * DIR825B1_KEYS_POLL_INTERVAL)
 
 #define DIR825B1_CAL_LOCATION_0                        0x1f661000
 #define DIR825B1_CAL_LOCATION_1                        0x1f665000
@@ -112,19 +113,19 @@ static struct gpio_led dir825b1_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button dir825b1_gpio_buttons[] __initdata = {
+static struct gpio_keys_button dir825b1_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = DIR825B1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR825B1_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = DIR825B1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = DIR825B1_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -176,9 +177,9 @@ static void __init dir825b1_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir825b1_leds_gpio),
                                        dir825b1_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, DIR825B1_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(dir825b1_gpio_buttons),
-                                       dir825b1_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, DIR825B1_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(dir825b1_gpio_keys),
+                                        dir825b1_gpio_keys);
 
        ar71xx_add_device_usb();
 
index c749eec4dd03d65d3dc559643e152e6915992c85..d960d0cd4947b5c26e2b11c4df972afa7c77b209 100644 (file)
@@ -22,7 +22,9 @@
 #include "dev-leds-gpio.h"
 #include "dev-m25p80.h"
 
-#define EAP7660D_BUTTONS_POLL_INTERVAL 20
+#define EAP7660D_KEYS_POLL_INTERVAL    20      /* msecs */
+#define EAP7660D_KEYS_DEBOUNCE_INTERVAL        (3 * EAP7660D_KEYS_POLL_INTERVAL)
+
 #define EAP7660D_GPIO_DS4              7
 #define EAP7660D_GPIO_DS5              2
 #define EAP7660D_GPIO_DS7              0
@@ -125,12 +127,12 @@ static struct gpio_led eap7660d_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button eap7660d_gpio_buttons[] __initdata = {
+static struct gpio_keys_button eap7660d_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = EAP7660D_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = EAP7660D_GPIO_SW1,
                .active_low     = 1,
        },
@@ -138,7 +140,7 @@ static struct gpio_button eap7660d_gpio_buttons[] __initdata = {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = EAP7660D_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = EAP7660D_GPIO_SW3,
                .active_low     = 1,
        }
@@ -158,9 +160,9 @@ static void __init eap7660d_setup(void)
        ar71xx_add_device_m25p80(NULL);
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(eap7660d_leds_gpio),
                                        eap7660d_leds_gpio);
-       ar71xx_add_device_gpio_buttons(-1, EAP7660D_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(eap7660d_gpio_buttons),
-                                       eap7660d_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, EAP7660D_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(eap7660d_gpio_keys),
+                                        eap7660d_gpio_keys);
        eap7660d_pci_init(boardconfig + EAP7660D_WMAC0_CALDATA_OFFSET,
                        boardconfig + EAP7660D_WMAC0_MAC_OFFSET,
                        boardconfig + EAP7660D_WMAC1_CALDATA_OFFSET,
index d39de3c4d03de38914dc6b5184226aed9ecb8bca..7d4467322212d7f37f3593009571fb920d7e81d4 100644 (file)
@@ -15,7 +15,8 @@
 #include "dev-usb.h"
 #include "dev-leds-gpio.h"
 
-#define JA76PF_BUTTONS_POLL_INTERVAL   20
+#define JA76PF_KEYS_POLL_INTERVAL      20      /* msecs */
+#define JA76PF_KEYS_DEBOUNCE_INTERVAL  (3 * JA76PF_KEYS_POLL_INTERVAL)
 
 #define JA76PF_GPIO_I2C_SCL            0
 #define JA76PF_GPIO_I2C_SDA            1
@@ -35,12 +36,12 @@ static struct gpio_led ja76pf_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button ja76pf_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ja76pf_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = JA76PF_GPIO_BTN_RESET,
                .active_low     = 1,
        }
@@ -85,9 +86,9 @@ static void __init ja76pf_init(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio),
                                        ja76pf_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, JA76PF_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ja76pf_gpio_buttons),
-                                       ja76pf_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ja76pf_gpio_keys),
+                                        ja76pf_gpio_keys);
 
        ar71xx_add_device_usb();
        pb42_pci_init();
index d62e9a00028e858432026f102f9eec9610652703..f7215a133f81a45ec5b387451721e6e73150c4c1 100644 (file)
 #include "dev-pb42-pci.h"
 #include "dev-usb.h"
 
-#define JWAP003_BUTTONS_POLL_INTERVAL  20
+#define JWAP003_KEYS_POLL_INTERVAL     20      /* msecs */
+#define JWAP003_KEYS_DEBOUNCE_INTERVAL (3 * JWAP003_KEYS_POLL_INTERVAL)
+
 #define JWAP003_GPIO_WPS       11
 #define JWAP003_GPIO_I2C_SCL   0
 #define JWAP003_GPIO_I2C_SDA   1
 
-static struct gpio_button jwap003_gpio_buttons[] __initdata = {
+static struct gpio_keys_button jwap003_gpio_keys[] __initdata = {
        {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = JWAP003_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = JWAP003_GPIO_WPS,
                .active_low     = 1,
        }
@@ -71,9 +73,9 @@ static void __init jwap003_init(void)
 
        ar71xx_add_device_usb();
 
-       ar71xx_add_device_gpio_buttons(-1, JWAP003_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(jwap003_gpio_buttons),
-                                       jwap003_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, JWAP003_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(jwap003_gpio_keys),
+                                        jwap003_gpio_keys);
 
        pb42_pci_init();
 }
index 2f5d41618501c51f2cd11b8ac7521d743308eb9b..54dbe35fc8038809c00d5723857f0b7c1c046cd5 100644 (file)
@@ -32,7 +32,8 @@
 #define MZK_W04NU_GPIO_BTN_WPS         12
 #define MZK_W04NU_GPIO_BTN_RESET       21
 
-#define MZK_W04NU_BUTTONS_POLL_INTERVAL        20
+#define MZK_W04NU_KEYS_POLL_INTERVAL   20      /* msecs */
+#define MZK_W04NU_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W04NU_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition mzk_w04nu_partitions[] = {
@@ -101,26 +102,26 @@ static struct gpio_led mzk_w04nu_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button mzk_w04nu_gpio_buttons[] __initdata = {
+static struct gpio_keys_button mzk_w04nu_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W04NU_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W04NU_GPIO_BTN_WPS,
                .active_low     = 1,
        }, {
                .desc           = "aprouter",
                .type           = EV_KEY,
                .code           = BTN_2,
-               .threshold      = 3,
+               .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W04NU_GPIO_BTN_APROUTER,
                .active_low     = 0,
        }
@@ -153,9 +154,9 @@ static void __init mzk_w04nu_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(mzk_w04nu_leds_gpio),
                                        mzk_w04nu_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(mzk_w04nu_gpio_buttons),
-                                       mzk_w04nu_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, MZK_W04NU_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(mzk_w04nu_gpio_keys),
+                                        mzk_w04nu_gpio_keys);
        ar71xx_add_device_usb();
 
        ar9xxx_add_device_wmac(eeprom, NULL);
index 03ffe5e6868b639ddea47edd205becc32ea8fb86..27f1738cf3fa897f2cdd6dfe198032fc28f506f8 100644 (file)
@@ -31,7 +31,8 @@
 #define MZK_W300NH_GPIO_BTN_WPS                12
 #define MZK_W300NH_GPIO_BTN_RESET      21
 
-#define MZK_W04NU_BUTTONS_POLL_INTERVAL        20
+#define MZK_W300NH_KEYS_POLL_INTERVAL  20      /* msecs */
+#define MZK_W300NH_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W300NH_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition mzk_w300nh_partitions[] = {
@@ -96,26 +97,26 @@ static struct gpio_led mzk_w300nh_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button mzk_w300nh_gpio_buttons[] __initdata = {
+static struct gpio_keys_button mzk_w300nh_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W300NH_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W300NH_GPIO_BTN_WPS,
                .active_low     = 1,
        }, {
                .desc           = "aprouter",
                .type           = EV_KEY,
                .code           = BTN_2,
-               .threshold      = 3,
+               .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = MZK_W300NH_GPIO_BTN_APROUTER,
                .active_low     = 0,
        }
@@ -148,9 +149,9 @@ static void __init mzk_w300nh_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(mzk_w300nh_leds_gpio),
                                        mzk_w300nh_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(mzk_w300nh_gpio_buttons),
-                                       mzk_w300nh_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, MZK_W300NH_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(mzk_w300nh_gpio_keys),
+                                        mzk_w300nh_gpio_keys);
        ar9xxx_add_device_wmac(eeprom, NULL);
 }
 
index 8f3b5208433183cde9801dbb63964d79ff8d35e0..7d8161811a574f1a1ca09577099f99f3a1154801 100644 (file)
@@ -38,7 +38,9 @@
 /* Buttons */
 #define NBG460N_GPIO_BTN_WPS           12
 #define NBG460N_GPIO_BTN_RESET         21
-#define NBG460N_BUTTONS_POLL_INTERVAL  20
+
+#define NBG460N_KEYS_POLL_INTERVAL     20      /* msecs */
+#define NBG460N_KEYS_DEBOUNCE_INTERVAL (3 * NBG460N_KEYS_POLL_INTERVAL)
 
 /* RTC chip PCF8563 I2C interface */
 #define NBG460N_GPIO_PCF8563_SDA       8
@@ -114,19 +116,19 @@ static struct gpio_led nbg460n_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button nbg460n_gpio_buttons[] __initdata = {
+static struct gpio_keys_button nbg460n_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = NBG460N_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = NBG460N_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = NBG460N_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = NBG460N_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -214,9 +216,9 @@ static void __init nbg460n_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(nbg460n_leds_gpio),
                                        nbg460n_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, NBG460N_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(nbg460n_gpio_buttons),
-                                       nbg460n_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, NBG460N_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(nbg460n_gpio_keys),
+                                        nbg460n_gpio_keys);
 }
 
 MIPS_MACHINE(AR71XX_MACH_NBG460N, "NBG460N", "Zyxel NBG460N/550N/550NH",
index 2dbb7537430d9d6fd6a471500d67572fb8aba2d1..118a54e99ba8efda66ec762a0764f6a00c0f6ee5 100644 (file)
 #include "dev-pb42-pci.h"
 #include "dev-usb.h"
 
-#define PB42_BUTTONS_POLL_INTERVAL     20
+#define PB42_KEYS_POLL_INTERVAL                20      /* msecs */
+#define PB42_KEYS_DEBOUNCE_INTERVAL    (3 * PB42_KEYS_POLL_INTERVAL)
 
 #define PB42_GPIO_BTN_SW4      8
 #define PB42_GPIO_BTN_SW5      3
 
-static struct gpio_button pb42_gpio_buttons[] __initdata = {
+static struct gpio_keys_button pb42_gpio_keys[] __initdata = {
        {
                .desc           = "sw4",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB42_GPIO_BTN_SW4,
                .active_low     = 1,
        }, {
                .desc           = "sw5",
                .type           = EV_KEY,
                .code           = BTN_1,
-               .threshold      = 3,
+               .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB42_GPIO_BTN_SW5,
                .active_low     = 1,
        }
@@ -63,9 +64,9 @@ static void __init pb42_init(void)
        ar71xx_add_device_eth(0);
        ar71xx_add_device_eth(1);
 
-       ar71xx_add_device_gpio_buttons(-1, PB42_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(pb42_gpio_buttons),
-                                       pb42_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, PB42_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(pb42_gpio_keys),
+                                        pb42_gpio_keys);
 
        pb42_pci_init();
 }
index 219b832ee354a41c636e06bda1ebef50c5d8ea9a..59802d4b8db3d2dfdf26906cb885cd1d99bb2264 100644 (file)
@@ -54,6 +54,9 @@
 #define PB44_GPIO_LED_JUMP1    (PB44_GPIO_EXP_BASE + PB44_PCF8757_LED_JUMP1)
 #define PB44_GPIO_LED_JUMP2    (PB44_GPIO_EXP_BASE + PB44_PCF8757_LED_JUMP2)
 
+#define PB44_KEYS_POLL_INTERVAL                20      /* msecs */
+#define PB44_KEYS_DEBOUNCE_INTERVAL    (3 * PB44_KEYS_POLL_INTERVAL)
+
 static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
        .sda_pin        = PB44_GPIO_I2C_SDA,
        .scl_pin        = PB44_GPIO_I2C_SCL,
@@ -90,19 +93,19 @@ static struct gpio_led pb44_leds_gpio[] __initdata = {
        },
 };
 
-static struct gpio_button pb44_gpio_buttons[] __initdata = {
+static struct gpio_keys_button pb44_gpio_keys[] __initdata = {
        {
                .desc           = "soft_reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB44_GPIO_SW_RESET,
                .active_low     = 1,
        }, {
                .desc           = "jumpstart",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB44_GPIO_SW_JUMP,
                .active_low     = 1,
        }
@@ -202,8 +205,9 @@ static void __init pb44_init(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio),
                                        pb44_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, 20, ARRAY_SIZE(pb44_gpio_buttons),
-                                       pb44_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, PB44_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(pb44_gpio_keys),
+                                        pb44_gpio_keys);
 }
 
 MIPS_MACHINE(AR71XX_MACH_PB44, "PB44", "Atheros PB44", pb44_init);
index 83a1e66cef5c759595b1507de5e83706f4e8b1b4..4a05f5bdca1a78c23830f85ef9b33eb69d4b3023 100644 (file)
@@ -56,25 +56,25 @@ static struct flash_platform_data pb92_flash_data = {
 #endif
 };
 
-
-#define PB92_BUTTONS_POLL_INTERVAL     20
+#define PB92_KEYS_POLL_INTERVAL                20      /* msecs */
+#define PB92_KEYS_DEBOUNCE_INTERVAL    (3 * PB92_KEYS_POLL_INTERVAL)
 
 #define PB92_GPIO_BTN_SW4      8
 #define PB92_GPIO_BTN_SW5      3
 
-static struct gpio_button pb92_gpio_buttons[] __initdata = {
+static struct gpio_keys_button pb92_gpio_keys[] __initdata = {
        {
                .desc           = "sw4",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = PB92_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB92_GPIO_BTN_SW4,
                .active_low     = 1,
        }, {
                .desc           = "sw5",
                .type           = EV_KEY,
                .code           = BTN_1,
-               .threshold      = 3,
+               .debounce_interval = PB92_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = PB92_GPIO_BTN_SW5,
                .active_low     = 1,
        }
@@ -100,9 +100,9 @@ static void __init pb92_init(void)
        ar71xx_add_device_eth(0);
        ar71xx_add_device_eth(1);
 
-       ar71xx_add_device_gpio_buttons(-1, PB92_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(pb92_gpio_buttons),
-                                       pb92_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, PB92_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(pb92_gpio_keys),
+                                        pb92_gpio_keys);
 
        pb9x_pci_init();
 }
index 6c670fbd87e9424351730a1ea95ebc327c0868d8..02fcaa47b9c229101d6fcf9601892ebe55e9d6f4 100644 (file)
@@ -38,7 +38,8 @@
 #define RB4XX_GPIO_CPLD_LED4   (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED4)
 #define RB4XX_GPIO_CPLD_LED5   (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED5)
 
-#define RB4XX_BUTTONS_POLL_INTERVAL    20
+#define RB4XX_KEYS_POLL_INTERVAL       20      /* msecs */
+#define RB4XX_KEYS_DEBOUNCE_INTERVAL   (3 * RB4XX_KEYS_POLL_INTERVAL)
 
 static struct gpio_led rb4xx_leds_gpio[] __initdata = {
        {
@@ -68,12 +69,12 @@ static struct gpio_led rb4xx_leds_gpio[] __initdata = {
        },
 };
 
-static struct gpio_button rb4xx_gpio_buttons[] __initdata = {
+static struct gpio_keys_button rb4xx_gpio_keys[] __initdata = {
        {
                .desc           = "reset_switch",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = RB4XX_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = RB4XX_GPIO_RESET_SWITCH,
                .active_low     = 1,
        }
@@ -201,9 +202,9 @@ static void __init rb4xx_generic_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
                                        rb4xx_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(rb4xx_gpio_buttons),
-                                       rb4xx_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, RB4XX_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(rb4xx_gpio_keys),
+                                        rb4xx_gpio_keys);
 
        spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info));
        platform_device_register(&rb4xx_spi_device);
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);
 }
index 8bf853b83cf086aec4eee6903f636c7e7685abf1..341f22907e9f36cfb80753ac18e9d78446f6db71 100644 (file)
@@ -31,7 +31,8 @@
 
 #define TL_MR3X20_GPIO_USB_POWER       6
 
-#define TL_MR3X20_BUTTONS_POLL_INTERVAL        20
+#define TL_MR3X20_KEYS_POLL_INTERVAL   20      /* msecs */
+#define TL_MR3X20_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR3X20_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_mr3x20_partitions[] = {
@@ -86,19 +87,19 @@ static struct gpio_led tl_mr3x20_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_mr3x20_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_mr3x20_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_MR3X20_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_MR3X20_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -118,9 +119,9 @@ static void __init tl_mr3x20_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio),
                                        tl_mr3x20_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_MR3X20_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_mr3x20_gpio_buttons),
-                                       tl_mr3x20_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_MR3X20_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_mr3x20_gpio_keys),
+                                        tl_mr3x20_gpio_keys);
 
        ar71xx_eth1_data.has_ar7240_switch = 1;
        ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
index 72a8bd21f6ca566c932b553ca1745af31423c313..7fb4d80aefc6a7d0009e1c8963683f9c7c8c2663 100644 (file)
@@ -30,8 +30,9 @@
 #define TL_WA901ND_V2_GPIO_BTN_RESET           3
 #define TL_WA901ND_V2_GPIO_BTN_QSS             7
 
-#define TL_WA901ND_V2_BUTTONS_POLL_INTERVAL    20
-
+#define TL_WA901ND_V2_KEYS_POLL_INTERVAL       20      /* msecs */
+#define TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL   \
+                                       (3 * TL_WA901ND_V2_KEYS_POLL_INTERVAL)
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wa901nd_v2_partitions[] = {
        {
@@ -82,19 +83,19 @@ static struct gpio_led tl_wa901nd_v2_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wa901nd_v2_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wa901nd_v2_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WA901ND_V2_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WA901ND_V2_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -120,9 +121,9 @@ static void __init tl_wa901nd_v2_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_v2_leds_gpio),
                                        tl_wa901nd_v2_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WA901ND_V2_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wa901nd_v2_gpio_buttons),
-                                       tl_wa901nd_v2_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WA901ND_V2_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wa901nd_v2_gpio_keys),
+                                        tl_wa901nd_v2_gpio_keys);
 
         ar9xxx_add_device_wmac(eeprom, mac);
 }
index 3193262c7dbaae4059bfb3378bd19b7dcee632a7..4a108feba188dfe0a1858eac8ae95fa49972168b 100644 (file)
@@ -27,7 +27,8 @@
 #define TL_WA901ND_GPIO_BTN_RESET      11
 #define TL_WA901ND_GPIO_BTN_QSS                12
 
-#define TL_WA901ND_BUTTONS_POLL_INTERVAL       20
+#define TL_WA901ND_KEYS_POLL_INTERVAL  20      /* msecs */
+#define TL_WA901ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wa901nd_partitions[] = {
@@ -76,19 +77,19 @@ static struct gpio_led tl_wa901nd_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wa901nd_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wa901nd_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WA901ND_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = BTN_1,
-               .threshold      = 3,
+               .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WA901ND_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -118,9 +119,9 @@ static void __init tl_wa901nd_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_leds_gpio),
                                        tl_wa901nd_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WA901ND_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wa901nd_gpio_buttons),
-                                       tl_wa901nd_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WA901ND_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wa901nd_gpio_keys),
+                                        tl_wa901nd_gpio_keys);
 
        ap91_pci_init(ee, mac);
 }
index e4de9d50c1474d88c273ccea9d5b726b9e66970b..1cf01684863b0ba66f9d4d677f084442220375e2 100644 (file)
@@ -33,7 +33,8 @@
 #define TL_WR1043ND_GPIO_RTL8366_SDA   18
 #define TL_WR1043ND_GPIO_RTL8366_SCK   19
 
-#define TL_WR1043ND_BUTTONS_POLL_INTERVAL     20
+#define TL_WR1043ND_KEYS_POLL_INTERVAL 20      /* msecs */
+#define TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043ND_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wr1043nd_partitions[] = {
@@ -90,19 +91,19 @@ static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wr1043nd_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wr1043nd_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR1043ND_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR1043ND_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -144,9 +145,9 @@ static void __init tl_wr1043nd_setup(void)
 
        platform_device_register(&tl_wr1043nd_rtl8366rb_device);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wr1043nd_gpio_buttons),
-                                       tl_wr1043nd_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WR1043ND_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wr1043nd_gpio_keys),
+                                        tl_wr1043nd_gpio_keys);
 
        ar9xxx_add_device_wmac(eeprom, mac);
 }
index 909327ac7501ccd9481556926734e36e7bf565a9..4732ab9cd8d5ed8aa9079cafb72744e46e5b2118 100644 (file)
@@ -26,7 +26,8 @@
 #define TL_WR741ND_GPIO_BTN_RESET      11
 #define TL_WR741ND_GPIO_BTN_QSS                12
 
-#define TL_WR741ND_BUTTONS_POLL_INTERVAL       20
+#define TL_WR741ND_KEYS_POLL_INTERVAL  20      /* msecs */
+#define TL_WR741ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR741ND_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wr741nd_partitions[] = {
@@ -75,19 +76,19 @@ static struct gpio_led tl_wr741nd_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wr741nd_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wr741nd_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_WR741ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR741ND_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_WR741ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR741ND_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -103,9 +104,9 @@ static void __init tl_wr741nd_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr741nd_leds_gpio),
                                        tl_wr741nd_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WR741ND_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wr741nd_gpio_buttons),
-                                       tl_wr741nd_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WR741ND_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wr741nd_gpio_keys),
+                                        tl_wr741nd_gpio_keys);
 
        ar71xx_eth1_data.has_ar7240_switch = 1;
        ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
index a9a59e5cf55e75a55d82dec2926126fe7e430bf7..b523b274fd892c87feb6792fa35523b93de5cf63 100644 (file)
@@ -28,7 +28,9 @@
 #define TL_WR841ND_V1_GPIO_BTN_RESET   3
 #define TL_WR841ND_V1_GPIO_BTN_QSS     7
 
-#define TL_WR841ND_V1_BUTTONS_POLL_INTERVAL    20
+#define TL_WR841ND_V1_KEYS_POLL_INTERVAL       20      /* msecs */
+#define TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL \
+                               (3 * TL_WR841ND_V1_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wr841n_v1_partitions[] = {
@@ -79,19 +81,19 @@ static struct gpio_led tl_wr841n_v1_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wr841n_v1_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wr841n_v1_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR841ND_V1_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR841ND_V1_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -131,9 +133,9 @@ static void __init tl_wr841n_v1_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v1_leds_gpio),
                                        tl_wr841n_v1_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WR841ND_V1_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wr841n_v1_gpio_buttons),
-                                       tl_wr841n_v1_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WR841ND_V1_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wr841n_v1_gpio_keys),
+                                        tl_wr841n_v1_gpio_keys);
 
        pb42_pci_init();
 }
index c0085e5739091ad8cc912a871a734e0afcdcfabb..04173ea2691f5ef8c55b9253a47e90d4b1ecc4c2 100644 (file)
@@ -29,7 +29,8 @@
 #define TL_WR941ND_GPIO_BTN_RESET      3
 #define TL_WR941ND_GPIO_BTN_QSS                7
 
-#define TL_WR941ND_BUTTONS_POLL_INTERVAL       20
+#define TL_WR941ND_KEYS_POLL_INTERVAL  20      /* msecs */
+#define TL_WR941ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition tl_wr941nd_partitions[] = {
@@ -84,19 +85,19 @@ static struct gpio_led tl_wr941nd_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button tl_wr941nd_gpio_buttons[] __initdata = {
+static struct gpio_keys_button tl_wr941nd_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR941ND_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "qss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = TL_WR941ND_GPIO_BTN_QSS,
                .active_low     = 1,
        }
@@ -136,9 +137,9 @@ static void __init tl_wr941nd_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_leds_gpio),
                                        tl_wr941nd_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, TL_WR941ND_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(tl_wr941nd_gpio_buttons),
-                                       tl_wr941nd_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(tl_wr941nd_gpio_keys),
+                                        tl_wr941nd_gpio_keys);
        ar9xxx_add_device_wmac(eeprom, mac);
 }
 
index 5db59319bab648566405a3248aabb841a8bea769..1cfcec38e6ef1c1ed8469c4aba5887d0ef952095 100644 (file)
@@ -38,7 +38,8 @@
 #define UBNT_M_GPIO_LED_L4     7
 #define UBNT_M_GPIO_BTN_RESET  12
 
-#define UBNT_BUTTONS_POLL_INTERVAL     20
+#define UBNT_KEYS_POLL_INTERVAL                20      /* msecs */
+#define UBNT_KEYS_DEBOUNCE_INTERVAL    (3 * UBNT_KEYS_POLL_INTERVAL)
 
 static struct gpio_led ubnt_rs_leds_gpio[] __initdata = {
        {
@@ -100,23 +101,23 @@ static struct gpio_led ubnt_m_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button ubnt_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ubnt_gpio_keys[] __initdata = {
        {
                .desc           = "sw4",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = UBNT_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = UBNT_RS_GPIO_SW4,
                .active_low     = 1,
        }
 };
 
-static struct gpio_button ubnt_m_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ubnt_m_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = UBNT_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = UBNT_M_GPIO_BTN_RESET,
                .active_low     = 1,
        }
@@ -126,9 +127,9 @@ static void __init ubnt_generic_setup(void)
 {
        ar71xx_add_device_m25p80(NULL);
 
-       ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ubnt_gpio_buttons),
-                                       ubnt_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, UBNT_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ubnt_gpio_keys),
+                                        ubnt_gpio_keys);
 
        pb42_pci_init();
 }
@@ -260,9 +261,9 @@ static void __init ubnt_m_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ubnt_m_leds_gpio),
                                        ubnt_m_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ubnt_m_gpio_buttons),
-                                       ubnt_m_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, UBNT_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ubnt_m_gpio_keys),
+                                        ubnt_m_gpio_keys);
 }
 
 static void __init ubnt_rocket_m_setup(void)
index f0b781955a0f8b98a603ee3d7fafb277f4d830d1..15bc05535dd8cef7d2533cbde73ddf8d1b933109 100644 (file)
@@ -38,7 +38,8 @@
 #define WNDR3700_GPIO_RTL8366_SDA      5
 #define WNDR3700_GPIO_RTL8366_SCK      7
 
-#define WNDR3700_BUTTONS_POLL_INTERVAL    20
+#define WNDR3700_KEYS_POLL_INTERVAL    20      /* msecs */
+#define WNDR3700_KEYS_DEBOUNCE_INTERVAL (3 * WNDR3700_KEYS_POLL_INTERVAL)
 
 #define WNDR3700_ETH0_MAC_OFFSET       0
 #define WNDR3700_ETH1_MAC_OFFSET       0x6
@@ -179,26 +180,26 @@ static struct gpio_led wndr3700_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wndr3700_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wndr3700_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WNDR3700_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WNDR3700_GPIO_BTN_WPS,
                .active_low     = 1,
        }, {
                .desc           = "wifi",
                .type           = EV_KEY,
                .code           = BTN_2,
-               .threshold      = 3,
+               .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WNDR3700_GPIO_BTN_WIFI,
                .active_low     = 1,
        }
@@ -246,9 +247,9 @@ static void __init wndr3700_common_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio),
                                        wndr3700_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wndr3700_gpio_buttons),
-                                       wndr3700_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WNDR3700_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wndr3700_gpio_keys),
+                                        wndr3700_gpio_keys);
 
        platform_device_register(&wndr3700_rtl8366s_device);
        platform_device_register_simple("wndr3700-led-usb", -1, NULL, 0);
index 24cf477a19e6cedde847b02d8b6f1a4fec7ad8d3..1da20fafc470ab5d3b11c2782ba99999233d4ca1 100644 (file)
@@ -29,7 +29,8 @@
 #define WNR2000_GPIO_BTN_RESET         21
 #define WNR2000_GPIO_BTN_WPS           8
 
-#define WNR2000_BUTTONS_POLL_INTERVAL  20
+#define WNR2000_KEYS_POLL_INTERVAL     20      /* msecs */
+#define WNR2000_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition wnr2000_partitions[] = {
@@ -98,18 +99,18 @@ static struct gpio_led wnr2000_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wnr2000_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wnr2000_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WNR2000_GPIO_BTN_RESET,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WNR2000_GPIO_BTN_WPS,
        }
 };
@@ -138,9 +139,9 @@ static void __init wnr2000_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio),
                                        wnr2000_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WNR2000_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wnr2000_gpio_buttons),
-                                       wnr2000_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WNR2000_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wnr2000_gpio_keys),
+                                        wnr2000_gpio_keys);
 
 
        ar9xxx_add_device_wmac(eeprom, NULL);
index 20e032441138dd59cb70c11ffc09bf09c0e36a26..d85f13e55f6869de6397394615b6f73c766de0df 100644 (file)
@@ -30,7 +30,8 @@
 #define WP543_GPIO_LED_DIAG    7
 #define WP543_GPIO_SW4         8
 
-#define WP543_BUTTONS_POLL_INTERVAL    20
+#define WP543_KEYS_POLL_INTERVAL       20      /* msecs */
+#define WP543_KEYS_DEBOUNCE_INTERVAL   (3 * WP543_KEYS_POLL_INTERVAL)
 
 static struct gpio_led wp543_leds_gpio[] __initdata = {
        {
@@ -56,18 +57,18 @@ static struct gpio_led wp543_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wp543_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wp543_gpio_keys[] __initdata = {
        {
                .desc           = "sw6",
                .type           = EV_KEY,
                .code           = BTN_0,
-               .threshold      = 3,
+               .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WP543_GPIO_SW6,
        }, {
                .desc           = "sw4",
                .type           = EV_KEY,
                .code           = BTN_1,
-               .threshold      = 3,
+               .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WP543_GPIO_SW4,
        }
 };
@@ -92,9 +93,9 @@ static void __init wp543_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
                                        wp543_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WP543_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wp543_gpio_buttons),
-                                       wp543_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WP543_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wp543_gpio_keys),
+                                        wp543_gpio_keys);
 }
 
 MIPS_MACHINE(AR71XX_MACH_WP543, "WP543", "Compex WP543", wp543_setup);
index 72dece80ad9ed8a8d7585306c0910252c3459b69..799f9f79647d7f394885999cce56c9ccc748aeac 100644 (file)
@@ -30,7 +30,8 @@
 #define WRT160NL_GPIO_BTN_WPS          7
 #define WRT160NL_GPIO_BTN_RESET                21
 
-#define WRT160NL_BUTTONS_POLL_INTERVAL 20
+#define WRT160NL_KEYS_POLL_INTERVAL    20      /* msecs */
+#define WRT160NL_KEYS_DEBOUNCE_INTERVAL        (3 * WRT160NL_KEYS_POLL_INTERVAL)
 
 #define WRT160NL_NVRAM_ADDR    0x1f7e0000
 #define WRT160NL_NVRAM_SIZE    0x10000
@@ -96,19 +97,19 @@ static struct gpio_led wrt160nl_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wrt160nl_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wrt160nl_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = WRT160NL_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WRT160NL_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = WRT160NL_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WRT160NL_GPIO_BTN_WPS,
                .active_low     = 1,
        }
@@ -150,9 +151,9 @@ static void __init wrt160nl_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio),
                                        wrt160nl_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WRT160NL_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wrt160nl_gpio_buttons),
-                                       wrt160nl_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WRT160NL_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wrt160nl_gpio_keys),
+                                        wrt160nl_gpio_keys);
 
 }
 
index 35860260c98e533d3487f65c6ffcbb4358ff5b83..fd0e5de0e201095ea5ce10ab0eba2b4c0d13a1ee 100644 (file)
@@ -29,7 +29,8 @@
 #define WRT400N_GPIO_BTN_RESET 8
 #define WRT400N_GPIO_BTN_WLSEC 3
 
-#define WRT400N_BUTTONS_POLL_INTERVAL  20
+#define WRT400N_KEYS_POLL_INTERVAL     20      /* msecs */
+#define WRT400N_KEYS_DEBOUNE_INTERVAL  (3 * WRT400N_KEYS_POLL_INTERVAL)
 
 #define WRT400N_MAC_ADDR_OFFSET                0x120c
 #define WRT400N_CALDATA0_OFFSET                0x1000
@@ -110,19 +111,19 @@ static struct gpio_led wrt400n_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wrt400n_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wrt400n_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = WRT400N_KEYS_DEBOUNE_INTERVAL,
                .gpio           = WRT400N_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "wlsec",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = WRT400N_KEYS_DEBOUNE_INTERVAL,
                .gpio           = WRT400N_GPIO_BTN_WLSEC,
                .active_low     = 1,
        }
@@ -152,9 +153,9 @@ static void __init wrt400n_setup(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio),
                                        wrt400n_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WRT400N_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wrt400n_gpio_buttons),
-                                       wrt400n_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WRT400N_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wrt400n_gpio_keys),
+                                        wrt400n_gpio_keys);
 
        ap94_pci_init(art + WRT400N_CALDATA0_OFFSET, NULL,
                      art + WRT400N_CALDATA1_OFFSET, NULL);
index 2806f3bf28e87ae108abac32c46cf8ca1fb99423..13a17db470b84703cf545e95f65d4acd34aa0eb9 100644 (file)
@@ -49,7 +49,8 @@
 #define WZRHPG300NH_GPIO_BTN_ROUTER_AUTO (WZRHPG300NH_GPIO_EXP_BASE + 6)
 #define WZRHPG300NH_GPIO_BTN_QOS_OFF   (WZRHPG300NH_GPIO_EXP_BASE + 7)
 
-#define WZRHPG300NH_BUTTONS_POLL_INTERVAL      20
+#define WZRHPG300NH_KEYS_POLL_INTERVAL 20      /* msecs */
+#define WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG300NH_KEYS_POLL_INTERVAL)
 
 #define WZRHPG300NH_MAC_OFFSET         0x20c
 
@@ -144,54 +145,54 @@ static struct gpio_led wzrhpg300nh_leds_gpio[] __initdata = {
        }
 };
 
-static struct gpio_button wzrhpg300nh_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wzrhpg300nh_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_RESET,
                .active_low     = 1,
        }, {
                .desc           = "aoss",
                .type           = EV_KEY,
                .code           = KEY_WPS_BUTTON,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_AOSS,
                .active_low     = 1,
        }, {
                .desc           = "usb",
                .type           = EV_KEY,
                .code           = BTN_2,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_USB,
                .active_low     = 1,
        }, {
                .desc           = "qos_on",
                .type           = EV_KEY,
                .code           = BTN_3,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_QOS_ON,
                .active_low     = 0,
        }, {
                .desc           = "qos_off",
                .type           = EV_KEY,
                .code           = BTN_4,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_QOS_OFF,
                .active_low     = 0,
        }, {
                .desc           = "router_on",
                .type           = EV_KEY,
                .code           = BTN_5,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_ROUTER_ON,
                .active_low     = 0,
        }, {
                .desc           = "router_auto",
                .type           = EV_KEY,
                .code           = BTN_6,
-               .threshold      = 3,
+               .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = WZRHPG300NH_GPIO_BTN_ROUTER_AUTO,
                .active_low     = 0,
        }
@@ -283,9 +284,9 @@ static void __init wzrhpg30xnh_setup(bool hasrtl8366rb)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpg300nh_leds_gpio),
                                        wzrhpg300nh_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, WZRHPG300NH_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(wzrhpg300nh_gpio_buttons),
-                                       wzrhpg300nh_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, WZRHPG300NH_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(wzrhpg300nh_gpio_keys),
+                                        wzrhpg300nh_gpio_keys);
 
 }
 
index c7be5c02924d56c203ada77f2d04e171c123c00d..bfbb72621f91d9bb4430fd45f5dfc876b7e75dd1 100644 (file)
@@ -34,7 +34,8 @@
 #define ZCN_1523H_5_GPIO_LED_MEDIUM    15
 #define ZCN_1523H_5_GPIO_LED_STRONG    16
 
-#define ZCN_1523H_BUTTONS_POLL_INTERVAL        20
+#define ZCN_1523H_KEYS_POLL_INTERVAL   20      /* msecs */
+#define ZCN_1523H_KEYS_DEBOUNCE_INTERVAL (3 * ZCN_1523H_KEYS_POLL_INTERVAL)
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition zcn_1523h_partitions[] = {
@@ -86,12 +87,12 @@ static struct flash_platform_data zcn_1523h_flash_data = {
 #endif
 };
 
-static struct gpio_button zcn_1523h_gpio_buttons[] __initdata = {
+static struct gpio_keys_button zcn_1523h_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = ZCN_1523H_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = ZCN_1523H_GPIO_BTN_RESET,
                .active_low     = 1,
        }
@@ -164,9 +165,9 @@ static void __init zcn_1523h_generic_setup(void)
        ar71xx_add_device_leds_gpio(0, ARRAY_SIZE(zcn_1523h_leds_gpio),
                                        zcn_1523h_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, ZCN_1523H_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(zcn_1523h_gpio_buttons),
-                                       zcn_1523h_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, ZCN_1523H_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(zcn_1523h_gpio_keys),
+                                        zcn_1523h_gpio_keys);
 
        ap91_pci_init(ee, mac);