]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
faa6a9f5fc403d8d67648cb94375418e6b9ac748
[thirdparty/kernel/stable-queue.git] /
1 From d823346876a970522ff9e4d2b323c9b734dcc4de Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Sat, 12 Sep 2020 11:35:32 +0200
4 Subject: platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360
5
6 From: Hans de Goede <hdegoede@redhat.com>
7
8 commit d823346876a970522ff9e4d2b323c9b734dcc4de upstream.
9
10 Commit cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist
11 SW_TABLET_MODE on the 9 / "Laptop" chasis-type") restored SW_TABLET_MODE
12 reporting on the HP stream x360 11 series on which it was previously broken
13 by commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet
14 mode switch on 2-in-1's").
15
16 It turns out that enabling SW_TABLET_MODE reporting on devices with a
17 chassis-type of 10 ("Notebook") causes SW_TABLET_MODE to always report 1
18 at boot on the HP Pavilion 11 x360, which causes libinput to disable the
19 kbd and touchpad.
20
21 The HP Pavilion 11 x360's ACPI VGBS method sets bit 4 instead of bit 6 when
22 NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT collection
23 shows only one other model, the Medion E1239T ever setting bit 4 and it
24 always sets this together with bit 6.
25
26 So lets treat bit 4 as a second bit which when set indicates the device not
27 being in tablet-mode, as we already do for bit 6.
28
29 While at it also prefix all VGBS constant defines with "VGBS_".
30
31 Fixes: cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type")
32 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
33 Acked-by: Mark Gross <mgross@linux.intel.com>
34 Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36
37 ---
38 drivers/platform/x86/intel-vbtn.c | 12 ++++++++----
39 1 file changed, 8 insertions(+), 4 deletions(-)
40
41 --- a/drivers/platform/x86/intel-vbtn.c
42 +++ b/drivers/platform/x86/intel-vbtn.c
43 @@ -15,9 +15,13 @@
44 #include <linux/platform_device.h>
45 #include <linux/suspend.h>
46
47 +/* Returned when NOT in tablet mode on some HP Stream x360 11 models */
48 +#define VGBS_TABLET_MODE_FLAG_ALT 0x10
49 /* When NOT in tablet mode, VGBS returns with the flag 0x40 */
50 -#define TABLET_MODE_FLAG 0x40
51 -#define DOCK_MODE_FLAG 0x80
52 +#define VGBS_TABLET_MODE_FLAG 0x40
53 +#define VGBS_DOCK_MODE_FLAG 0x80
54 +
55 +#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT)
56
57 MODULE_LICENSE("GPL");
58 MODULE_AUTHOR("AceLan Kao");
59 @@ -148,9 +152,9 @@ static void detect_tablet_mode(struct pl
60 if (ACPI_FAILURE(status))
61 return;
62
63 - m = !(vgbs & TABLET_MODE_FLAG);
64 + m = !(vgbs & VGBS_TABLET_MODE_FLAGS);
65 input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
66 - m = (vgbs & DOCK_MODE_FLAG) ? 1 : 0;
67 + m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0;
68 input_report_switch(priv->input_dev, SW_DOCK, m);
69 }
70