Re: platform/x86: intel-vbtn: reports SW_TABLET_MODE=1 even if that's not the case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 9/10/20 7:06 PM, Barnabás Pőcze wrote:
Hello,


it has been reported[1], the 'intel-vbtn' driver reports SW_TABLET_MODE=1
even if that doesn't  accurately represent reality. That renders the
built-in keyboard and touchpad unusable when using libinput.

The device in question is

  DMI: Hewlett-Packard HP Pavilion 11 x360 PC/8050, BIOS F.28 08/11/2015

with chassis type=10.


The ACPI[2] device is as follows:

  Device (VGBI)
  {
  	Name (_HID, "INT33D6" /* Intel Virtual Buttons Device */)  // _HID: Hardware ID
  	Name (VBDS, Zero)
  	Name (ONTM, One)
  	Method (_STA, 0, Serialized)  // _STA: Status
  	{
  		Return (0x0F)
  	}

  	Method (VBDL, 0, Serialized)
  	{
  		P80H = 0xD1
  		^^PCI0.LPCB.EC0.IVBD = One
  	}

  	Method (VGBS, 0, Serialized)
  	{
  		If ((^^PCI0.LPCB.EC0.ROLS == Zero))
  		{
  			VBDS = 0x10
  		}
  		Else
  		{
  			VBDS = Zero
  		}

  		Return (VBDS) /* \_SB_.VGBI.VBDS */
  	}
  }


Seemingly, the 4th bit is set instead of the 6th (that is what the driver expects)
when not in tablet mode. This causes the driver to always report SW_TABLET_MODE=1.

This issue has been (most probably) introduced by commit cfae58ed681c5fe0185db843013ecc71cd265ebf
("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type").

Thank you for the detailed bug-report.

Attached is a patch which should fix this. Can you build a test-kernel for
the user with the patch added and ask him to test with the patched-kernel?

As a sidenote, another interesting thing is that seemingly no ACPI events are fired when
the device is "folded".

Hmm, that is weird, there is a handler for such an event in the EC event handler
table in the DSDT. How did you monitor this?

Can you ask the user to run "sudo evemu-record" and then select the
"Intel Virtual Button driver" device? That should now report 0 as state
for SW_TABLET_MODE when booted in normal clamshell mode; and hopefully it
will change to 1 when the user folds the 2-in-1 into tablet mode.

Regards,

Hans
>From 21104b5f14bb485cb36c3283056efb7f6f2b8ebf Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@xxxxxxxxxx>
Date: Fri, 11 Sep 2020 13:34:42 +0200
Subject: [PATCH] platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting
 1 on the HP Pavilion 11 x360

Commit cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist
SW_TABLET_MODE on the 9 / "Laptop" chasis-type") restored SW_TABLET_MODE
reporting on the HP stream x360 11 series on which it was previously broken
by commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet
mode switch on 2-in-1's").

It turns out that enabling SW_TABLET_MODE reporting on devices with a
chassis-type of 10 ("Notebook") causes SW_TABLET_MODE to always report 1
at boot on the HP Pavilion 11 x360, which causes libinput to disable the
kbd and touchpad.

The HP Pavilion 11 x360's ACPI VGBS method sets bit 4 instead of bit 6 when
NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT collection
shows only one other model, the Medion E1239T ever setting bit 4 and it
always sets this together with bit 6.

So lets treat bit 4 as a second bit which when set indicates the device not
being in tablet-mode, as we already do for bit 6.

While at it also prefix all VGBS constant defines with "VGBS_".

Fixes: cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type")
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
 drivers/platform/x86/intel-vbtn.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
index e85d8e58320c..f443619e1e7e 100644
--- a/drivers/platform/x86/intel-vbtn.c
+++ b/drivers/platform/x86/intel-vbtn.c
@@ -15,9 +15,13 @@
 #include <linux/platform_device.h>
 #include <linux/suspend.h>
 
+/* Returned when NOT in tablet mode on some HP Stream x360 11 models */
+#define VGBS_TABLET_MODE_FLAG_ALT	0x10
 /* When NOT in tablet mode, VGBS returns with the flag 0x40 */
-#define TABLET_MODE_FLAG 0x40
-#define DOCK_MODE_FLAG   0x80
+#define VGBS_TABLET_MODE_FLAG		0x40
+#define VGBS_DOCK_MODE_FLAG		0x80
+
+#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("AceLan Kao");
@@ -72,9 +76,9 @@ static void detect_tablet_mode(struct platform_device *device)
 	if (ACPI_FAILURE(status))
 		return;
 
-	m = !(vgbs & TABLET_MODE_FLAG);
+	m = !(vgbs & VGBS_TABLET_MODE_FLAGS);
 	input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
-	m = (vgbs & DOCK_MODE_FLAG) ? 1 : 0;
+	m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0;
 	input_report_switch(priv->input_dev, SW_DOCK, m);
 }
 
-- 
2.28.0


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux