[PATCH v1 1/1] led: led_pwm: fix active-low behavior

Svyatoslav Ryhel clamor95 at gmail.com
Mon Feb 9 19:07:18 CET 2026


From: Jonas Schwöbel <jonasschwoebel at yahoo.de>

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 <jonasschwoebel at yahoo.de>
Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
---
 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



More information about the U-Boot mailing list