blob: c437b1aeff55052e14f07d2e382259d3f9642bbf [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001 IBM ThinkPad ACPI Extras Driver
2
3 Version 0.8
4 8 November 2004
5
6 Borislav Deianov <borislav@users.sf.net>
7 http://ibm-acpi.sf.net/
8
9
10This is a Linux ACPI driver for the IBM ThinkPad laptops. It aims to
11support various features of these laptops which are accessible through
12the ACPI framework but not otherwise supported by the generic Linux
13ACPI drivers.
14
15
16Status
17------
18
19The features currently supported are the following (see below for
20detailed description):
21
22 - Fn key combinations
23 - Bluetooth enable and disable
24 - video output switching, expansion control
25 - ThinkLight on and off
26 - limited docking and undocking
27 - UltraBay eject
28 - Experimental: CMOS control
29 - Experimental: LED control
30 - Experimental: ACPI sounds
31
32A compatibility table by model and feature is maintained on the web
33site, http://ibm-acpi.sf.net/. I appreciate any success or failure
34reports, especially if they add to or correct the compatibility table.
35Please include the following information in your report:
36
37 - ThinkPad model name
38 - a copy of your DSDT, from /proc/acpi/dsdt
39 - which driver features work and which don't
40 - the observed behavior of non-working features
41
42Any other comments or patches are also more than welcome.
43
44
45Installation
46------------
47
48If you are compiling this driver as included in the Linux kernel
49sources, simply enable the CONFIG_ACPI_IBM option (Power Management /
50ACPI / IBM ThinkPad Laptop Extras). The rest of this section describes
51how to install this driver when downloaded from the web site.
52
53First, you need to get a kernel with ACPI support up and running.
54Please refer to http://acpi.sourceforge.net/ for help with this
55step. How successful you will be depends a lot on you ThinkPad model,
56the kernel you are using and any additional patches applied. The
57kernel provided with your distribution may not be good enough. I
58needed to compile a 2.6.7 kernel with the 20040715 ACPI patch to get
59ACPI working reliably on my ThinkPad X40. Old ThinkPad models may not
60be supported at all.
61
62Assuming you have the basic ACPI support working (e.g. you can see the
63/proc/acpi directory), follow the following steps to install this
64driver:
65
66 - unpack the archive:
67
68 tar xzvf ibm-acpi-x.y.tar.gz; cd ibm-acpi-x.y
69
70 - compile the driver:
71
72 make
73
74 - install the module in your kernel modules directory:
75
76 make install
77
78 - load the module:
79
80 modprobe ibm_acpi
81
82After loading the module, check the "dmesg" output for any error messages.
83
84
85Features
86--------
87
88The driver creates the /proc/acpi/ibm directory. There is a file under
89that directory for each feature described below. Note that while the
90driver is still in the alpha stage, the exact proc file format and
91commands supported by the various features is guaranteed to change
92frequently.
93
94Driver Version -- /proc/acpi/ibm/driver
95--------------------------------------
96
97The driver name and version. No commands can be written to this file.
98
99Hot Keys -- /proc/acpi/ibm/hotkey
100---------------------------------
101
102Without this driver, only the Fn-F4 key (sleep button) generates an
103ACPI event. With the driver loaded, the hotkey feature enabled and the
104mask set (see below), the various hot keys generate ACPI events in the
105following format:
106
107 ibm/hotkey HKEY 00000080 0000xxxx
108
109The last four digits vary depending on the key combination pressed.
110All labeled Fn-Fx key combinations generate distinct events. In
111addition, the lid microswitch and some docking station buttons may
112also generate such events.
113
114The following commands can be written to this file:
115
116 echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature
117 echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature
118 echo 0xffff > /proc/acpi/ibm/hotkey -- enable all possible hot keys
119 echo 0x0000 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
120 ... any other 4-hex-digit mask ...
121 echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
122
123The bit mask allows some control over which hot keys generate ACPI
124events. Not all bits in the mask can be modified. Not all bits that
125can be modified do anything. Not all hot keys can be individually
126controlled by the mask. Most recent ThinkPad models honor the
127following bits (assuming the hot keys feature has been enabled):
128
129 key bit behavior when set behavior when unset
130
131 Fn-F3 always generates ACPI event
132 Fn-F4 always generates ACPI event
133 Fn-F5 0010 generate ACPI event enable/disable Bluetooth
134 Fn-F7 0040 generate ACPI event switch LCD and external display
135 Fn-F8 0080 generate ACPI event expand screen or none
136 Fn-F9 0100 generate ACPI event none
137 Fn-F12 always generates ACPI event
138
139Some models do not support all of the above. For example, the T30 does
140not support Fn-F5 and Fn-F9. Other models do not support the mask at
141all. On those models, hot keys cannot be controlled individually.
142
143Note that enabling ACPI events for some keys prevents their default
144behavior. For example, if events for Fn-F5 are enabled, that key will
145no longer enable/disable Bluetooth by itself. This can still be done
146from an acpid handler for the ibm/hotkey event.
147
148Note also that not all Fn key combinations are supported through
149ACPI. For example, on the X40, the brightness, volume and "Access IBM"
150buttons do not generate ACPI events even with this driver. They *can*
151be used through the "ThinkPad Buttons" utility, see
152http://www.nongnu.org/tpb/
153
154Bluetooth -- /proc/acpi/ibm/bluetooth
155-------------------------------------
156
157This feature shows the presence and current state of a Bluetooth
158device. If Bluetooth is installed, the following commands can be used:
159
160 echo enable > /proc/acpi/ibm/bluetooth
161 echo disable > /proc/acpi/ibm/bluetooth
162
163Video output control -- /proc/acpi/ibm/video
164--------------------------------------------
165
166This feature allows control over the devices used for video output -
167LCD, CRT or DVI (if available). The following commands are available:
168
169 echo lcd_enable > /proc/acpi/ibm/video
170 echo lcd_disable > /proc/acpi/ibm/video
171 echo crt_enable > /proc/acpi/ibm/video
172 echo crt_disable > /proc/acpi/ibm/video
173 echo dvi_enable > /proc/acpi/ibm/video
174 echo dvi_disable > /proc/acpi/ibm/video
175 echo auto_enable > /proc/acpi/ibm/video
176 echo auto_disable > /proc/acpi/ibm/video
177 echo expand_toggle > /proc/acpi/ibm/video
178 echo video_switch > /proc/acpi/ibm/video
179
180Each video output device can be enabled or disabled individually.
181Reading /proc/acpi/ibm/video shows the status of each device.
182
183Automatic video switching can be enabled or disabled. When automatic
184video switching is enabled, certain events (e.g. opening the lid,
185docking or undocking) cause the video output device to change
186automatically. While this can be useful, it also causes flickering
187and, on the X40, video corruption. By disabling automatic switching,
188the flickering or video corruption can be avoided.
189
190The video_switch command cycles through the available video outputs
191(it sumulates the behavior of Fn-F7).
192
193Video expansion can be toggled through this feature. This controls
194whether the display is expanded to fill the entire LCD screen when a
195mode with less than full resolution is used. Note that the current
196video expansion status cannot be determined through this feature.
197
198Note that on many models (particularly those using Radeon graphics
199chips) the X driver configures the video card in a way which prevents
200Fn-F7 from working. This also disables the video output switching
201features of this driver, as it uses the same ACPI methods as
202Fn-F7. Video switching on the console should still work.
203
204ThinkLight control -- /proc/acpi/ibm/light
205------------------------------------------
206
207The current status of the ThinkLight can be found in this file. A few
208models which do not make the status available will show it as
209"unknown". The available commands are:
210
211 echo on > /proc/acpi/ibm/light
212 echo off > /proc/acpi/ibm/light
213
214Docking / Undocking -- /proc/acpi/ibm/dock
215------------------------------------------
216
217Docking and undocking (e.g. with the X4 UltraBase) requires some
218actions to be taken by the operating system to safely make or break
219the electrical connections with the dock.
220
221The docking feature of this driver generates the following ACPI events:
222
223 ibm/dock GDCK 00000003 00000001 -- eject request
224 ibm/dock GDCK 00000003 00000002 -- undocked
225 ibm/dock GDCK 00000000 00000003 -- docked
226
227NOTE: These events will only be generated if the laptop was docked
228when originally booted. This is due to the current lack of support for
229hot plugging of devices in the Linux ACPI framework. If the laptop was
230booted while not in the dock, the following message is shown in the
231logs: "ibm_acpi: dock device not present". No dock-related events are
232generated but the dock and undock commands described below still
233work. They can be executed manually or triggered by Fn key
234combinations (see the example acpid configuration files included in
235the driver tarball package available on the web site).
236
237When the eject request button on the dock is pressed, the first event
238above is generated. The handler for this event should issue the
239following command:
240
241 echo undock > /proc/acpi/ibm/dock
242
243After the LED on the dock goes off, it is safe to eject the laptop.
244Note: if you pressed this key by mistake, go ahead and eject the
245laptop, then dock it back in. Otherwise, the dock may not function as
246expected.
247
248When the laptop is docked, the third event above is generated. The
249handler for this event should issue the following command to fully
250enable the dock:
251
252 echo dock > /proc/acpi/ibm/dock
253
254The contents of the /proc/acpi/ibm/dock file shows the current status
255of the dock, as provided by the ACPI framework.
256
257The docking support in this driver does not take care of enabling or
258disabling any other devices you may have attached to the dock. For
259example, a CD drive plugged into the UltraBase needs to be disabled or
260enabled separately. See the provided example acpid configuration files
261for how this can be accomplished.
262
263There is no support yet for PCI devices that may be attached to a
264docking station, e.g. in the ThinkPad Dock II. The driver currently
265does not recognize, enable or disable such devices. This means that
266the only docking stations currently supported are the X-series
267UltraBase docks and "dumb" port replicators like the Mini Dock (the
268latter don't need any ACPI support, actually).
269
270UltraBay Eject -- /proc/acpi/ibm/bay
271------------------------------------
272
273Inserting or ejecting an UltraBay device requires some actions to be
274taken by the operating system to safely make or break the electrical
275connections with the device.
276
277This feature generates the following ACPI events:
278
279 ibm/bay MSTR 00000003 00000000 -- eject request
280 ibm/bay MSTR 00000001 00000000 -- eject lever inserted
281
282NOTE: These events will only be generated if the UltraBay was present
283when the laptop was originally booted (on the X series, the UltraBay
284is in the dock, so it may not be present if the laptop was undocked).
285This is due to the current lack of support for hot plugging of devices
286in the Linux ACPI framework. If the laptop was booted without the
287UltraBay, the following message is shown in the logs: "ibm_acpi: bay
288device not present". No bay-related events are generated but the eject
289command described below still works. It can be executed manually or
290triggered by a hot key combination.
291
292Sliding the eject lever generates the first event shown above. The
293handler for this event should take whatever actions are necessary to
294shut down the device in the UltraBay (e.g. call idectl), then issue
295the following command:
296
297 echo eject > /proc/acpi/ibm/bay
298
299After the LED on the UltraBay goes off, it is safe to pull out the
300device.
301
302When the eject lever is inserted, the second event above is
303generated. The handler for this event should take whatever actions are
304necessary to enable the UltraBay device (e.g. call idectl).
305
306The contents of the /proc/acpi/ibm/bay file shows the current status
307of the UltraBay, as provided by the ACPI framework.
308
309Experimental Features
310---------------------
311
312The following features are marked experimental because using them
313involves guessing the correct values of some parameters. Guessing
314incorrectly may have undesirable effects like crashing your
315ThinkPad. USE THESE WITH CAUTION! To activate them, you'll need to
316supply the experimental=1 parameter when loading the module.
317
318Experimental: CMOS control - /proc/acpi/ibm/cmos
319------------------------------------------------
320
321This feature is used internally by the ACPI firmware to control the
322ThinkLight on most newer ThinkPad models. It appears that it can also
323control LCD brightness, sounds volume and more, but only on some
324models.
325
326The commands are non-negative integer numbers:
327
328 echo 0 >/proc/acpi/ibm/cmos
329 echo 1 >/proc/acpi/ibm/cmos
330 echo 2 >/proc/acpi/ibm/cmos
331 ...
332
333The range of numbers which are used internally by various models is 0
334to 21, but it's possible that numbers outside this range have
335interesting behavior. Here is the behavior on the X40 (tpb is the
336ThinkPad Buttons utility):
337
338 0 - no effect but tpb reports "Volume down"
339 1 - no effect but tpb reports "Volume up"
340 2 - no effect but tpb reports "Mute on"
341 3 - simulate pressing the "Access IBM" button
342 4 - LCD brightness up
343 5 - LCD brightness down
344 11 - toggle screen expansion
345 12 - ThinkLight on
346 13 - ThinkLight off
347 14 - no effect but tpb reports ThinkLight status change
348
349If you try this feature, please send me a report similar to the
350above. On models which allow control of LCD brightness or sound
351volume, I'd like to provide this functionality in an user-friendly
352way, but first I need a way to identify the models which this is
353possible.
354
355Experimental: LED control - /proc/acpi/ibm/LED
356----------------------------------------------
357
358Some of the LED indicators can be controlled through this feature. The
359available commands are:
360
361 echo <led number> on >/proc/acpi/ibm/led
362 echo <led number> off >/proc/acpi/ibm/led
363 echo <led number> blink >/proc/acpi/ibm/led
364
365The <led number> parameter is a non-negative integer. The range of LED
366numbers used internally by various models is 0 to 7 but it's possible
367that numbers outside this range are also valid. Here is the mapping on
368the X40:
369
370 0 - power
371 1 - battery (orange)
372 2 - battery (green)
373 3 - UltraBase
374 4 - UltraBay
375 7 - standby
376
377All of the above can be turned on and off and can be made to blink.
378
379If you try this feature, please send me a report similar to the
380above. I'd like to provide this functionality in an user-friendly way,
381but first I need to identify the which numbers correspond to which
382LEDs on various models.
383
384Experimental: ACPI sounds - /proc/acpi/ibm/beep
385-----------------------------------------------
386
387The BEEP method is used internally by the ACPI firmware to provide
388audible alerts in various situtation. This feature allows the same
389sounds to be triggered manually.
390
391The commands are non-negative integer numbers:
392
393 echo 0 >/proc/acpi/ibm/beep
394 echo 1 >/proc/acpi/ibm/beep
395 echo 2 >/proc/acpi/ibm/beep
396 ...
397
398The range of numbers which are used internally by various models is 0
399to 17, but it's possible that numbers outside this range are also
400valid. Here is the behavior on the X40:
401
402 2 - two beeps, pause, third beep
403 3 - single beep
404 4 - "unable"
405 5 - single beep
406 6 - "AC/DC"
407 7 - high-pitched beep
408 9 - three short beeps
409 10 - very long beep
410 12 - low-pitched beep
411
412(I've only been able to identify a couple of them).
413
414If you try this feature, please send me a report similar to the
415above. I'd like to provide this functionality in an user-friendly way,
416but first I need to identify the which numbers correspond to which
417sounds on various models.
418
419
420Multiple Command, Module Parameters
421-----------------------------------
422
423Multiple commands can be written to the proc files in one shot by
424separating them with commas, for example:
425
426 echo enable,0xffff > /proc/acpi/ibm/hotkey
427 echo lcd_disable,crt_enable > /proc/acpi/ibm/video
428
429Commands can also be specified when loading the ibm_acpi module, for
430example:
431
432 modprobe ibm_acpi hotkey=enable,0xffff video=auto_disable
433
434
435Example Configuration
436---------------------
437
438The ACPI support in the kernel is intended to be used in conjunction
439with a user-space daemon, acpid. The configuration files for this
440daemon control what actions are taken in response to various ACPI
441events. An example set of configuration files are included in the
442config/ directory of the tarball package available on the web
443site. Note that these are provided for illustration purposes only and
444may need to be adapted to your particular setup.
445
446The following utility scripts are used by the example action
447scripts (included with ibm-acpi for completeness):
448
449 /usr/local/sbin/idectl -- from the hdparm source distribution,
450 see http://www.ibiblio.org/pub/Linux/system/hardware
451 /usr/local/sbin/laptop_mode -- from the Linux kernel source
452 distribution, see Documentation/laptop-mode.txt
453 /sbin/service -- comes with Redhat/Fedora distributions
454
455Toan T Nguyen <ntt@control.uchicago.edu> has written a SuSE powersave
456script for the X20, included in config/usr/sbin/ibm_hotkeys_X20
457
458Henrik Brix Andersen <brix@gentoo.org> has written a Gentoo ACPI event
459handler script for the X31. You can get the latest version from
460http://dev.gentoo.org/~brix/files/x31.sh
461
462David Schweikert <dws@ee.eth.ch> has written an alternative blank.sh
463script which works on Debian systems, included in
464configs/etc/acpi/actions/blank-debian.sh
465
466
467TODO
468----
469
470I'd like to implement the following features but haven't yet found the
471time and/or I don't yet know how to implement them:
472
473- UltraBay floppy drive support
474