Commit 4270a78d23eece0b25a13bff1e71d114ec547de4

Authored by Robin Gong
Committed by Bryan Wu
1 parent 25c6579f87

leds: leds-gpio: add retain-state-suspended property

Some gpio-leds need retain the state even in suspend, such as charger led.
But this property missed in devicetree, add it.

(cooloney@gmail.com: fold DT binding updates into this patch)

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff

Documentation/devicetree/bindings/leds/leds-gpio.txt
... ... @@ -21,6 +21,8 @@
21 21 on). The "keep" setting will keep the LED at whatever its current
22 22 state is, without producing a glitch. The default is off if this
23 23 property is not present.
  24 +- retain-state-suspended: (optional) The suspend state can be retained.Such
  25 + as charge-led gpio.
24 26  
25 27 Examples:
26 28  
... ... @@ -48,6 +50,16 @@
48 50 green {
49 51 gpios = <&mpc8572 7 0>;
50 52 default-state = "on";
  53 + };
  54 +};
  55 +
  56 +leds {
  57 + compatible = "gpio-leds";
  58 +
  59 + charger-led {
  60 + gpios = <&gpio1 2 0>;
  61 + linux,default-trigger = "max8903-charger-charging";
  62 + retain-state-suspended;
51 63 };
52 64 };
drivers/leds/leds-gpio.c
... ... @@ -204,6 +204,9 @@
204 204 led.default_state = LEDS_GPIO_DEFSTATE_OFF;
205 205 }
206 206  
  207 + if (of_get_property(child, "retain-state-suspended", NULL))
  208 + led.retain_state_suspended = 1;
  209 +
207 210 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
208 211 &pdev->dev, NULL);
209 212 if (ret < 0) {