1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Helper code to detect 360 degree hinges (yoga) style 2-in-1 devices using 2 accelerometers
4 * to allow the OS to determine the angle between the display and the base of the device.
6 * On Windows these are read by a special HingeAngleService process which calls undocumented
7 * ACPI methods, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode.
8 * The firmware may use this to disable the kbd and touchpad to avoid spurious input in
9 * tablet-mode as well as to report SW_TABLET_MODE info to the OS.
11 * Since Linux does not call these undocumented methods, the SW_TABLET_MODE info reported
12 * by various drivers/platform/x86 drivers is incorrect. These drivers use the detection
13 * code in this file to disable SW_TABLET_MODE reporting to avoid reporting broken info
14 * (instead userspace can derive the status itself by directly reading the 2 accels).
17 #include <linux/acpi.h>
18 #include <linux/i2c.h>
20 static bool dual_accel_detect_bosc0200(void)
22 struct acpi_device
*adev
;
25 adev
= acpi_dev_get_first_match_dev("BOSC0200", NULL
, -1);
29 count
= i2c_acpi_client_count(adev
);
36 static bool dual_accel_detect(void)
38 /* Systems which use a pair of accels with KIOX010A / KIOX020A ACPI ids */
39 if (acpi_dev_present("KIOX010A", NULL
, -1) &&
40 acpi_dev_present("KIOX020A", NULL
, -1))
43 /* Systems which use a single DUAL250E ACPI device to model 2 accels */
44 if (acpi_dev_present("DUAL250E", NULL
, -1))
47 /* Systems which use a single BOSC0200 ACPI device to model 2 accels */
48 if (dual_accel_detect_bosc0200())