Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: asus-wmi: adjust screenpad power/brightness handling

Fix illogical screen off control by hardcoding 0 and 1 depending on the
requested brightness and also do not rely on the last screenpad power
state to issue screen brightness commands.

Fixes: 2c97d3e55b70 ("platform/x86: asus-wmi: add support for ASUS screenpad")
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Signed-off-by: Luke Jones <luke@ljones.dev>
Link: https://patch.msgid.link/20260302174431.349816-2-denis.benato@linux.dev
Link: https://patch.msgid.link/20260326231154.856729-2-ethantidmore06@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Denis Benato and committed by
Ilpo Järvinen
130d29c5 186bf903

+13 -21
+13 -21
drivers/platform/x86/asus-wmi.c
··· 4422 4422 4423 4423 static int update_screenpad_bl_status(struct backlight_device *bd) 4424 4424 { 4425 - struct asus_wmi *asus = bl_get_data(bd); 4426 - int power, err = 0; 4427 - u32 ctrl_param; 4425 + u32 ctrl_param = bd->props.brightness; 4426 + int err = 0; 4428 4427 4429 - power = read_screenpad_backlight_power(asus); 4430 - if (power < 0) 4431 - return power; 4428 + if (bd->props.power) { 4429 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL); 4430 + if (err < 0) 4431 + return err; 4432 4432 4433 - if (bd->props.power != power) { 4434 - if (power != BACKLIGHT_POWER_ON) { 4435 - /* Only brightness > 0 can power it back on */ 4436 - ctrl_param = asus->driver->screenpad_brightness - ASUS_SCREENPAD_BRIGHT_MIN; 4437 - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, 4438 - ctrl_param, NULL); 4439 - } else { 4440 - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL); 4441 - } 4442 - } else if (power == BACKLIGHT_POWER_ON) { 4443 - /* Only set brightness if powered on or we get invalid/unsync state */ 4444 - ctrl_param = bd->props.brightness + ASUS_SCREENPAD_BRIGHT_MIN; 4445 4433 err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL); 4434 + if (err < 0) 4435 + return err; 4446 4436 } 4447 4437 4448 - /* Ensure brightness is stored to turn back on with */ 4449 - if (err == 0) 4450 - asus->driver->screenpad_brightness = bd->props.brightness + ASUS_SCREENPAD_BRIGHT_MIN; 4438 + if (!bd->props.power) { 4439 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL); 4440 + if (err < 0) 4441 + return err; 4442 + } 4451 4443 4452 4444 return err; 4453 4445 }