ibm-acpi.txt 17 KB

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