forked from pool/u-boot
Guillaume GARDET
0b6100c9f6
OBS-URL: https://build.opensuse.org/request/show/926979 OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=154
75 lines
2.9 KiB
Diff
75 lines
2.9 KiB
Diff
From 30b758689c60de57a3e55276a78a37974f43047a Mon Sep 17 00:00:00 2001
|
|
From: Guillaume Gardet <guillaume.gardet@arm.com>
|
|
Date: Thu, 21 Oct 2021 15:20:10 +0200
|
|
Subject: [PATCH] Revert "video: backlight: fix pwm's duty cycle calculation"
|
|
|
|
This reverts commit 76c2ff3e5fd8068b433acbb0e76d33fa5116dade.
|
|
|
|
This fixes backlight on Chromebook snow - boo#1187573
|
|
---
|
|
drivers/video/pwm_backlight.c | 2 +-
|
|
test/dm/panel.c | 12 ++++++------
|
|
2 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
|
|
index d7c096923b..2f3a68ba87 100644
|
|
--- a/drivers/video/pwm_backlight.c
|
|
+++ b/drivers/video/pwm_backlight.c
|
|
@@ -64,7 +64,7 @@ static int set_pwm(struct pwm_backlight_priv *priv)
|
|
|
|
if (priv->period_ns) {
|
|
duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
|
|
- (priv->max_level - priv->min_level);
|
|
+ (priv->max_level - priv->min_level + 1);
|
|
ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns,
|
|
duty_cycle);
|
|
} else {
|
|
diff --git a/test/dm/panel.c b/test/dm/panel.c
|
|
index 4d435a0d25..9229c7f4ea 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 / 255, duty_ns);
|
|
+ ut_asserteq(170 * 1000 / 256, 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 / 255, duty_ns);
|
|
+ ut_asserteq(64 * 1000 / 256, 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 / 255, duty_ns);
|
|
+ ut_asserteq(255 * 1000 / 256, 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 / 255, duty_ns);
|
|
+ ut_asserteq(0 * 1000 / 256, 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 / 255, duty_ns);
|
|
+ ut_asserteq(170 * 1000 / 256, 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 / 255, duty_ns);
|
|
+ ut_asserteq(0 * 1000 / 256, duty_ns);
|
|
ut_asserteq(0, sandbox_gpio_get_value(gpio, 1));
|
|
ut_asserteq(false, regulator_get_enable(reg));
|
|
|