Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
9e723c5
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
chrome
goldfish
mellanox
mips
olpc
surface
x86
dell
intel
intel_speed_select_if
Kconfig
Makefile
acer-wireless.c
acer-wmi.c
acerhdf.c
adv_swbutton.c
amd-pmc.c
amilo-rfkill.c
apple-gmux.c
asus-laptop.c
asus-nb-wmi.c
asus-wireless.c
asus-wmi.c
asus-wmi.h
classmate-laptop.c
compal-laptop.c
dual_accel_detect.h
eeepc-laptop.c
eeepc-wmi.c
firmware_attributes_class.c
firmware_attributes_class.h
fujitsu-laptop.c
fujitsu-tablet.c
gigabyte-wmi.c
gpd-pocket-fan.c
hdaps.c
hp-wmi.c
hp_accel.c
huawei-wmi.c
i2c-multi-instantiate.c
ibm_rtl.c
ideapad-laptop.c
intel-hid.c
intel-rst.c
intel-smartconnect.c
intel-uncore-frequency.c
intel-vbtn.c
intel-wmi-sbl-fw-update.c
intel-wmi-thunderbolt.c
intel_atomisp2_led.c
intel_atomisp2_pm.c
intel_bxtwc_tmu.c
intel_chtdc_ti_pwrbtn.c
intel_int0002_vgpio.c
intel_ips.c
intel_ips.h
intel_menlow.c
intel_mrfld_pwrbtn.c
intel_oaktrail.c
intel_pmc_core.c
intel_pmc_core.h
intel_pmc_core_pltdrv.c
intel_pmt_class.c
intel_pmt_class.h
intel_pmt_crashlog.c
intel_pmt_telemetry.c
intel_punit_ipc.c
intel_scu_ipc.c
intel_scu_ipcutil.c
intel_scu_pcidrv.c
intel_scu_pltdrv.c
intel_scu_wdt.c
intel_telemetry_core.c
intel_telemetry_debugfs.c
intel_telemetry_pltdrv.c
intel_turbo_max_3.c
lg-laptop.c
mlx-platform.c
msi-laptop.c
msi-wmi.c
mxm-wmi.c
panasonic-laptop.c
pcengines-apuv2.c
peaq-wmi.c
pmc_atom.c
samsung-laptop.c
samsung-q10.c
sony-laptop.c
system76_acpi.c
tc1100-wmi.c
think-lmi.c
think-lmi.h
thinkpad_acpi.c
topstar-laptop.c
toshiba-wmi.c
toshiba_acpi.c
toshiba_bluetooth.c
toshiba_haps.c
touchscreen_dmi.c
uv_sysfs.c
wireless-hotkey.c
wmi-bmof.c
wmi.c
xiaomi-wmi.c
xo1-rfkill.c
xo15-ebook.c
Kconfig
Makefile
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
uio
usb
vdpa
vfio
vhost
video
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
platform
/
x86
/
dual_accel_detect.h
Blame
Blame
Latest commit
History
History
76 lines (60 loc) · 2.17 KB
Breadcrumbs
linux
/
drivers
/
platform
/
x86
/
dual_accel_detect.h
Top
File metadata and controls
Code
Blame
76 lines (60 loc) · 2.17 KB
Raw
/* SPDX-License-Identifier: GPL-2.0 */ /* * Helper code to detect 360 degree hinges (yoga) style 2-in-1 devices using 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 undocumented * ACPI methods, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode. * The firmware may use this to disable the kbd and touchpad to avoid spurious input in * tablet-mode as well as to report SW_TABLET_MODE info to the OS. * * Since Linux does not call these undocumented methods, the SW_TABLET_MODE info reported * by various drivers/platform/x86 drivers is incorrect. These drivers use the detection * code in this file to disable SW_TABLET_MODE reporting to avoid reporting broken info * (instead userspace can derive the status itself by directly reading the 2 accels). */ #include <linux/acpi.h> #include <linux/i2c.h> static int dual_accel_i2c_resource_count(struct acpi_resource *ares, void *data) { struct acpi_resource_i2c_serialbus *sb; int *count = data; if (i2c_acpi_get_i2c_resource(ares, &sb)) *count = *count + 1; return 1; } static int dual_accel_i2c_client_count(struct acpi_device *adev) { int ret, count = 0; LIST_HEAD(r); ret = acpi_dev_get_resources(adev, &r, dual_accel_i2c_resource_count, &count); if (ret < 0) return ret; acpi_dev_free_resource_list(&r); return count; } static bool dual_accel_detect_bosc0200(void) { struct acpi_device *adev; int count; adev = acpi_dev_get_first_match_dev("BOSC0200", NULL, -1); if (!adev) return false; count = dual_accel_i2c_client_count(adev); acpi_dev_put(adev); return count == 2; } static bool dual_accel_detect(void) { /* Systems which use a pair of accels with KIOX010A / KIOX020A ACPI ids */ if (acpi_dev_present("KIOX010A", NULL, -1) && acpi_dev_present("KIOX020A", NULL, -1)) return true; /* Systems which use a single DUAL250E ACPI device to model 2 accels */ if (acpi_dev_present("DUAL250E", NULL, -1)) return true; /* Systems which use a single BOSC0200 ACPI device to model 2 accels */ if (dual_accel_detect_bosc0200()) return true; return false; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
You can’t perform that action at this time.