Browse Source

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>
Robin Gong 11 years ago
parent
commit
4270a78d23
2 changed files with 15 additions and 0 deletions
  1. 12 0
      Documentation/devicetree/bindings/leds/leds-gpio.txt
  2. 3 0
      drivers/leds/leds-gpio.c

+ 12 - 0
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
   on).  The "keep" setting will keep the LED at whatever its current
   state is, without producing a glitch.  The default is off if this
   state is, without producing a glitch.  The default is off if this
   property is not present.
   property is not present.
+- retain-state-suspended: (optional) The suspend state can be retained.Such
+  as charge-led gpio.
 
 
 Examples:
 Examples:
 
 
@@ -50,3 +52,13 @@ run-control {
 		default-state = "on";
 		default-state = "on";
 	};
 	};
 };
 };
+
+leds {
+	compatible = "gpio-leds";
+
+	charger-led {
+		gpios = <&gpio1 2 0>;
+		linux,default-trigger = "max8903-charger-charging";
+		retain-state-suspended;
+	};
+};

+ 3 - 0
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;
 				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++],
 		ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
 				      &pdev->dev, NULL);
 				      &pdev->dev, NULL);
 		if (ret < 0) {
 		if (ret < 0) {