[SRU][R:linux-raspi][PATCH 1/1] regulator: edatec-panel-regulator: Fix backlight power state restoration

Yufeng Gao yufeng.gao at canonical.com
Thu Jul 2 00:36:06 UTC 2026


From: FrankLeeEDA <Fli at edatec.cn>

BugLink: https://bugs.launchpad.net/bugs/2158944

The previous implementation only wrote to the REG_PWR register when
bl_power was explicitly 1 or 4. This caused a bug where transitioning
from a low-power state (1 or 4) back to the normal backlight state (0)
would not trigger a register update, leaving the panel in an incorrect
power state.

Signed-off-by: FrankLeeEDA <Fli at edatec.cn>
(cherry picked from commit 25a3352a71be303b7159b77e2ad38050569b741a rpi-7.0.y)
Signed-off-by: Yufeng Gao <yufeng.gao at canonical.com>
---
 drivers/regulator/edatec-panel-regulator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/edatec-panel-regulator.c b/drivers/regulator/edatec-panel-regulator.c
index 4227837466cb..fa39f15dd2ef 100644
--- a/drivers/regulator/edatec-panel-regulator.c
+++ b/drivers/regulator/edatec-panel-regulator.c
@@ -38,6 +38,7 @@ enum gpio_signals {
 
 struct ed_regulator {
 	struct regmap	*regmap;
+	int bl_power_last;
 };
 
 static bool ed_readable_reg(struct device *dev, unsigned int reg)
@@ -64,11 +65,13 @@ static int ed_update_status(struct backlight_device *bl)
 	int bl_power = props->power;
 	int ret;
 
-	if (bl_power == 1 || bl_power == 4)
+	if (bl_power != regulator->bl_power_last)
 		ret = regmap_write(regmap, REG_PWR, bl_power);
 	else
 		ret = regmap_write(regmap, REG_PWM, brightness);
 
+	regulator->bl_power_last = bl_power;
+
 	return ret;
 }
 
@@ -146,6 +149,7 @@ static int ed_i2c_probe(struct i2c_client *i2c)
 	props.max_brightness = 0xff;
 	props.brightness = 0xff;
 
+	regulator->bl_power_last = 0;
 	regulator->regmap = regmap;
 	bl = devm_backlight_device_register(&i2c->dev, dev_name(&i2c->dev),
 					    &i2c->dev, regulator, &ed_bl, &props);
-- 
2.43.0




More information about the kernel-team mailing list