From: Gabor Juhos Date: Tue, 12 Apr 2011 09:29:21 +0000 (+0000) Subject: ar71xx: use the gpio_keys_polled driver instead of gpio_buttons X-Git-Tag: reboot~16924 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e19354773372c9dc81f6987b777ca9d5c25cb9f8;p=openwrt%2Fstaging%2Fblogic.git ar71xx: use the gpio_keys_polled driver instead of gpio_buttons SVN-Revision: 26603 --- diff --git a/target/linux/ar71xx/Makefile b/target/linux/ar71xx/Makefile index 1ab408d54420..b223c40dd886 100644 --- a/target/linux/ar71xx/Makefile +++ b/target/linux/ar71xx/Makefile @@ -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. diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_enable_reset_button_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_enable_reset_button_ar71xx index 2b4e4adb53f3..305fe0018be7 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/05_enable_reset_button_ar71xx +++ b/target/linux/ar71xx/base-files/lib/preinit/05_enable_reset_button_ar71xx @@ -8,7 +8,7 @@ preinit_enable_reset_button() { insmod input-core insmod input-polldev - insmod gpio_buttons + insmod gpio_keys_polled insmod button-hotplug } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c index 85ba33e50f5a..c22e652f190e 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c @@ -15,14 +15,14 @@ #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; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h index 97e9fe599178..5ed86348934d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h @@ -13,13 +13,11 @@ #define _AR71XX_DEV_GPIO_BUTTONS_H #include -#include +#include -#include - -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 */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c index a8d1818ae7de..66c57ed308ee 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c index 964fac55d5c5..bcd2faeb5f92 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c @@ -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(); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c index c8d86ef78c9b..a43631ff29d6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap96.c @@ -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, diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c index a6c317ea606d..96cae553408d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c @@ -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", diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-db120.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-db120.c index c6fb64245405..56c2bf7526db 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-db120.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-db120.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c index c076489bfb3f..34f77dde3e03 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c index e7431c5d2422..2b1a8e24b106 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c index 6b4bc7608571..84fb184c0bc4 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c @@ -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(); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-eap7660d.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-eap7660d.c index c749eec4dd03..d960d0cd4947 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-eap7660d.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-eap7660d.c @@ -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, diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c index d39de3c4d03d..7d4467322212 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ja76pf.c @@ -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(); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c index d62e9a00028e..f7215a133f81 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-jwap003.c @@ -15,17 +15,19 @@ #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(); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c index 2f5d41618501..54dbe35fc803 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c index 03ffe5e6868b..27f1738cf3fa 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-nbg460n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-nbg460n.c index 8f3b52084331..7d8161811a57 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-nbg460n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-nbg460n.c @@ -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", diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c index 2dbb7537430d..118a54e99ba8 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c @@ -18,24 +18,25 @@ #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(); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c index 219b832ee354..59802d4b8db3 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c index 83a1e66cef5c..4a05f5bdca1a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c @@ -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(); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c index 6c670fbd87e9..02fcaa47b9c2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c index 9816f0336a9a..14deb982b388 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c index 8bf853b83cf0..341f22907e9f 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-mr3x20.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd-v2.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd-v2.c index 72a8bd21f6ca..7fb4d80aefc6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd-v2.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd-v2.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd.c index 3193262c7dba..4a108feba188 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wa901nd.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c index e4de9d50c147..1cf01684863b 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c index 909327ac7501..4732ab9cd8d5 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c index a9a59e5cf55e..b523b274fd89 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c @@ -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(); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c index c0085e573909..04173ea2691f 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 5db59319bab6..1cfcec38e6ef 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -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) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index f0b781955a0f..15bc05535dd8 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c index 24cf477a19e6..1da20fafc470 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c index 20e032441138..d85f13e55f68 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c index 72dece80ad9e..799f9f79647d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c index 35860260c98e..fd0e5de0e201 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c @@ -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); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c index 2806f3bf28e8..13a17db470b8 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c @@ -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); } diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-zcn-1523h.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-zcn-1523h.c index c7be5c02924d..bfbb72621f91 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-zcn-1523h.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-zcn-1523h.c @@ -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);