linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk
@ 2025-08-08 15:47 Antheas Kapenekakis
  2025-08-08 15:47 ` [PATCH v2 2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13 Antheas Kapenekakis
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-08-08 15:47 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: linux-kernel, Corentin Chary, Luke D . Jones, Mathieu Fenniak,
	Hans de Goede, Ilpo Järvinen, Antheas Kapenekakis

Currently, the ignore_key_wlan quirk applies to keycodes 0x5D, 0x5E, and
0x5F. However, the relevant code for the Asus Zenbook Duo is only 0x5F.
Since this code is emitted by other Asus devices, such as from the Z13
for its ROG button, remove the extra codes before expanding the quirk.

For the Duo devices, which are the only ones that use this quirk, there
should be no effect.

Fixes: 9286dfd5735b ("platform/x86: asus-wmi: Fix spurious rfkill on UX8406MA")
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
 drivers/platform/x86/asus-nb-wmi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index f84c3d03c1de..e6726be5890e 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -655,8 +655,6 @@ 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;

base-commit: 186f3edfdd41f2ae87fc40a9ccba52a3bf930994
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13
  2025-08-08 15:47 [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
@ 2025-08-08 15:47 ` Antheas Kapenekakis
  2025-08-08 15:49 ` [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
  2025-08-25 11:30 ` Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-08-08 15:47 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: linux-kernel, Corentin Chary, Luke D . Jones, Mathieu Fenniak,
	Hans de Goede, Ilpo Järvinen, Antheas Kapenekakis

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. 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 | 23 +++++++++++++++++++----
 drivers/platform/x86/asus-wmi.h    |  3 ++-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index e6726be5890e..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,9 +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 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;
 	/*
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk
  2025-08-08 15:47 [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
  2025-08-08 15:47 ` [PATCH v2 2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13 Antheas Kapenekakis
@ 2025-08-08 15:49 ` Antheas Kapenekakis
  2025-08-25 11:30 ` Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-08-08 15:49 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: linux-kernel, Corentin Chary, Luke D . Jones, Mathieu Fenniak,
	Hans de Goede, Ilpo Järvinen

Also cc'd Mathieu on this one. Would be good to verify my assessment
is correct. I asked two other Duo users while making the patch.

Antheas

On Fri, 8 Aug 2025 at 17:48, Antheas Kapenekakis <lkml@antheas.dev> wrote:
>
> Currently, the ignore_key_wlan quirk applies to keycodes 0x5D, 0x5E, and
> 0x5F. However, the relevant code for the Asus Zenbook Duo is only 0x5F.
> Since this code is emitted by other Asus devices, such as from the Z13
> for its ROG button, remove the extra codes before expanding the quirk.
>
> For the Duo devices, which are the only ones that use this quirk, there
> should be no effect.
>
> Fixes: 9286dfd5735b ("platform/x86: asus-wmi: Fix spurious rfkill on UX8406MA")
> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
> ---
>  drivers/platform/x86/asus-nb-wmi.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
> index f84c3d03c1de..e6726be5890e 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -655,8 +655,6 @@ 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;
>
> base-commit: 186f3edfdd41f2ae87fc40a9ccba52a3bf930994
> --
> 2.50.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk
  2025-08-08 15:47 [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
  2025-08-08 15:47 ` [PATCH v2 2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13 Antheas Kapenekakis
  2025-08-08 15:49 ` [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
@ 2025-08-25 11:30 ` Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2025-08-25 11:30 UTC (permalink / raw)
  To: platform-driver-x86, Antheas Kapenekakis
  Cc: linux-kernel, Corentin Chary, Luke D . Jones, Mathieu Fenniak,
	Hans de Goede

On Fri, 08 Aug 2025 17:47:09 +0200, Antheas Kapenekakis wrote:

> Currently, the ignore_key_wlan quirk applies to keycodes 0x5D, 0x5E, and
> 0x5F. However, the relevant code for the Asus Zenbook Duo is only 0x5F.
> Since this code is emitted by other Asus devices, such as from the Z13
> for its ROG button, remove the extra codes before expanding the quirk.
> 
> For the Duo devices, which are the only ones that use this quirk, there
> should be no effect.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk
      commit: cf3940ac737d05c85395f343fe33a3cfcadb47db
[2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13
      commit: 132bfcd24925d4d4531a19b87acb8474be82a017

--
 i.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-25 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 15:47 [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
2025-08-08 15:47 ` [PATCH v2 2/2] platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13 Antheas Kapenekakis
2025-08-08 15:49 ` [PATCH v2 1/2] platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk Antheas Kapenekakis
2025-08-25 11:30 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).