public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] video: backlight: fix pwm invertation
@ 2019-07-02 20:08 marvin24 at posteo.de
  2019-07-02 21:04 ` Anatolij Gustschin
  2019-07-07 13:50 ` Anatolij Gustschin
  0 siblings, 2 replies; 3+ messages in thread
From: marvin24 at posteo.de @ 2019-07-02 20:08 UTC (permalink / raw)
  To: u-boot

Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")

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

v2: simplify logic

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
 drivers/video/pwm_backlight.c | 3 +++
 1 file changed, 3 insertions(+)

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);
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-07 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02 20:08 [U-Boot] [PATCH v2] video: backlight: fix pwm invertation marvin24 at posteo.de
2019-07-02 21:04 ` Anatolij Gustschin
2019-07-07 13:50 ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox