提交 d19a8a70 编写于 作者: R Russell King 提交者: Bryan Wu

leds: leds-pwm: implement PWM inversion

Some PWM outputs are wired such that the LED they're controlling is
connected to supply rather than ground.  These PWMs may not support
output inversion, or when they do, disabling the PWM may set the
PWM output low, causing a "brightness" value of zero to turn the LED
fully on.

The platform data for this driver already indicates that this was
thought about, and we have the "active_low" property there already.
However, the implementation for this is missing.

Add the trivial implementation for this feature.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Acked-by: NThierry Reding <thierry.reding@gmail.com>
Signed-off-by: NBryan Wu <cooloney@gmail.com>
上级 b795e6d9
......@@ -69,6 +69,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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部