On Sat, May 31, 2025 at 7:39 PM Yao Zi ziyao@disroot.org wrote:
Previously 1 is unconditionally taken as current brightness value. This causes problems since it's required to restore brightness settings on resumption, and a value that doesn't match EC's state before suspension will cause surprising changes of screen brightness.
laptop_backlight_register() isn't called at resuming, so I think your problem has nothing to do with suspend (S3).
But there is really a problem about hibernation (S4): the brightness is 1 during booting, but when switching to the target kernel, the brightness may jump to the old value.
If the above case is what you meet, please update the commit message.
Huacai
Let's get brightness from EC and take it as the current brightness on probe of the laptop driver to avoid the surprising behavior. Tested on TongFang L860-T2 3A5000 laptop.
Cc: stable@vger.kernel.org Fixes: 6246ed09111f ("LoongArch: Add ACPI-based generic laptop driver") Signed-off-by: Yao Zi ziyao@disroot.org
drivers/platform/loongarch/loongson-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platform/loongarch/loongson-laptop.c index 99203584949d..828bd62e3596 100644 --- a/drivers/platform/loongarch/loongson-laptop.c +++ b/drivers/platform/loongarch/loongson-laptop.c @@ -392,7 +392,7 @@ static int laptop_backlight_register(void) if (!acpi_evalf(hotkey_handle, &status, "ECLL", "d")) return -EIO;
props.brightness = 1;
props.brightness = ec_get_brightness(); props.max_brightness = status; props.type = BACKLIGHT_PLATFORM;
-- 2.49.0