video: backlight: fix pwm inversion
authorMarc Dietrich <marvin24@gmx.de>
Tue, 2 Jul 2019 20:08:33 +0000 (22:08 +0200)
committerAnatolij Gustschin <agust@denx.de>
Sat, 6 Jul 2019 21:31:52 +0000 (23:31 +0200)
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>
drivers/video/pwm_backlight.c

index a587977c225045599aafe6b5c0b782ae3495041d..ad20bf2441f38a1e0980a7664ced5b1a31a18c80 100644 (file)
@@ -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);
 }