ramips: use gpio-keys-polled instead of gpio-buttons
[openwrt/svn-archive/archive.git] / target / linux / ramips / files / arch / mips / ralink / rt288x / mach-wli-tx4-ag300n.c
index 0f200ea298e33abf67c4355d1860c455cdaefd44..a9f0de4d86f26d7cf100483f6205e9b4dfd79b44 100644 (file)
@@ -32,9 +32,9 @@
 #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)
 
-#ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition wli_tx4_ag300n_partitions[] = {
        {
                .name   = "u-boot",
@@ -75,13 +75,10 @@ static struct mtd_partition wli_tx4_ag300n_partitions[] = {
                .size   = 0x3a0000,
        },
 };
-#endif /* CONFIG_MTD_PARTITIONS */
 
 static struct physmap_flash_data wli_tx4_ag300n_flash_data = {
-#ifdef CONFIG_MTD_PARTITIONS
        .nr_parts       = ARRAY_SIZE(wli_tx4_ag300n_partitions),
        .parts          = wli_tx4_ag300n_partitions,
-#endif
 };
 
 static struct gpio_led wli_tx4_ag300n_leds_gpio[] __initdata = {
@@ -102,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,
        },
@@ -115,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,
        },
@@ -123,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,
        },
@@ -135,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);