aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDario Binacchi <dariobin@libero.it>2020-10-11 14:28:04 +0200
committerAnatolij Gustschin <agust@denx.de>2020-10-18 15:07:33 +0200
commit76c2ff3e5fd8068b433acbb0e76d33fa5116dade (patch)
tree3baaf2748b10f35d80c1ee06477e63f1fba5d778 /drivers
parentf9b94055bdde93a302075ff86a1046b98e2c8e05 (diff)
downloadu-boot-76c2ff3e5fd8068b433acbb0e76d33fa5116dade.zip
u-boot-76c2ff3e5fd8068b433acbb0e76d33fa5116dade.tar.gz
u-boot-76c2ff3e5fd8068b433acbb0e76d33fa5116dade.tar.bz2
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/pwm_backlight.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index acfde7b..9519180 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)