aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Gong <b38343@freescale.com>2014-01-20 06:41:26 -0500
committerBryan Wu <cooloney@gmail.com>2014-02-27 12:56:56 -0500
commit4270a78d23eece0b25a13bff1e71d114ec547de4 (patch)
tree95df7c93fbfc6d3e9e2dafc52767c490dc45df93
parent25c6579f872d0542809067d56fad22984b8ff565 (diff)
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>
-rw-r--r--Documentation/devicetree/bindings/leds/leds-gpio.txt12
-rw-r--r--drivers/leds/leds-gpio.c3
2 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/leds/leds-gpio.txt b/Documentation/devicetree/bindings/leds/leds-gpio.txt
index df1b3080f6b8..f77148f372ea 100644
--- a/Documentation/devicetree/bindings/leds/leds-gpio.txt
+++ b/Documentation/devicetree/bindings/leds/leds-gpio.txt
@@ -21,6 +21,8 @@ LED sub-node properties:
21 on). The "keep" setting will keep the LED at whatever its current 21 on). The "keep" setting will keep the LED at whatever its current
22 state is, without producing a glitch. The default is off if this 22 state is, without producing a glitch. The default is off if this
23 property is not present. 23 property is not present.
24- retain-state-suspended: (optional) The suspend state can be retained.Such
25 as charge-led gpio.
24 26
25Examples: 27Examples:
26 28
@@ -50,3 +52,13 @@ run-control {
50 default-state = "on"; 52 default-state = "on";
51 }; 53 };
52}; 54};
55
56leds {
57 compatible = "gpio-leds";
58
59 charger-led {
60 gpios = <&gpio1 2 0>;
61 linux,default-trigger = "max8903-charger-charging";
62 retain-state-suspended;
63 };
64};
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 78b0e273a903..1bb3f1ab1d91 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -204,6 +204,9 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
204 led.default_state = LEDS_GPIO_DEFSTATE_OFF; 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 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++], 210 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
208 &pdev->dev, NULL); 211 &pdev->dev, NULL);
209 if (ret < 0) { 212 if (ret < 0) {