From 76c2ff3e5fd8068b433acbb0e76d33fa5116dade Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 11 Oct 2020 14:28:04 +0200 Subject: 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 Reviewed-by: Simon Glass --- drivers/video/pwm_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c index acfde7ba3d8..9519180ceb3 100644 --- a/drivers/video/pwm_backlight.c +++ b/drivers/video/pwm_backlight.c @@ -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) -- cgit v1.2.3