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 7297107cf83285d5fe7b6d8254eafc7c64cc2c85..6c6583c35f2ff6bfe41ca3e9747dc720d6d72d84 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 8bd225df14dea3f88f505abaaa7d03d1ef0c9629..f5cf1b0f274873d9142a008dff9e024b6da3251d 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);