]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
76c9344d84e2b09b99fa1acac8ead233437c9e14
[thirdparty/kernel/stable-queue.git] /
1 From 1797d588af15174d4a4e7159dac8c800538e4f8c Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Wed, 16 Sep 2020 16:14:39 +0200
4 Subject: platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Hans de Goede <hdegoede@redhat.com>
10
11 commit 1797d588af15174d4a4e7159dac8c800538e4f8c upstream.
12
13 Commit b0dbd97de1f1 ("platform/x86: asus-wmi: Add support for
14 SW_TABLET_MODE") added support for reporting SW_TABLET_MODE using the
15 Asus 0x00120063 WMI-device-id to see if various transformer models were
16 docked into their keyboard-dock (SW_TABLET_MODE=0) or if they were
17 being used as a tablet.
18
19 The new SW_TABLET_MODE support (naively?) assumed that non Transformer
20 devices would either not support the 0x00120063 WMI-device-id at all,
21 or would NOT set ASUS_WMI_DSTS_PRESENCE_BIT in their reply when querying
22 the device-id.
23
24 Unfortunately this is not true and we have received many bug reports about
25 this change causing the asus-wmi driver to always report SW_TABLET_MODE=1
26 on non Transformer devices. This causes libinput to think that these are
27 360 degree hinges style 2-in-1s folded into tablet-mode. Making libinput
28 suppress keyboard and touchpad events from the builtin keyboard and
29 touchpad. So effectively this causes the keyboard and touchpad to not work
30 on many non Transformer Asus models.
31
32 This commit fixes this by using the existing DMI based quirk mechanism in
33 asus-nb-wmi.c to allow using the 0x00120063 device-id for reporting
34 SW_TABLET_MODE on Transformer models and ignoring it on all other models.
35
36 Fixes: b0dbd97de1f1 ("platform/x86: asus-wmi: Add support for SW_TABLET_MODE")
37 Link: https://patchwork.kernel.org/patch/11780901/
38 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209011
39 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1876997
40 Reported-by: Samuel Čavoj <samuel@cavoj.net>
41 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
42 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43
44 ---
45 drivers/platform/x86/asus-nb-wmi.c | 32 ++++++++++++++++++++++++++++++++
46 drivers/platform/x86/asus-wmi.c | 16 +++++++++-------
47 drivers/platform/x86/asus-wmi.h | 1 +
48 3 files changed, 42 insertions(+), 7 deletions(-)
49
50 --- a/drivers/platform/x86/asus-nb-wmi.c
51 +++ b/drivers/platform/x86/asus-nb-wmi.c
52 @@ -120,6 +120,10 @@ static struct quirk_entry quirk_asus_ga5
53 .wmi_backlight_set_devstate = true,
54 };
55
56 +static struct quirk_entry quirk_asus_use_kbd_dock_devid = {
57 + .use_kbd_dock_devid = true,
58 +};
59 +
60 static int dmi_matched(const struct dmi_system_id *dmi)
61 {
62 pr_info("Identified laptop model '%s'\n", dmi->ident);
63 @@ -493,6 +497,34 @@ static const struct dmi_system_id asus_q
64 },
65 .driver_data = &quirk_asus_ga502i,
66 },
67 + {
68 + .callback = dmi_matched,
69 + .ident = "Asus Transformer T100TA / T100HA / T100CHI",
70 + .matches = {
71 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
72 + /* Match *T100* */
73 + DMI_MATCH(DMI_PRODUCT_NAME, "T100"),
74 + },
75 + .driver_data = &quirk_asus_use_kbd_dock_devid,
76 + },
77 + {
78 + .callback = dmi_matched,
79 + .ident = "Asus Transformer T101HA",
80 + .matches = {
81 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
82 + DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"),
83 + },
84 + .driver_data = &quirk_asus_use_kbd_dock_devid,
85 + },
86 + {
87 + .callback = dmi_matched,
88 + .ident = "Asus Transformer T200TA",
89 + .matches = {
90 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
91 + DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
92 + },
93 + .driver_data = &quirk_asus_use_kbd_dock_devid,
94 + },
95 {},
96 };
97
98 --- a/drivers/platform/x86/asus-wmi.c
99 +++ b/drivers/platform/x86/asus-wmi.c
100 @@ -365,12 +365,14 @@ static int asus_wmi_input_init(struct as
101 if (err)
102 goto err_free_dev;
103
104 - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);
105 - if (result >= 0) {
106 - input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
107 - input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);
108 - } else if (result != -ENODEV) {
109 - pr_err("Error checking for keyboard-dock: %d\n", result);
110 + if (asus->driver->quirks->use_kbd_dock_devid) {
111 + result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);
112 + if (result >= 0) {
113 + input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
114 + input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);
115 + } else if (result != -ENODEV) {
116 + pr_err("Error checking for keyboard-dock: %d\n", result);
117 + }
118 }
119
120 err = input_register_device(asus->inputdev);
121 @@ -2114,7 +2116,7 @@ static void asus_wmi_handle_event_code(i
122 return;
123 }
124
125 - if (code == NOTIFY_KBD_DOCK_CHANGE) {
126 + if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) {
127 result = asus_wmi_get_devstate_simple(asus,
128 ASUS_WMI_DEVID_KBD_DOCK);
129 if (result >= 0) {
130 --- a/drivers/platform/x86/asus-wmi.h
131 +++ b/drivers/platform/x86/asus-wmi.h
132 @@ -33,6 +33,7 @@ struct quirk_entry {
133 bool wmi_backlight_native;
134 bool wmi_backlight_set_devstate;
135 bool wmi_force_als_set;
136 + bool use_kbd_dock_devid;
137 int wapf;
138 /*
139 * For machines with AMD graphic chips, it will send out WMI event