[PATCH v1 3/4] platform/x86: asus-wmi: use backlight_is_blank() for screenpad power

From: Denis Benato

Date: Wed Sep 16 2026 - 11:20:56 EST


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@xxxxxxxxx>
Closes: https://lore.kernel.org/all/CAO84+xJ9aW3pj3x8e9b5biWtnNd4EyH7A4Uy7aqBR4qZMDcVvg@xxxxxxxxxxxxxx/
Assisted-by: zcode:glm-5.3-flash
Signed-off-by: Denis Benato <denis.benato@xxxxxxxxx>
---
drivers/platform/x86/asus-wmi.c | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index ded1aa356cf3..e6f3a5c0dba9 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4536,32 +4536,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 = {
--
2.47.3