]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/6.8.6/platform-x86-intel-vbtn-update-tablet-mode-switch-at.patch
Linux 6.8.6
[thirdparty/kernel/stable-queue.git] / releases / 6.8.6 / platform-x86-intel-vbtn-update-tablet-mode-switch-at.patch
1 From 186a8f34fbbb4e32eeb02627cce5078f9703467a Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 29 Mar 2024 07:32:06 -0700
4 Subject: platform/x86: intel-vbtn: Update tablet mode switch at end of probe
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Gwendal Grignou <gwendal@chromium.org>
10
11 [ Upstream commit 434e5781d8cd2d0ed512d920c6cdeba4b33a2e81 ]
12
13 ACER Vivobook Flip (TP401NAS) virtual intel switch is implemented as
14 follow:
15
16 Device (VGBI)
17 {
18 Name (_HID, EisaId ("INT33D6") ...
19 Name (VBDS, Zero)
20 Method (_STA, 0, Serialized) // _STA: Status ...
21 Method (VBDL, 0, Serialized)
22 {
23 PB1E |= 0x20
24 VBDS |= 0x40
25 }
26 Method (VGBS, 0, Serialized)
27 {
28 Return (VBDS) /* \_SB_.PCI0.SBRG.EC0_.VGBI.VBDS */
29 }
30 ...
31 }
32
33 By default VBDS is set to 0. At boot it is set to clamshell (bit 6 set)
34 only after method VBDL is executed.
35
36 Since VBDL is now evaluated in the probe routine later, after the device
37 is registered, the retrieved value of VBDS was still 0 ("tablet mode")
38 when setting up the virtual switch.
39
40 Make sure to evaluate VGBS after VBDL, to ensure the
41 convertible boots in clamshell mode, the expected default.
42
43 Fixes: 26173179fae1 ("platform/x86: intel-vbtn: Eval VBDL after registering our notifier")
44 Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
45 Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
46 Reviewed-by: Hans de Goede <hdegoede@redhat.com>
47 Link: https://lore.kernel.org/r/20240329143206.2977734-3-gwendal@chromium.org
48 Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
49 Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
50 Signed-off-by: Sasha Levin <sashal@kernel.org>
51 ---
52 drivers/platform/x86/intel/vbtn.c | 5 +++--
53 1 file changed, 3 insertions(+), 2 deletions(-)
54
55 diff --git a/drivers/platform/x86/intel/vbtn.c b/drivers/platform/x86/intel/vbtn.c
56 index 084c355c86f5f..5d13452bb947a 100644
57 --- a/drivers/platform/x86/intel/vbtn.c
58 +++ b/drivers/platform/x86/intel/vbtn.c
59 @@ -136,8 +136,6 @@ static int intel_vbtn_input_setup(struct platform_device *device)
60 priv->switches_dev->id.bustype = BUS_HOST;
61
62 if (priv->has_switches) {
63 - detect_tablet_mode(&device->dev);
64 -
65 ret = input_register_device(priv->switches_dev);
66 if (ret)
67 return ret;
68 @@ -316,6 +314,9 @@ static int intel_vbtn_probe(struct platform_device *device)
69 if (ACPI_FAILURE(status))
70 dev_err(&device->dev, "Error VBDL failed with ACPI status %d\n", status);
71 }
72 + // Check switches after buttons since VBDL may have side effects.
73 + if (has_switches)
74 + detect_tablet_mode(&device->dev);
75
76 device_init_wakeup(&device->dev, true);
77 /*
78 --
79 2.43.0
80