brcm47xx: add new led and button support
[openwrt.git] / target / linux / brcm47xx / patches-3.10 / 126-MIPS-BCM47XX-Use-timer-trigger-for-status-LEDs.patch
1 From 5c985c2a17ae0bdbc95fd8246631e00a35746396 Mon Sep 17 00:00:00 2001
2 From: Rafa? Mi?ecki <zajec5@gmail.com>
3 Date: Fri, 3 Jan 2014 09:04:39 +0100
4 Subject: [PATCH] MIPS: BCM47XX: Use "timer" trigger for status LEDs
5
6 Some devices have power LED as well as status LED. The second one is
7 used to show the firmware is up and running. Set "timer" trigger for
8 such LEDs.
9
10 Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
11 ---
12  arch/mips/bcm47xx/leds.c |   14 ++++++++++++--
13  1 file changed, 12 insertions(+), 2 deletions(-)
14
15 --- a/arch/mips/bcm47xx/leds.c
16 +++ b/arch/mips/bcm47xx/leds.c
17 @@ -16,6 +16,16 @@
18                 .default_state  = _default_state,                       \
19         }
20  
21 +#define BCM47XX_GPIO_LED_TRIGGER(_gpio, _color, _function, _active_low,        \
22 +                                _default_trigger)                      \
23 +       {                                                               \
24 +               .name           = "bcm47xx:" _color ":" _function,      \
25 +               .gpio           = _gpio,                                \
26 +               .active_low     = _active_low,                          \
27 +               .default_state  = LEDS_GPIO_DEFSTATE_OFF,               \
28 +               .default_trigger        = _default_trigger,             \
29 +       }
30 +
31  /* Asus */
32  
33  static const struct gpio_led
34 @@ -176,13 +186,13 @@ bcm47xx_leds_dell_tm2300[] __initconst =
35  
36  static const struct gpio_led
37  bcm47xx_leds_dlink_dir130[] __initconst = {
38 -       BCM47XX_GPIO_LED(0, "green", "status", 1, LEDS_GPIO_DEFSTATE_OFF), /* Originally blinking when device is ready, separated from "power" LED */
39 +       BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
40         BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
41  };
42  
43  static const struct gpio_led
44  bcm47xx_leds_dlink_dir330[] __initconst = {
45 -       BCM47XX_GPIO_LED(0, "green", "status", 1, LEDS_GPIO_DEFSTATE_OFF), /* Originally blinking when device is ready, separated from "power" LED */
46 +       BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
47         BCM47XX_GPIO_LED(4, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
48         BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
49  };