Skip to content

Commit 1797d58

Browse files
committed
platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models
Commit b0dbd97 ("platform/x86: asus-wmi: Add support for SW_TABLET_MODE") added support for reporting SW_TABLET_MODE using the Asus 0x00120063 WMI-device-id to see if various transformer models were docked into their keyboard-dock (SW_TABLET_MODE=0) or if they were being used as a tablet. The new SW_TABLET_MODE support (naively?) assumed that non Transformer devices would either not support the 0x00120063 WMI-device-id at all, or would NOT set ASUS_WMI_DSTS_PRESENCE_BIT in their reply when querying the device-id. Unfortunately this is not true and we have received many bug reports about this change causing the asus-wmi driver to always report SW_TABLET_MODE=1 on non Transformer devices. This causes libinput to think that these are 360 degree hinges style 2-in-1s folded into tablet-mode. Making libinput suppress keyboard and touchpad events from the builtin keyboard and touchpad. So effectively this causes the keyboard and touchpad to not work on many non Transformer Asus models. This commit fixes this by using the existing DMI based quirk mechanism in asus-nb-wmi.c to allow using the 0x00120063 device-id for reporting SW_TABLET_MODE on Transformer models and ignoring it on all other models. Fixes: b0dbd97 ("platform/x86: asus-wmi: Add support for SW_TABLET_MODE") Link: https://patchwork.kernel.org/patch/11780901/ BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209011 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1876997 Reported-by: Samuel Čavoj <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 720ef73 commit 1797d58

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ static struct quirk_entry quirk_asus_vendor_backlight = {
115115
.wmi_backlight_set_devstate = true,
116116
};
117117

118+
static struct quirk_entry quirk_asus_use_kbd_dock_devid = {
119+
.use_kbd_dock_devid = true,
120+
};
121+
118122
static int dmi_matched(const struct dmi_system_id *dmi)
119123
{
120124
pr_info("Identified laptop model '%s'\n", dmi->ident);
@@ -488,6 +492,34 @@ static const struct dmi_system_id asus_quirks[] = {
488492
},
489493
.driver_data = &quirk_asus_vendor_backlight,
490494
},
495+
{
496+
.callback = dmi_matched,
497+
.ident = "Asus Transformer T100TA / T100HA / T100CHI",
498+
.matches = {
499+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
500+
/* Match *T100* */
501+
DMI_MATCH(DMI_PRODUCT_NAME, "T100"),
502+
},
503+
.driver_data = &quirk_asus_use_kbd_dock_devid,
504+
},
505+
{
506+
.callback = dmi_matched,
507+
.ident = "Asus Transformer T101HA",
508+
.matches = {
509+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
510+
DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"),
511+
},
512+
.driver_data = &quirk_asus_use_kbd_dock_devid,
513+
},
514+
{
515+
.callback = dmi_matched,
516+
.ident = "Asus Transformer T200TA",
517+
.matches = {
518+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
519+
DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
520+
},
521+
.driver_data = &quirk_asus_use_kbd_dock_devid,
522+
},
491523
{},
492524
};
493525

drivers/platform/x86/asus-wmi.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,14 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
365365
if (err)
366366
goto err_free_dev;
367367

368-
result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);
369-
if (result >= 0) {
370-
input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
371-
input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);
372-
} else if (result != -ENODEV) {
373-
pr_err("Error checking for keyboard-dock: %d\n", result);
368+
if (asus->driver->quirks->use_kbd_dock_devid) {
369+
result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);
370+
if (result >= 0) {
371+
input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
372+
input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);
373+
} else if (result != -ENODEV) {
374+
pr_err("Error checking for keyboard-dock: %d\n", result);
375+
}
374376
}
375377

376378
err = input_register_device(asus->inputdev);
@@ -2115,7 +2117,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
21152117
return;
21162118
}
21172119

2118-
if (code == NOTIFY_KBD_DOCK_CHANGE) {
2120+
if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) {
21192121
result = asus_wmi_get_devstate_simple(asus,
21202122
ASUS_WMI_DEVID_KBD_DOCK);
21212123
if (result >= 0) {

drivers/platform/x86/asus-wmi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct quirk_entry {
3333
bool wmi_backlight_native;
3434
bool wmi_backlight_set_devstate;
3535
bool wmi_force_als_set;
36+
bool use_kbd_dock_devid;
3637
int wapf;
3738
/*
3839
* For machines with AMD graphic chips, it will send out WMI event

0 commit comments

Comments
 (0)