Skip to content

Commit 132bfcd

Browse files
antheasij-intel
authored andcommitted
platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13
On commit 9286dfd ("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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent cf3940a commit 132bfcd

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

drivers/platform/x86/asus-nb-wmi.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ static struct quirk_entry quirk_asus_ignore_fan = {
147147
};
148148

149149
static struct quirk_entry quirk_asus_zenbook_duo_kbd = {
150-
.ignore_key_wlan = true,
150+
.key_wlan_event = ASUS_WMI_KEY_IGNORE,
151+
};
152+
153+
static struct quirk_entry quirk_asus_z13 = {
154+
.key_wlan_event = ASUS_WMI_KEY_ARMOURY,
155+
.tablet_switch_mode = asus_wmi_kbd_dock_devid,
151156
};
152157

153158
static int dmi_matched(const struct dmi_system_id *dmi)
@@ -539,6 +544,15 @@ static const struct dmi_system_id asus_quirks[] = {
539544
},
540545
.driver_data = &quirk_asus_zenbook_duo_kbd,
541546
},
547+
{
548+
.callback = dmi_matched,
549+
.ident = "ASUS ROG Z13",
550+
.matches = {
551+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
552+
DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow Z13"),
553+
},
554+
.driver_data = &quirk_asus_z13,
555+
},
542556
{},
543557
};
544558

@@ -636,6 +650,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
636650
{ KE_IGNORE, 0xCF, }, /* AC mode */
637651
{ KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */
638652
{ KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */
653+
{ KE_KEY, ASUS_WMI_KEY_ARMOURY, { KEY_PROG3 } },
639654
{ KE_END, 0},
640655
};
641656

@@ -655,9 +670,9 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
655670
if (atkbd_reports_vol_keys)
656671
*code = ASUS_WMI_KEY_IGNORE;
657672
break;
658-
case 0x5F: /* Wireless console Disable */
659-
if (quirks->ignore_key_wlan)
660-
*code = ASUS_WMI_KEY_IGNORE;
673+
case 0x5F: /* Wireless console Disable / Special Key */
674+
if (quirks->key_wlan_event)
675+
*code = quirks->key_wlan_event;
661676
break;
662677
}
663678
}

drivers/platform/x86/asus-wmi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/i8042.h>
1919

2020
#define ASUS_WMI_KEY_IGNORE (-1)
21+
#define ASUS_WMI_KEY_ARMOURY 0xffff01
2122
#define ASUS_WMI_BRN_DOWN 0x2e
2223
#define ASUS_WMI_BRN_UP 0x2f
2324

@@ -40,7 +41,7 @@ struct quirk_entry {
4041
bool wmi_force_als_set;
4142
bool wmi_ignore_fan;
4243
bool filter_i8042_e1_extended_codes;
43-
bool ignore_key_wlan;
44+
int key_wlan_event;
4445
enum asus_wmi_tablet_switch_mode tablet_switch_mode;
4546
int wapf;
4647
/*

0 commit comments

Comments
 (0)