Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-pwm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ LED sub-node properties:
see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger : (optional)
see Documentation/devicetree/bindings/leds/common.txt
- active-low : (optional)
Inverts the duty cycle to reflect a low-active output pin

Example:

Expand All @@ -38,6 +40,7 @@ pwmleds {
label = "omap4::keypad";
pwms = <&twl_pwm 0 7812500>;
max-brightness = <127>;
active-low;
};

charging {
Expand Down
5 changes: 5 additions & 0 deletions drivers/leds/leds-pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ static void led_pwm_set(struct led_classdev *led_cdev,

duty *= brightness;
do_div(duty, max);

if (led_dat->active_low)
duty = led_dat->period - duty;

led_dat->duty = duty;

if (led_dat->can_sleep)
Expand Down Expand Up @@ -117,6 +121,7 @@ static int led_pwm_create_of(struct platform_device *pdev,

led_dat->cdev.default_trigger = of_get_property(child,
"linux,default-trigger", NULL);
led_dat->active_low = of_property_read_bool(child, "active-low");
of_property_read_u32(child, "max-brightness",
&led_dat->cdev.max_brightness);

Expand Down