aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/leds.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-01-14 12:14:41 +0100
committerRalf Baechle <ralf@linux-mips.org>2014-01-24 22:39:51 +0100
commit515fa75d4845c424c853a727a4f02b0e02340370 (patch)
treeaff49e83e72804e9bf1eb4cd2cc253263950cdf3 /arch/mips/bcm47xx/leds.c
parentMIPS: BCM47XX: do not use cpu_wait instruction on BCM4706 (diff)
downloadlinux-dev-515fa75d4845c424c853a727a4f02b0e02340370.tar.xz
linux-dev-515fa75d4845c424c853a727a4f02b0e02340370.zip
MIPS: BCM47XX: Prepare support for LEDs
So far this is mostly just a proof of concept, database consists of a single device. Creating a nice iterateable array wasn't an option because devices have different amount of LEDs. And we don't want to waste memory just because of support for a device with dozens on LEDs. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John Crispin <blogic@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/6299/
Diffstat (limited to 'arch/mips/bcm47xx/leds.c')
-rw-r--r--arch/mips/bcm47xx/leds.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c
new file mode 100644
index 000000000000..6a49d4c6c9c3
--- /dev/null
+++ b/arch/mips/bcm47xx/leds.c
@@ -0,0 +1,73 @@
+#include "bcm47xx_private.h"
+
+#include <linux/leds.h>
+#include <bcm47xx_board.h>
+
+static const struct gpio_led
+bcm47xx_leds_netgear_wndr4500_v1_leds[] __initconst = {
+ {
+ .name = "bcm47xx:green:wps",
+ .gpio = 1,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:green:power",
+ .gpio = 2,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:orange:power",
+ .gpio = 3,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:green:usb1",
+ .gpio = 8,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:green:2ghz",
+ .gpio = 9,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:blue:5ghz",
+ .gpio = 11,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+ {
+ .name = "bcm47xx:green:usb2",
+ .gpio = 14,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_KEEP,
+ },
+};
+
+static struct gpio_led_platform_data bcm47xx_leds_pdata;
+
+#define bcm47xx_set_pdata(dev_leds) do { \
+ bcm47xx_leds_pdata.leds = dev_leds; \
+ bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \
+} while (0)
+
+void __init bcm47xx_leds_register(void)
+{
+ enum bcm47xx_board board = bcm47xx_board_get();
+
+ switch (board) {
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500_v1_leds);
+ break;
+ default:
+ pr_debug("No LEDs configuration found for this device\n");
+ return;
+ }
+
+ gpio_led_register_device(-1, &bcm47xx_leds_pdata);
+}