aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-11-16 17:31:25 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-11-16 17:31:25 +0000
commita12a03de8dae6c76d9d3ff764482801fda1df488 (patch)
tree4b46370b8deb9acf01564af0407c6a6d0c54e8fb
parent2f5d0b63d4c3ba0cab1228d2dcf407dfbe06a9e5 (diff)
downloadupstream-a12a03de8dae6c76d9d3ff764482801fda1df488.tar.gz
upstream-a12a03de8dae6c76d9d3ff764482801fda1df488.tar.bz2
upstream-a12a03de8dae6c76d9d3ff764482801fda1df488.zip
ar71xx: register LEDs and buttons on the WNDR3700
Thanks to aorlinks (https://forum.openwrt.org/viewtopic.php?pid=97415#p97415) SVN-Revision: 18435
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c61
2 files changed, 63 insertions, 1 deletions
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 053d6d4396..82de0a9920 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -66,6 +66,9 @@ get_status_led() {
tl-wr941nd)
status_led="tl-wr941nd:green:system"
;;
+ wndr3700)
+ status_led="wndr3700:green:power"
+ ;;
wnr2000)
status_led="wnr2000:green:power"
;;
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 aee68cb9f8..1599dce05f 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
@@ -14,6 +14,7 @@
#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>
@@ -21,6 +22,17 @@
#include "devices.h"
+#define WNDR3700_GPIO_LED_WPS_ORANGE 0
+#define WNDR3700_GPIO_LED_POWER_ORANGE 1
+#define WNDR3700_GPIO_LED_POWER_GREEN 2
+#define WNDR3700_GPIO_LED_WPS_GREEN 4
+
+#define WNDR3700_GPIO_BTN_WPS 3
+#define WNDR3700_GPIO_BTN_RESET 8
+#define WNDR3700_GPIO_BTN_WIFI 11
+
+#define WNDR3700_BUTTONS_POLL_INTERVAL 20
+
#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition wndr3700_partitions[] = {
{
@@ -100,6 +112,48 @@ static struct spi_board_info wndr3700_spi_info[] = {
}
};
+static struct gpio_led wndr3700_leds_gpio[] __initdata = {
+ {
+ .name = "wndr3700:green:power",
+ .gpio = WNDR3700_GPIO_LED_POWER_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wndr3700:orange:power",
+ .gpio = WNDR3700_GPIO_LED_POWER_ORANGE,
+ .active_low = 1,
+ }, {
+ .name = "wndr3700:green:wps",
+ .gpio = WNDR3700_GPIO_LED_WPS_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "wndr3700:orange:wps",
+ .gpio = WNDR3700_GPIO_LED_WPS_ORANGE,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_button wndr3700_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .threshold = 5,
+ .gpio = WNDR3700_GPIO_BTN_RESET,
+ }, {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = BTN_1,
+ .threshold = 5,
+ .gpio = WNDR3700_GPIO_BTN_WPS,
+ } , {
+ .desc = "wifi",
+ .type = EV_KEY,
+ .code = BTN_2,
+ .threshold = 5,
+ .gpio = WNDR3700_GPIO_BTN_WIFI,
+ }
+};
+
static void __init wndr3700_setup(void)
{
u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
@@ -125,7 +179,12 @@ static void __init wndr3700_setup(void)
ar71xx_add_device_spi(NULL, wndr3700_spi_info,
ARRAY_SIZE(wndr3700_spi_info));
- /* TODO: LEDs, buttons support */
+ 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);
}
MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup);