* [PATCH] platform/x86: asus-wmi: fix unclear usage of bd->props.power
@ 2026-08-19 20:53 Denis Benato
2026-08-19 20:55 ` Denis Benato
0 siblings, 1 reply; 3+ messages in thread
From: Denis Benato @ 2026-08-19 20:53 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, Hans de Goede, Ilpo Järvinen,
Luke D . Jones, Manuel A. R. de Orúe Ríos, Denis Benato,
Salvatore Bonaccorso, Ponali, Denis Benato
The bd->props.power is checked in parts of the driver correctly comparing with
BACKLIGHT_POWER_ON, while in others with a raw usage of bd->props.power
and !bd->props.power, moreover in certain checks the logic has been
inverted due to BACKLIGHT_POWER_ON being defined as 0: fix both the wrong
usage and the inconsistencies by using proper comparisons.
Fixes: 130d29c5627c ("platform/x86: asus-wmi: adjust screenpad power/brightness handling")
Closes: https://lore.kernel.org/all/178362762638.911488.8564892548331679884@eldamar.lan/
Closes: https://lore.kernel.org/all/ea9c63d1-4776-49d5-9dc4-6c09498f99c9@linux.dev/
Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
drivers/platform/x86/asus-wmi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8610663b8269..3600dddd8f36 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4500,7 +4500,8 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
u32 ctrl_param = bd->props.brightness;
int err = 0;
- if (bd->props.power) {
+ 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;
@@ -4508,12 +4509,17 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL);
if (err < 0)
return err;
- }
+ break;
- if (!bd->props.power) {
+ case BACKLIGHT_POWER_OFF:
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
if (err < 0)
return err;
+ break;
+
+ default:
+ pr_warn("Invalid screenpad backlight power state: %d\n", bd->props.power);
+ return -EINVAL;
}
return err;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: asus-wmi: fix unclear usage of bd->props.power
2026-08-19 20:53 [PATCH] platform/x86: asus-wmi: fix unclear usage of bd->props.power Denis Benato
@ 2026-08-19 20:55 ` Denis Benato
2026-08-25 11:38 ` Ponali
0 siblings, 1 reply; 3+ messages in thread
From: Denis Benato @ 2026-08-19 20:55 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, Hans de Goede, Ilpo Järvinen,
Luke D . Jones, Manuel A. R. de Orúe Ríos, Denis Benato,
Salvatore Bonaccorso, Ponali
On 8/19/26 22:53, Denis Benato wrote:
> The bd->props.power is checked in parts of the driver correctly comparing with
> BACKLIGHT_POWER_ON, while in others with a raw usage of bd->props.power
> and !bd->props.power, moreover in certain checks the logic has been
> inverted due to BACKLIGHT_POWER_ON being defined as 0: fix both the wrong
> usage and the inconsistencies by using proper comparisons.
Can someone having the regression please try this out please?
> Fixes: 130d29c5627c ("platform/x86: asus-wmi: adjust screenpad power/brightness handling")
> Closes: https://lore.kernel.org/all/178362762638.911488.8564892548331679884@eldamar.lan/
> Closes: https://lore.kernel.org/all/ea9c63d1-4776-49d5-9dc4-6c09498f99c9@linux.dev/
> Signed-off-by: Denis Benato <denis.benato@linux.dev>
> ---
> drivers/platform/x86/asus-wmi.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 8610663b8269..3600dddd8f36 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -4500,7 +4500,8 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
> u32 ctrl_param = bd->props.brightness;
> int err = 0;
>
> - if (bd->props.power) {
> + 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;
> @@ -4508,12 +4509,17 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
> err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL);
> if (err < 0)
> return err;
> - }
> + break;
>
> - if (!bd->props.power) {
> + case BACKLIGHT_POWER_OFF:
> err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
> if (err < 0)
> return err;
> + break;
> +
> + default:
> + pr_warn("Invalid screenpad backlight power state: %d\n", bd->props.power);
> + return -EINVAL;
> }
>
> return err;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: asus-wmi: fix unclear usage of bd->props.power
2026-08-19 20:55 ` Denis Benato
@ 2026-08-25 11:38 ` Ponali
0 siblings, 0 replies; 3+ messages in thread
From: Ponali @ 2026-08-25 11:38 UTC (permalink / raw)
To: Denis Benato
Cc: platform-driver-x86, ilpo.jarvinen, hansg, luke, deor001,
benato.denis96, Salvatore Bonaccorso, ponali2k
Hi,
I have applied your small patch, based on the diff you gave me, and the
ASUS ScreenPad display has started working.
I'm not sure what commit I was supposed to patch though, so I guessed
9bd6ec. I had to patch it manually because the line numbers weren't
matching, and you sent me the output of git diff directly instead of the
contents of a git patch file.
The custom compiled kernel created couldn't handle the brightness
correctly, only the power:
On KDE Plasma, changing the brightness is possible, but the maximum
brightness was set to be darker than usual.
On both brightnessctl and sysfs, writing to the brightness value would
change both brightness and actual_brightness, but no changes would
appear on the backlight.
Booting to a disk image of pre-6.12.90 linux with XFCE has the same
exact issues, but then after booting back to my normal 6.12.90 system,
the maximum brightness came back to what it used to be.
I hope this heisenbug only happened because i simply patched the wrong
commit.
On 19/08/2026 10:55 PM, Denis Benato wrote:
> On 8/19/26 22:53, Denis Benato wrote:
>> The bd->props.power is checked in parts of the driver correctly comparing with
>> BACKLIGHT_POWER_ON, while in others with a raw usage of bd->props.power
>> and !bd->props.power, moreover in certain checks the logic has been
>> inverted due to BACKLIGHT_POWER_ON being defined as 0: fix both the wrong
>> usage and the inconsistencies by using proper comparisons.
> Can someone having the regression please try this out please?
>> Fixes: 130d29c5627c ("platform/x86: asus-wmi: adjust screenpad power/brightness handling")
>> Closes:https://lore.kernel.org/all/178362762638.911488.8564892548331679884@eldamar.lan/
>> Closes:https://lore.kernel.org/all/ea9c63d1-4776-49d5-9dc4-6c09498f99c9@linux.dev/
>> Signed-off-by: Denis Benato<denis.benato@linux.dev>
>> ---
>> drivers/platform/x86/asus-wmi.c | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 8610663b8269..3600dddd8f36 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -4500,7 +4500,8 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
>> u32 ctrl_param = bd->props.brightness;
>> int err = 0;
>>
>> - if (bd->props.power) {
>> + 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;
>> @@ -4508,12 +4509,17 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
>> err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL);
>> if (err < 0)
>> return err;
>> - }
>> + break;
>>
>> - if (!bd->props.power) {
>> + case BACKLIGHT_POWER_OFF:
>> err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
>> if (err < 0)
>> return err;
>> + break;
>> +
>> + default:
>> + pr_warn("Invalid screenpad backlight power state: %d\n", bd->props.power);
>> + return -EINVAL;
>> }
>>
>> return err;
Regards,
Ponali
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-25 11:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 20:53 [PATCH] platform/x86: asus-wmi: fix unclear usage of bd->props.power Denis Benato
2026-08-19 20:55 ` Denis Benato
2026-08-25 11:38 ` Ponali
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox