Skip to content

Commit 1205088

Browse files
ziyao233chenhuacai
authored andcommitted
platform/loongarch: laptop: Get brightness setting from EC on probe
Previously during driver probe, 1 is unconditionally taken as current brightness value and set to props.brightness, which will be considered as the brightness before suspend and restored to EC on resume. Since a brightness value of 1 almost never matches EC's state on coldboot (my laptop's EC defaults to 80), this causes surprising changes of screen brightness on the first time of resume after coldboot. 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 Loongson-3A5000 laptop. Cc: stable@vger.kernel.org Fixes: 6246ed0 ("LoongArch: Add ACPI-based generic laptop driver") Signed-off-by: Yao Zi <ziyao@disroot.org> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 1cf8060 commit 1205088

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/loongarch/loongson-laptop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ static int laptop_backlight_register(void)
392392
if (!acpi_evalf(hotkey_handle, &status, "ECLL", "d"))
393393
return -EIO;
394394

395-
props.brightness = 1;
396395
props.max_brightness = status;
396+
props.brightness = ec_get_brightness();
397397
props.type = BACKLIGHT_PLATFORM;
398398

399399
backlight_device_register("loongson_laptop",

0 commit comments

Comments
 (0)