]> www.infradead.org Git - users/hch/misc.git/commitdiff
platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13
authorAntheas Kapenekakis <lkml@antheas.dev>
Fri, 8 Aug 2025 15:47:10 +0000 (17:47 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 25 Aug 2025 11:13:55 +0000 (14:13 +0300)
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>
Link: https://lore.kernel.org/r/20250808154710.8981-2-lkml@antheas.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/asus-nb-wmi.c
drivers/platform/x86/asus-wmi.h

index e6726be5890e7f5ffe2ebb869b69710e7f4dbba4..6928bb6ae0f3c83169ec88bf179d0426fd4c0bc5 100644 (file)
@@ -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;
        }
 }
index 018dfde4025e79007f3d2ee838ceda4e1a0db2c6..5cd4392b964eb816def80c84e396f41cd9cb926d 100644 (file)
@@ -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;
        /*