From: Gabor Juhos Date: Sat, 11 Feb 2012 19:37:06 +0000 (+0000) Subject: ramips: use gpio-keys-polled instead of gpio-buttons X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=32b9e8c750598b88e6989455768f873e59064092;p=openwrt%2Fstaging%2Fstintel.git ramips: use gpio-keys-polled instead of gpio-buttons SVN-Revision: 30461 --- diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile index c9dc086ee9..16fc2c6caa 100644 --- a/target/linux/ramips/Makefile +++ b/target/linux/ramips/Makefile @@ -17,8 +17,9 @@ LINUX_VERSION:=2.6.39.4 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES+=\ - kmod-leds-gpio kmod-input-core kmod-input-polldev kmod-input-gpio-buttons \ - kmod-button-hotplug kmod-rt2800-pci wpad-mini maccalc + kmod-leds-gpio kmod-input-core kmod-input-polldev \ + kmod-input-gpio-keys-polled kmod-button-hotplug \ + kmod-rt2800-pci wpad-mini maccalc define Target/Description Build firmware images for Ralink RT288x/RT305x based boards. diff --git a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/dev-gpio-buttons.h b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/dev-gpio-buttons.h index d223737e09..8eb5e16906 100644 --- a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/dev-gpio-buttons.h +++ b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/dev-gpio-buttons.h @@ -12,18 +12,16 @@ #define __ASM_MACH_RALINK_DEV_GPIO_BUTTONS_H #include -#include +#include #ifdef CONFIG_RALINK_DEV_GPIO_BUTTONS -void ramips_register_gpio_buttons(int id, - unsigned poll_interval, - unsigned nbuttons, - struct gpio_button *buttons); +void +ramips_register_gpio_buttons(int id, unsigned poll_interval, unsigned nbuttons, + struct gpio_keys_button *buttons); #else -static inline void ramips_register_gpio_buttons(int id, - unsigned poll_interval, - unsigned nbuttons, - struct gpio_button *buttons) +static inline void +ramips_register_gpio_buttons(int id, unsigned poll_interval, unsigned nbuttons, + struct gpio_keys_button *buttons) { } #endif diff --git a/target/linux/ramips/files/arch/mips/ralink/common/dev-gpio-buttons.c b/target/linux/ramips/files/arch/mips/ralink/common/dev-gpio-buttons.c index 4d936d05c2..75a2a17143 100644 --- a/target/linux/ramips/files/arch/mips/ralink/common/dev-gpio-buttons.c +++ b/target/linux/ramips/files/arch/mips/ralink/common/dev-gpio-buttons.c @@ -17,11 +17,11 @@ void __init ramips_register_gpio_buttons(int id, unsigned poll_interval, unsigned nbuttons, - struct gpio_button *buttons) + 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); @@ -30,7 +30,7 @@ void __init ramips_register_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; @@ -43,7 +43,6 @@ void __init ramips_register_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/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c index 71c84c1467..850dc4bd7d 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c @@ -35,7 +35,8 @@ #define F5D8235_GPIO_BUTTON_WPS 0 #define F5D8235_GPIO_BUTTON_RESET 9 -#define F5D8235_BUTTONS_POLL_INTERVAL 20 +#define F5D8235_KEYS_POLL_INTERVAL 20 +#define F5D8235_KEYS_DEBOUNCE_INTERVAL (3 * F5D8235_KEYS_POLL_INTERVAL) static struct mtd_partition f5d8235_partitions[] = { { @@ -92,19 +93,19 @@ static struct gpio_led f5d8235_leds_gpio[] __initdata = { } }; -static struct gpio_button f5d8235_gpio_buttons[] __initdata = { +static struct gpio_keys_button f5d8235_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, .gpio = F5D8235_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = F5D8235_KEYS_DEBOUNCE_INTERVAL, .gpio = F5D8235_GPIO_BUTTON_WPS, .active_low = 1, } @@ -121,7 +122,7 @@ static void __init f5d8235_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235_leds_gpio), f5d8235_leds_gpio); - ramips_register_gpio_buttons(-1, F5D8235_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, F5D8235_KEYS_POLL_INTERVAL, ARRAY_SIZE(f5d8235_gpio_buttons), f5d8235_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c index 0818f2c233..dcffec0006 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c @@ -32,7 +32,8 @@ #define RT_N15_GPIO_RTL8366_SCK 2 #define RT_N15_GPIO_RTL8366_SDA 1 -#define RT_N15_BUTTONS_POLL_INTERVAL 20 +#define RT_N15_KEYS_POLL_INTERVAL 20 +#define RT_N15_KEYS_DEBOUNCE_INTERVAL (3 * RT_N15_KEYS_POLL_INTERVAL) static struct mtd_partition rt_n15_partitions[] = { { @@ -78,19 +79,19 @@ static struct gpio_led rt_n15_leds_gpio[] __initdata = { } }; -static struct gpio_button rt_n15_gpio_buttons[] __initdata = { +static struct gpio_keys_button rt_n15_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = RT_N15_KEYS_DEBOUNCE_INTERVAL, .gpio = RT_N15_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = RT_N15_KEYS_DEBOUNCE_INTERVAL, .gpio = RT_N15_GPIO_BUTTON_WPS, .active_low = 1, } @@ -118,7 +119,7 @@ static void __init rt_n15_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(rt_n15_leds_gpio), rt_n15_leds_gpio); - ramips_register_gpio_buttons(-1, RT_N15_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, RT_N15_KEYS_POLL_INTERVAL, ARRAY_SIZE(rt_n15_gpio_buttons), rt_n15_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c index 03c4adf31b..a9f0de4d86 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c @@ -32,7 +32,8 @@ #define WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH 8 #define WLI_TX4_AG300N_GPIO_BUTTON_RESET 9 -#define WLI_TX4_AG300N_BUTTONS_POLL_INTERVAL 20 +#define WLI_TX4_AG300N_KEYS_POLL_INTERVAL 20 +#define WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLI_TX4_AG300N_KEYS_POLL_INTERVAL) static struct mtd_partition wli_tx4_ag300n_partitions[] = { { @@ -98,12 +99,12 @@ static struct gpio_led wli_tx4_ag300n_leds_gpio[] __initdata = { }, }; -static struct gpio_button wli_tx4_ag300n_gpio_buttons[] __initdata = { +static struct gpio_keys_button wli_tx4_ag300n_gpio_buttons[] __initdata = { { .desc = "Reset button", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WLI_TX4_AG300N_GPIO_BUTTON_RESET, .active_low = 1, }, @@ -111,7 +112,7 @@ static struct gpio_button wli_tx4_ag300n_gpio_buttons[] __initdata = { .desc = "AOSS button", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WLI_TX4_AG300N_GPIO_BUTTON_AOSS, .active_low = 1, }, @@ -119,7 +120,7 @@ static struct gpio_button wli_tx4_ag300n_gpio_buttons[] __initdata = { .desc = "Bandwidth switch", .type = EV_KEY, .code = BTN_0, - .threshold = 3, + .debounce_interval = WLI_TX4_AG300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WLI_TX4_AG300N_GPIO_BUTTON_BW_SWITCH, .active_low = 0, }, @@ -131,7 +132,7 @@ static void __init wli_tx4_ag300n_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(wli_tx4_ag300n_leds_gpio), wli_tx4_ag300n_leds_gpio); - ramips_register_gpio_buttons(-1, WLI_TX4_AG300N_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WLI_TX4_AG300N_KEYS_POLL_INTERVAL, ARRAY_SIZE(wli_tx4_ag300n_gpio_buttons), wli_tx4_ag300n_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c index 3a53e16d07..cd25c4345b 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c @@ -28,7 +28,8 @@ #define ALL0256N_GPIO_LED_RSSI_LOW 14 #define ALL0256N_GPIO_LED_RSSI_MED 12 #define ALL0256N_GPIO_LED_RSSI_HIGH 13 -#define ALL0256N_BUTTONS_POLL_INTERVAL 20 +#define ALL0256N_KEYS_POLL_INTERVAL 20 +#define ALL0256N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0256N_KEYS_POLL_INTERVAL) static struct mtd_partition all0256n_partitions[] = { { @@ -76,12 +77,12 @@ struct spi_board_info all0256n_spi_slave_info[] __initdata = { }, }; -static struct gpio_button all0256n_gpio_buttons[] __initdata = { +static struct gpio_keys_button all0256n_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = ALL0256N_KEYS_DEBOUNCE_INTERVAL, .gpio = ALL0256N_GPIO_BUTTON_RESET, .active_low = 1, } @@ -112,7 +113,7 @@ static void __init all0256n_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(all0256n_leds_gpio), all0256n_leds_gpio); - ramips_register_gpio_buttons(-1, ALL0256N_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, ALL0256N_KEYS_POLL_INTERVAL, ARRAY_SIZE(all0256n_gpio_buttons), all0256n_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c index d1c5170293..00832f13bb 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c @@ -27,7 +27,8 @@ #define ARGUS_ATP52B_GPIO_LED_NET 13 #define ARGUS_ATP52B_GPIO_BUTTON_WPS 0 #define ARGUS_ATP52B_GPIO_BUTTON_RESET 10 -#define ARGUS_ATP52B_BUTTONS_POLL_INTERVAL 20 +#define ARGUS_ATP52B_KEYS_POLL_INTERVAL 20 +#define ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL (3 * ARGUS_ATP52B_KEYS_POLL_INTERVAL) static struct gpio_led argus_atp52b_leds_gpio[] __initdata = { { @@ -42,12 +43,12 @@ static struct gpio_led argus_atp52b_leds_gpio[] __initdata = { } }; -static struct gpio_button argus_atp52b_gpio_buttons[] __initdata = { +static struct gpio_keys_button argus_atp52b_gpio_buttons[] __initdata = { { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL, .gpio = ARGUS_ATP52B_GPIO_BUTTON_WPS, .active_low = 1, }, @@ -55,7 +56,7 @@ static struct gpio_button argus_atp52b_gpio_buttons[] __initdata = { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 10, + .debounce_interval = ARGUS_ATP52B_KEYS_DEBOUNCE_INTERVAL, .gpio = ARGUS_ATP52B_GPIO_BUTTON_RESET, .active_low = 1, } @@ -99,7 +100,7 @@ static void __init argus_atp52b_init(void) rt305x_register_flash(0, &argus_atp52b_flash_data); ramips_register_gpio_leds(-1, ARRAY_SIZE(argus_atp52b_leds_gpio), argus_atp52b_leds_gpio); - ramips_register_gpio_buttons(-1, ARGUS_ATP52B_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, ARGUS_ATP52B_KEYS_POLL_INTERVAL, ARRAY_SIZE(argus_atp52b_gpio_buttons), argus_atp52b_gpio_buttons); rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL; diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c index bb225c1f1c..4b03b776c7 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c @@ -25,7 +25,8 @@ #define BC2_GPIO_BUTTON_RESET 17 #define BC2_GPIO_LED_USB 20 -#define BC2_BUTTONS_POLL_INTERVAL 20 +#define BC2_KEYS_POLL_INTERVAL 20 +#define BC2_KEYS_DEBOUNCE_INTERVAL (3 * BC2_KEYS_POLL_INTERVAL) static struct mtd_partition bc2_partitions[] = { { @@ -71,12 +72,12 @@ static struct gpio_led bc2_leds_gpio[] __initdata = { } }; -static struct gpio_button bc2_gpio_buttons[] __initdata = { +static struct gpio_keys_button bc2_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = BC2_KEYS_DEBOUNCE_INTERVAL, .gpio = BC2_GPIO_BUTTON_RESET, .active_low = 1, } @@ -93,7 +94,7 @@ static void __init bc2_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(bc2_leds_gpio), bc2_leds_gpio); - ramips_register_gpio_buttons(-1, BC2_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, BC2_KEYS_POLL_INTERVAL, ARRAY_SIZE(bc2_gpio_buttons), bc2_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c index 70a2245b8d..b84d9ed9f4 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c @@ -29,7 +29,8 @@ #define DIR_300B_GPIO_BUTTON_WPS 0 /* active low */ #define DIR_300B_GPIO_BUTTON_RESET 10 /* active low */ -#define DIR_300B_BUTTONS_POLL_INTERVAL 20 +#define DIR_300B_KEYS_POLL_INTERVAL 20 +#define DIR_300B_KEYS_DEBOUNCE_INTERVAL (3 * DIR_300B_KEYS_POLL_INTERVAL) static struct mtd_partition dir_300b_partitions[] = { { @@ -83,19 +84,19 @@ static struct gpio_led dir_300b_leds_gpio[] __initdata = { } }; -static struct gpio_button dir_300b_gpio_buttons[] __initdata = { +static struct gpio_keys_button dir_300b_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = DIR_300B_KEYS_DEBOUNCE_INTERVAL, .gpio = DIR_300B_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = DIR_300B_KEYS_DEBOUNCE_INTERVAL, .gpio = DIR_300B_GPIO_BUTTON_WPS, .active_low = 1, } @@ -110,7 +111,7 @@ static void __init dir_300b_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_300b_leds_gpio), dir_300b_leds_gpio); - ramips_register_gpio_buttons(-1, DIR_300B_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, DIR_300B_KEYS_POLL_INTERVAL, ARRAY_SIZE(dir_300b_gpio_buttons), dir_300b_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c index fb3b7c8d66..371487a217 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c @@ -28,7 +28,8 @@ #define ESR_9753_GPIO_BUTTON_WPS 0 /* active low */ #define ESR_9753_GPIO_BUTTON_RESET 10 /* active low */ -#define ESR_9753_BUTTONS_POLL_INTERVAL 20 +#define ESR_9753_KEYS_POLL_INTERVAL 20 +#define ESR_9753_KEYS_DEBOUNCE_INTERVAL (3 * ESR_9753_KEYS_POLL_INTERVAL) static struct mtd_partition esr_9753_partitions[] = { { @@ -78,19 +79,19 @@ static struct gpio_led esr_9753_leds_gpio[] __initdata = { } }; -static struct gpio_button esr_9753_gpio_buttons[] __initdata = { +static struct gpio_keys_button esr_9753_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = ESR_9753_KEYS_DEBOUNCE_INTERVAL, .gpio = ESR_9753_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = ESR_9753_KEYS_DEBOUNCE_INTERVAL, .gpio = ESR_9753_GPIO_BUTTON_WPS, .active_low = 1, } @@ -105,7 +106,7 @@ static void __init esr_9753_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(esr_9753_leds_gpio), esr_9753_leds_gpio); - ramips_register_gpio_buttons(-1, ESR_9753_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, ESR_9753_KEYS_POLL_INTERVAL, ARRAY_SIZE(esr_9753_gpio_buttons), esr_9753_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c index 2157ca7a7c..5955f63918 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c @@ -29,7 +29,8 @@ #define FONERA20N_GPIO_LED_POWER 9 #define FONERA20N_GPIO_LED_USB 14 -#define FONERA20N_BUTTONS_POLL_INTERVAL 20 +#define FONERA20N_KEYS_POLL_INTERVAL 20 +#define FONERA20N_KEYS_DEBOUNCE_INTERVAL (3 * FONERA20N_KEYS_POLL_INTERVAL) static struct mtd_partition fonera20n_partitions[] = { { @@ -83,19 +84,19 @@ static struct gpio_led fonera20n_leds_gpio[] __initdata = { } }; -static struct gpio_button fonera20n_gpio_buttons[] __initdata = { +static struct gpio_keys_button fonera20n_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = FONERA20N_KEYS_DEBOUNCE_INTERVAL, .gpio = FONERA20N_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "switch", .type = EV_KEY, .code = BTN_1, - .threshold = 3, + .debounce_interval = FONERA20N_KEYS_DEBOUNCE_INTERVAL, .gpio = FONERA20N_GPIO_SWITCH, .active_low = 1, } @@ -110,7 +111,7 @@ static void __init fonera20n_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(fonera20n_leds_gpio), fonera20n_leds_gpio); - ramips_register_gpio_buttons(-1, FONERA20N_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, FONERA20N_KEYS_POLL_INTERVAL, ARRAY_SIZE(fonera20n_gpio_buttons), fonera20n_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c index 21587812c4..08ee40a914 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c @@ -31,7 +31,8 @@ #define HW550_3G_GPIO_BUTTON_CONNECT 7 #define HW550_3G_GPIO_BUTTON_WPS 0 -#define HW550_3G_BUTTONS_POLL_INTERVAL 20 +#define HW550_3G_KEYS_POLL_INTERVAL 20 +#define HW550_3G_KEYS_DEBOUNCE_INTERVAL (3 * HW550_3G_KEYS_POLL_INTERVAL) static struct mtd_partition hw550_3g_partitions[] = { { @@ -89,26 +90,26 @@ static struct gpio_led hw550_3g_leds_gpio[] __initdata = { } }; -static struct gpio_button hw550_3g_gpio_buttons[] __initdata = { +static struct gpio_keys_button hw550_3g_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, .gpio = HW550_3G_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "connect", .type = EV_KEY, .code = KEY_CONNECT, - .threshold = 3, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, .gpio = HW550_3G_GPIO_BUTTON_CONNECT, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = HW550_3G_KEYS_DEBOUNCE_INTERVAL, .gpio = HW550_3G_GPIO_BUTTON_WPS, .active_low = 1, } @@ -127,7 +128,7 @@ static void __init hw550_3g_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(hw550_3g_leds_gpio), hw550_3g_leds_gpio); - ramips_register_gpio_buttons(-1, HW550_3G_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, HW550_3G_KEYS_POLL_INTERVAL, ARRAY_SIZE(hw550_3g_gpio_buttons), hw550_3g_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c index e3273ba70e..fa046df9fe 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c @@ -31,7 +31,8 @@ #define MOFI3500_3GN_GPIO_BUTTON_CONNECT 7 #define MOFI3500_3GN_GPIO_BUTTON_WPS 0 -#define MOFI3500_3GN_BUTTONS_POLL_INTERVAL 20 +#define MOFI3500_3GN_KEYS_POLL_INTERVAL 20 +#define MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL (3 * MOFI3500_3GN_KEYS_POLL_INTERVAL) static struct mtd_partition mofi3500_3gn_partitions[] = { { @@ -89,26 +90,26 @@ static struct gpio_led mofi3500_3gn_leds_gpio[] __initdata = { } }; -static struct gpio_button mofi3500_3gn_gpio_buttons[] __initdata = { +static struct gpio_keys_button mofi3500_3gn_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, .gpio = MOFI3500_3GN_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "connect", .type = EV_KEY, .code = KEY_CONNECT, - .threshold = 3, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, .gpio = MOFI3500_3GN_GPIO_BUTTON_CONNECT, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL, .gpio = MOFI3500_3GN_GPIO_BUTTON_WPS, .active_low = 1, } @@ -127,7 +128,7 @@ static void __init mofi3500_3gn_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(mofi3500_3gn_leds_gpio), mofi3500_3gn_leds_gpio); - ramips_register_gpio_buttons(-1, MOFI3500_3GN_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, MOFI3500_3GN_KEYS_POLL_INTERVAL, ARRAY_SIZE(mofi3500_3gn_gpio_buttons), mofi3500_3gn_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c index 63071da656..afe51d71e8 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c @@ -28,7 +28,8 @@ #define NBG_419N_GPIO_BUTTON_WPS 0 /* active low */ #define NBG_419N_GPIO_BUTTON_RESET 10 /* active low */ -#define NBG_419N_BUTTONS_POLL_INTERVAL 20 +#define NBG_419N_KEYS_POLL_INTERVAL 20 +#define NBG_419N_KEYS_DEBOUNCE_INTERVAL (3 * NBG_419N_KEYS_POLL_INTERVAL) static struct mtd_partition nbg_419n_partitions[] = { { @@ -70,19 +71,19 @@ static struct gpio_led nbg_419n_leds_gpio[] __initdata = { } }; -static struct gpio_button nbg_419n_gpio_buttons[] __initdata = { +static struct gpio_keys_button nbg_419n_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = NBG_419N_KEYS_DEBOUNCE_INTERVAL, .gpio = NBG_419N_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = NBG_419N_KEYS_DEBOUNCE_INTERVAL, .gpio = NBG_419N_GPIO_BUTTON_WPS, .active_low = 1, } @@ -97,7 +98,7 @@ static void __init nbg_419n_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(nbg_419n_leds_gpio), nbg_419n_leds_gpio); - ramips_register_gpio_buttons(-1, NBG_419N_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, NBG_419N_KEYS_POLL_INTERVAL, ARRAY_SIZE(nbg_419n_gpio_buttons), nbg_419n_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c index 917357ec12..a287bc63ff 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c @@ -32,7 +32,8 @@ #define NW718_GPIO_SPI_CS0 3 -#define NW718_BUTTONS_POLL_INTERVAL 20 +#define NW718_KEYS_POLL_INTERVAL 20 +#define NW718_KEYS_DEBOUNCE_INTERVAL (3 * NW718_KEYS_POLL_INTERVAL) static struct mtd_partition nw718_partitions[] = { { @@ -86,19 +87,19 @@ static struct gpio_led nw718_leds_gpio[] __initdata = { } }; -static struct gpio_button nw718_gpio_buttons[] __initdata = { +static struct gpio_keys_button nw718_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = NW718_KEYS_DEBOUNCE_INTERVAL, .gpio = NW718_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = NW718_KEYS_DEBOUNCE_INTERVAL, .gpio = NW718_GPIO_BUTTON_WPS, .active_low = 1, } @@ -124,7 +125,7 @@ static void __init nw718_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(nw718_leds_gpio), nw718_leds_gpio); - ramips_register_gpio_buttons(-1, NW718_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, NW718_KEYS_POLL_INTERVAL, ARRAY_SIZE(nw718_gpio_buttons), nw718_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c index a6c1a163a3..149609956a 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c @@ -25,7 +25,8 @@ #define OMNI_EMB_GPIO_BUTTON_RESET 12 /* active low */ -#define OMNI_EMB_BUTTONS_POLL_INTERVAL 20 +#define OMNI_EMB_KEYS_POLL_INTERVAL 20 +#define OMNI_EMB_KEYS_DEBOUNCE_INTERVAL (3 * OMNI_EMB_KEYS_POLL_INTERVAL) #define OMNI_EMB_GPIO_LED_STATUS 9 #define OMNI_EMB_GPIO_LED_WLAN 14 @@ -77,12 +78,12 @@ static struct gpio_led omni_emb_leds_gpio[] __initdata = { } }; -static struct gpio_button omni_emb_gpio_buttons[] __initdata = { +static struct gpio_keys_button omni_emb_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = OMNI_EMB_KEYS_DEBOUNCE_INTERVAL, .gpio = OMNI_EMB_GPIO_BUTTON_RESET, .active_low = 1, } @@ -96,7 +97,7 @@ static void __init omni_emb_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(omni_emb_leds_gpio), omni_emb_leds_gpio); - ramips_register_gpio_buttons(-1, OMNI_EMB_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, OMNI_EMB_KEYS_POLL_INTERVAL, ARRAY_SIZE(omni_emb_gpio_buttons), omni_emb_gpio_buttons); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c index 4eb1f4b99e..dc02f49638 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c @@ -25,7 +25,8 @@ #define PWH2004_GPIO_BUTTON_WPS 12 #define PWH2004_GPIO_LED_POWER 9 #define PWH2004_GPIO_LED_WIFI 14 -#define PWH2004_BUTTONS_POLL_INTERVAL 20 +#define PWH2004_KEYS_POLL_INTERVAL 20 +#define PWH2004_KEYS_DEBOUNCE_INTERVAL (3 * PWH2004_KEYS_POLL_INTERVAL) static struct mtd_partition pwh2004_partitions[] = { { @@ -71,12 +72,12 @@ static struct gpio_led pwh2004_leds_gpio[] __initdata = { } }; -static struct gpio_button pwh2004_gpio_buttons[] __initdata = { +static struct gpio_keys_button pwh2004_gpio_buttons[] __initdata = { { .desc = "wps", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = PWH2004_KEYS_DEBOUNCE_INTERVAL, .gpio = PWH2004_GPIO_BUTTON_WPS, .active_low = 1, } @@ -88,7 +89,7 @@ static void __init pwh2004_init(void) rt305x_register_flash(0, &pwh2004_flash_data); ramips_register_gpio_leds(-1, ARRAY_SIZE(pwh2004_leds_gpio), pwh2004_leds_gpio); - ramips_register_gpio_buttons(-1, PWH2004_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, PWH2004_KEYS_POLL_INTERVAL, ARRAY_SIZE(pwh2004_gpio_buttons), pwh2004_gpio_buttons); rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c index 6963c1744e..2359f2a40d 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c @@ -25,7 +25,8 @@ #define RT_G32B_GPIO_BUTTON_WPS 0 /* active low */ #define RT_G32B_GPIO_BUTTON_RESET 10 /* active low */ -#define RT_G32B_BUTTONS_POLL_INTERVAL 20 +#define RT_G32B_KEYS_POLL_INTERVAL 20 +#define RT_G32B_KEYS_DEBOUNCE_INTERVAL (3 * RT_G32B_KEYS_POLL_INTERVAL) static struct mtd_partition rt_g32b_partitions[] = { { @@ -75,19 +76,19 @@ struct spi_board_info __initdata rt_g32b_spi_slave_info[] = { }, }; -static struct gpio_button rt_g32b_gpio_buttons[] __initdata = { +static struct gpio_keys_button rt_g32b_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, .gpio = RT_G32B_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, .gpio = RT_G32B_GPIO_BUTTON_WPS, .active_low = 1, } @@ -101,7 +102,7 @@ static void __init rt_g32b_init(void) rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; rt305x_register_ethernet(); - ramips_register_gpio_buttons(-1, RT_G32B_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, RT_G32B_KEYS_POLL_INTERVAL, ARRAY_SIZE(rt_g32b_gpio_buttons), rt_g32b_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c index 6dee249440..acef978071 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c @@ -27,7 +27,8 @@ #define V22RW_2X2_GPIO_LED_SECURITY 13 #define V22RW_2X2_GPIO_LED_WPS 14 -#define V22RW_2X2_BUTTONS_POLL_INTERVAL 20 +#define V22RW_2X2_KEYS_POLL_INTERVAL 20 +#define V22RW_2X2_KEYS_DEBOUNCE_INTERVAL (3 * V22RW_2X2_KEYS_POLL_INTERVAL) static struct mtd_partition v22rw_2x2_partitions[] = { { @@ -77,19 +78,19 @@ static struct gpio_led v22rw_2x2_leds_gpio[] __initdata = { } }; -static struct gpio_button v22rw_2x2_gpio_buttons[] __initdata = { +static struct gpio_keys_button v22rw_2x2_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = V22RW_2X2_KEYS_DEBOUNCE_INTERVAL, .gpio = V22RW_2X2_GPIO_BUTTON_SWRST, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = V22RW_2X2_KEYS_DEBOUNCE_INTERVAL, .gpio = V22RW_2X2_GPIO_BUTTON_WPS, .active_low = 1, } @@ -104,7 +105,7 @@ static void __init v22rw_2x2_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(v22rw_2x2_leds_gpio), v22rw_2x2_leds_gpio); - ramips_register_gpio_buttons(-1, V22RW_2X2_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, V22RW_2X2_KEYS_POLL_INTERVAL, ARRAY_SIZE(v22rw_2x2_gpio_buttons), v22rw_2x2_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c index b214026595..390388b1ce 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c @@ -28,7 +28,8 @@ #define W502U_GPIO_BUTTON_WPS 0 #define W502U_GPIO_BUTTON_RESET 10 -#define W502U_BUTTONS_POLL_INTERVAL 20 +#define W502U_KEYS_POLL_INTERVAL 20 +#define W502U_KEYS_DEBOUNCE_INTERVAL (3 * W502U_KEYS_POLL_INTERVAL) static struct mtd_partition w502u_partitions[] = { { @@ -84,12 +85,12 @@ static struct gpio_led w502u_leds_gpio[] __initdata = { }, }; -static struct gpio_button w502u_gpio_buttons[] __initdata = { +static struct gpio_keys_button w502u_gpio_buttons[] __initdata = { { .desc = "Reset button", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL, .gpio = W502U_GPIO_BUTTON_RESET, .active_low = 1, }, @@ -97,7 +98,7 @@ static struct gpio_button w502u_gpio_buttons[] __initdata = { .desc = "WPS button", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL, .gpio = W502U_GPIO_BUTTON_WPS, .active_low = 1, }, @@ -113,7 +114,7 @@ static void __init w502u_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio), w502u_leds_gpio); - ramips_register_gpio_buttons(-1, W502U_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, W502U_KEYS_POLL_INTERVAL, ARRAY_SIZE(w502u_gpio_buttons), w502u_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c index 8e3ed733a2..96a449527f 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c @@ -26,7 +26,8 @@ #define WCR150GN_GPIO_LED_POWER 8 #define WCR150GN_GPIO_BUTTON_WPS 10 #define WCR150GN_GPIO_BUTTON_RESET 0 -#define WCR150GN_BUTTONS_POLL_INTERVAL 20 +#define WCR150GN_KEYS_POLL_INTERVAL 20 +#define WCR150GN_KEYS_DEBOUNCE_INTERVAL (3 * WCR150GN_KEYS_POLL_INTERVAL) static struct gpio_led wcr150gn_leds_gpio[] __initdata = { { @@ -41,12 +42,12 @@ static struct gpio_led wcr150gn_leds_gpio[] __initdata = { } }; -static struct gpio_button wcr150gn_gpio_buttons[] __initdata = { +static struct gpio_keys_button wcr150gn_gpio_buttons[] __initdata = { { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WCR150GN_KEYS_DEBOUNCE_INTERVAL, .gpio = WCR150GN_GPIO_BUTTON_WPS, .active_low = 1, }, @@ -54,7 +55,7 @@ static struct gpio_button wcr150gn_gpio_buttons[] __initdata = { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 10, + .debounce_interval = WCR150GN_KEYS_DEBOUNCE_INTERVAL, .gpio = WCR150GN_GPIO_BUTTON_RESET, .active_low = 1, } @@ -104,7 +105,7 @@ static void __init wcr150gn_init(void) rt305x_register_flash(0, &wcr150gn_flash_data); ramips_register_gpio_leds(-1, ARRAY_SIZE(wcr150gn_leds_gpio), wcr150gn_leds_gpio); - ramips_register_gpio_buttons(-1, WCR150GN_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WCR150GN_KEYS_POLL_INTERVAL, ARRAY_SIZE(wcr150gn_gpio_buttons), wcr150gn_gpio_buttons); rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c index 394c45acca..6d6dc7f60f 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c @@ -31,7 +31,8 @@ #define WHR_G300N_GPIO_BUTTON_ROUTER_ON 8 /* active low */ #define WHR_G300N_GPIO_BUTTON_ROUTER_OFF 11 /* active low */ -#define WHR_G300N_BUTTONS_POLL_INTERVAL 20 +#define WHR_G300N_KEYS_POLL_INTERVAL 20 +#define WHR_G300N_KEYS_DEBOUNCE_INTERVAL (3 * WHR_G300N_KEYS_POLL_INTERVAL) static struct mtd_partition whr_g300n_partitions[] = { { @@ -89,33 +90,33 @@ static struct gpio_led whr_g300n_leds_gpio[] __initdata = { } }; -static struct gpio_button whr_g300n_gpio_buttons[] __initdata = { +static struct gpio_keys_button whr_g300n_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WHR_G300N_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "aoss", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WHR_G300N_GPIO_BUTTON_AOSS, .active_low = 1, }, { .desc = "router-off", .type = EV_KEY, .code = BTN_2, - .threshold = 3, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WHR_G300N_GPIO_BUTTON_ROUTER_OFF, .active_low = 1, }, { .desc = "router-on", .type = EV_KEY, .code = BTN_3, - .threshold = 3, + .debounce_interval = WHR_G300N_KEYS_DEBOUNCE_INTERVAL, .gpio = WHR_G300N_GPIO_BUTTON_ROUTER_ON, .active_low = 1, } @@ -130,7 +131,7 @@ static void __init whr_g300n_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(whr_g300n_leds_gpio), whr_g300n_leds_gpio); - ramips_register_gpio_buttons(-1, WHR_G300N_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WHR_G300N_KEYS_POLL_INTERVAL, ARRAY_SIZE(whr_g300n_gpio_buttons), whr_g300n_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c index a3c4485584..f737fe523d 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c @@ -33,7 +33,8 @@ #define WL341V3_GPIO_BUTTON_WPS 5 /* active low */ #define WL341V3_GPIO_BUTTON_RESET 7 /* active low */ -#define WL341V3_BUTTONS_POLL_INTERVAL 20 +#define WL341V3_KEYS_POLL_INTERVAL 20 +#define WL341V3_KEYS_DEBOUNCE_INTERVAL (3 * WL341V3_KEYS_POLL_INTERVAL) static struct mtd_partition wl341v3_partitions[] = { { @@ -111,19 +112,19 @@ static struct gpio_led wl341v3_leds_gpio[] __initdata = { } }; -static struct gpio_button wl341v3_gpio_buttons[] __initdata = { +static struct gpio_keys_button wl341v3_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL, .gpio = WL341V3_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WL341V3_KEYS_DEBOUNCE_INTERVAL, .gpio = WL341V3_GPIO_BUTTON_WPS, .active_low = 1, } @@ -138,7 +139,7 @@ static void __init wl341v3_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio), wl341v3_leds_gpio); - ramips_register_gpio_buttons(-1, WL341V3_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WL341V3_KEYS_POLL_INTERVAL, ARRAY_SIZE(wl341v3_gpio_buttons), wl341v3_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c index ff2a1c2e56..9d227b66b8 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c @@ -31,8 +31,8 @@ #define WL351_GPIO_BUTTON_RESET 10 #define WL351_GPIO_BUTTON_WPS 0 -#define WL351_BUTTONS_POLL_INTERVAL 20 - +#define WL351_KEYS_POLL_INTERVAL 20 +#define WL351_KEYS_DEBOUNCE_INTERVAL (3 * WL351_KEYS_POLL_INTERVAL) static struct gpio_led wl351_leds_gpio[] __initdata = { { @@ -51,19 +51,19 @@ static struct gpio_led wl351_leds_gpio[] __initdata = { }; -static struct gpio_button wl351_gpio_buttons[] __initdata = { +static struct gpio_keys_button wl351_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WL351_KEYS_DEBOUNCE_INTERVAL, .gpio = WL351_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WL351_KEYS_DEBOUNCE_INTERVAL, .gpio = WL351_GPIO_BUTTON_WPS, .active_low = 1, } @@ -133,7 +133,7 @@ static void __init wl351_init(void) rt305x_register_flash(0, &wl351_flash_data); ramips_register_gpio_leds(-1, ARRAY_SIZE(wl351_leds_gpio), wl351_leds_gpio); - ramips_register_gpio_buttons(-1, WL351_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WL351_KEYS_POLL_INTERVAL, ARRAY_SIZE(wl351_gpio_buttons), wl351_gpio_buttons); // external rtl8366rb diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c index d49a243622..201823c49c 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c @@ -42,7 +42,8 @@ #define WR512_3GN_GPIO_BUTTON_WPS 0 #define WR512_3GN_GPIO_BUTTON_WPS2 8 -#define WR512_3GN_BUTTONS_POLL_INTERVAL 20 +#define WR512_3GN_KEYS_POLL_INTERVAL 20 +#define WR512_3GN_KEYS_DEBOUNCE_INTERVAL (3 * WR512_3GN_KEYS_POLL_INTERVAL) static struct mtd_partition wr512_3gn_partitions[] = { { @@ -104,19 +105,19 @@ static struct gpio_led wr512_3gn_leds_gpio[] __initdata = { } }; -static struct gpio_button wr512_3gn_gpio_buttons[] __initdata = { +static struct gpio_keys_button wr512_3gn_gpio_buttons[] __initdata = { { .desc = "reset_wps", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WR512_3GN_KEYS_DEBOUNCE_INTERVAL, .gpio = WR512_3GN_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "mode", .type = EV_KEY, .code = KEY_M, - .threshold = 3, + .debounce_interval = WR512_3GN_KEYS_DEBOUNCE_INTERVAL, .gpio = WR512_3GN_GPIO_BUTTON_CONNECT, .active_low = 1, } @@ -135,7 +136,7 @@ static void __init wr512_3gn_init(void) rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(wr512_3gn_leds_gpio), wr512_3gn_leds_gpio); - ramips_register_gpio_buttons(-1, WR512_3GN_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WR512_3GN_KEYS_POLL_INTERVAL, ARRAY_SIZE(wr512_3gn_gpio_buttons), wr512_3gn_gpio_buttons); rt305x_register_wifi(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c index 9609b18285..c63adb96dd 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c @@ -26,7 +26,8 @@ #define WR6202_GPIO_BUTTON_RESET 10 /* active low */ #define WR6202_GPIO_BUTTON_WPS 0 /* active low */ -#define WR6202_BUTTONS_POLL_INTERVAL 20 +#define WR6202_KEYS_POLL_INTERVAL 20 +#define WR6202_KEYS_DEBOUNCE_INTERVAL (3 * WR6202_KEYS_POLL_INTERVAL) #define WR6202_GPIO_USB_POWER 11 @@ -76,19 +77,19 @@ static struct gpio_led wr6202_leds_gpio[] __initdata = { } }; -static struct gpio_button wr6202_gpio_buttons[] __initdata = { +static struct gpio_keys_button wr6202_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, - .threshold = 3, + .debounce_interval = WR6202_KEYS_DEBOUNCE_INTERVAL, .gpio = WR6202_GPIO_BUTTON_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, - .threshold = 3, + .debounce_interval = WR6202_KEYS_DEBOUNCE_INTERVAL, .gpio = WR6202_GPIO_BUTTON_WPS, .active_low = 1, } @@ -102,7 +103,7 @@ static void __init wr6202_init(void) ramips_register_gpio_leds(-1, ARRAY_SIZE(wr6202_leds_gpio), wr6202_leds_gpio); - ramips_register_gpio_buttons(-1, WR6202_BUTTONS_POLL_INTERVAL, + ramips_register_gpio_buttons(-1, WR6202_KEYS_POLL_INTERVAL, ARRAY_SIZE(wr6202_gpio_buttons), wr6202_gpio_buttons);