From: Jonas Schwöbel <[email protected]>

In the case of active-low behavior the Duty Cycle needs to be set to 100%.
The PWM driver takes care of this but the LED_PWM driver does not take
this into account. Adjust LED_PWM to take into account polarity of PWM.

Signed-off-by: Jonas Schwöbel <[email protected]>
Signed-off-by: Svyatoslav Ryhel <[email protected]>
---
 drivers/led/led_pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c
index 15dd836509b..7edfa286468 100644
--- a/drivers/led/led_pwm.c
+++ b/drivers/led/led_pwm.c
@@ -34,7 +34,7 @@ static int led_pwm_enable(struct udevice *dev)
        if (ret)
                return ret;
 
-       ret = pwm_set_enable(priv->pwm, priv->channel, true);
+       ret = pwm_set_enable(priv->pwm, priv->channel, priv->active_low);
        if (ret)
                return ret;
 
@@ -52,7 +52,7 @@ static int led_pwm_disable(struct udevice *dev)
        if (ret)
                return ret;
 
-       ret = pwm_set_enable(priv->pwm, priv->channel, false);
+       ret = pwm_set_enable(priv->pwm, priv->channel, priv->active_low);
        if (ret)
                return ret;
 
-- 
2.51.0

Reply via email to