xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/laptops/thinkpad-acpi.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===========================
2*4882a593SmuzhiyunThinkPad ACPI Extras Driver
3*4882a593Smuzhiyun===========================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunVersion 0.25
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunOctober 16th,  2013
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun- Borislav Deianov <borislav@users.sf.net>
10*4882a593Smuzhiyun- Henrique de Moraes Holschuh <hmh@hmh.eng.br>
11*4882a593Smuzhiyun
12*4882a593Smuzhiyunhttp://ibm-acpi.sf.net/
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunThis is a Linux driver for the IBM and Lenovo ThinkPad laptops. It
15*4882a593Smuzhiyunsupports various features of these laptops which are accessible
16*4882a593Smuzhiyunthrough the ACPI and ACPI EC framework, but not otherwise fully
17*4882a593Smuzhiyunsupported by the generic Linux ACPI drivers.
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThis driver used to be named ibm-acpi until kernel 2.6.21 and release
20*4882a593Smuzhiyun0.13-20070314.  It used to be in the drivers/acpi tree, but it was
21*4882a593Smuzhiyunmoved to the drivers/misc tree and renamed to thinkpad-acpi for kernel
22*4882a593Smuzhiyun2.6.22, and release 0.14.  It was moved to drivers/platform/x86 for
23*4882a593Smuzhiyunkernel 2.6.29 and release 0.22.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe driver is named "thinkpad-acpi".  In some places, like module
26*4882a593Smuzhiyunnames and log messages, "thinkpad_acpi" is used because of userspace
27*4882a593Smuzhiyunissues.
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun"tpacpi" is used as a shorthand where "thinkpad-acpi" would be too
30*4882a593Smuzhiyunlong due to length limitations on some Linux kernel versions.
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunStatus
33*4882a593Smuzhiyun------
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunThe features currently supported are the following (see below for
36*4882a593Smuzhiyundetailed description):
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun	- Fn key combinations
39*4882a593Smuzhiyun	- Bluetooth enable and disable
40*4882a593Smuzhiyun	- video output switching, expansion control
41*4882a593Smuzhiyun	- ThinkLight on and off
42*4882a593Smuzhiyun	- CMOS/UCMS control
43*4882a593Smuzhiyun	- LED control
44*4882a593Smuzhiyun	- ACPI sounds
45*4882a593Smuzhiyun	- temperature sensors
46*4882a593Smuzhiyun	- Experimental: embedded controller register dump
47*4882a593Smuzhiyun	- LCD brightness control
48*4882a593Smuzhiyun	- Volume control
49*4882a593Smuzhiyun	- Fan control and monitoring: fan speed, fan enable/disable
50*4882a593Smuzhiyun	- WAN enable and disable
51*4882a593Smuzhiyun	- UWB enable and disable
52*4882a593Smuzhiyun	- LCD Shadow (PrivacyGuard) enable and disable
53*4882a593Smuzhiyun	- Lap mode sensor
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunA compatibility table by model and feature is maintained on the web
56*4882a593Smuzhiyunsite, http://ibm-acpi.sf.net/. I appreciate any success or failure
57*4882a593Smuzhiyunreports, especially if they add to or correct the compatibility table.
58*4882a593SmuzhiyunPlease include the following information in your report:
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun	- ThinkPad model name
61*4882a593Smuzhiyun	- a copy of your ACPI tables, using the "acpidump" utility
62*4882a593Smuzhiyun	- a copy of the output of dmidecode, with serial numbers
63*4882a593Smuzhiyun	  and UUIDs masked off
64*4882a593Smuzhiyun	- which driver features work and which don't
65*4882a593Smuzhiyun	- the observed behavior of non-working features
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunAny other comments or patches are also more than welcome.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunInstallation
71*4882a593Smuzhiyun------------
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunIf you are compiling this driver as included in the Linux kernel
74*4882a593Smuzhiyunsources, look for the CONFIG_THINKPAD_ACPI Kconfig option.
75*4882a593SmuzhiyunIt is located on the menu path: "Device Drivers" -> "X86 Platform
76*4882a593SmuzhiyunSpecific Device Drivers" -> "ThinkPad ACPI Laptop Extras".
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunFeatures
80*4882a593Smuzhiyun--------
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunThe driver exports two different interfaces to userspace, which can be
83*4882a593Smuzhiyunused to access the features it provides.  One is a legacy procfs-based
84*4882a593Smuzhiyuninterface, which will be removed at some time in the future.  The other
85*4882a593Smuzhiyunis a new sysfs-based interface which is not complete yet.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunThe procfs interface creates the /proc/acpi/ibm directory.  There is a
88*4882a593Smuzhiyunfile under that directory for each feature it supports.  The procfs
89*4882a593Smuzhiyuninterface is mostly frozen, and will change very little if at all: it
90*4882a593Smuzhiyunwill not be extended to add any new functionality in the driver, instead
91*4882a593Smuzhiyunall new functionality will be implemented on the sysfs interface.
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunThe sysfs interface tries to blend in the generic Linux sysfs subsystems
94*4882a593Smuzhiyunand classes as much as possible.  Since some of these subsystems are not
95*4882a593Smuzhiyunyet ready or stabilized, it is expected that this interface will change,
96*4882a593Smuzhiyunand any and all userspace programs must deal with it.
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunNotes about the sysfs interface
100*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunUnlike what was done with the procfs interface, correctness when talking
103*4882a593Smuzhiyunto the sysfs interfaces will be enforced, as will correctness in the
104*4882a593Smuzhiyunthinkpad-acpi's implementation of sysfs interfaces.
105*4882a593Smuzhiyun
106*4882a593SmuzhiyunAlso, any bugs in the thinkpad-acpi sysfs driver code or in the
107*4882a593Smuzhiyunthinkpad-acpi's implementation of the sysfs interfaces will be fixed for
108*4882a593Smuzhiyunmaximum correctness, even if that means changing an interface in
109*4882a593Smuzhiyunnon-compatible ways.  As these interfaces mature both in the kernel and
110*4882a593Smuzhiyunin thinkpad-acpi, such changes should become quite rare.
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunApplications interfacing to the thinkpad-acpi sysfs interfaces must
113*4882a593Smuzhiyunfollow all sysfs guidelines and correctly process all errors (the sysfs
114*4882a593Smuzhiyuninterface makes extensive use of errors).  File descriptors and open /
115*4882a593Smuzhiyunclose operations to the sysfs inodes must also be properly implemented.
116*4882a593Smuzhiyun
117*4882a593SmuzhiyunThe version of thinkpad-acpi's sysfs interface is exported by the driver
118*4882a593Smuzhiyunas a driver attribute (see below).
119*4882a593Smuzhiyun
120*4882a593SmuzhiyunSysfs driver attributes are on the driver's sysfs attribute space,
121*4882a593Smuzhiyunfor 2.6.23+ this is /sys/bus/platform/drivers/thinkpad_acpi/ and
122*4882a593Smuzhiyun/sys/bus/platform/drivers/thinkpad_hwmon/
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunSysfs device attributes are on the thinkpad_acpi device sysfs attribute
125*4882a593Smuzhiyunspace, for 2.6.23+ this is /sys/devices/platform/thinkpad_acpi/.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunSysfs device attributes for the sensors and fan are on the
128*4882a593Smuzhiyunthinkpad_hwmon device's sysfs attribute space, but you should locate it
129*4882a593Smuzhiyunlooking for a hwmon device with the name attribute of "thinkpad", or
130*4882a593Smuzhiyunbetter yet, through libsensors. For 4.14+ sysfs attributes were moved to the
131*4882a593Smuzhiyunhwmon device (/sys/bus/platform/devices/thinkpad_hwmon/hwmon/hwmon? or
132*4882a593Smuzhiyun/sys/class/hwmon/hwmon?).
133*4882a593Smuzhiyun
134*4882a593SmuzhiyunDriver version
135*4882a593Smuzhiyun--------------
136*4882a593Smuzhiyun
137*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/driver
138*4882a593Smuzhiyun
139*4882a593Smuzhiyunsysfs driver attribute: version
140*4882a593Smuzhiyun
141*4882a593SmuzhiyunThe driver name and version. No commands can be written to this file.
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunSysfs interface version
145*4882a593Smuzhiyun-----------------------
146*4882a593Smuzhiyun
147*4882a593Smuzhiyunsysfs driver attribute: interface_version
148*4882a593Smuzhiyun
149*4882a593SmuzhiyunVersion of the thinkpad-acpi sysfs interface, as an unsigned long
150*4882a593Smuzhiyun(output in hex format: 0xAAAABBCC), where:
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun	AAAA
153*4882a593Smuzhiyun	  - major revision
154*4882a593Smuzhiyun	BB
155*4882a593Smuzhiyun	  - minor revision
156*4882a593Smuzhiyun	CC
157*4882a593Smuzhiyun	  - bugfix revision
158*4882a593Smuzhiyun
159*4882a593SmuzhiyunThe sysfs interface version changelog for the driver can be found at the
160*4882a593Smuzhiyunend of this document.  Changes to the sysfs interface done by the kernel
161*4882a593Smuzhiyunsubsystems are not documented here, nor are they tracked by this
162*4882a593Smuzhiyunattribute.
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunChanges to the thinkpad-acpi sysfs interface are only considered
165*4882a593Smuzhiyunnon-experimental when they are submitted to Linux mainline, at which
166*4882a593Smuzhiyunpoint the changes in this interface are documented and interface_version
167*4882a593Smuzhiyunmay be updated.  If you are using any thinkpad-acpi features not yet
168*4882a593Smuzhiyunsent to mainline for merging, you do so on your own risk: these features
169*4882a593Smuzhiyunmay disappear, or be implemented in a different and incompatible way by
170*4882a593Smuzhiyunthe time they are merged in Linux mainline.
171*4882a593Smuzhiyun
172*4882a593SmuzhiyunChanges that are backwards-compatible by nature (e.g. the addition of
173*4882a593Smuzhiyunattributes that do not change the way the other attributes work) do not
174*4882a593Smuzhiyunalways warrant an update of interface_version.  Therefore, one must
175*4882a593Smuzhiyunexpect that an attribute might not be there, and deal with it properly
176*4882a593Smuzhiyun(an attribute not being there *is* a valid way to make it clear that a
177*4882a593Smuzhiyunfeature is not available in sysfs).
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunHot keys
181*4882a593Smuzhiyun--------
182*4882a593Smuzhiyun
183*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/hotkey
184*4882a593Smuzhiyun
185*4882a593Smuzhiyunsysfs device attribute: hotkey_*
186*4882a593Smuzhiyun
187*4882a593SmuzhiyunIn a ThinkPad, the ACPI HKEY handler is responsible for communicating
188*4882a593Smuzhiyunsome important events and also keyboard hot key presses to the operating
189*4882a593Smuzhiyunsystem.  Enabling the hotkey functionality of thinkpad-acpi signals the
190*4882a593Smuzhiyunfirmware that such a driver is present, and modifies how the ThinkPad
191*4882a593Smuzhiyunfirmware will behave in many situations.
192*4882a593Smuzhiyun
193*4882a593SmuzhiyunThe driver enables the HKEY ("hot key") event reporting automatically
194*4882a593Smuzhiyunwhen loaded, and disables it when it is removed.
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunThe driver will report HKEY events in the following format::
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun	ibm/hotkey HKEY 00000080 0000xxxx
199*4882a593Smuzhiyun
200*4882a593SmuzhiyunSome of these events refer to hot key presses, but not all of them.
201*4882a593Smuzhiyun
202*4882a593SmuzhiyunThe driver will generate events over the input layer for hot keys and
203*4882a593Smuzhiyunradio switches, and over the ACPI netlink layer for other events.  The
204*4882a593Smuzhiyuninput layer support accepts the standard IOCTLs to remap the keycodes
205*4882a593Smuzhiyunassigned to each hot key.
206*4882a593Smuzhiyun
207*4882a593SmuzhiyunThe hot key bit mask allows some control over which hot keys generate
208*4882a593Smuzhiyunevents.  If a key is "masked" (bit set to 0 in the mask), the firmware
209*4882a593Smuzhiyunwill handle it.  If it is "unmasked", it signals the firmware that
210*4882a593Smuzhiyunthinkpad-acpi would prefer to handle it, if the firmware would be so
211*4882a593Smuzhiyunkind to allow it (and it often doesn't!).
212*4882a593Smuzhiyun
213*4882a593SmuzhiyunNot all bits in the mask can be modified.  Not all bits that can be
214*4882a593Smuzhiyunmodified do anything.  Not all hot keys can be individually controlled
215*4882a593Smuzhiyunby the mask.  Some models do not support the mask at all.  The behaviour
216*4882a593Smuzhiyunof the mask is, therefore, highly dependent on the ThinkPad model.
217*4882a593Smuzhiyun
218*4882a593SmuzhiyunThe driver will filter out any unmasked hotkeys, so even if the firmware
219*4882a593Smuzhiyundoesn't allow disabling an specific hotkey, the driver will not report
220*4882a593Smuzhiyunevents for unmasked hotkeys.
221*4882a593Smuzhiyun
222*4882a593SmuzhiyunNote that unmasking some keys prevents their default behavior.  For
223*4882a593Smuzhiyunexample, if Fn+F5 is unmasked, that key will no longer enable/disable
224*4882a593SmuzhiyunBluetooth by itself in firmware.
225*4882a593Smuzhiyun
226*4882a593SmuzhiyunNote also that not all Fn key combinations are supported through ACPI
227*4882a593Smuzhiyundepending on the ThinkPad model and firmware version.  On those
228*4882a593SmuzhiyunThinkPads, it is still possible to support some extra hotkeys by
229*4882a593Smuzhiyunpolling the "CMOS NVRAM" at least 10 times per second.  The driver
230*4882a593Smuzhiyunattempts to enables this functionality automatically when required.
231*4882a593Smuzhiyun
232*4882a593Smuzhiyunprocfs notes
233*4882a593Smuzhiyun^^^^^^^^^^^^
234*4882a593Smuzhiyun
235*4882a593SmuzhiyunThe following commands can be written to the /proc/acpi/ibm/hotkey file::
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun	echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
238*4882a593Smuzhiyun	echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
239*4882a593Smuzhiyun	... any other 8-hex-digit mask ...
240*4882a593Smuzhiyun	echo reset > /proc/acpi/ibm/hotkey -- restore the recommended mask
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunThe following commands have been deprecated and will cause the kernel
243*4882a593Smuzhiyunto log a warning::
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun	echo enable > /proc/acpi/ibm/hotkey -- does nothing
246*4882a593Smuzhiyun	echo disable > /proc/acpi/ibm/hotkey -- returns an error
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunThe procfs interface does not support NVRAM polling control.  So as to
249*4882a593Smuzhiyunmaintain maximum bug-to-bug compatibility, it does not report any masks,
250*4882a593Smuzhiyunnor does it allow one to manipulate the hot key mask when the firmware
251*4882a593Smuzhiyundoes not support masks at all, even if NVRAM polling is in use.
252*4882a593Smuzhiyun
253*4882a593Smuzhiyunsysfs notes
254*4882a593Smuzhiyun^^^^^^^^^^^
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun	hotkey_bios_enabled:
257*4882a593Smuzhiyun		DEPRECATED, WILL BE REMOVED SOON.
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun		Returns 0.
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun	hotkey_bios_mask:
262*4882a593Smuzhiyun		DEPRECATED, DON'T USE, WILL BE REMOVED IN THE FUTURE.
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun		Returns the hot keys mask when thinkpad-acpi was loaded.
265*4882a593Smuzhiyun		Upon module unload, the hot keys mask will be restored
266*4882a593Smuzhiyun		to this value.   This is always 0x80c, because those are
267*4882a593Smuzhiyun		the hotkeys that were supported by ancient firmware
268*4882a593Smuzhiyun		without mask support.
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun	hotkey_enable:
271*4882a593Smuzhiyun		DEPRECATED, WILL BE REMOVED SOON.
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun		0: returns -EPERM
274*4882a593Smuzhiyun		1: does nothing
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun	hotkey_mask:
277*4882a593Smuzhiyun		bit mask to enable reporting (and depending on
278*4882a593Smuzhiyun		the firmware, ACPI event generation) for each hot key
279*4882a593Smuzhiyun		(see above).  Returns the current status of the hot keys
280*4882a593Smuzhiyun		mask, and allows one to modify it.
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun	hotkey_all_mask:
283*4882a593Smuzhiyun		bit mask that should enable event reporting for all
284*4882a593Smuzhiyun		supported hot keys, when echoed to hotkey_mask above.
285*4882a593Smuzhiyun		Unless you know which events need to be handled
286*4882a593Smuzhiyun		passively (because the firmware *will* handle them
287*4882a593Smuzhiyun		anyway), do *not* use hotkey_all_mask.  Use
288*4882a593Smuzhiyun		hotkey_recommended_mask, instead. You have been warned.
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun	hotkey_recommended_mask:
291*4882a593Smuzhiyun		bit mask that should enable event reporting for all
292*4882a593Smuzhiyun		supported hot keys, except those which are always
293*4882a593Smuzhiyun		handled by the firmware anyway.  Echo it to
294*4882a593Smuzhiyun		hotkey_mask above, to use.  This is the default mask
295*4882a593Smuzhiyun		used by the driver.
296*4882a593Smuzhiyun
297*4882a593Smuzhiyun	hotkey_source_mask:
298*4882a593Smuzhiyun		bit mask that selects which hot keys will the driver
299*4882a593Smuzhiyun		poll the NVRAM for.  This is auto-detected by the driver
300*4882a593Smuzhiyun		based on the capabilities reported by the ACPI firmware,
301*4882a593Smuzhiyun		but it can be overridden at runtime.
302*4882a593Smuzhiyun
303*4882a593Smuzhiyun		Hot keys whose bits are set in hotkey_source_mask are
304*4882a593Smuzhiyun		polled for in NVRAM, and reported as hotkey events if
305*4882a593Smuzhiyun		enabled in hotkey_mask.  Only a few hot keys are
306*4882a593Smuzhiyun		available through CMOS NVRAM polling.
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun		Warning: when in NVRAM mode, the volume up/down/mute
309*4882a593Smuzhiyun		keys are synthesized according to changes in the mixer,
310*4882a593Smuzhiyun		which uses a single volume up or volume down hotkey
311*4882a593Smuzhiyun		press to unmute, as per the ThinkPad volume mixer user
312*4882a593Smuzhiyun		interface.  When in ACPI event mode, volume up/down/mute
313*4882a593Smuzhiyun		events are reported by the firmware and can behave
314*4882a593Smuzhiyun		differently (and that behaviour changes with firmware
315*4882a593Smuzhiyun		version -- not just with firmware models -- as well as
316*4882a593Smuzhiyun		OSI(Linux) state).
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun	hotkey_poll_freq:
319*4882a593Smuzhiyun		frequency in Hz for hot key polling. It must be between
320*4882a593Smuzhiyun		0 and 25 Hz.  Polling is only carried out when strictly
321*4882a593Smuzhiyun		needed.
322*4882a593Smuzhiyun
323*4882a593Smuzhiyun		Setting hotkey_poll_freq to zero disables polling, and
324*4882a593Smuzhiyun		will cause hot key presses that require NVRAM polling
325*4882a593Smuzhiyun		to never be reported.
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun		Setting hotkey_poll_freq too low may cause repeated
328*4882a593Smuzhiyun		pressings of the same hot key to be misreported as a
329*4882a593Smuzhiyun		single key press, or to not even be detected at all.
330*4882a593Smuzhiyun		The recommended polling frequency is 10Hz.
331*4882a593Smuzhiyun
332*4882a593Smuzhiyun	hotkey_radio_sw:
333*4882a593Smuzhiyun		If the ThinkPad has a hardware radio switch, this
334*4882a593Smuzhiyun		attribute will read 0 if the switch is in the "radios
335*4882a593Smuzhiyun		disabled" position, and 1 if the switch is in the
336*4882a593Smuzhiyun		"radios enabled" position.
337*4882a593Smuzhiyun
338*4882a593Smuzhiyun		This attribute has poll()/select() support.
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun	hotkey_tablet_mode:
341*4882a593Smuzhiyun		If the ThinkPad has tablet capabilities, this attribute
342*4882a593Smuzhiyun		will read 0 if the ThinkPad is in normal mode, and
343*4882a593Smuzhiyun		1 if the ThinkPad is in tablet mode.
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun		This attribute has poll()/select() support.
346*4882a593Smuzhiyun
347*4882a593Smuzhiyun	wakeup_reason:
348*4882a593Smuzhiyun		Set to 1 if the system is waking up because the user
349*4882a593Smuzhiyun		requested a bay ejection.  Set to 2 if the system is
350*4882a593Smuzhiyun		waking up because the user requested the system to
351*4882a593Smuzhiyun		undock.  Set to zero for normal wake-ups or wake-ups
352*4882a593Smuzhiyun		due to unknown reasons.
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun		This attribute has poll()/select() support.
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun	wakeup_hotunplug_complete:
357*4882a593Smuzhiyun		Set to 1 if the system was waken up because of an
358*4882a593Smuzhiyun		undock or bay ejection request, and that request
359*4882a593Smuzhiyun		was successfully completed.  At this point, it might
360*4882a593Smuzhiyun		be useful to send the system back to sleep, at the
361*4882a593Smuzhiyun		user's choice.  Refer to HKEY events 0x4003 and
362*4882a593Smuzhiyun		0x3003, below.
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun		This attribute has poll()/select() support.
365*4882a593Smuzhiyun
366*4882a593Smuzhiyuninput layer notes
367*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunA Hot key is mapped to a single input layer EV_KEY event, possibly
370*4882a593Smuzhiyunfollowed by an EV_MSC MSC_SCAN event that shall contain that key's scan
371*4882a593Smuzhiyuncode.  An EV_SYN event will always be generated to mark the end of the
372*4882a593Smuzhiyunevent block.
373*4882a593Smuzhiyun
374*4882a593SmuzhiyunDo not use the EV_MSC MSC_SCAN events to process keys.  They are to be
375*4882a593Smuzhiyunused as a helper to remap keys, only.  They are particularly useful when
376*4882a593Smuzhiyunremapping KEY_UNKNOWN keys.
377*4882a593Smuzhiyun
378*4882a593SmuzhiyunThe events are available in an input device, with the following id:
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun	==============  ==============================
381*4882a593Smuzhiyun	Bus		BUS_HOST
382*4882a593Smuzhiyun	vendor		0x1014 (PCI_VENDOR_ID_IBM)  or
383*4882a593Smuzhiyun			0x17aa (PCI_VENDOR_ID_LENOVO)
384*4882a593Smuzhiyun	product		0x5054 ("TP")
385*4882a593Smuzhiyun	version		0x4101
386*4882a593Smuzhiyun	==============  ==============================
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunThe version will have its LSB incremented if the keymap changes in a
389*4882a593Smuzhiyunbackwards-compatible way.  The MSB shall always be 0x41 for this input
390*4882a593Smuzhiyundevice.  If the MSB is not 0x41, do not use the device as described in
391*4882a593Smuzhiyunthis section, as it is either something else (e.g. another input device
392*4882a593Smuzhiyunexported by a thinkpad driver, such as HDAPS) or its functionality has
393*4882a593Smuzhiyunbeen changed in a non-backwards compatible way.
394*4882a593Smuzhiyun
395*4882a593SmuzhiyunAdding other event types for other functionalities shall be considered a
396*4882a593Smuzhiyunbackwards-compatible change for this input device.
397*4882a593Smuzhiyun
398*4882a593SmuzhiyunThinkpad-acpi Hot Key event map (version 0x4101):
399*4882a593Smuzhiyun
400*4882a593Smuzhiyun=======	=======	==============	==============================================
401*4882a593SmuzhiyunACPI	Scan
402*4882a593Smuzhiyunevent	code	Key		Notes
403*4882a593Smuzhiyun=======	=======	==============	==============================================
404*4882a593Smuzhiyun0x1001	0x00	FN+F1		-
405*4882a593Smuzhiyun
406*4882a593Smuzhiyun0x1002	0x01	FN+F2		IBM: battery (rare)
407*4882a593Smuzhiyun				Lenovo: Screen lock
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun0x1003	0x02	FN+F3		Many IBM models always report
410*4882a593Smuzhiyun				this hot key, even with hot keys
411*4882a593Smuzhiyun				disabled or with Fn+F3 masked
412*4882a593Smuzhiyun				off
413*4882a593Smuzhiyun				IBM: screen lock, often turns
414*4882a593Smuzhiyun				off the ThinkLight as side-effect
415*4882a593Smuzhiyun				Lenovo: battery
416*4882a593Smuzhiyun
417*4882a593Smuzhiyun0x1004	0x03	FN+F4		Sleep button (ACPI sleep button
418*4882a593Smuzhiyun				semantics, i.e. sleep-to-RAM).
419*4882a593Smuzhiyun				It always generates some kind
420*4882a593Smuzhiyun				of event, either the hot key
421*4882a593Smuzhiyun				event or an ACPI sleep button
422*4882a593Smuzhiyun				event. The firmware may
423*4882a593Smuzhiyun				refuse to generate further FN+F4
424*4882a593Smuzhiyun				key presses until a S3 or S4 ACPI
425*4882a593Smuzhiyun				sleep cycle is performed or some
426*4882a593Smuzhiyun				time passes.
427*4882a593Smuzhiyun
428*4882a593Smuzhiyun0x1005	0x04	FN+F5		Radio.  Enables/disables
429*4882a593Smuzhiyun				the internal Bluetooth hardware
430*4882a593Smuzhiyun				and W-WAN card if left in control
431*4882a593Smuzhiyun				of the firmware.  Does not affect
432*4882a593Smuzhiyun				the WLAN card.
433*4882a593Smuzhiyun				Should be used to turn on/off all
434*4882a593Smuzhiyun				radios (Bluetooth+W-WAN+WLAN),
435*4882a593Smuzhiyun				really.
436*4882a593Smuzhiyun
437*4882a593Smuzhiyun0x1006	0x05	FN+F6		-
438*4882a593Smuzhiyun
439*4882a593Smuzhiyun0x1007	0x06	FN+F7		Video output cycle.
440*4882a593Smuzhiyun				Do you feel lucky today?
441*4882a593Smuzhiyun
442*4882a593Smuzhiyun0x1008	0x07	FN+F8		IBM: toggle screen expand
443*4882a593Smuzhiyun				Lenovo: configure UltraNav,
444*4882a593Smuzhiyun				or toggle screen expand
445*4882a593Smuzhiyun
446*4882a593Smuzhiyun0x1009	0x08	FN+F9		-
447*4882a593Smuzhiyun
448*4882a593Smuzhiyun...	...	...		...
449*4882a593Smuzhiyun
450*4882a593Smuzhiyun0x100B	0x0A	FN+F11		-
451*4882a593Smuzhiyun
452*4882a593Smuzhiyun0x100C	0x0B	FN+F12		Sleep to disk.  You are always
453*4882a593Smuzhiyun				supposed to handle it yourself,
454*4882a593Smuzhiyun				either through the ACPI event,
455*4882a593Smuzhiyun				or through a hotkey event.
456*4882a593Smuzhiyun				The firmware may refuse to
457*4882a593Smuzhiyun				generate further FN+F12 key
458*4882a593Smuzhiyun				press events until a S3 or S4
459*4882a593Smuzhiyun				ACPI sleep cycle is performed,
460*4882a593Smuzhiyun				or some time passes.
461*4882a593Smuzhiyun
462*4882a593Smuzhiyun0x100D	0x0C	FN+BACKSPACE	-
463*4882a593Smuzhiyun0x100E	0x0D	FN+INSERT	-
464*4882a593Smuzhiyun0x100F	0x0E	FN+DELETE	-
465*4882a593Smuzhiyun
466*4882a593Smuzhiyun0x1010	0x0F	FN+HOME		Brightness up.  This key is
467*4882a593Smuzhiyun				always handled by the firmware
468*4882a593Smuzhiyun				in IBM ThinkPads, even when
469*4882a593Smuzhiyun				unmasked.  Just leave it alone.
470*4882a593Smuzhiyun				For Lenovo ThinkPads with a new
471*4882a593Smuzhiyun				BIOS, it has to be handled either
472*4882a593Smuzhiyun				by the ACPI OSI, or by userspace.
473*4882a593Smuzhiyun				The driver does the right thing,
474*4882a593Smuzhiyun				never mess with this.
475*4882a593Smuzhiyun0x1011	0x10	FN+END		Brightness down.  See brightness
476*4882a593Smuzhiyun				up for details.
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun0x1012	0x11	FN+PGUP		ThinkLight toggle.  This key is
479*4882a593Smuzhiyun				always handled by the firmware,
480*4882a593Smuzhiyun				even when unmasked.
481*4882a593Smuzhiyun
482*4882a593Smuzhiyun0x1013	0x12	FN+PGDOWN	-
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun0x1014	0x13	FN+SPACE	Zoom key
485*4882a593Smuzhiyun
486*4882a593Smuzhiyun0x1015	0x14	VOLUME UP	Internal mixer volume up. This
487*4882a593Smuzhiyun				key is always handled by the
488*4882a593Smuzhiyun				firmware, even when unmasked.
489*4882a593Smuzhiyun				NOTE: Lenovo seems to be changing
490*4882a593Smuzhiyun				this.
491*4882a593Smuzhiyun0x1016	0x15	VOLUME DOWN	Internal mixer volume up. This
492*4882a593Smuzhiyun				key is always handled by the
493*4882a593Smuzhiyun				firmware, even when unmasked.
494*4882a593Smuzhiyun				NOTE: Lenovo seems to be changing
495*4882a593Smuzhiyun				this.
496*4882a593Smuzhiyun0x1017	0x16	MUTE		Mute internal mixer. This
497*4882a593Smuzhiyun				key is always handled by the
498*4882a593Smuzhiyun				firmware, even when unmasked.
499*4882a593Smuzhiyun
500*4882a593Smuzhiyun0x1018	0x17	THINKPAD	ThinkPad/Access IBM/Lenovo key
501*4882a593Smuzhiyun
502*4882a593Smuzhiyun0x1019	0x18	unknown
503*4882a593Smuzhiyun
504*4882a593Smuzhiyun...	...	...
505*4882a593Smuzhiyun
506*4882a593Smuzhiyun0x1020	0x1F	unknown
507*4882a593Smuzhiyun=======	=======	==============	==============================================
508*4882a593Smuzhiyun
509*4882a593SmuzhiyunThe ThinkPad firmware does not allow one to differentiate when most hot
510*4882a593Smuzhiyunkeys are pressed or released (either that, or we don't know how to, yet).
511*4882a593SmuzhiyunFor these keys, the driver generates a set of events for a key press and
512*4882a593Smuzhiyunimmediately issues the same set of events for a key release.  It is
513*4882a593Smuzhiyununknown by the driver if the ThinkPad firmware triggered these events on
514*4882a593Smuzhiyunhot key press or release, but the firmware will do it for either one, not
515*4882a593Smuzhiyunboth.
516*4882a593Smuzhiyun
517*4882a593SmuzhiyunIf a key is mapped to KEY_RESERVED, it generates no input events at all.
518*4882a593SmuzhiyunIf a key is mapped to KEY_UNKNOWN, it generates an input event that
519*4882a593Smuzhiyunincludes an scan code.  If a key is mapped to anything else, it will
520*4882a593Smuzhiyungenerate input device EV_KEY events.
521*4882a593Smuzhiyun
522*4882a593SmuzhiyunIn addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW
523*4882a593Smuzhiyunevents for switches:
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun==============	==============================================
526*4882a593SmuzhiyunSW_RFKILL_ALL	T60 and later hardware rfkill rocker switch
527*4882a593SmuzhiyunSW_TABLET_MODE	Tablet ThinkPads HKEY events 0x5009 and 0x500A
528*4882a593Smuzhiyun==============	==============================================
529*4882a593Smuzhiyun
530*4882a593SmuzhiyunNon hotkey ACPI HKEY event map
531*4882a593Smuzhiyun------------------------------
532*4882a593Smuzhiyun
533*4882a593SmuzhiyunEvents that are never propagated by the driver:
534*4882a593Smuzhiyun
535*4882a593Smuzhiyun======		==================================================
536*4882a593Smuzhiyun0x2304		System is waking up from suspend to undock
537*4882a593Smuzhiyun0x2305		System is waking up from suspend to eject bay
538*4882a593Smuzhiyun0x2404		System is waking up from hibernation to undock
539*4882a593Smuzhiyun0x2405		System is waking up from hibernation to eject bay
540*4882a593Smuzhiyun0x5001		Lid closed
541*4882a593Smuzhiyun0x5002		Lid opened
542*4882a593Smuzhiyun0x5009		Tablet swivel: switched to tablet mode
543*4882a593Smuzhiyun0x500A		Tablet swivel: switched to normal mode
544*4882a593Smuzhiyun0x5010		Brightness level changed/control event
545*4882a593Smuzhiyun0x6000		KEYBOARD: Numlock key pressed
546*4882a593Smuzhiyun0x6005		KEYBOARD: Fn key pressed (TO BE VERIFIED)
547*4882a593Smuzhiyun0x7000		Radio Switch may have changed state
548*4882a593Smuzhiyun======		==================================================
549*4882a593Smuzhiyun
550*4882a593Smuzhiyun
551*4882a593SmuzhiyunEvents that are propagated by the driver to userspace:
552*4882a593Smuzhiyun
553*4882a593Smuzhiyun======		=====================================================
554*4882a593Smuzhiyun0x2313		ALARM: System is waking up from suspend because
555*4882a593Smuzhiyun		the battery is nearly empty
556*4882a593Smuzhiyun0x2413		ALARM: System is waking up from hibernation because
557*4882a593Smuzhiyun		the battery is nearly empty
558*4882a593Smuzhiyun0x3003		Bay ejection (see 0x2x05) complete, can sleep again
559*4882a593Smuzhiyun0x3006		Bay hotplug request (hint to power up SATA link when
560*4882a593Smuzhiyun		the optical drive tray is ejected)
561*4882a593Smuzhiyun0x4003		Undocked (see 0x2x04), can sleep again
562*4882a593Smuzhiyun0x4010		Docked into hotplug port replicator (non-ACPI dock)
563*4882a593Smuzhiyun0x4011		Undocked from hotplug port replicator (non-ACPI dock)
564*4882a593Smuzhiyun0x500B		Tablet pen inserted into its storage bay
565*4882a593Smuzhiyun0x500C		Tablet pen removed from its storage bay
566*4882a593Smuzhiyun0x6011		ALARM: battery is too hot
567*4882a593Smuzhiyun0x6012		ALARM: battery is extremely hot
568*4882a593Smuzhiyun0x6021		ALARM: a sensor is too hot
569*4882a593Smuzhiyun0x6022		ALARM: a sensor is extremely hot
570*4882a593Smuzhiyun0x6030		System thermal table changed
571*4882a593Smuzhiyun0x6032		Thermal Control command set completion  (DYTC, Windows)
572*4882a593Smuzhiyun0x6040		Nvidia Optimus/AC adapter related (TO BE VERIFIED)
573*4882a593Smuzhiyun0x60C0		X1 Yoga 2016, Tablet mode status changed
574*4882a593Smuzhiyun0x60F0		Thermal Transformation changed (GMTS, Windows)
575*4882a593Smuzhiyun======		=====================================================
576*4882a593Smuzhiyun
577*4882a593SmuzhiyunBattery nearly empty alarms are a last resort attempt to get the
578*4882a593Smuzhiyunoperating system to hibernate or shutdown cleanly (0x2313), or shutdown
579*4882a593Smuzhiyuncleanly (0x2413) before power is lost.  They must be acted upon, as the
580*4882a593Smuzhiyunwake up caused by the firmware will have negated most safety nets...
581*4882a593Smuzhiyun
582*4882a593SmuzhiyunWhen any of the "too hot" alarms happen, according to Lenovo the user
583*4882a593Smuzhiyunshould suspend or hibernate the laptop (and in the case of battery
584*4882a593Smuzhiyunalarms, unplug the AC adapter) to let it cool down.  These alarms do
585*4882a593Smuzhiyunsignal that something is wrong, they should never happen on normal
586*4882a593Smuzhiyunoperating conditions.
587*4882a593Smuzhiyun
588*4882a593SmuzhiyunThe "extremely hot" alarms are emergencies.  According to Lenovo, the
589*4882a593Smuzhiyunoperating system is to force either an immediate suspend or hibernate
590*4882a593Smuzhiyuncycle, or a system shutdown.  Obviously, something is very wrong if this
591*4882a593Smuzhiyunhappens.
592*4882a593Smuzhiyun
593*4882a593Smuzhiyun
594*4882a593SmuzhiyunBrightness hotkey notes
595*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^
596*4882a593Smuzhiyun
597*4882a593SmuzhiyunDon't mess with the brightness hotkeys in a Thinkpad.  If you want
598*4882a593Smuzhiyunnotifications for OSD, use the sysfs backlight class event support.
599*4882a593Smuzhiyun
600*4882a593SmuzhiyunThe driver will issue KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN events
601*4882a593Smuzhiyunautomatically for the cases were userspace has to do something to
602*4882a593Smuzhiyunimplement brightness changes.  When you override these events, you will
603*4882a593Smuzhiyuneither fail to handle properly the ThinkPads that require explicit
604*4882a593Smuzhiyunaction to change backlight brightness, or the ThinkPads that require
605*4882a593Smuzhiyunthat no action be taken to work properly.
606*4882a593Smuzhiyun
607*4882a593Smuzhiyun
608*4882a593SmuzhiyunBluetooth
609*4882a593Smuzhiyun---------
610*4882a593Smuzhiyun
611*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/bluetooth
612*4882a593Smuzhiyun
613*4882a593Smuzhiyunsysfs device attribute: bluetooth_enable (deprecated)
614*4882a593Smuzhiyun
615*4882a593Smuzhiyunsysfs rfkill class: switch "tpacpi_bluetooth_sw"
616*4882a593Smuzhiyun
617*4882a593SmuzhiyunThis feature shows the presence and current state of a ThinkPad
618*4882a593SmuzhiyunBluetooth device in the internal ThinkPad CDC slot.
619*4882a593Smuzhiyun
620*4882a593SmuzhiyunIf the ThinkPad supports it, the Bluetooth state is stored in NVRAM,
621*4882a593Smuzhiyunso it is kept across reboots and power-off.
622*4882a593Smuzhiyun
623*4882a593SmuzhiyunProcfs notes
624*4882a593Smuzhiyun^^^^^^^^^^^^
625*4882a593Smuzhiyun
626*4882a593SmuzhiyunIf Bluetooth is installed, the following commands can be used::
627*4882a593Smuzhiyun
628*4882a593Smuzhiyun	echo enable > /proc/acpi/ibm/bluetooth
629*4882a593Smuzhiyun	echo disable > /proc/acpi/ibm/bluetooth
630*4882a593Smuzhiyun
631*4882a593SmuzhiyunSysfs notes
632*4882a593Smuzhiyun^^^^^^^^^^^
633*4882a593Smuzhiyun
634*4882a593Smuzhiyun	If the Bluetooth CDC card is installed, it can be enabled /
635*4882a593Smuzhiyun	disabled through the "bluetooth_enable" thinkpad-acpi device
636*4882a593Smuzhiyun	attribute, and its current status can also be queried.
637*4882a593Smuzhiyun
638*4882a593Smuzhiyun	enable:
639*4882a593Smuzhiyun
640*4882a593Smuzhiyun		- 0: disables Bluetooth / Bluetooth is disabled
641*4882a593Smuzhiyun		- 1: enables Bluetooth / Bluetooth is enabled.
642*4882a593Smuzhiyun
643*4882a593Smuzhiyun	Note: this interface has been superseded by the	generic rfkill
644*4882a593Smuzhiyun	class.  It has been deprecated, and it will be removed in year
645*4882a593Smuzhiyun	2010.
646*4882a593Smuzhiyun
647*4882a593Smuzhiyun	rfkill controller switch "tpacpi_bluetooth_sw": refer to
648*4882a593Smuzhiyun	Documentation/driver-api/rfkill.rst for details.
649*4882a593Smuzhiyun
650*4882a593Smuzhiyun
651*4882a593SmuzhiyunVideo output control -- /proc/acpi/ibm/video
652*4882a593Smuzhiyun--------------------------------------------
653*4882a593Smuzhiyun
654*4882a593SmuzhiyunThis feature allows control over the devices used for video output -
655*4882a593SmuzhiyunLCD, CRT or DVI (if available). The following commands are available::
656*4882a593Smuzhiyun
657*4882a593Smuzhiyun	echo lcd_enable > /proc/acpi/ibm/video
658*4882a593Smuzhiyun	echo lcd_disable > /proc/acpi/ibm/video
659*4882a593Smuzhiyun	echo crt_enable > /proc/acpi/ibm/video
660*4882a593Smuzhiyun	echo crt_disable > /proc/acpi/ibm/video
661*4882a593Smuzhiyun	echo dvi_enable > /proc/acpi/ibm/video
662*4882a593Smuzhiyun	echo dvi_disable > /proc/acpi/ibm/video
663*4882a593Smuzhiyun	echo auto_enable > /proc/acpi/ibm/video
664*4882a593Smuzhiyun	echo auto_disable > /proc/acpi/ibm/video
665*4882a593Smuzhiyun	echo expand_toggle > /proc/acpi/ibm/video
666*4882a593Smuzhiyun	echo video_switch > /proc/acpi/ibm/video
667*4882a593Smuzhiyun
668*4882a593SmuzhiyunNOTE:
669*4882a593Smuzhiyun  Access to this feature is restricted to processes owning the
670*4882a593Smuzhiyun  CAP_SYS_ADMIN capability for safety reasons, as it can interact badly
671*4882a593Smuzhiyun  enough with some versions of X.org to crash it.
672*4882a593Smuzhiyun
673*4882a593SmuzhiyunEach video output device can be enabled or disabled individually.
674*4882a593SmuzhiyunReading /proc/acpi/ibm/video shows the status of each device.
675*4882a593Smuzhiyun
676*4882a593SmuzhiyunAutomatic video switching can be enabled or disabled.  When automatic
677*4882a593Smuzhiyunvideo switching is enabled, certain events (e.g. opening the lid,
678*4882a593Smuzhiyundocking or undocking) cause the video output device to change
679*4882a593Smuzhiyunautomatically. While this can be useful, it also causes flickering
680*4882a593Smuzhiyunand, on the X40, video corruption. By disabling automatic switching,
681*4882a593Smuzhiyunthe flickering or video corruption can be avoided.
682*4882a593Smuzhiyun
683*4882a593SmuzhiyunThe video_switch command cycles through the available video outputs
684*4882a593Smuzhiyun(it simulates the behavior of Fn-F7).
685*4882a593Smuzhiyun
686*4882a593SmuzhiyunVideo expansion can be toggled through this feature. This controls
687*4882a593Smuzhiyunwhether the display is expanded to fill the entire LCD screen when a
688*4882a593Smuzhiyunmode with less than full resolution is used. Note that the current
689*4882a593Smuzhiyunvideo expansion status cannot be determined through this feature.
690*4882a593Smuzhiyun
691*4882a593SmuzhiyunNote that on many models (particularly those using Radeon graphics
692*4882a593Smuzhiyunchips) the X driver configures the video card in a way which prevents
693*4882a593SmuzhiyunFn-F7 from working. This also disables the video output switching
694*4882a593Smuzhiyunfeatures of this driver, as it uses the same ACPI methods as
695*4882a593SmuzhiyunFn-F7. Video switching on the console should still work.
696*4882a593Smuzhiyun
697*4882a593SmuzhiyunUPDATE: refer to https://bugs.freedesktop.org/show_bug.cgi?id=2000
698*4882a593Smuzhiyun
699*4882a593Smuzhiyun
700*4882a593SmuzhiyunThinkLight control
701*4882a593Smuzhiyun------------------
702*4882a593Smuzhiyun
703*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/light
704*4882a593Smuzhiyun
705*4882a593Smuzhiyunsysfs attributes: as per LED class, for the "tpacpi::thinklight" LED
706*4882a593Smuzhiyun
707*4882a593Smuzhiyunprocfs notes
708*4882a593Smuzhiyun^^^^^^^^^^^^
709*4882a593Smuzhiyun
710*4882a593SmuzhiyunThe ThinkLight status can be read and set through the procfs interface.  A
711*4882a593Smuzhiyunfew models which do not make the status available will show the ThinkLight
712*4882a593Smuzhiyunstatus as "unknown". The available commands are::
713*4882a593Smuzhiyun
714*4882a593Smuzhiyun	echo on  > /proc/acpi/ibm/light
715*4882a593Smuzhiyun	echo off > /proc/acpi/ibm/light
716*4882a593Smuzhiyun
717*4882a593Smuzhiyunsysfs notes
718*4882a593Smuzhiyun^^^^^^^^^^^
719*4882a593Smuzhiyun
720*4882a593SmuzhiyunThe ThinkLight sysfs interface is documented by the LED class
721*4882a593Smuzhiyundocumentation, in Documentation/leds/leds-class.rst.  The ThinkLight LED name
722*4882a593Smuzhiyunis "tpacpi::thinklight".
723*4882a593Smuzhiyun
724*4882a593SmuzhiyunDue to limitations in the sysfs LED class, if the status of the ThinkLight
725*4882a593Smuzhiyuncannot be read or if it is unknown, thinkpad-acpi will report it as "off".
726*4882a593SmuzhiyunIt is impossible to know if the status returned through sysfs is valid.
727*4882a593Smuzhiyun
728*4882a593Smuzhiyun
729*4882a593SmuzhiyunCMOS/UCMS control
730*4882a593Smuzhiyun-----------------
731*4882a593Smuzhiyun
732*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/cmos
733*4882a593Smuzhiyun
734*4882a593Smuzhiyunsysfs device attribute: cmos_command
735*4882a593Smuzhiyun
736*4882a593SmuzhiyunThis feature is mostly used internally by the ACPI firmware to keep the legacy
737*4882a593SmuzhiyunCMOS NVRAM bits in sync with the current machine state, and to record this
738*4882a593Smuzhiyunstate so that the ThinkPad will retain such settings across reboots.
739*4882a593Smuzhiyun
740*4882a593SmuzhiyunSome of these commands actually perform actions in some ThinkPad models, but
741*4882a593Smuzhiyunthis is expected to disappear more and more in newer models.  As an example, in
742*4882a593Smuzhiyuna T43 and in a X40, commands 12 and 13 still control the ThinkLight state for
743*4882a593Smuzhiyunreal, but commands 0 to 2 don't control the mixer anymore (they have been
744*4882a593Smuzhiyunphased out) and just update the NVRAM.
745*4882a593Smuzhiyun
746*4882a593SmuzhiyunThe range of valid cmos command numbers is 0 to 21, but not all have an
747*4882a593Smuzhiyuneffect and the behavior varies from model to model.  Here is the behavior
748*4882a593Smuzhiyunon the X40 (tpb is the ThinkPad Buttons utility):
749*4882a593Smuzhiyun
750*4882a593Smuzhiyun	- 0 - Related to "Volume down" key press
751*4882a593Smuzhiyun	- 1 - Related to "Volume up" key press
752*4882a593Smuzhiyun	- 2 - Related to "Mute on" key press
753*4882a593Smuzhiyun	- 3 - Related to "Access IBM" key press
754*4882a593Smuzhiyun	- 4 - Related to "LCD brightness up" key press
755*4882a593Smuzhiyun	- 5 - Related to "LCD brightness down" key press
756*4882a593Smuzhiyun	- 11 - Related to "toggle screen expansion" key press/function
757*4882a593Smuzhiyun	- 12 - Related to "ThinkLight on"
758*4882a593Smuzhiyun	- 13 - Related to "ThinkLight off"
759*4882a593Smuzhiyun	- 14 - Related to "ThinkLight" key press (toggle ThinkLight)
760*4882a593Smuzhiyun
761*4882a593SmuzhiyunThe cmos command interface is prone to firmware split-brain problems, as
762*4882a593Smuzhiyunin newer ThinkPads it is just a compatibility layer.  Do not use it, it is
763*4882a593Smuzhiyunexported just as a debug tool.
764*4882a593Smuzhiyun
765*4882a593Smuzhiyun
766*4882a593SmuzhiyunLED control
767*4882a593Smuzhiyun-----------
768*4882a593Smuzhiyun
769*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/led
770*4882a593Smuzhiyunsysfs attributes: as per LED class, see below for names
771*4882a593Smuzhiyun
772*4882a593SmuzhiyunSome of the LED indicators can be controlled through this feature.  On
773*4882a593Smuzhiyunsome older ThinkPad models, it is possible to query the status of the
774*4882a593SmuzhiyunLED indicators as well.  Newer ThinkPads cannot query the real status
775*4882a593Smuzhiyunof the LED indicators.
776*4882a593Smuzhiyun
777*4882a593SmuzhiyunBecause misuse of the LEDs could induce an unaware user to perform
778*4882a593Smuzhiyundangerous actions (like undocking or ejecting a bay device while the
779*4882a593Smuzhiyunbuses are still active), or mask an important alarm (such as a nearly
780*4882a593Smuzhiyunempty battery, or a broken battery), access to most LEDs is
781*4882a593Smuzhiyunrestricted.
782*4882a593Smuzhiyun
783*4882a593SmuzhiyunUnrestricted access to all LEDs requires that thinkpad-acpi be
784*4882a593Smuzhiyuncompiled with the CONFIG_THINKPAD_ACPI_UNSAFE_LEDS option enabled.
785*4882a593SmuzhiyunDistributions must never enable this option.  Individual users that
786*4882a593Smuzhiyunare aware of the consequences are welcome to enabling it.
787*4882a593Smuzhiyun
788*4882a593SmuzhiyunAudio mute and microphone mute LEDs are supported, but currently not
789*4882a593Smuzhiyunvisible to userspace. They are used by the snd-hda-intel audio driver.
790*4882a593Smuzhiyun
791*4882a593Smuzhiyunprocfs notes
792*4882a593Smuzhiyun^^^^^^^^^^^^
793*4882a593Smuzhiyun
794*4882a593SmuzhiyunThe available commands are::
795*4882a593Smuzhiyun
796*4882a593Smuzhiyun	echo '<LED number> on' >/proc/acpi/ibm/led
797*4882a593Smuzhiyun	echo '<LED number> off' >/proc/acpi/ibm/led
798*4882a593Smuzhiyun	echo '<LED number> blink' >/proc/acpi/ibm/led
799*4882a593Smuzhiyun
800*4882a593SmuzhiyunThe <LED number> range is 0 to 15. The set of LEDs that can be
801*4882a593Smuzhiyuncontrolled varies from model to model. Here is the common ThinkPad
802*4882a593Smuzhiyunmapping:
803*4882a593Smuzhiyun
804*4882a593Smuzhiyun	- 0 - power
805*4882a593Smuzhiyun	- 1 - battery (orange)
806*4882a593Smuzhiyun	- 2 - battery (green)
807*4882a593Smuzhiyun	- 3 - UltraBase/dock
808*4882a593Smuzhiyun	- 4 - UltraBay
809*4882a593Smuzhiyun	- 5 - UltraBase battery slot
810*4882a593Smuzhiyun	- 6 - (unknown)
811*4882a593Smuzhiyun	- 7 - standby
812*4882a593Smuzhiyun	- 8 - dock status 1
813*4882a593Smuzhiyun	- 9 - dock status 2
814*4882a593Smuzhiyun	- 10, 11 - (unknown)
815*4882a593Smuzhiyun	- 12 - thinkvantage
816*4882a593Smuzhiyun	- 13, 14, 15 - (unknown)
817*4882a593Smuzhiyun
818*4882a593SmuzhiyunAll of the above can be turned on and off and can be made to blink.
819*4882a593Smuzhiyun
820*4882a593Smuzhiyunsysfs notes
821*4882a593Smuzhiyun^^^^^^^^^^^
822*4882a593Smuzhiyun
823*4882a593SmuzhiyunThe ThinkPad LED sysfs interface is described in detail by the LED class
824*4882a593Smuzhiyundocumentation, in Documentation/leds/leds-class.rst.
825*4882a593Smuzhiyun
826*4882a593SmuzhiyunThe LEDs are named (in LED ID order, from 0 to 12):
827*4882a593Smuzhiyun"tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt",
828*4882a593Smuzhiyun"tpacpi::dock_active", "tpacpi::bay_active", "tpacpi::dock_batt",
829*4882a593Smuzhiyun"tpacpi::unknown_led", "tpacpi::standby", "tpacpi::dock_status1",
830*4882a593Smuzhiyun"tpacpi::dock_status2", "tpacpi::unknown_led2", "tpacpi::unknown_led3",
831*4882a593Smuzhiyun"tpacpi::thinkvantage".
832*4882a593Smuzhiyun
833*4882a593SmuzhiyunDue to limitations in the sysfs LED class, if the status of the LED
834*4882a593Smuzhiyunindicators cannot be read due to an error, thinkpad-acpi will report it as
835*4882a593Smuzhiyuna brightness of zero (same as LED off).
836*4882a593Smuzhiyun
837*4882a593SmuzhiyunIf the thinkpad firmware doesn't support reading the current status,
838*4882a593Smuzhiyuntrying to read the current LED brightness will just return whatever
839*4882a593Smuzhiyunbrightness was last written to that attribute.
840*4882a593Smuzhiyun
841*4882a593SmuzhiyunThese LEDs can blink using hardware acceleration.  To request that a
842*4882a593SmuzhiyunThinkPad indicator LED should blink in hardware accelerated mode, use the
843*4882a593Smuzhiyun"timer" trigger, and leave the delay_on and delay_off parameters set to
844*4882a593Smuzhiyunzero (to request hardware acceleration autodetection).
845*4882a593Smuzhiyun
846*4882a593SmuzhiyunLEDs that are known not to exist in a given ThinkPad model are not
847*4882a593Smuzhiyunmade available through the sysfs interface.  If you have a dock and you
848*4882a593Smuzhiyunnotice there are LEDs listed for your ThinkPad that do not exist (and
849*4882a593Smuzhiyunare not in the dock), or if you notice that there are missing LEDs,
850*4882a593Smuzhiyuna report to ibm-acpi-devel@lists.sourceforge.net is appreciated.
851*4882a593Smuzhiyun
852*4882a593Smuzhiyun
853*4882a593SmuzhiyunACPI sounds -- /proc/acpi/ibm/beep
854*4882a593Smuzhiyun----------------------------------
855*4882a593Smuzhiyun
856*4882a593SmuzhiyunThe BEEP method is used internally by the ACPI firmware to provide
857*4882a593Smuzhiyunaudible alerts in various situations. This feature allows the same
858*4882a593Smuzhiyunsounds to be triggered manually.
859*4882a593Smuzhiyun
860*4882a593SmuzhiyunThe commands are non-negative integer numbers::
861*4882a593Smuzhiyun
862*4882a593Smuzhiyun	echo <number> >/proc/acpi/ibm/beep
863*4882a593Smuzhiyun
864*4882a593SmuzhiyunThe valid <number> range is 0 to 17. Not all numbers trigger sounds
865*4882a593Smuzhiyunand the sounds vary from model to model. Here is the behavior on the
866*4882a593SmuzhiyunX40:
867*4882a593Smuzhiyun
868*4882a593Smuzhiyun	- 0 - stop a sound in progress (but use 17 to stop 16)
869*4882a593Smuzhiyun	- 2 - two beeps, pause, third beep ("low battery")
870*4882a593Smuzhiyun	- 3 - single beep
871*4882a593Smuzhiyun	- 4 - high, followed by low-pitched beep ("unable")
872*4882a593Smuzhiyun	- 5 - single beep
873*4882a593Smuzhiyun	- 6 - very high, followed by high-pitched beep ("AC/DC")
874*4882a593Smuzhiyun	- 7 - high-pitched beep
875*4882a593Smuzhiyun	- 9 - three short beeps
876*4882a593Smuzhiyun	- 10 - very long beep
877*4882a593Smuzhiyun	- 12 - low-pitched beep
878*4882a593Smuzhiyun	- 15 - three high-pitched beeps repeating constantly, stop with 0
879*4882a593Smuzhiyun	- 16 - one medium-pitched beep repeating constantly, stop with 17
880*4882a593Smuzhiyun	- 17 - stop 16
881*4882a593Smuzhiyun
882*4882a593Smuzhiyun
883*4882a593SmuzhiyunTemperature sensors
884*4882a593Smuzhiyun-------------------
885*4882a593Smuzhiyun
886*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/thermal
887*4882a593Smuzhiyun
888*4882a593Smuzhiyunsysfs device attributes: (hwmon "thinkpad") temp*_input
889*4882a593Smuzhiyun
890*4882a593SmuzhiyunMost ThinkPads include six or more separate temperature sensors but only
891*4882a593Smuzhiyunexpose the CPU temperature through the standard ACPI methods.  This
892*4882a593Smuzhiyunfeature shows readings from up to eight different sensors on older
893*4882a593SmuzhiyunThinkPads, and up to sixteen different sensors on newer ThinkPads.
894*4882a593Smuzhiyun
895*4882a593SmuzhiyunFor example, on the X40, a typical output may be:
896*4882a593Smuzhiyun
897*4882a593Smuzhiyuntemperatures:
898*4882a593Smuzhiyun	42 42 45 41 36 -128 33 -128
899*4882a593Smuzhiyun
900*4882a593SmuzhiyunOn the T43/p, a typical output may be:
901*4882a593Smuzhiyun
902*4882a593Smuzhiyuntemperatures:
903*4882a593Smuzhiyun	48 48 36 52 38 -128 31 -128 48 52 48 -128 -128 -128 -128 -128
904*4882a593Smuzhiyun
905*4882a593SmuzhiyunThe mapping of thermal sensors to physical locations varies depending on
906*4882a593Smuzhiyunsystem-board model (and thus, on ThinkPad model).
907*4882a593Smuzhiyun
908*4882a593Smuzhiyunhttps://thinkwiki.org/wiki/Thermal_Sensors is a public wiki page that
909*4882a593Smuzhiyuntries to track down these locations for various models.
910*4882a593Smuzhiyun
911*4882a593SmuzhiyunMost (newer?) models seem to follow this pattern:
912*4882a593Smuzhiyun
913*4882a593Smuzhiyun- 1:  CPU
914*4882a593Smuzhiyun- 2:  (depends on model)
915*4882a593Smuzhiyun- 3:  (depends on model)
916*4882a593Smuzhiyun- 4:  GPU
917*4882a593Smuzhiyun- 5:  Main battery: main sensor
918*4882a593Smuzhiyun- 6:  Bay battery: main sensor
919*4882a593Smuzhiyun- 7:  Main battery: secondary sensor
920*4882a593Smuzhiyun- 8:  Bay battery: secondary sensor
921*4882a593Smuzhiyun- 9-15: (depends on model)
922*4882a593Smuzhiyun
923*4882a593SmuzhiyunFor the R51 (source: Thomas Gruber):
924*4882a593Smuzhiyun
925*4882a593Smuzhiyun- 2:  Mini-PCI
926*4882a593Smuzhiyun- 3:  Internal HDD
927*4882a593Smuzhiyun
928*4882a593SmuzhiyunFor the T43, T43/p (source: Shmidoax/Thinkwiki.org)
929*4882a593Smuzhiyunhttps://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_T43.2C_T43p
930*4882a593Smuzhiyun
931*4882a593Smuzhiyun- 2:  System board, left side (near PCMCIA slot), reported as HDAPS temp
932*4882a593Smuzhiyun- 3:  PCMCIA slot
933*4882a593Smuzhiyun- 9:  MCH (northbridge) to DRAM Bus
934*4882a593Smuzhiyun- 10: Clock-generator, mini-pci card and ICH (southbridge), under Mini-PCI
935*4882a593Smuzhiyun      card, under touchpad
936*4882a593Smuzhiyun- 11: Power regulator, underside of system board, below F2 key
937*4882a593Smuzhiyun
938*4882a593SmuzhiyunThe A31 has a very atypical layout for the thermal sensors
939*4882a593Smuzhiyun(source: Milos Popovic, https://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_A31)
940*4882a593Smuzhiyun
941*4882a593Smuzhiyun- 1:  CPU
942*4882a593Smuzhiyun- 2:  Main Battery: main sensor
943*4882a593Smuzhiyun- 3:  Power Converter
944*4882a593Smuzhiyun- 4:  Bay Battery: main sensor
945*4882a593Smuzhiyun- 5:  MCH (northbridge)
946*4882a593Smuzhiyun- 6:  PCMCIA/ambient
947*4882a593Smuzhiyun- 7:  Main Battery: secondary sensor
948*4882a593Smuzhiyun- 8:  Bay Battery: secondary sensor
949*4882a593Smuzhiyun
950*4882a593Smuzhiyun
951*4882a593SmuzhiyunProcfs notes
952*4882a593Smuzhiyun^^^^^^^^^^^^
953*4882a593Smuzhiyun
954*4882a593Smuzhiyun	Readings from sensors that are not available return -128.
955*4882a593Smuzhiyun	No commands can be written to this file.
956*4882a593Smuzhiyun
957*4882a593SmuzhiyunSysfs notes
958*4882a593Smuzhiyun^^^^^^^^^^^
959*4882a593Smuzhiyun
960*4882a593Smuzhiyun	Sensors that are not available return the ENXIO error.  This
961*4882a593Smuzhiyun	status may change at runtime, as there are hotplug thermal
962*4882a593Smuzhiyun	sensors, like those inside the batteries and docks.
963*4882a593Smuzhiyun
964*4882a593Smuzhiyun	thinkpad-acpi thermal sensors are reported through the hwmon
965*4882a593Smuzhiyun	subsystem, and follow all of the hwmon guidelines at
966*4882a593Smuzhiyun	Documentation/hwmon.
967*4882a593Smuzhiyun
968*4882a593SmuzhiyunEXPERIMENTAL: Embedded controller register dump
969*4882a593Smuzhiyun-----------------------------------------------
970*4882a593Smuzhiyun
971*4882a593SmuzhiyunThis feature is not included in the thinkpad driver anymore.
972*4882a593SmuzhiyunInstead the EC can be accessed through /sys/kernel/debug/ec with
973*4882a593Smuzhiyuna userspace tool which can be found here:
974*4882a593Smuzhiyunftp://ftp.suse.com/pub/people/trenn/sources/ec
975*4882a593Smuzhiyun
976*4882a593SmuzhiyunUse it to determine the register holding the fan
977*4882a593Smuzhiyunspeed on some models. To do that, do the following:
978*4882a593Smuzhiyun
979*4882a593Smuzhiyun	- make sure the battery is fully charged
980*4882a593Smuzhiyun	- make sure the fan is running
981*4882a593Smuzhiyun	- use above mentioned tool to read out the EC
982*4882a593Smuzhiyun
983*4882a593SmuzhiyunOften fan and temperature values vary between
984*4882a593Smuzhiyunreadings. Since temperatures don't change vary fast, you can take
985*4882a593Smuzhiyunseveral quick dumps to eliminate them.
986*4882a593Smuzhiyun
987*4882a593SmuzhiyunYou can use a similar method to figure out the meaning of other
988*4882a593Smuzhiyunembedded controller registers - e.g. make sure nothing else changes
989*4882a593Smuzhiyunexcept the charging or discharging battery to determine which
990*4882a593Smuzhiyunregisters contain the current battery capacity, etc. If you experiment
991*4882a593Smuzhiyunwith this, do send me your results (including some complete dumps with
992*4882a593Smuzhiyuna description of the conditions when they were taken.)
993*4882a593Smuzhiyun
994*4882a593Smuzhiyun
995*4882a593SmuzhiyunLCD brightness control
996*4882a593Smuzhiyun----------------------
997*4882a593Smuzhiyun
998*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/brightness
999*4882a593Smuzhiyun
1000*4882a593Smuzhiyunsysfs backlight device "thinkpad_screen"
1001*4882a593Smuzhiyun
1002*4882a593SmuzhiyunThis feature allows software control of the LCD brightness on ThinkPad
1003*4882a593Smuzhiyunmodels which don't have a hardware brightness slider.
1004*4882a593Smuzhiyun
1005*4882a593SmuzhiyunIt has some limitations: the LCD backlight cannot be actually turned
1006*4882a593Smuzhiyunon or off by this interface, it just controls the backlight brightness
1007*4882a593Smuzhiyunlevel.
1008*4882a593Smuzhiyun
1009*4882a593SmuzhiyunOn IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
1010*4882a593Smuzhiyunhas eight brightness levels, ranging from 0 to 7.  Some of the levels
1011*4882a593Smuzhiyunmay not be distinct.  Later Lenovo models that implement the ACPI
1012*4882a593Smuzhiyundisplay backlight brightness control methods have 16 levels, ranging
1013*4882a593Smuzhiyunfrom 0 to 15.
1014*4882a593Smuzhiyun
1015*4882a593SmuzhiyunFor IBM ThinkPads, there are two interfaces to the firmware for direct
1016*4882a593Smuzhiyunbrightness control, EC and UCMS (or CMOS).  To select which one should be
1017*4882a593Smuzhiyunused, use the brightness_mode module parameter: brightness_mode=1 selects
1018*4882a593SmuzhiyunEC mode, brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC
1019*4882a593Smuzhiyunmode with NVRAM backing (so that brightness changes are remembered across
1020*4882a593Smuzhiyunshutdown/reboot).
1021*4882a593Smuzhiyun
1022*4882a593SmuzhiyunThe driver tries to select which interface to use from a table of
1023*4882a593Smuzhiyundefaults for each ThinkPad model.  If it makes a wrong choice, please
1024*4882a593Smuzhiyunreport this as a bug, so that we can fix it.
1025*4882a593Smuzhiyun
1026*4882a593SmuzhiyunLenovo ThinkPads only support brightness_mode=2 (UCMS).
1027*4882a593Smuzhiyun
1028*4882a593SmuzhiyunWhen display backlight brightness controls are available through the
1029*4882a593Smuzhiyunstandard ACPI interface, it is best to use it instead of this direct
1030*4882a593SmuzhiyunThinkPad-specific interface.  The driver will disable its native
1031*4882a593Smuzhiyunbacklight brightness control interface if it detects that the standard
1032*4882a593SmuzhiyunACPI interface is available in the ThinkPad.
1033*4882a593Smuzhiyun
1034*4882a593SmuzhiyunIf you want to use the thinkpad-acpi backlight brightness control
1035*4882a593Smuzhiyuninstead of the generic ACPI video backlight brightness control for some
1036*4882a593Smuzhiyunreason, you should use the acpi_backlight=vendor kernel parameter.
1037*4882a593Smuzhiyun
1038*4882a593SmuzhiyunThe brightness_enable module parameter can be used to control whether
1039*4882a593Smuzhiyunthe LCD brightness control feature will be enabled when available.
1040*4882a593Smuzhiyunbrightness_enable=0 forces it to be disabled.  brightness_enable=1
1041*4882a593Smuzhiyunforces it to be enabled when available, even if the standard ACPI
1042*4882a593Smuzhiyuninterface is also available.
1043*4882a593Smuzhiyun
1044*4882a593SmuzhiyunProcfs notes
1045*4882a593Smuzhiyun^^^^^^^^^^^^
1046*4882a593Smuzhiyun
1047*4882a593SmuzhiyunThe available commands are::
1048*4882a593Smuzhiyun
1049*4882a593Smuzhiyun	echo up   >/proc/acpi/ibm/brightness
1050*4882a593Smuzhiyun	echo down >/proc/acpi/ibm/brightness
1051*4882a593Smuzhiyun	echo 'level <level>' >/proc/acpi/ibm/brightness
1052*4882a593Smuzhiyun
1053*4882a593SmuzhiyunSysfs notes
1054*4882a593Smuzhiyun^^^^^^^^^^^
1055*4882a593Smuzhiyun
1056*4882a593SmuzhiyunThe interface is implemented through the backlight sysfs class, which is
1057*4882a593Smuzhiyunpoorly documented at this time.
1058*4882a593Smuzhiyun
1059*4882a593SmuzhiyunLocate the thinkpad_screen device under /sys/class/backlight, and inside
1060*4882a593Smuzhiyunit there will be the following attributes:
1061*4882a593Smuzhiyun
1062*4882a593Smuzhiyun	max_brightness:
1063*4882a593Smuzhiyun		Reads the maximum brightness the hardware can be set to.
1064*4882a593Smuzhiyun		The minimum is always zero.
1065*4882a593Smuzhiyun
1066*4882a593Smuzhiyun	actual_brightness:
1067*4882a593Smuzhiyun		Reads what brightness the screen is set to at this instant.
1068*4882a593Smuzhiyun
1069*4882a593Smuzhiyun	brightness:
1070*4882a593Smuzhiyun		Writes request the driver to change brightness to the
1071*4882a593Smuzhiyun		given value.  Reads will tell you what brightness the
1072*4882a593Smuzhiyun		driver is trying to set the display to when "power" is set
1073*4882a593Smuzhiyun		to zero and the display has not been dimmed by a kernel
1074*4882a593Smuzhiyun		power management event.
1075*4882a593Smuzhiyun
1076*4882a593Smuzhiyun	power:
1077*4882a593Smuzhiyun		power management mode, where 0 is "display on", and 1 to 3
1078*4882a593Smuzhiyun		will dim the display backlight to brightness level 0
1079*4882a593Smuzhiyun		because thinkpad-acpi cannot really turn the backlight
1080*4882a593Smuzhiyun		off.  Kernel power management events can temporarily
1081*4882a593Smuzhiyun		increase the current power management level, i.e. they can
1082*4882a593Smuzhiyun		dim the display.
1083*4882a593Smuzhiyun
1084*4882a593Smuzhiyun
1085*4882a593SmuzhiyunWARNING:
1086*4882a593Smuzhiyun
1087*4882a593Smuzhiyun    Whatever you do, do NOT ever call thinkpad-acpi backlight-level change
1088*4882a593Smuzhiyun    interface and the ACPI-based backlight level change interface
1089*4882a593Smuzhiyun    (available on newer BIOSes, and driven by the Linux ACPI video driver)
1090*4882a593Smuzhiyun    at the same time.  The two will interact in bad ways, do funny things,
1091*4882a593Smuzhiyun    and maybe reduce the life of the backlight lamps by needlessly kicking
1092*4882a593Smuzhiyun    its level up and down at every change.
1093*4882a593Smuzhiyun
1094*4882a593Smuzhiyun
1095*4882a593SmuzhiyunVolume control (Console Audio control)
1096*4882a593Smuzhiyun--------------------------------------
1097*4882a593Smuzhiyun
1098*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/volume
1099*4882a593Smuzhiyun
1100*4882a593SmuzhiyunALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC"
1101*4882a593Smuzhiyun
1102*4882a593SmuzhiyunNOTE: by default, the volume control interface operates in read-only
1103*4882a593Smuzhiyunmode, as it is supposed to be used for on-screen-display purposes.
1104*4882a593SmuzhiyunThe read/write mode can be enabled through the use of the
1105*4882a593Smuzhiyun"volume_control=1" module parameter.
1106*4882a593Smuzhiyun
1107*4882a593SmuzhiyunNOTE: distros are urged to not enable volume_control by default, this
1108*4882a593Smuzhiyunshould be done by the local admin only.  The ThinkPad UI is for the
1109*4882a593Smuzhiyunconsole audio control to be done through the volume keys only, and for
1110*4882a593Smuzhiyunthe desktop environment to just provide on-screen-display feedback.
1111*4882a593SmuzhiyunSoftware volume control should be done only in the main AC97/HDA
1112*4882a593Smuzhiyunmixer.
1113*4882a593Smuzhiyun
1114*4882a593Smuzhiyun
1115*4882a593SmuzhiyunAbout the ThinkPad Console Audio control
1116*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1117*4882a593Smuzhiyun
1118*4882a593SmuzhiyunThinkPads have a built-in amplifier and muting circuit that drives the
1119*4882a593Smuzhiyunconsole headphone and speakers.  This circuit is after the main AC97
1120*4882a593Smuzhiyunor HDA mixer in the audio path, and under exclusive control of the
1121*4882a593Smuzhiyunfirmware.
1122*4882a593Smuzhiyun
1123*4882a593SmuzhiyunThinkPads have three special hotkeys to interact with the console
1124*4882a593Smuzhiyunaudio control: volume up, volume down and mute.
1125*4882a593Smuzhiyun
1126*4882a593SmuzhiyunIt is worth noting that the normal way the mute function works (on
1127*4882a593SmuzhiyunThinkPads that do not have a "mute LED") is:
1128*4882a593Smuzhiyun
1129*4882a593Smuzhiyun1. Press mute to mute.  It will *always* mute, you can press it as
1130*4882a593Smuzhiyun   many times as you want, and the sound will remain mute.
1131*4882a593Smuzhiyun
1132*4882a593Smuzhiyun2. Press either volume key to unmute the ThinkPad (it will _not_
1133*4882a593Smuzhiyun   change the volume, it will just unmute).
1134*4882a593Smuzhiyun
1135*4882a593SmuzhiyunThis is a very superior design when compared to the cheap software-only
1136*4882a593Smuzhiyunmute-toggle solution found on normal consumer laptops:  you can be
1137*4882a593Smuzhiyunabsolutely sure the ThinkPad will not make noise if you press the mute
1138*4882a593Smuzhiyunbutton, no matter the previous state.
1139*4882a593Smuzhiyun
1140*4882a593SmuzhiyunThe IBM ThinkPads, and the earlier Lenovo ThinkPads have variable-gain
1141*4882a593Smuzhiyunamplifiers driving the speakers and headphone output, and the firmware
1142*4882a593Smuzhiyunalso handles volume control for the headphone and speakers on these
1143*4882a593SmuzhiyunThinkPads without any help from the operating system (this volume
1144*4882a593Smuzhiyuncontrol stage exists after the main AC97 or HDA mixer in the audio
1145*4882a593Smuzhiyunpath).
1146*4882a593Smuzhiyun
1147*4882a593SmuzhiyunThe newer Lenovo models only have firmware mute control, and depend on
1148*4882a593Smuzhiyunthe main HDA mixer to do volume control (which is done by the operating
1149*4882a593Smuzhiyunsystem).  In this case, the volume keys are filtered out for unmute
1150*4882a593Smuzhiyunkey press (there are some firmware bugs in this area) and delivered as
1151*4882a593Smuzhiyunnormal key presses to the operating system (thinkpad-acpi is not
1152*4882a593Smuzhiyuninvolved).
1153*4882a593Smuzhiyun
1154*4882a593Smuzhiyun
1155*4882a593SmuzhiyunThe ThinkPad-ACPI volume control
1156*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1157*4882a593Smuzhiyun
1158*4882a593SmuzhiyunThe preferred way to interact with the Console Audio control is the
1159*4882a593SmuzhiyunALSA interface.
1160*4882a593Smuzhiyun
1161*4882a593SmuzhiyunThe legacy procfs interface allows one to read the current state,
1162*4882a593Smuzhiyunand if volume control is enabled, accepts the following commands::
1163*4882a593Smuzhiyun
1164*4882a593Smuzhiyun	echo up   >/proc/acpi/ibm/volume
1165*4882a593Smuzhiyun	echo down >/proc/acpi/ibm/volume
1166*4882a593Smuzhiyun	echo mute >/proc/acpi/ibm/volume
1167*4882a593Smuzhiyun	echo unmute >/proc/acpi/ibm/volume
1168*4882a593Smuzhiyun	echo 'level <level>' >/proc/acpi/ibm/volume
1169*4882a593Smuzhiyun
1170*4882a593SmuzhiyunThe <level> number range is 0 to 14 although not all of them may be
1171*4882a593Smuzhiyundistinct. To unmute the volume after the mute command, use either the
1172*4882a593Smuzhiyunup or down command (the level command will not unmute the volume), or
1173*4882a593Smuzhiyunthe unmute command.
1174*4882a593Smuzhiyun
1175*4882a593SmuzhiyunYou can use the volume_capabilities parameter to tell the driver
1176*4882a593Smuzhiyunwhether your thinkpad has volume control or mute-only control:
1177*4882a593Smuzhiyunvolume_capabilities=1 for mixers with mute and volume control,
1178*4882a593Smuzhiyunvolume_capabilities=2 for mixers with only mute control.
1179*4882a593Smuzhiyun
1180*4882a593SmuzhiyunIf the driver misdetects the capabilities for your ThinkPad model,
1181*4882a593Smuzhiyunplease report this to ibm-acpi-devel@lists.sourceforge.net, so that we
1182*4882a593Smuzhiyuncan update the driver.
1183*4882a593Smuzhiyun
1184*4882a593SmuzhiyunThere are two strategies for volume control.  To select which one
1185*4882a593Smuzhiyunshould be used, use the volume_mode module parameter: volume_mode=1
1186*4882a593Smuzhiyunselects EC mode, and volume_mode=3 selects EC mode with NVRAM backing
1187*4882a593Smuzhiyun(so that volume/mute changes are remembered across shutdown/reboot).
1188*4882a593Smuzhiyun
1189*4882a593SmuzhiyunThe driver will operate in volume_mode=3 by default. If that does not
1190*4882a593Smuzhiyunwork well on your ThinkPad model, please report this to
1191*4882a593Smuzhiyunibm-acpi-devel@lists.sourceforge.net.
1192*4882a593Smuzhiyun
1193*4882a593SmuzhiyunThe driver supports the standard ALSA module parameters.  If the ALSA
1194*4882a593Smuzhiyunmixer is disabled, the driver will disable all volume functionality.
1195*4882a593Smuzhiyun
1196*4882a593Smuzhiyun
1197*4882a593SmuzhiyunFan control and monitoring: fan speed, fan enable/disable
1198*4882a593Smuzhiyun---------------------------------------------------------
1199*4882a593Smuzhiyun
1200*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/fan
1201*4882a593Smuzhiyun
1202*4882a593Smuzhiyunsysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1, pwm1_enable, fan2_input
1203*4882a593Smuzhiyun
1204*4882a593Smuzhiyunsysfs hwmon driver attributes: fan_watchdog
1205*4882a593Smuzhiyun
1206*4882a593SmuzhiyunNOTE NOTE NOTE:
1207*4882a593Smuzhiyun   fan control operations are disabled by default for
1208*4882a593Smuzhiyun   safety reasons.  To enable them, the module parameter "fan_control=1"
1209*4882a593Smuzhiyun   must be given to thinkpad-acpi.
1210*4882a593Smuzhiyun
1211*4882a593SmuzhiyunThis feature attempts to show the current fan speed, control mode and
1212*4882a593Smuzhiyunother fan data that might be available.  The speed is read directly
1213*4882a593Smuzhiyunfrom the hardware registers of the embedded controller.  This is known
1214*4882a593Smuzhiyunto work on later R, T, X and Z series ThinkPads but may show a bogus
1215*4882a593Smuzhiyunvalue on other models.
1216*4882a593Smuzhiyun
1217*4882a593SmuzhiyunSome Lenovo ThinkPads support a secondary fan.  This fan cannot be
1218*4882a593Smuzhiyuncontrolled separately, it shares the main fan control.
1219*4882a593Smuzhiyun
1220*4882a593SmuzhiyunFan levels
1221*4882a593Smuzhiyun^^^^^^^^^^
1222*4882a593Smuzhiyun
1223*4882a593SmuzhiyunMost ThinkPad fans work in "levels" at the firmware interface.  Level 0
1224*4882a593Smuzhiyunstops the fan.  The higher the level, the higher the fan speed, although
1225*4882a593Smuzhiyunadjacent levels often map to the same fan speed.  7 is the highest
1226*4882a593Smuzhiyunlevel, where the fan reaches the maximum recommended speed.
1227*4882a593Smuzhiyun
1228*4882a593SmuzhiyunLevel "auto" means the EC changes the fan level according to some
1229*4882a593Smuzhiyuninternal algorithm, usually based on readings from the thermal sensors.
1230*4882a593Smuzhiyun
1231*4882a593SmuzhiyunThere is also a "full-speed" level, also known as "disengaged" level.
1232*4882a593SmuzhiyunIn this level, the EC disables the speed-locked closed-loop fan control,
1233*4882a593Smuzhiyunand drives the fan as fast as it can go, which might exceed hardware
1234*4882a593Smuzhiyunlimits, so use this level with caution.
1235*4882a593Smuzhiyun
1236*4882a593SmuzhiyunThe fan usually ramps up or down slowly from one speed to another, and
1237*4882a593Smuzhiyunit is normal for the EC to take several seconds to react to fan
1238*4882a593Smuzhiyuncommands.  The full-speed level may take up to two minutes to ramp up to
1239*4882a593Smuzhiyunmaximum speed, and in some ThinkPads, the tachometer readings go stale
1240*4882a593Smuzhiyunwhile the EC is transitioning to the full-speed level.
1241*4882a593Smuzhiyun
1242*4882a593SmuzhiyunWARNING WARNING WARNING: do not leave the fan disabled unless you are
1243*4882a593Smuzhiyunmonitoring all of the temperature sensor readings and you are ready to
1244*4882a593Smuzhiyunenable it if necessary to avoid overheating.
1245*4882a593Smuzhiyun
1246*4882a593SmuzhiyunAn enabled fan in level "auto" may stop spinning if the EC decides the
1247*4882a593SmuzhiyunThinkPad is cool enough and doesn't need the extra airflow.  This is
1248*4882a593Smuzhiyunnormal, and the EC will spin the fan up if the various thermal readings
1249*4882a593Smuzhiyunrise too much.
1250*4882a593Smuzhiyun
1251*4882a593SmuzhiyunOn the X40, this seems to depend on the CPU and HDD temperatures.
1252*4882a593SmuzhiyunSpecifically, the fan is turned on when either the CPU temperature
1253*4882a593Smuzhiyunclimbs to 56 degrees or the HDD temperature climbs to 46 degrees.  The
1254*4882a593Smuzhiyunfan is turned off when the CPU temperature drops to 49 degrees and the
1255*4882a593SmuzhiyunHDD temperature drops to 41 degrees.  These thresholds cannot
1256*4882a593Smuzhiyuncurrently be controlled.
1257*4882a593Smuzhiyun
1258*4882a593SmuzhiyunThe ThinkPad's ACPI DSDT code will reprogram the fan on its own when
1259*4882a593Smuzhiyuncertain conditions are met.  It will override any fan programming done
1260*4882a593Smuzhiyunthrough thinkpad-acpi.
1261*4882a593Smuzhiyun
1262*4882a593SmuzhiyunThe thinkpad-acpi kernel driver can be programmed to revert the fan
1263*4882a593Smuzhiyunlevel to a safe setting if userspace does not issue one of the procfs
1264*4882a593Smuzhiyunfan commands: "enable", "disable", "level" or "watchdog", or if there
1265*4882a593Smuzhiyunare no writes to pwm1_enable (or to pwm1 *if and only if* pwm1_enable is
1266*4882a593Smuzhiyunset to 1, manual mode) within a configurable amount of time of up to
1267*4882a593Smuzhiyun120 seconds.  This functionality is called fan safety watchdog.
1268*4882a593Smuzhiyun
1269*4882a593SmuzhiyunNote that the watchdog timer stops after it enables the fan.  It will be
1270*4882a593Smuzhiyunrearmed again automatically (using the same interval) when one of the
1271*4882a593Smuzhiyunabove mentioned fan commands is received.  The fan watchdog is,
1272*4882a593Smuzhiyuntherefore, not suitable to protect against fan mode changes made through
1273*4882a593Smuzhiyunmeans other than the "enable", "disable", and "level" procfs fan
1274*4882a593Smuzhiyuncommands, or the hwmon fan control sysfs interface.
1275*4882a593Smuzhiyun
1276*4882a593SmuzhiyunProcfs notes
1277*4882a593Smuzhiyun^^^^^^^^^^^^
1278*4882a593Smuzhiyun
1279*4882a593SmuzhiyunThe fan may be enabled or disabled with the following commands::
1280*4882a593Smuzhiyun
1281*4882a593Smuzhiyun	echo enable  >/proc/acpi/ibm/fan
1282*4882a593Smuzhiyun	echo disable >/proc/acpi/ibm/fan
1283*4882a593Smuzhiyun
1284*4882a593SmuzhiyunPlacing a fan on level 0 is the same as disabling it.  Enabling a fan
1285*4882a593Smuzhiyunwill try to place it in a safe level if it is too slow or disabled.
1286*4882a593Smuzhiyun
1287*4882a593SmuzhiyunThe fan level can be controlled with the command::
1288*4882a593Smuzhiyun
1289*4882a593Smuzhiyun	echo 'level <level>' > /proc/acpi/ibm/fan
1290*4882a593Smuzhiyun
1291*4882a593SmuzhiyunWhere <level> is an integer from 0 to 7, or one of the words "auto" or
1292*4882a593Smuzhiyun"full-speed" (without the quotes).  Not all ThinkPads support the "auto"
1293*4882a593Smuzhiyunand "full-speed" levels.  The driver accepts "disengaged" as an alias for
1294*4882a593Smuzhiyun"full-speed", and reports it as "disengaged" for backwards
1295*4882a593Smuzhiyuncompatibility.
1296*4882a593Smuzhiyun
1297*4882a593SmuzhiyunOn the X31 and X40 (and ONLY on those models), the fan speed can be
1298*4882a593Smuzhiyuncontrolled to a certain degree.  Once the fan is running, it can be
1299*4882a593Smuzhiyunforced to run faster or slower with the following command::
1300*4882a593Smuzhiyun
1301*4882a593Smuzhiyun	echo 'speed <speed>' > /proc/acpi/ibm/fan
1302*4882a593Smuzhiyun
1303*4882a593SmuzhiyunThe sustainable range of fan speeds on the X40 appears to be from about
1304*4882a593Smuzhiyun3700 to about 7350. Values outside this range either do not have any
1305*4882a593Smuzhiyuneffect or the fan speed eventually settles somewhere in that range.  The
1306*4882a593Smuzhiyunfan cannot be stopped or started with this command.  This functionality
1307*4882a593Smuzhiyunis incomplete, and not available through the sysfs interface.
1308*4882a593Smuzhiyun
1309*4882a593SmuzhiyunTo program the safety watchdog, use the "watchdog" command::
1310*4882a593Smuzhiyun
1311*4882a593Smuzhiyun	echo 'watchdog <interval in seconds>' > /proc/acpi/ibm/fan
1312*4882a593Smuzhiyun
1313*4882a593SmuzhiyunIf you want to disable the watchdog, use 0 as the interval.
1314*4882a593Smuzhiyun
1315*4882a593SmuzhiyunSysfs notes
1316*4882a593Smuzhiyun^^^^^^^^^^^
1317*4882a593Smuzhiyun
1318*4882a593SmuzhiyunThe sysfs interface follows the hwmon subsystem guidelines for the most
1319*4882a593Smuzhiyunpart, and the exception is the fan safety watchdog.
1320*4882a593Smuzhiyun
1321*4882a593SmuzhiyunWrites to any of the sysfs attributes may return the EINVAL error if
1322*4882a593Smuzhiyunthat operation is not supported in a given ThinkPad or if the parameter
1323*4882a593Smuzhiyunis out-of-bounds, and EPERM if it is forbidden.  They may also return
1324*4882a593SmuzhiyunEINTR (interrupted system call), and EIO (I/O error while trying to talk
1325*4882a593Smuzhiyunto the firmware).
1326*4882a593Smuzhiyun
1327*4882a593SmuzhiyunFeatures not yet implemented by the driver return ENOSYS.
1328*4882a593Smuzhiyun
1329*4882a593Smuzhiyunhwmon device attribute pwm1_enable:
1330*4882a593Smuzhiyun	- 0: PWM offline (fan is set to full-speed mode)
1331*4882a593Smuzhiyun	- 1: Manual PWM control (use pwm1 to set fan level)
1332*4882a593Smuzhiyun	- 2: Hardware PWM control (EC "auto" mode)
1333*4882a593Smuzhiyun	- 3: reserved (Software PWM control, not implemented yet)
1334*4882a593Smuzhiyun
1335*4882a593Smuzhiyun	Modes 0 and 2 are not supported by all ThinkPads, and the
1336*4882a593Smuzhiyun	driver is not always able to detect this.  If it does know a
1337*4882a593Smuzhiyun	mode is unsupported, it will return -EINVAL.
1338*4882a593Smuzhiyun
1339*4882a593Smuzhiyunhwmon device attribute pwm1:
1340*4882a593Smuzhiyun	Fan level, scaled from the firmware values of 0-7 to the hwmon
1341*4882a593Smuzhiyun	scale of 0-255.  0 means fan stopped, 255 means highest normal
1342*4882a593Smuzhiyun	speed (level 7).
1343*4882a593Smuzhiyun
1344*4882a593Smuzhiyun	This attribute only commands the fan if pmw1_enable is set to 1
1345*4882a593Smuzhiyun	(manual PWM control).
1346*4882a593Smuzhiyun
1347*4882a593Smuzhiyunhwmon device attribute fan1_input:
1348*4882a593Smuzhiyun	Fan tachometer reading, in RPM.  May go stale on certain
1349*4882a593Smuzhiyun	ThinkPads while the EC transitions the PWM to offline mode,
1350*4882a593Smuzhiyun	which can take up to two minutes.  May return rubbish on older
1351*4882a593Smuzhiyun	ThinkPads.
1352*4882a593Smuzhiyun
1353*4882a593Smuzhiyunhwmon device attribute fan2_input:
1354*4882a593Smuzhiyun	Fan tachometer reading, in RPM, for the secondary fan.
1355*4882a593Smuzhiyun	Available only on some ThinkPads.  If the secondary fan is
1356*4882a593Smuzhiyun	not installed, will always read 0.
1357*4882a593Smuzhiyun
1358*4882a593Smuzhiyunhwmon driver attribute fan_watchdog:
1359*4882a593Smuzhiyun	Fan safety watchdog timer interval, in seconds.  Minimum is
1360*4882a593Smuzhiyun	1 second, maximum is 120 seconds.  0 disables the watchdog.
1361*4882a593Smuzhiyun
1362*4882a593SmuzhiyunTo stop the fan: set pwm1 to zero, and pwm1_enable to 1.
1363*4882a593Smuzhiyun
1364*4882a593SmuzhiyunTo start the fan in a safe mode: set pwm1_enable to 2.  If that fails
1365*4882a593Smuzhiyunwith EINVAL, try to set pwm1_enable to 1 and pwm1 to at least 128 (255
1366*4882a593Smuzhiyunwould be the safest choice, though).
1367*4882a593Smuzhiyun
1368*4882a593Smuzhiyun
1369*4882a593SmuzhiyunWAN
1370*4882a593Smuzhiyun---
1371*4882a593Smuzhiyun
1372*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/wan
1373*4882a593Smuzhiyun
1374*4882a593Smuzhiyunsysfs device attribute: wwan_enable (deprecated)
1375*4882a593Smuzhiyun
1376*4882a593Smuzhiyunsysfs rfkill class: switch "tpacpi_wwan_sw"
1377*4882a593Smuzhiyun
1378*4882a593SmuzhiyunThis feature shows the presence and current state of the built-in
1379*4882a593SmuzhiyunWireless WAN device.
1380*4882a593Smuzhiyun
1381*4882a593SmuzhiyunIf the ThinkPad supports it, the WWAN state is stored in NVRAM,
1382*4882a593Smuzhiyunso it is kept across reboots and power-off.
1383*4882a593Smuzhiyun
1384*4882a593SmuzhiyunIt was tested on a Lenovo ThinkPad X60. It should probably work on other
1385*4882a593SmuzhiyunThinkPad models which come with this module installed.
1386*4882a593Smuzhiyun
1387*4882a593SmuzhiyunProcfs notes
1388*4882a593Smuzhiyun^^^^^^^^^^^^
1389*4882a593Smuzhiyun
1390*4882a593SmuzhiyunIf the W-WAN card is installed, the following commands can be used::
1391*4882a593Smuzhiyun
1392*4882a593Smuzhiyun	echo enable > /proc/acpi/ibm/wan
1393*4882a593Smuzhiyun	echo disable > /proc/acpi/ibm/wan
1394*4882a593Smuzhiyun
1395*4882a593SmuzhiyunSysfs notes
1396*4882a593Smuzhiyun^^^^^^^^^^^
1397*4882a593Smuzhiyun
1398*4882a593Smuzhiyun	If the W-WAN card is installed, it can be enabled /
1399*4882a593Smuzhiyun	disabled through the "wwan_enable" thinkpad-acpi device
1400*4882a593Smuzhiyun	attribute, and its current status can also be queried.
1401*4882a593Smuzhiyun
1402*4882a593Smuzhiyun	enable:
1403*4882a593Smuzhiyun		- 0: disables WWAN card / WWAN card is disabled
1404*4882a593Smuzhiyun		- 1: enables WWAN card / WWAN card is enabled.
1405*4882a593Smuzhiyun
1406*4882a593Smuzhiyun	Note: this interface has been superseded by the	generic rfkill
1407*4882a593Smuzhiyun	class.  It has been deprecated, and it will be removed in year
1408*4882a593Smuzhiyun	2010.
1409*4882a593Smuzhiyun
1410*4882a593Smuzhiyun	rfkill controller switch "tpacpi_wwan_sw": refer to
1411*4882a593Smuzhiyun	Documentation/driver-api/rfkill.rst for details.
1412*4882a593Smuzhiyun
1413*4882a593Smuzhiyun
1414*4882a593SmuzhiyunLCD Shadow control
1415*4882a593Smuzhiyun------------------
1416*4882a593Smuzhiyun
1417*4882a593Smuzhiyunprocfs: /proc/acpi/ibm/lcdshadow
1418*4882a593Smuzhiyun
1419*4882a593SmuzhiyunSome newer T480s and T490s ThinkPads provide a feature called
1420*4882a593SmuzhiyunPrivacyGuard. By turning this feature on, the usable vertical and
1421*4882a593Smuzhiyunhorizontal viewing angles of the LCD can be limited (as if some privacy
1422*4882a593Smuzhiyunscreen was applied manually in front of the display).
1423*4882a593Smuzhiyun
1424*4882a593Smuzhiyunprocfs notes
1425*4882a593Smuzhiyun^^^^^^^^^^^^
1426*4882a593Smuzhiyun
1427*4882a593SmuzhiyunThe available commands are::
1428*4882a593Smuzhiyun
1429*4882a593Smuzhiyun	echo '0' >/proc/acpi/ibm/lcdshadow
1430*4882a593Smuzhiyun	echo '1' >/proc/acpi/ibm/lcdshadow
1431*4882a593Smuzhiyun
1432*4882a593SmuzhiyunThe first command ensures the best viewing angle and the latter one turns
1433*4882a593Smuzhiyunon the feature, restricting the viewing angles.
1434*4882a593Smuzhiyun
1435*4882a593Smuzhiyun
1436*4882a593SmuzhiyunDYTC Lapmode sensor
1437*4882a593Smuzhiyun-------------------
1438*4882a593Smuzhiyun
1439*4882a593Smuzhiyunsysfs: dytc_lapmode
1440*4882a593Smuzhiyun
1441*4882a593SmuzhiyunNewer thinkpads and mobile workstations have the ability to determine if
1442*4882a593Smuzhiyunthe device is in deskmode or lapmode. This feature is used by user space
1443*4882a593Smuzhiyunto decide if WWAN transmission can be increased to maximum power and is
1444*4882a593Smuzhiyunalso useful for understanding the different thermal modes available as
1445*4882a593Smuzhiyunthey differ between desk and lap mode.
1446*4882a593Smuzhiyun
1447*4882a593SmuzhiyunThe property is read-only. If the platform doesn't have support the sysfs
1448*4882a593Smuzhiyunclass is not created.
1449*4882a593Smuzhiyun
1450*4882a593SmuzhiyunEXPERIMENTAL: UWB
1451*4882a593Smuzhiyun-----------------
1452*4882a593Smuzhiyun
1453*4882a593SmuzhiyunThis feature is considered EXPERIMENTAL because it has not been extensively
1454*4882a593Smuzhiyuntested and validated in various ThinkPad models yet.  The feature may not
1455*4882a593Smuzhiyunwork as expected. USE WITH CAUTION! To use this feature, you need to supply
1456*4882a593Smuzhiyunthe experimental=1 parameter when loading the module.
1457*4882a593Smuzhiyun
1458*4882a593Smuzhiyunsysfs rfkill class: switch "tpacpi_uwb_sw"
1459*4882a593Smuzhiyun
1460*4882a593SmuzhiyunThis feature exports an rfkill controller for the UWB device, if one is
1461*4882a593Smuzhiyunpresent and enabled in the BIOS.
1462*4882a593Smuzhiyun
1463*4882a593SmuzhiyunSysfs notes
1464*4882a593Smuzhiyun^^^^^^^^^^^
1465*4882a593Smuzhiyun
1466*4882a593Smuzhiyun	rfkill controller switch "tpacpi_uwb_sw": refer to
1467*4882a593Smuzhiyun	Documentation/driver-api/rfkill.rst for details.
1468*4882a593Smuzhiyun
1469*4882a593SmuzhiyunAdaptive keyboard
1470*4882a593Smuzhiyun-----------------
1471*4882a593Smuzhiyun
1472*4882a593Smuzhiyunsysfs device attribute: adaptive_kbd_mode
1473*4882a593Smuzhiyun
1474*4882a593SmuzhiyunThis sysfs attribute controls the keyboard "face" that will be shown on the
1475*4882a593SmuzhiyunLenovo X1 Carbon 2nd gen (2014)'s adaptive keyboard. The value can be read
1476*4882a593Smuzhiyunand set.
1477*4882a593Smuzhiyun
1478*4882a593Smuzhiyun- 1 = Home mode
1479*4882a593Smuzhiyun- 2 = Web-browser mode
1480*4882a593Smuzhiyun- 3 = Web-conference mode
1481*4882a593Smuzhiyun- 4 = Function mode
1482*4882a593Smuzhiyun- 5 = Layflat mode
1483*4882a593Smuzhiyun
1484*4882a593SmuzhiyunFor more details about which buttons will appear depending on the mode, please
1485*4882a593Smuzhiyunreview the laptop's user guide:
1486*4882a593Smuzhiyunhttp://www.lenovo.com/shop/americas/content/user_guides/x1carbon_2_ug_en.pdf
1487*4882a593Smuzhiyun
1488*4882a593SmuzhiyunBattery charge control
1489*4882a593Smuzhiyun----------------------
1490*4882a593Smuzhiyun
1491*4882a593Smuzhiyunsysfs attributes:
1492*4882a593Smuzhiyun/sys/class/power_supply/BAT*/charge_control_{start,end}_threshold
1493*4882a593Smuzhiyun
1494*4882a593SmuzhiyunThese two attributes are created for those batteries that are supported by the
1495*4882a593Smuzhiyundriver. They enable the user to control the battery charge thresholds of the
1496*4882a593Smuzhiyungiven battery. Both values may be read and set. `charge_control_start_threshold`
1497*4882a593Smuzhiyunaccepts an integer between 0 and 99 (inclusive); this value represents a battery
1498*4882a593Smuzhiyunpercentage level, below which charging will begin. `charge_control_end_threshold`
1499*4882a593Smuzhiyunaccepts an integer between 1 and 100 (inclusive); this value represents a battery
1500*4882a593Smuzhiyunpercentage level, above which charging will stop.
1501*4882a593Smuzhiyun
1502*4882a593SmuzhiyunThe exact semantics of the attributes may be found in
1503*4882a593SmuzhiyunDocumentation/ABI/testing/sysfs-class-power.
1504*4882a593Smuzhiyun
1505*4882a593SmuzhiyunMultiple Commands, Module Parameters
1506*4882a593Smuzhiyun------------------------------------
1507*4882a593Smuzhiyun
1508*4882a593SmuzhiyunMultiple commands can be written to the proc files in one shot by
1509*4882a593Smuzhiyunseparating them with commas, for example::
1510*4882a593Smuzhiyun
1511*4882a593Smuzhiyun	echo enable,0xffff > /proc/acpi/ibm/hotkey
1512*4882a593Smuzhiyun	echo lcd_disable,crt_enable > /proc/acpi/ibm/video
1513*4882a593Smuzhiyun
1514*4882a593SmuzhiyunCommands can also be specified when loading the thinkpad-acpi module,
1515*4882a593Smuzhiyunfor example::
1516*4882a593Smuzhiyun
1517*4882a593Smuzhiyun	modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable
1518*4882a593Smuzhiyun
1519*4882a593Smuzhiyun
1520*4882a593SmuzhiyunEnabling debugging output
1521*4882a593Smuzhiyun-------------------------
1522*4882a593Smuzhiyun
1523*4882a593SmuzhiyunThe module takes a debug parameter which can be used to selectively
1524*4882a593Smuzhiyunenable various classes of debugging output, for example::
1525*4882a593Smuzhiyun
1526*4882a593Smuzhiyun	 modprobe thinkpad_acpi debug=0xffff
1527*4882a593Smuzhiyun
1528*4882a593Smuzhiyunwill enable all debugging output classes.  It takes a bitmask, so
1529*4882a593Smuzhiyunto enable more than one output class, just add their values.
1530*4882a593Smuzhiyun
1531*4882a593Smuzhiyun	=============		======================================
1532*4882a593Smuzhiyun	Debug bitmask		Description
1533*4882a593Smuzhiyun	=============		======================================
1534*4882a593Smuzhiyun	0x8000			Disclose PID of userspace programs
1535*4882a593Smuzhiyun				accessing some functions of the driver
1536*4882a593Smuzhiyun	0x0001			Initialization and probing
1537*4882a593Smuzhiyun	0x0002			Removal
1538*4882a593Smuzhiyun	0x0004			RF Transmitter control (RFKILL)
1539*4882a593Smuzhiyun				(bluetooth, WWAN, UWB...)
1540*4882a593Smuzhiyun	0x0008			HKEY event interface, hotkeys
1541*4882a593Smuzhiyun	0x0010			Fan control
1542*4882a593Smuzhiyun	0x0020			Backlight brightness
1543*4882a593Smuzhiyun	0x0040			Audio mixer/volume control
1544*4882a593Smuzhiyun	=============		======================================
1545*4882a593Smuzhiyun
1546*4882a593SmuzhiyunThere is also a kernel build option to enable more debugging
1547*4882a593Smuzhiyuninformation, which may be necessary to debug driver problems.
1548*4882a593Smuzhiyun
1549*4882a593SmuzhiyunThe level of debugging information output by the driver can be changed
1550*4882a593Smuzhiyunat runtime through sysfs, using the driver attribute debug_level.  The
1551*4882a593Smuzhiyunattribute takes the same bitmask as the debug module parameter above.
1552*4882a593Smuzhiyun
1553*4882a593Smuzhiyun
1554*4882a593SmuzhiyunForce loading of module
1555*4882a593Smuzhiyun-----------------------
1556*4882a593Smuzhiyun
1557*4882a593SmuzhiyunIf thinkpad-acpi refuses to detect your ThinkPad, you can try to specify
1558*4882a593Smuzhiyunthe module parameter force_load=1.  Regardless of whether this works or
1559*4882a593Smuzhiyunnot, please contact ibm-acpi-devel@lists.sourceforge.net with a report.
1560*4882a593Smuzhiyun
1561*4882a593Smuzhiyun
1562*4882a593SmuzhiyunSysfs interface changelog
1563*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^
1564*4882a593Smuzhiyun
1565*4882a593Smuzhiyun=========	===============================================================
1566*4882a593Smuzhiyun0x000100:	Initial sysfs support, as a single platform driver and
1567*4882a593Smuzhiyun		device.
1568*4882a593Smuzhiyun0x000200:	Hot key support for 32 hot keys, and radio slider switch
1569*4882a593Smuzhiyun		support.
1570*4882a593Smuzhiyun0x010000:	Hot keys are now handled by default over the input
1571*4882a593Smuzhiyun		layer, the radio switch generates input event EV_RADIO,
1572*4882a593Smuzhiyun		and the driver enables hot key handling by default in
1573*4882a593Smuzhiyun		the firmware.
1574*4882a593Smuzhiyun
1575*4882a593Smuzhiyun0x020000:	ABI fix: added a separate hwmon platform device and
1576*4882a593Smuzhiyun		driver, which must be located by name (thinkpad)
1577*4882a593Smuzhiyun		and the hwmon class for libsensors4 (lm-sensors 3)
1578*4882a593Smuzhiyun		compatibility.  Moved all hwmon attributes to this
1579*4882a593Smuzhiyun		new platform device.
1580*4882a593Smuzhiyun
1581*4882a593Smuzhiyun0x020100:	Marker for thinkpad-acpi with hot key NVRAM polling
1582*4882a593Smuzhiyun		support.  If you must, use it to know you should not
1583*4882a593Smuzhiyun		start a userspace NVRAM poller (allows to detect when
1584*4882a593Smuzhiyun		NVRAM is compiled out by the user because it is
1585*4882a593Smuzhiyun		unneeded/undesired in the first place).
1586*4882a593Smuzhiyun0x020101:	Marker for thinkpad-acpi with hot key NVRAM polling
1587*4882a593Smuzhiyun		and proper hotkey_mask semantics (version 8 of the
1588*4882a593Smuzhiyun		NVRAM polling patch).  Some development snapshots of
1589*4882a593Smuzhiyun		0.18 had an earlier version that did strange things
1590*4882a593Smuzhiyun		to hotkey_mask.
1591*4882a593Smuzhiyun
1592*4882a593Smuzhiyun0x020200:	Add poll()/select() support to the following attributes:
1593*4882a593Smuzhiyun		hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason
1594*4882a593Smuzhiyun
1595*4882a593Smuzhiyun0x020300:	hotkey enable/disable support removed, attributes
1596*4882a593Smuzhiyun		hotkey_bios_enabled and hotkey_enable deprecated and
1597*4882a593Smuzhiyun		marked for removal.
1598*4882a593Smuzhiyun
1599*4882a593Smuzhiyun0x020400:	Marker for 16 LEDs support.  Also, LEDs that are known
1600*4882a593Smuzhiyun		to not exist in a given model are not registered with
1601*4882a593Smuzhiyun		the LED sysfs class anymore.
1602*4882a593Smuzhiyun
1603*4882a593Smuzhiyun0x020500:	Updated hotkey driver, hotkey_mask is always available
1604*4882a593Smuzhiyun		and it is always able to disable hot keys.  Very old
1605*4882a593Smuzhiyun		thinkpads are properly supported.  hotkey_bios_mask
1606*4882a593Smuzhiyun		is deprecated and marked for removal.
1607*4882a593Smuzhiyun
1608*4882a593Smuzhiyun0x020600:	Marker for backlight change event support.
1609*4882a593Smuzhiyun
1610*4882a593Smuzhiyun0x020700:	Support for mute-only mixers.
1611*4882a593Smuzhiyun		Volume control in read-only mode by default.
1612*4882a593Smuzhiyun		Marker for ALSA mixer support.
1613*4882a593Smuzhiyun
1614*4882a593Smuzhiyun0x030000:	Thermal and fan sysfs attributes were moved to the hwmon
1615*4882a593Smuzhiyun		device instead of being attached to the backing platform
1616*4882a593Smuzhiyun		device.
1617*4882a593Smuzhiyun=========	===============================================================
1618