X86 platform drivers
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: Robin Everaars <robineveraars@pm.me>,
	hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: corentin.chary@gmail.com, luke@ljones.dev,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] platform/x86: asus-wmi: accept either lid-flip notify code
Date: Wed, 5 Aug 2026 14:11:46 +0200	[thread overview]
Message-ID: <a27396b5-31ad-4973-a7aa-0ae7ef269c73@linux.dev> (raw)
In-Reply-To: <20260805101502.235668-3-robineveraars@pm.me>


On 8/5/26 12:15, Robin Everaars wrote:
> asus-wmi pairs the devid it polls for the tablet switch with the single
> notify code it listens for, and tablet_mode_sw only offers those fixed
> pairings. Some convertibles read the hinge at one lid-flip devid but
> notify with the other, which no value covers.
>
> The ASUS ProArt PX13 (HN7306EAC) is one. ASUS_WMI_DEVID_LID_FLIP is frozen
> at 1 in every pose while ASUS_WMI_DEVID_LID_FLIP_ROG tracks the hinge, yet
> folding notifies with NOTIFY_LID_FLIP rather than NOTIFY_LID_FLIP_ROG. So
> tablet_mode_sw=2 pins the switch on and suspends the internal keyboard for
> good, and tablet_mode_sw=3 reads the right devid but never hears the event.
>
> Accept either lid-flip code once a lid-flip switch is registered. Both are
> the same "lid flip action" event and both already map to KEY_PROG2 in the
> sparse keymap. Machines with a keyboard-dock switch notify with 0x75 and
> are unaffected, and with no switch registered the event code is 0 and the
> old equality test still runs.
>
> Signed-off-by: Robin 
> Everaars <robineveraars@pm.me>
> ---
>  drivers/platform/x86/asus-wmi.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index f68fd2bcd..bcbb98529 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -819,6 +819,27 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)
>  		asus_wmi_tablet_sw_report(asus, result);
>  }
>  
> +/*
> + * Some convertibles report the hinge at one lid-flip devid while their firmware
> + * notifies with the other lid-flip code, a pairing no tablet_mode_sw value
> + * covers. The ASUS ProArt PX13 (HN7306EAC) is one: ASUS_WMI_DEVID_LID_FLIP is
> + * frozen at 1 in every pose while ASUS_WMI_DEVID_LID_FLIP_ROG tracks the hinge,
> + * yet the fold notifies with NOTIFY_LID_FLIP rather than NOTIFY_LID_FLIP_ROG.
> + * Accept either code once a lid-flip switch is registered; both are the same
> + * "lid flip action" ev
> ent and both already map to KEY_PROG2 in the sparse keymap.
> + */
You may want to complete this kernel doc blockm adding at the beginning
function_name() - brief

and below the description params and return.
> +static bool asus_wmi_is_tablet_switch_code(struct asus_wmi *asus, int code)
> +{
> +	if (code == asus->tablet_switch_event_code)
> +		return true;
> +
> +	if (asus->tablet_switch_event_code == NOTIFY_LID_FLIP ||
> +	    asus->tablet_switch_event_code == NOTIFY_LID_FLIP_ROG)
> +		return code == NOTIFY_LID_FLIP || code == NOTIFY_LID_FLIP_ROG;
> +
> +	return false;
> +}
> +
>  /* Charging mode, 1=Barrel, 2=USB ******************************************/
>  #if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>  static ssize_t charge_mode_show(struct device *dev,
> @@ -4674,7 +4695,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
>  		return;
>  	}
>  
> -	if (code == asus->tablet_switch_event_code) {
> +	if (asus_wmi_is_tablet_switch_code(asus, code)) {
>  		asus_wmi_tablet_mode_get_state(asus);
>  		return;
>  	}

  reply	other threads:[~2026-08-05 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 10:15 [PATCH 0/2] platform/x86: asus-wmi: make the tablet switch work on the ProArt PX13 Robin Everaars
2026-08-05 10:15 ` [PATCH 1/2] platform/x86: asus-wmi: keep the lid-flip state when UNKNOWN is set Robin Everaars
2026-08-05 12:07   ` Denis Benato
2026-08-05 10:15 ` [PATCH 2/2] platform/x86: asus-wmi: accept either lid-flip notify code Robin Everaars
2026-08-05 12:11   ` Denis Benato [this message]
2026-08-05 14:11 ` [PATCH v2 0/2] platform/x86: asus-wmi: make the tablet switch work on the ProArt PX13 Robin Everaars
2026-08-05 14:11   ` [PATCH v2 1/2] platform/x86: asus-wmi: keep the lid-flip state when UNKNOWN is set Robin Everaars
2026-08-05 14:11   ` [PATCH v2 2/2] platform/x86: asus-wmi: accept either lid-flip notify code Robin Everaars

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=a27396b5-31ad-4973-a7aa-0ae7ef269c73@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=corentin.chary@gmail.com \
    --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 \
    --cc=robineveraars@pm.me \
    /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