lkml.org 
[lkml]   [2014]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] leds: pwm: set polarity on non DT platforms
Date
Set inversed polarity when .active_low is set in the platform_data. With device
tree, this is taken care of by of_pwm_xlate_with_flags(), called from
of_pwm_get().

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/leds/leds-pwm.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 605047428b5a..09681556a6aa 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -180,6 +180,11 @@ static int led_pwm_probe(struct platform_device *pdev)
led_dat->cdev.max_brightness = cur_led->max_brightness;
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;

+ if (led_dat->active_low)
+ if (pwm_set_polarity(led_dat->pwm,
+ PWM_POLARITY_INVERSED))
+ dev_err(&pdev->dev, "impossible to change polarity");
+
led_dat->can_sleep = pwm_can_sleep(led_dat->pwm);
if (led_dat->can_sleep)
INIT_WORK(&led_dat->work, led_pwm_work);
--
1.8.3.2


\
 
 \ /
  Last update: 2014-03-17 20:21    [W:1.537 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site