leds: leds-gpio: add retain-state-suspended property
authorRobin Gong <b38343@freescale.com>
Mon, 20 Jan 2014 11:41:26 +0000 (03:41 -0800)
committerBryan Wu <cooloney@gmail.com>
Thu, 27 Feb 2014 17:56:56 +0000 (09:56 -0800)
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>
Documentation/devicetree/bindings/leds/leds-gpio.txt
drivers/leds/leds-gpio.c

index df1b3080f6b88f22f5844d02c7c2f717dac50175..f77148f372ea2b5f986a96e25078c515889b48a3 100644 (file)
@@ -21,6 +21,8 @@ LED sub-node properties:
   on).  The "keep" setting will keep the LED at whatever its current
   state is, without producing a glitch.  The default is off if this
   property is not present.
+- retain-state-suspended: (optional) The suspend state can be retained.Such
+  as charge-led gpio.
 
 Examples:
 
@@ -50,3 +52,13 @@ run-control {
                default-state = "on";
        };
 };
+
+leds {
+       compatible = "gpio-leds";
+
+       charger-led {
+               gpios = <&gpio1 2 0>;
+               linux,default-trigger = "max8903-charger-charging";
+               retain-state-suspended;
+       };
+};
index 78b0e273a903eec5e64e8607e89418b82a8ff0da..1bb3f1ab1d9143c185b74d8baaf9fa4eb9bd501a 100644 (file)
@@ -204,6 +204,9 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
                                led.default_state = LEDS_GPIO_DEFSTATE_OFF;
                }
 
+               if (of_get_property(child, "retain-state-suspended", NULL))
+                       led.retain_state_suspended = 1;
+
                ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
                                      &pdev->dev, NULL);
                if (ret < 0) {