From: Marc Dietrich <marvin24@gmx.de>
Date: Tue, 2 Jul 2019 20:08:33 +0000 (+0200)
Subject: video: backlight: fix pwm inversion
X-Git-Tag: v2025.01-rc5-pxa1908~2903^2
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/%7B%7B?a=commitdiff_plain;h=a2c4ef097774e70f0afc4ab25f53b769c6da3397;p=u-boot.git

video: backlight: fix pwm inversion

set_pwm() will always fail with -ENOSYS if pwm_ops set_invert() is
not implemented, leaving the backlight dark. Fix this by returning
no error if set_invert() is not implemented and no polarity change
is requested.

Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index a587977c22..ad20bf2441 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -67,6 +67,9 @@ static int set_pwm(struct pwm_backlight_priv *priv)
 		return log_ret(ret);
 
 	ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
+	if (ret == -ENOSYS && !priv->polarity)
+		ret = 0;
+
 	return log_ret(ret);
 }