From e48f692559d498c192bcf54d177c5f2a63492498 Mon Sep 17 00:00:00 2001 From: FrankLeeEDA Date: Thu, 25 Jun 2026 13:36:38 +0000 Subject: [PATCH] regulator: edatec-panel-regulator: Fix backlight power state restoration 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 --- 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 4227837466cbf2..fa39f15dd2ef8b 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);