![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * Helper code to detect 360 degree hinges (yoga) style 2-in-1 devices using 2 accelerometers 0004 * to allow the OS to determine the angle between the display and the base of the device. 0005 * 0006 * On Windows these are read by a special HingeAngleService process which calls undocumented 0007 * ACPI methods, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode. 0008 * The firmware may use this to disable the kbd and touchpad to avoid spurious input in 0009 * tablet-mode as well as to report SW_TABLET_MODE info to the OS. 0010 * 0011 * Since Linux does not call these undocumented methods, the SW_TABLET_MODE info reported 0012 * by various drivers/platform/x86 drivers is incorrect. These drivers use the detection 0013 * code in this file to disable SW_TABLET_MODE reporting to avoid reporting broken info 0014 * (instead userspace can derive the status itself by directly reading the 2 accels). 0015 */ 0016 0017 #include <linux/acpi.h> 0018 #include <linux/i2c.h> 0019 0020 static bool dual_accel_detect_bosc0200(void) 0021 { 0022 struct acpi_device *adev; 0023 int count; 0024 0025 adev = acpi_dev_get_first_match_dev("BOSC0200", NULL, -1); 0026 if (!adev) 0027 return false; 0028 0029 count = i2c_acpi_client_count(adev); 0030 0031 acpi_dev_put(adev); 0032 0033 return count == 2; 0034 } 0035 0036 static bool dual_accel_detect(void) 0037 { 0038 /* Systems which use a pair of accels with KIOX010A / KIOX020A ACPI ids */ 0039 if (acpi_dev_present("KIOX010A", NULL, -1) && 0040 acpi_dev_present("KIOX020A", NULL, -1)) 0041 return true; 0042 0043 /* Systems which use a single DUAL250E ACPI device to model 2 accels */ 0044 if (acpi_dev_present("DUAL250E", NULL, -1)) 0045 return true; 0046 0047 /* Systems which use a single BOSC0200 ACPI device to model 2 accels */ 0048 if (dual_accel_detect_bosc0200()) 0049 return true; 0050 0051 return false; 0052 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |