mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Antheas Kapenekakis <lkml@antheas.dev>
Cc: platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	 Corentin Chary <corentin.chary@gmail.com>,
	 "Luke D . Jones" <luke@ljones.dev>,
	Hans de Goede <hansg@kernel.org>
Subject: Re: [PATCH v1] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13
Date: Wed, 6 Aug 2025 14:35:56 +0300 (EEST)	[thread overview]
Message-ID: <2c7476d5-2a1b-5f1a-9c75-76f74752d0da@linux.intel.com> (raw)
In-Reply-To: <20250803155713.9301-1-lkml@antheas.dev>

On Sun, 3 Aug 2025, Antheas Kapenekakis wrote:

> On commit 9286dfd5735b ("platform/x86: asus-wmi: Fix spurious rfkill on
> UX8406MA"), Mathieu adds a quirk for the Zenbook Duo to ignore the code
> 0x5f (WLAN button disable). On that laptop, this code is triggered when
> the device keyboard is attached.
> 
> On the ASUS ROG Z13 2025, this code is triggered when pressing the side
> button of the device, which is used to open Armoury Crate in Windows.
> 
> As this is becoming a pattern, where newer Asus laptops use this keycode
> for emitting events, let's convert the wlan ignore quirk to instead
> allow emitting codes, so that userspace programs can listen to it and
> so that it does not interfere with the rfkill state.
> 
> With this patch, the Z13 wil emit KEY_PROG3 and the Duo will remain
> unchanged and emit no event.

> This patch also removes the override for
> codes 0x5d and 0x5e, as those were added for completeness in the
> previous patch.

This sounds like it warrants own patch.

> While at it, add a quirk for the Z13 to switch into tablet mode when
> removing the keyboard.
>
> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
> ---
>  drivers/platform/x86/asus-nb-wmi.c | 25 +++++++++++++++++++------
>  drivers/platform/x86/asus-wmi.h    |  3 ++-
>  2 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
> index f84c3d03c1de..6928bb6ae0f3 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -147,7 +147,12 @@ static struct quirk_entry quirk_asus_ignore_fan = {
>  };
>  
>  static struct quirk_entry quirk_asus_zenbook_duo_kbd = {
> -	.ignore_key_wlan = true,
> +	.key_wlan_event = ASUS_WMI_KEY_IGNORE,
> +};
> +
> +static struct quirk_entry quirk_asus_z13 = {
> +	.key_wlan_event = ASUS_WMI_KEY_ARMOURY,
> +	.tablet_switch_mode = asus_wmi_kbd_dock_devid,
>  };
>  
>  static int dmi_matched(const struct dmi_system_id *dmi)
> @@ -539,6 +544,15 @@ static const struct dmi_system_id asus_quirks[] = {
>  		},
>  		.driver_data = &quirk_asus_zenbook_duo_kbd,
>  	},
> +	{
> +		.callback = dmi_matched,
> +		.ident = "ASUS ROG Z13",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow Z13"),
> +		},
> +		.driver_data = &quirk_asus_z13,
> +	},
>  	{},
>  };
>  
> @@ -636,6 +650,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
>  	{ KE_IGNORE, 0xCF, },	/* AC mode */
>  	{ KE_KEY, 0xFA, { KEY_PROG2 } },           /* Lid flip action */
>  	{ KE_KEY, 0xBD, { KEY_PROG2 } },           /* Lid flip action on ROG xflow laptops */
> +	{ KE_KEY, ASUS_WMI_KEY_ARMOURY, { KEY_PROG3 } },
>  	{ KE_END, 0},
>  };
>  
> @@ -655,11 +670,9 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
>  		if (atkbd_reports_vol_keys)
>  			*code = ASUS_WMI_KEY_IGNORE;
>  		break;
> -	case 0x5D: /* Wireless console Toggle */
> -	case 0x5E: /* Wireless console Enable */
> -	case 0x5F: /* Wireless console Disable */
> -		if (quirks->ignore_key_wlan)
> -			*code = ASUS_WMI_KEY_IGNORE;
> +	case 0x5F: /* Wireless console Disable / Special Key */
> +		if (quirks->key_wlan_event)
> +			*code = quirks->key_wlan_event;
>  		break;
>  	}
>  }
> diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
> index 018dfde4025e..5cd4392b964e 100644
> --- a/drivers/platform/x86/asus-wmi.h
> +++ b/drivers/platform/x86/asus-wmi.h
> @@ -18,6 +18,7 @@
>  #include <linux/i8042.h>
>  
>  #define ASUS_WMI_KEY_IGNORE (-1)
> +#define ASUS_WMI_KEY_ARMOURY	0xffff01
>  #define ASUS_WMI_BRN_DOWN	0x2e
>  #define ASUS_WMI_BRN_UP		0x2f
>  
> @@ -40,7 +41,7 @@ struct quirk_entry {
>  	bool wmi_force_als_set;
>  	bool wmi_ignore_fan;
>  	bool filter_i8042_e1_extended_codes;
> -	bool ignore_key_wlan;
> +	int key_wlan_event;
>  	enum asus_wmi_tablet_switch_mode tablet_switch_mode;
>  	int wapf;
>  	/*
> 
> base-commit: 186f3edfdd41f2ae87fc40a9ccba52a3bf930994
> 

-- 
 i.


      reply	other threads:[~2025-08-06 11:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-03 15:57 Antheas Kapenekakis
2025-08-06 11:35 ` Ilpo Järvinen [this message]

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=2c7476d5-2a1b-5f1a-9c75-76f74752d0da@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=corentin.chary@gmail.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@antheas.dev \
    --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

all inboxes | Powered by JetHome®