Skip to contentSkip to conversation

platform/x86: intel-hid: Do not create SW_TABLET_MODE input-dev when a KIOX010A ACPI dev is present

PATCH In review Hans de Goede 2 participants 2 messages Dec 7, 2020 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: intel-hid: Do not create SW_TABLET_MODE input-dev when a KIOX010A ACPI dev is present

Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers to allow the OS to determine the angle between the display and the base of the device. On Windows these are read by a special HingeAngleService process which calls an ACPI DSM (Device Specific Method) on the ACPI KIOX010A device node for the sensor in the display, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can disable the kbd and touchpad to avoid spurious input in tablet-mode.

The linux kxcjk1013 driver calls the DSM for this once at probe time to ensure that the builtin kbd and touchpad work. On some devices this causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case there is not a functional tablet-mode switch, so we should not register the tablet-mode switch device.

---
 drivers/platform/x86/intel-hid.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/platform/x86/intel-hid.c +16 -1
index 66ccdc17a64d..4a396ef54d2e 100644
@@ -441,8 +441,23 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
 	 * Some convertible have unreliable VGBS return which could cause incorrect
 	 * SW_TABLET_MODE report, in these cases we enable support when receiving
 	 * the first event instead of during driver setup.
+	 *
+	 * Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers
+	 * to allow the OS to determine the angle between the display and the base
+	 * of the device. On Windows these are read by a special HingeAngleService
+	 * process which calls an ACPI DSM (Device Specific Method) on the
+	 * ACPI KIOX010A device node for the sensor in the display, to let the
+	 * firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can
+	 * disable the kbd and touchpad to avoid spurious input in tablet-mode.
+	 *
+	 * The linux kxcjk1013 driver calls the DSM for this once at probe time
+	 * to ensure that the builtin kbd and touchpad work. On some devices this
+	 * causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case
+	 * there is not a functional tablet-mode switch, so we should not register
+	 * the tablet-mode switch device.
 	 */
-	if (!priv->switches && (event == 0xcc || event == 0xcd)) {
+	if (!priv->switches && (event == 0xcc || event == 0xcd) &&
+	    !acpi_dev_present("KIOX010A", NULL, -1)) {
 		dev_info(&device->dev, "switch event received, enable switches supports\n");
 		err = intel_hid_switches_setup(device);
 		if (err)
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Hans de Goede

Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers

Yoga

Quoted 3 lines

to allow the OS to determine the angle between the display and the base of the device. On Windows these are read by a special HingeAngleService process which calls an ACPI DSM (Device Specific Method) on the

_DSM

Quoted 3 lines

ACPI KIOX010A device node for the sensor in the display, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can disable the kbd and touchpad to avoid spurious input in tablet-mode.

keyboard

Quoted 1 line

The linux kxcjk1013 driver calls the DSM for this once at probe time

Perhaps similar way as above: On Linux the ...

(Note 'Linux' with capital letter)

_DSM

Quoted 1 line

to ensure that the builtin kbd and touchpad work. On some devices this

keyboard

Quoted 1 line

causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case

device

Quoted 2 lines

there is not a functional tablet-mode switch, so we should not register the tablet-mode switch device.

Same comments for below text (IIUC that one is identical).

Quoted 38 lines
---
 drivers/platform/x86/intel-hid.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/platform/x86/intel-hid.c +16 -2
index 66ccdc17a64d..4a396ef54d2e 100644
@@ -441,8 +441,23 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
         * Some convertible have unreliable VGBS return which could cause incorrect
         * SW_TABLET_MODE report, in these cases we enable support when receiving
         * the first event instead of during driver setup.
+        *
+        * Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers
+        * to allow the OS to determine the angle between the display and the base
+        * of the device. On Windows these are read by a special HingeAngleService
+        * process which calls an ACPI DSM (Device Specific Method) on the
+        * ACPI KIOX010A device node for the sensor in the display, to let the
+        * firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can
+        * disable the kbd and touchpad to avoid spurious input in tablet-mode.
+        *
+        * The linux kxcjk1013 driver calls the DSM for this once at probe time
+        * to ensure that the builtin kbd and touchpad work. On some devices this
+        * causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case
+        * there is not a functional tablet-mode switch, so we should not register
+        * the tablet-mode switch device.
         */
-       if (!priv->switches && (event == 0xcc || event == 0xcd)) {
+       if (!priv->switches && (event == 0xcc || event == 0xcd) &&
+           !acpi_dev_present("KIOX010A", NULL, -1)) {
                dev_info(&device->dev, "switch event received, enable switches supports\n");
                err = intel_hid_switches_setup(device);
                if (err)
--

2.28.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko