]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
platform/loongarch: laptop: Get brightness setting from EC on probe
authorYao Zi <ziyao@disroot.org>
Thu, 5 Jun 2025 12:34:46 +0000 (20:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:36 +0000 (11:07 +0100)
commitf9d339839ffda763f3b0851abf74b1f9d4b00b07
tree24e977adc0cb7d325d61e36c8e3081b6ded141af
parentecf5ee280b702270afb02f61b299d3dfe3ec7730
platform/loongarch: laptop: Get brightness setting from EC on probe

commit 1205088fd0393bd9eae96b62bf1e4b9eb1b73edf upstream.

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: 6246ed09111f ("LoongArch: Add ACPI-based generic laptop driver")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/loongarch/loongson-laptop.c