summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch/mips
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-12-26 14:19:01 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-12-26 14:19:01 +0000
commit1bb20685418e882074c97230a76eeb8835d9288f (patch)
tree1504ab573dbeb7463e3e1ef92975915bf5a3c2ab /target/linux/ar71xx/files/arch/mips
parentc2b4fcb0cc6e24df1692da93ed409c723a2de3ee (diff)
ar71xx: move gpio-buttons support into a spearate file
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18937 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig24
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c58
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h25
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/devices.c43
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/devices.h6
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c7
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c2
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c3
27 files changed, 134 insertions, 74 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
index 08d03970c..fe9b7a70d 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
@@ -6,12 +6,14 @@ config AR71XX_MACH_AP81
bool "Atheros AP81 board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
config AR71XX_MACH_AP83
bool "Atheros AP83 board support"
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -19,6 +21,7 @@ config AR71XX_MACH_DIR_615_C1
bool "D-Link DIR-615 rev. C1 support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -26,17 +29,20 @@ config AR71XX_MACH_DIR_825_B1
bool "D-Link DIR-825 rev. B1 board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AP94_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
config AR71XX_MACH_PB42
bool "Atheros PB42 board support"
select AR71XX_DEV_M25P80
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_PB42_PCI if PCI
default y
config AR71XX_MACH_PB44
bool "Atheros PB44 board support"
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_PB42_PCI if PCI
select AR71XX_DEV_LEDS_GPIO
default y
@@ -44,6 +50,7 @@ config AR71XX_MACH_PB44
config AR71XX_MACH_AW_NR580
bool "AzureWave AW-NR580 board support"
select AR71XX_DEV_M25P80
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_PB42_PCI if PCI
select AR71XX_DEV_LEDS_GPIO
default y
@@ -56,6 +63,7 @@ config AR71XX_MACH_WP543
bool "Compex WP543/WPJ543 board support"
select MYLOADER
select AR71XX_DEV_M25P80
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_PB42_PCI if PCI
select AR71XX_DEV_LEDS_GPIO
default y
@@ -64,17 +72,20 @@ config AR71XX_MACH_WRT160NL
bool "Linksys WRT160NL board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
config AR71XX_MACH_WRT400N
bool "Linksys WRT400N board support"
select AR71XX_DEV_M25P80
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
config AR71XX_MACH_RB_4XX
bool "MikroTik RouterBOARD 4xx series support"
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -82,6 +93,7 @@ config AR71XX_MACH_WNDR3700
bool "NETGEAR WNDR3700 board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AP94_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -89,6 +101,7 @@ config AR71XX_MACH_WNR2000
bool "NETGEAR WNR2000 board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -96,6 +109,7 @@ config AR71XX_MACH_MZK_W04NU
bool "Planex MZK-W04NU board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -103,6 +117,7 @@ config AR71XX_MACH_MZK_W300NH
bool "Planex MZK-W300NH board support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -110,6 +125,7 @@ config AR71XX_MACH_TL_WR741ND
bool "TP-LINK TL-WR741ND support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AP91_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -117,6 +133,7 @@ config AR71XX_MACH_TL_WR841N_V1
bool "TP-LINK TL-WR841N v1 support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_PB42_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -124,6 +141,7 @@ config AR71XX_MACH_TL_WR941ND
bool "TP-LINK TL-WR941ND support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -131,6 +149,7 @@ config AR71XX_MACH_TL_WR1043ND
bool "TP-LINK TL-WR1043ND support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -138,6 +157,7 @@ config AR71XX_MACH_TEW_632BRP
bool "TRENDnet TEW-632BRP support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AR913X_WMAC
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
default y
@@ -145,6 +165,7 @@ config AR71XX_MACH_UBNT
bool "Ubiquiti AR71xx based boards support"
select AR71XX_DEV_M25P80
select AR71XX_DEV_AP91_PCI if PCI
+ select AR71XX_DEV_GPIO_BUTTONS
select AR71XX_DEV_LEDS_GPIO
select AR71XX_DEV_PB42_PCI if PCI
default y
@@ -163,6 +184,9 @@ config AR71XX_DEV_AP94_PCI
config AR71XX_DEV_AR913X_WMAC
def_bool n
+config AR71XX_DEV_GPIO_BUTTONS
+ def_bool n
+
config AR71XX_DEV_LEDS_GPIO
def_bool n
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
index fee95bd4a..962af4bb2 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_AR71XX_DEV_AP91_PCI) += dev-ap91-pci.o
obj-$(CONFIG_AR71XX_DEV_AP94_PCI) += dev-ap94-pci.o
obj-$(CONFIG_AR71XX_DEV_AR913X_WMAC) += dev-ar913x-wmac.o
+obj-$(CONFIG_AR71XX_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o
obj-$(CONFIG_AR71XX_DEV_LEDS_GPIO) += dev-leds-gpio.o
obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o
obj-$(CONFIG_AR71XX_DEV_PB42_PCI) += dev-pb42-pci.o
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
new file mode 100644
index 000000000..df7416de1
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.c
@@ -0,0 +1,58 @@
+/*
+ * Atheros AR71xx GPIO button support
+ *
+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "linux/init.h"
+#include <linux/platform_device.h>
+
+#include "dev-gpio-buttons.h"
+
+void __init ar71xx_add_device_gpio_buttons(int id,
+ unsigned poll_interval,
+ unsigned nbuttons,
+ struct gpio_button *buttons)
+{
+ struct platform_device *pdev;
+ struct gpio_buttons_platform_data pdata;
+ struct gpio_button *p;
+ int err;
+
+ p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
+ if (!p)
+ return;
+
+ memcpy(p, buttons, nbuttons * sizeof(*p));
+
+ pdev = platform_device_alloc("gpio-buttons", id);
+ if (!pdev)
+ goto err_free_buttons;
+
+ memset(&pdata, 0, sizeof(pdata));
+ pdata.poll_interval = poll_interval;
+ pdata.nbuttons = nbuttons;
+ pdata.buttons = p;
+
+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+ if (err)
+ goto err_put_pdev;
+
+
+ err = platform_device_add(pdev);
+ if (err)
+ goto err_put_pdev;
+
+ return;
+
+err_put_pdev:
+ platform_device_put(pdev);
+
+err_free_buttons:
+ kfree(p);
+}
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
new file mode 100644
index 000000000..97e9fe599
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-gpio-buttons.h
@@ -0,0 +1,25 @@
+/*
+ * Atheros AR71xx GPIO button support
+ *
+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#ifndef _AR71XX_DEV_GPIO_BUTTONS_H
+#define _AR71XX_DEV_GPIO_BUTTONS_H
+
+#include <linux/input.h>
+#include <linux/gpio_buttons.h>
+
+#include <asm/mach-ar71xx/platform.h>
+
+void ar71xx_add_device_gpio_buttons(int id,
+ unsigned poll_interval,
+ unsigned nbuttons,
+ struct gpio_button *buttons) __init;
+
+#endif /* _AR71XX_DEV_GPIO_BUTTONS_H */
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c
index e2e08bbd7..5c29f8097 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c
@@ -665,49 +665,6 @@ void __init ar71xx_add_device_spi(struct ar71xx_spi_platform_data *pdata,
platform_device_register(&ar71xx_spi_device);
}
-void __init ar71xx_add_device_gpio_buttons(int id,
- unsigned poll_interval,
- unsigned nbuttons,
- struct gpio_button *buttons)
-{
- struct platform_device *pdev;
- struct gpio_buttons_platform_data pdata;
- struct gpio_button *p;
- int err;
-
- p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
- if (!p)
- return;
-
- memcpy(p, buttons, nbuttons * sizeof(*p));
-
- pdev = platform_device_alloc("gpio-buttons", id);
- if (!pdev)
- goto err_free_buttons;
-
- memset(&pdata, 0, sizeof(pdata));
- pdata.poll_interval = poll_interval;
- pdata.nbuttons = nbuttons;
- pdata.buttons = p;
-
- err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
- if (err)
- goto err_put_pdev;
-
-
- err = platform_device_add(pdev);
- if (err)
- goto err_put_pdev;
-
- return;
-
-err_put_pdev:
- platform_device_put(pdev);
-
-err_free_buttons:
- kfree(p);
-}
-
void __init ar71xx_add_device_wdt(void)
{
platform_device_register_simple("ar71xx-wdt", -1, NULL, 0);
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h
index 3e4eaeb90..c15f22985 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h
@@ -14,7 +14,6 @@
#include <asm/mach-ar71xx/platform.h>
-#include <linux/gpio_buttons.h>
#include <net/dsa.h>
void ar71xx_add_device_spi(struct ar71xx_spi_platform_data *pdata,
@@ -39,11 +38,6 @@ void ar71xx_add_device_eth(unsigned int id) __init;
void ar71xx_add_device_mdio(u32 phy_mask) __init;
-void ar71xx_add_device_gpio_buttons(int id,
- unsigned poll_interval,
- unsigned nbuttons,
- struct gpio_button *buttons) __init;
-
void ar71xx_add_device_usb(void) __init;
void ar71xx_add_device_uart(void) __init;
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 0b234cd45..5790dc807 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -20,6 +19,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define AP81_GPIO_LED_STATUS 1
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 a9bb2bfe1..93072a360 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c
@@ -11,7 +11,6 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
-#include <linux/input.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
@@ -24,6 +23,7 @@
#include "devices.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define AP83_GPIO_LED_WLAN 6
@@ -37,6 +37,8 @@
#define AP83_050_GPIO_VSC7385_MOSI 16
#define AP83_050_GPIO_VSC7385_SCK 17
+#define AP83_BUTTONS_POLL_INTERVAL 20
+
#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition ap83_flash_partitions[] = {
{
@@ -214,7 +216,8 @@ 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, 20, ARRAY_SIZE(ap83_gpio_buttons),
+ ar71xx_add_device_gpio_buttons(-1, AP83_BUTTONS_POLL_INTERVAL,
+ ARRAY_SIZE(ap83_gpio_buttons),
ap83_gpio_buttons);
ar71xx_add_device_usb();
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 9e17e3f40..813081e50 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
@@ -12,13 +12,13 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
+#include "dev-gpio-buttons.h"
#include "dev-pb42-pci.h"
#include "dev-leds-gpio.h"
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 d9bd2857b..9f18bde25 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
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -20,6 +19,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */
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 732107145..338110dea 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
@@ -13,7 +13,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <linux/delay.h>
#include <linux/rtl8366_smi.h>
@@ -23,6 +22,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ap94-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define DIR825B1_GPIO_LED_BLUE_USB 0
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 7e8f0b5e9..a3d71f624 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
@@ -13,13 +13,13 @@
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define MZK_W04NU_GPIO_LED_USB 0
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 24b05b3d8..bf72ccb9c 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
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -20,6 +19,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define MZK_W300NH_GPIO_LED_STATUS 1
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 6e85155cc..643d7c298 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c
@@ -11,7 +11,6 @@
#include <linux/init.h>
#include <linux/bitops.h>
-#include <linux/input.h>
#include <linux/platform_device.h>
#include <asm/mips_machine.h>
@@ -19,6 +18,7 @@
#include "devices.h"
#include "dev-m25p80.h"
+#include "dev-gpio-buttons.h"
#include "dev-pb42-pci.h"
#define PB42_BUTTONS_POLL_INTERVAL 20
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 c8a0c6d82..011c05f27 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c
@@ -10,7 +10,6 @@
#include <linux/init.h>
#include <linux/bitops.h>
-#include <linux/input.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
@@ -25,6 +24,7 @@
#include "devices.h"
#include "dev-pb42-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define PB44_PCF8757_VSC7395_CS 0
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
index 69e25ce12..164ddcc26 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
@@ -15,13 +15,13 @@
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/spi/mmc_spi.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/pci.h>
#include "devices.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define RB4XX_GPIO_USER_LED 4
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 fd8f67a29..190070d83 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
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -20,6 +19,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define TEW_632BRP_GPIO_LED_STATUS 1
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 1dc61c72d..f36d3600e 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
@@ -11,15 +11,14 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
-
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define TL_WR1043ND_GPIO_LED_USB 1
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 4273f2a25..2b7294600 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
@@ -11,15 +11,14 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
-
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ap91-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define TL_WR741ND_GPIO_LED_QSS 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 459cfa545..54ff549c4 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
@@ -11,13 +11,13 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
+#include "dev-gpio-buttons.h"
#include "dev-pb42-pci.h"
#include "dev-leds-gpio.h"
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 4bd4a9a2f..6bc0d71df 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
@@ -11,7 +11,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -19,6 +18,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define TL_WR941ND_GPIO_LED_SYSTEM 2
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 d83b28396..5ad59943d 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c
@@ -12,7 +12,6 @@
#include <linux/pci.h>
#include <linux/platform_device.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -20,6 +19,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ap91-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-pb42-pci.h"
#include "dev-leds-gpio.h"
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 e50235bc8..befeeda0d 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <linux/delay.h>
#include <linux/rtl8366_smi.h>
@@ -22,6 +21,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ap94-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define WNDR3700_GPIO_LED_WPS_ORANGE 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 73e898288..8b7532322 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c
@@ -13,15 +13,14 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
-
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define WNR2000_GPIO_LED_PWR_GREEN 14
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 15e427880..9fd02d48b 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -21,6 +20,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-pb42-pci.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define WP543_GPIO_SW6 2
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 571fe1da1..1d4b25fe2 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c
@@ -11,7 +11,6 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
@@ -19,6 +18,7 @@
#include "devices.h"
#include "dev-m25p80.h"
#include "dev-ar913x-wmac.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define WRT160NL_GPIO_LED_POWER 14
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 bd6fdb225..28e16421e 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c
@@ -12,13 +12,14 @@
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include "devices.h"
#include "dev-m25p80.h"
+#include "dev-gpio-buttons.h"
+#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#define WRT400N_GPIO_LED_ORANGE 5