video: backlight: fix pwm's duty cycle calculation

For levels equal to the maximum value, the duty cycle must be equal to
the period.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Dario Binacchi
2020-10-11 14:28:04 +02:00
committed by Anatolij Gustschin
parent f9b94055bd
commit 76c2ff3e5f
2 changed files with 7 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ static int set_pwm(struct pwm_backlight_priv *priv)
int ret;
duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
(priv->max_level - priv->min_level + 1);
(priv->max_level - priv->min_level);
ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns,
duty_cycle);
if (ret)