summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorDenis Benato <denis.benato@linux.dev>2026-09-16 14:38:27 +0000
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2026-10-13 11:45:08 +0300
commitad10eecfe8166606fe2b5ea7a20c2e4433f252bf (patch)
treea065274bde31cd3c2eed4636692a40074807ab78 /drivers/platform
parentf9a1cd14b392a82fdc73474894bf8b198757dfb2 (diff)
downloadlinux-ad10eecfe8166606fe2b5ea7a20c2e4433f252bf.tar.gz
linux-ad10eecfe8166606fe2b5ea7a20c2e4433f252bf.zip
platform/x86: asus-wmi: use backlight_is_blank() for screenpad power
The screenpad backlight sets BL_CORE_SUSPENDRESUME, so the backlight core calls update_status() on suspend, resume and fb blanking with BL_CORE_SUSPENDED or BL_CORE_FBBLANK set in bd->props.state while bd->props.power keeps its value: the switch on bd->props.power alone ignored those flags, repowering the panel at suspend entry instead of turning it off, and ignoring fb blank requests. Replace the switch with backlight_is_blank(), which accounts for both bd->props.power and bd->props.state: the panel is powered off whenever the backlight is blank and powered on with backlight_get_brightness() otherwise. Writing a power state other than BACKLIGHT_POWER_ON or BACKLIGHT_POWER_OFF to bl_power now blanks the panel following the core convention instead of warning and failing with -EINVAL. The visible change is that the panel now actually powers off on suspend and fb blank, and is restored on unblank and resume. Suggested-by: Hugo Baigue <hugobaigue2004@gmail.com> Closes: https://lore.kernel.org/all/CAO84+xJ9aW3pj3x8e9b5biWtnNd4EyH7A4Uy7aqBR4qZMDcVvg@mail.gmail.com/ Assisted-by: zcode:glm-5.3-flash Signed-off-by: Denis Benato <denis.benato@linux.dev> Link: https://patch.msgid.link/20260916143838.170950-4-denis.benato@linux.dev Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus-wmi.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index a6bfecf6b9f9..491715c16139 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4560,32 +4560,18 @@ static int read_screenpad_brightness(struct backlight_device *bd)
static int update_screenpad_bl_status(struct backlight_device *bd)
{
- u32 ctrl_param = bd->props.brightness;
- int err = 0;
-
- switch (bd->props.power) {
- case BACKLIGHT_POWER_ON:
- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL);
- if (err < 0)
- return err;
-
- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL);
- if (err < 0)
- return err;
- break;
+ int err;
- case BACKLIGHT_POWER_OFF:
- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
- if (err < 0)
- return err;
- break;
+ if (backlight_is_blank(bd))
+ return asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER,
+ 0, NULL);
- default:
- pr_warn("Invalid screenpad backlight power state: %d\n", bd->props.power);
- return -EINVAL;
- }
+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL);
+ if (err < 0)
+ return err;
- return err;
+ return asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT,
+ backlight_get_brightness(bd), NULL);
}
static const struct backlight_ops asus_screenpad_bl_ops = {