leds: leds-pwm: add DT support for LEDs wired to supply
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 6 Apr 2014 22:20:24 +0000 (15:20 -0700)
committerBryan Wu <cooloney@gmail.com>
Thu, 8 May 2014 06:28:07 +0000 (14:28 +0800)
The non-DT driver allowed an active low property to be specified, but DT
is missing this in its description.  Add the property to the DT binding
document, making it optional.  It defaults to active high, which retains
compatibility with existing descriptions.

This should only be used for causes where the LED is wired to supply,
and the PWM does not sensibly support its own inversion.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Documentation/devicetree/bindings/leds/leds-pwm.txt
drivers/leds/leds-pwm.c

index 7297107..6c6583c 100644 (file)
@@ -13,6 +13,8 @@ LED sub-node properties:
   For the pwms and pwm-names property please refer to:
   Documentation/devicetree/bindings/pwm/pwm.txt
 - max-brightness : Maximum brightness possible for the LED
+- active-low : (optional) For PWMs where the LED is wired to supply
+  rather than ground.
 - label :  (optional)
   see Documentation/devicetree/bindings/leds/common.txt
 - linux,default-trigger :  (optional)
index 8bd225d..f5cf1b0 100644 (file)
@@ -154,6 +154,7 @@ static int led_pwm_create_of(struct device *dev, struct led_pwm_priv *priv)
 
                led.default_trigger = of_get_property(child,
                                                "linux,default-trigger", NULL);
+               led.active_low = of_property_read_bool(child, "active-low");
                of_property_read_u32(child, "max-brightness",
                                     &led.max_brightness);