mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org,
	Hans de Goede <hansg@kernel.org>,
	"Luke D . Jones" <luke@ljones.dev>,
	Mateusz Schyboll <dragonn@op.pl>,
	Denis Benato <benato.denis96@gmail.com>
Subject: Re: [PATCH 1/2] platform/x86: asus-wmi: adjust screenpad power/brightness handling
Date: Mon, 23 Feb 2026 19:15:22 +0100	[thread overview]
Message-ID: <d42c4be9-5c2b-498a-b2dd-ac672c926c9b@linux.dev> (raw)
In-Reply-To: <71a3278d-d814-87cf-40cc-95bca45146e9@linux.intel.com>


On 2/23/26 15:38, Ilpo Järvinen wrote:
> On Thu, 12 Feb 2026, Denis Benato wrote:
>
>> 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.
> Should this have a Fixes tag?
>
Same for the other patch: I am not sure.

What I know for certain is that Luke had an asus DUO to test this patch with
and most certainly it was because someone contacted him about these bugs.

I split up commits found int the previous version of this patch:
https://lore.kernel.org/all/20250525204214.104030-1-luke@ljones.dev/

I changed nothing else beside removing a redundant variable assignment.
>> Signed-off-by: Denis Benato <denis.benato@linux.dev>
>> Signed-off-by: Luke Jones <luke@ljones.dev>
>> ---
>>  drivers/platform/x86/asus-wmi.c | 34 +++++++++++++--------------------
>>  1 file changed, 13 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 0775fadedd10..4130dae37e15 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -4254,32 +4254,24 @@ static int read_screenpad_brightness(struct backlight_device *bd)
>>  
>>  static int update_screenpad_bl_status(struct backlight_device *bd)
>>  {
>> -	struct asus_wmi *asus = bl_get_data(bd);
>> -	int power, err = 0;
>> -	u32 ctrl_param;
>> +	int err = 0;
>> +	u32 ctrl_param = bd->props.brightness;
> Please retain reverse xmas-tree order.
>
>>  
>> -	power = read_screenpad_backlight_power(asus);
>> -	if (power < 0)
>> -		return power;
>> +	if (ctrl_param >= 0 && bd->props.power) {
>> +		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL);
>> +		if (err < 0)
>> +			return err;
>>  
>> -	if (bd->props.power != power) {
>> -		if (power != BACKLIGHT_POWER_ON) {
>> -			/* Only brightness > 0 can power it back on */
>> -			ctrl_param = asus->driver->screenpad_brightness - ASUS_SCREENPAD_BRIGHT_MIN;
>> -			err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT,
>> -						    ctrl_param, NULL);
>> -		} else {
>> -			err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
>> -		}
>> -	} else if (power == BACKLIGHT_POWER_ON) {
>> -		/* Only set brightness if powered on or we get invalid/unsync state */
>> -		ctrl_param = bd->props.brightness + ASUS_SCREENPAD_BRIGHT_MIN;
>>  		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_LIGHT, ctrl_param, NULL);
>> +		if (err < 0)
>> +			return err;
>>  	}
>>  
>> -	/* Ensure brightness is stored to turn back on with */
>> -	if (err == 0)
>> -		asus->driver->screenpad_brightness = bd->props.brightness + ASUS_SCREENPAD_BRIGHT_MIN;
>> +	if (!bd->props.power) {
>> +		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 0, NULL);
>> +		if (err < 0)
>> +			return err;
>> +	}
>>  
>>  	return err;
>>  }
>>

  reply	other threads:[~2026-02-23 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 22:02 [PATCH 0/2] platform/x86: asus-wmi: fix screenpad brightness/power management Denis Benato
2026-02-12 22:02 ` [PATCH 1/2] platform/x86: asus-wmi: adjust screenpad power/brightness handling Denis Benato
2026-02-23 14:38   ` Ilpo Järvinen
2026-02-23 18:15     ` Denis Benato [this message]
2026-02-24  4:15       ` luke
2026-02-24 20:42         ` Denis Benato
2026-02-12 22:02 ` [PATCH 2/2] platform/x86: asus-wmi: fix screenpad brightness scaling Denis Benato
2026-02-23 14:42   ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d42c4be9-5c2b-498a-b2dd-ac672c926c9b@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=benato.denis96@gmail.com \
    --cc=dragonn@op.pl \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome