2014-01-20 11:36:11

by Robin Gong

[permalink] [raw]
Subject: [PATCH v1 1/2] 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.

Signed-off-by: Robin Gong <[email protected]>
---
drivers/leds/leds-gpio.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 78b0e27..1bb3f1a 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)
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) {
--
1.7.5.4


2014-01-20 11:36:24

by Robin Gong

[permalink] [raw]
Subject: [PATCH v1 2/2] update binding doc of leds-gpio.txt

Update the binding doc for new property: "retain-state-suspended"

Signed-off-by: Robin Gong <[email protected]>
---
.../devicetree/bindings/leds/leds-gpio.txt | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/leds-gpio.txt b/Documentation/devicetree/bindings/leds/leds-gpio.txt
index df1b308..f77148f 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:
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;
+ };
+};
--
1.7.5.4

2014-02-06 19:24:53

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] leds: leds-gpio: add retain-state-suspended property

On Mon, Jan 20, 2014 at 3:41 AM, Robin Gong <[email protected]> wrote:
> Some gpio-leds need retain the state even in suspend, such as charger led.
> But this property missed in devicetree, add it.
>

Good catch, I just fold these 2 patches into one patch and applied.
Thanks,
-Bryan


> Signed-off-by: Robin Gong <[email protected]>
> ---
> drivers/leds/leds-gpio.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 78b0e27..1bb3f1a 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)
> 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) {
> --
> 1.7.5.4
>
>