diff options
author | Dario Binacchi <dariobin@libero.it> | 2020-10-11 14:28:04 +0200 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2020-10-18 15:07:33 +0200 |
commit | 76c2ff3e5fd8068b433acbb0e76d33fa5116dade (patch) | |
tree | 3baaf2748b10f35d80c1ee06477e63f1fba5d778 /test | |
parent | f9b94055bdde93a302075ff86a1046b98e2c8e05 (diff) | |
download | u-boot-76c2ff3e5fd8068b433acbb0e76d33fa5116dade.tar.gz |
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 'test')
-rw-r--r-- | test/dm/panel.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/dm/panel.c b/test/dm/panel.c index a840fb4951..49f5ac7169 100644 --- a/test/dm/panel.c +++ b/test/dm/panel.c @@ -40,7 +40,7 @@ static int dm_test_panel(struct unit_test_state *uts) ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); ut_asserteq(1000, period_ns); - ut_asserteq(170 * 1000 / 256, duty_ns); + ut_asserteq(170 * 1000 / 255, duty_ns); ut_asserteq(true, enable); ut_asserteq(false, polarity); ut_asserteq(1, sandbox_gpio_get_value(gpio, 1)); @@ -49,29 +49,29 @@ static int dm_test_panel(struct unit_test_state *uts) ut_assertok(panel_set_backlight(dev, 40)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); - ut_asserteq(64 * 1000 / 256, duty_ns); + ut_asserteq(64 * 1000 / 255, duty_ns); ut_assertok(panel_set_backlight(dev, BACKLIGHT_MAX)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); - ut_asserteq(255 * 1000 / 256, duty_ns); + ut_asserteq(255 * 1000 / 255, duty_ns); ut_assertok(panel_set_backlight(dev, BACKLIGHT_MIN)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); - ut_asserteq(0 * 1000 / 256, duty_ns); + ut_asserteq(0 * 1000 / 255, duty_ns); ut_asserteq(1, sandbox_gpio_get_value(gpio, 1)); ut_assertok(panel_set_backlight(dev, BACKLIGHT_DEFAULT)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); ut_asserteq(true, enable); - ut_asserteq(170 * 1000 / 256, duty_ns); + ut_asserteq(170 * 1000 / 255, duty_ns); ut_assertok(panel_set_backlight(dev, BACKLIGHT_OFF)); ut_assertok(sandbox_pwm_get_config(pwm, 0, &period_ns, &duty_ns, &enable, &polarity)); - ut_asserteq(0 * 1000 / 256, duty_ns); + ut_asserteq(0 * 1000 / 255, duty_ns); ut_asserteq(0, sandbox_gpio_get_value(gpio, 1)); ut_asserteq(false, regulator_get_enable(reg)); |