summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-04-18 10:12:57 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-07-15 08:20:25 -0400
commitb02f1651ff7758c4db0d759ab765d39986a79f5a (patch)
treec129ec86b6d244203d00066c4dc3d0b911e54d54
parentdb9a0975a20c1f21c108b9d44545792d790593e4 (diff)
docs: laptops: convert to ReST
Rename the laptops documentation files to ReST, add an index for them and adjust in order to produce a nice html output via the Sphinx build system. At its new index.rst, let's add a :orphan: while this is not linked to the main index.rst file, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-rw-r--r--Documentation/ABI/testing/sysfs-block-device2
-rw-r--r--Documentation/ABI/testing/sysfs-platform-asus-laptop2
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt2
-rw-r--r--Documentation/laptops/asus-laptop.rst (renamed from Documentation/laptops/asus-laptop.txt)92
-rw-r--r--Documentation/laptops/disk-shock-protection.rst (renamed from Documentation/laptops/disk-shock-protection.txt)32
-rw-r--r--Documentation/laptops/index.rst17
-rw-r--r--Documentation/laptops/laptop-mode.rst (renamed from Documentation/laptops/laptop-mode.txt)579
-rw-r--r--Documentation/laptops/sony-laptop.rst (renamed from Documentation/laptops/sony-laptop.txt)58
-rw-r--r--Documentation/laptops/sonypi.rst (renamed from Documentation/laptops/sonypi.txt)28
-rw-r--r--Documentation/laptops/thinkpad-acpi.rst (renamed from Documentation/laptops/thinkpad-acpi.txt)363
-rw-r--r--Documentation/laptops/toshiba_haps.rst (renamed from Documentation/laptops/toshiba_haps.txt)47
-rw-r--r--Documentation/sysctl/vm.txt4
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/platform/x86/Kconfig4
15 files changed, 695 insertions, 539 deletions
diff --git a/Documentation/ABI/testing/sysfs-block-device b/Documentation/ABI/testing/sysfs-block-device
index 82ef6eab042d..0d57bbb4fddc 100644
--- a/Documentation/ABI/testing/sysfs-block-device
+++ b/Documentation/ABI/testing/sysfs-block-device
@@ -45,7 +45,7 @@ Description:
45 - Values below -2 are rejected with -EINVAL 45 - Values below -2 are rejected with -EINVAL
46 46
47 For more information, see 47 For more information, see
48 Documentation/laptops/disk-shock-protection.txt 48 Documentation/laptops/disk-shock-protection.rst
49 49
50 50
51What: /sys/block/*/device/ncq_prio_enable 51What: /sys/block/*/device/ncq_prio_enable
diff --git a/Documentation/ABI/testing/sysfs-platform-asus-laptop b/Documentation/ABI/testing/sysfs-platform-asus-laptop
index cd9d667c3da2..d67fa4bafa70 100644
--- a/Documentation/ABI/testing/sysfs-platform-asus-laptop
+++ b/Documentation/ABI/testing/sysfs-platform-asus-laptop
@@ -31,7 +31,7 @@ Description:
31 To control the LED display, use the following : 31 To control the LED display, use the following :
32 echo 0x0T000DDD > /sys/devices/platform/asus_laptop/ 32 echo 0x0T000DDD > /sys/devices/platform/asus_laptop/
33 where T control the 3 letters display, and DDD the 3 digits display. 33 where T control the 3 letters display, and DDD the 3 digits display.
34 The DDD table can be found in Documentation/laptops/asus-laptop.txt 34 The DDD table can be found in Documentation/laptops/asus-laptop.rst
35 35
36What: /sys/devices/platform/asus_laptop/bluetooth 36What: /sys/devices/platform/asus_laptop/bluetooth
37Date: January 2007 37Date: January 2007
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index ed104a44e8b2..a342dd5c95a9 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4347,7 +4347,7 @@
4347 Format: <integer> 4347 Format: <integer>
4348 4348
4349 sonypi.*= [HW] Sony Programmable I/O Control Device driver 4349 sonypi.*= [HW] Sony Programmable I/O Control Device driver
4350 See Documentation/laptops/sonypi.txt 4350 See Documentation/laptops/sonypi.rst
4351 4351
4352 spectre_v2= [X86] Control mitigation of Spectre variant 2 4352 spectre_v2= [X86] Control mitigation of Spectre variant 2
4353 (indirect branch speculation) vulnerability. 4353 (indirect branch speculation) vulnerability.
diff --git a/Documentation/laptops/asus-laptop.txt b/Documentation/laptops/asus-laptop.rst
index 5f2858712aa0..95176321a25a 100644
--- a/Documentation/laptops/asus-laptop.txt
+++ b/Documentation/laptops/asus-laptop.rst
@@ -1,6 +1,9 @@
1==================
1Asus Laptop Extras 2Asus Laptop Extras
3==================
2 4
3Version 0.1 5Version 0.1
6
4August 6, 2009 7August 6, 2009
5 8
6Corentin Chary <corentincj@iksaif.net> 9Corentin Chary <corentincj@iksaif.net>
@@ -10,11 +13,12 @@ http://acpi4asus.sf.net/
10 It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or 13 It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or
11 VICTOR XP7210 for example). It makes all the extra buttons generate input 14 VICTOR XP7210 for example). It makes all the extra buttons generate input
12 events (like keyboards). 15 events (like keyboards).
16
13 On some models adds support for changing the display brightness and output, 17 On some models adds support for changing the display brightness and output,
14 switching the LCD backlight on and off, and most importantly, allows you to 18 switching the LCD backlight on and off, and most importantly, allows you to
15 blink those fancy LEDs intended for reporting mail and wireless status. 19 blink those fancy LEDs intended for reporting mail and wireless status.
16 20
17This driver supercedes the old asus_acpi driver. 21This driver supersedes the old asus_acpi driver.
18 22
19Requirements 23Requirements
20------------ 24------------
@@ -49,7 +53,7 @@ Usage
49 see some lines like this : 53 see some lines like this :
50 54
51 Asus Laptop Extras version 0.42 55 Asus Laptop Extras version 0.42
52 L2D model detected. 56 - L2D model detected.
53 57
54 If it is not the output you have on your laptop, send it (and the laptop's 58 If it is not the output you have on your laptop, send it (and the laptop's
55 DSDT) to me. 59 DSDT) to me.
@@ -68,9 +72,12 @@ Usage
68LEDs 72LEDs
69---- 73----
70 74
71 You can modify LEDs be echoing values to /sys/class/leds/asus::*/brightness : 75 You can modify LEDs be echoing values to `/sys/class/leds/asus/*/brightness`::
76
72 echo 1 > /sys/class/leds/asus::mail/brightness 77 echo 1 > /sys/class/leds/asus::mail/brightness
78
73 will switch the mail LED on. 79 will switch the mail LED on.
80
74 You can also know if they are on/off by reading their content and use 81 You can also know if they are on/off by reading their content and use
75 kernel triggers like disk-activity or heartbeat. 82 kernel triggers like disk-activity or heartbeat.
76 83
@@ -81,7 +88,7 @@ Backlight
81 /sys/class/backlight/asus-laptop/. Brightness Values are between 0 and 15. 88 /sys/class/backlight/asus-laptop/. Brightness Values are between 0 and 15.
82 89
83Wireless devices 90Wireless devices
84--------------- 91----------------
85 92
86 You can turn the internal Bluetooth adapter on/off with the bluetooth entry 93 You can turn the internal Bluetooth adapter on/off with the bluetooth entry
87 (only on models with Bluetooth). This usually controls the associated LED. 94 (only on models with Bluetooth). This usually controls the associated LED.
@@ -93,18 +100,20 @@ Display switching
93 Note: the display switching code is currently considered EXPERIMENTAL. 100 Note: the display switching code is currently considered EXPERIMENTAL.
94 101
95 Switching works for the following models: 102 Switching works for the following models:
96 L3800C 103
97 A2500H 104 - L3800C
98 L5800C 105 - A2500H
99 M5200N 106 - L5800C
100 W1000N (albeit with some glitches) 107 - M5200N
101 M6700R 108 - W1000N (albeit with some glitches)
102 A6JC 109 - M6700R
103 F3J 110 - A6JC
111 - F3J
104 112
105 Switching doesn't work for the following: 113 Switching doesn't work for the following:
106 M3700N 114
107 L2X00D (locks the laptop under certain conditions) 115 - M3700N
116 - L2X00D (locks the laptop under certain conditions)
108 117
109 To switch the displays, echo values from 0 to 15 to 118 To switch the displays, echo values from 0 to 15 to
110 /sys/devices/platform/asus-laptop/display. The significance of those values 119 /sys/devices/platform/asus-laptop/display. The significance of those values
@@ -113,48 +122,51 @@ Display switching
113 +-------+-----+-----+-----+-----+-----+ 122 +-------+-----+-----+-----+-----+-----+
114 | Bin | Val | DVI | TV | CRT | LCD | 123 | Bin | Val | DVI | TV | CRT | LCD |
115 +-------+-----+-----+-----+-----+-----+ 124 +-------+-----+-----+-----+-----+-----+
116 + 0000 + 0 + + + + + 125 | 0000 | 0 | | | | |
117 +-------+-----+-----+-----+-----+-----+ 126 +-------+-----+-----+-----+-----+-----+
118 + 0001 + 1 + + + + X + 127 | 0001 | 1 | | | | X |
119 +-------+-----+-----+-----+-----+-----+ 128 +-------+-----+-----+-----+-----+-----+
120 + 0010 + 2 + + + X + + 129 | 0010 | 2 | | | X | |
121 +-------+-----+-----+-----+-----+-----+ 130 +-------+-----+-----+-----+-----+-----+
122 + 0011 + 3 + + + X + X + 131 | 0011 | 3 | | | X | X |
123 +-------+-----+-----+-----+-----+-----+ 132 +-------+-----+-----+-----+-----+-----+
124 + 0100 + 4 + + X + + + 133 | 0100 | 4 | | X | | |
125 +-------+-----+-----+-----+-----+-----+ 134 +-------+-----+-----+-----+-----+-----+
126 + 0101 + 5 + + X + + X + 135 | 0101 | 5 | | X | | X |
127 +-------+-----+-----+-----+-----+-----+ 136 +-------+-----+-----+-----+-----+-----+
128 + 0110 + 6 + + X + X + + 137 | 0110 | 6 | | X | X | |
129 +-------+-----+-----+-----+-----+-----+ 138 +-------+-----+-----+-----+-----+-----+
130 + 0111 + 7 + + X + X + X + 139 | 0111 | 7 | | X | X | X |
131 +-------+-----+-----+-----+-----+-----+ 140 +-------+-----+-----+-----+-----+-----+
132 + 1000 + 8 + X + + + + 141 | 1000 | 8 | X | | | |
133 +-------+-----+-----+-----+-----+-----+ 142 +-------+-----+-----+-----+-----+-----+
134 + 1001 + 9 + X + + + X + 143 | 1001 | 9 | X | | | X |
135 +-------+-----+-----+-----+-----+-----+ 144 +-------+-----+-----+-----+-----+-----+
136 + 1010 + 10 + X + + X + + 145 | 1010 | 10 | X | | X | |
137 +-------+-----+-----+-----+-----+-----+ 146 +-------+-----+-----+-----+-----+-----+
138 + 1011 + 11 + X + + X + X + 147 | 1011 | 11 | X | | X | X |
139 +-------+-----+-----+-----+-----+-----+ 148 +-------+-----+-----+-----+-----+-----+
140 + 1100 + 12 + X + X + + + 149 | 1100 | 12 | X | X | | |
141 +-------+-----+-----+-----+-----+-----+ 150 +-------+-----+-----+-----+-----+-----+
142 + 1101 + 13 + X + X + + X + 151 | 1101 | 13 | X | X | | X |
143 +-------+-----+-----+-----+-----+-----+ 152 +-------+-----+-----+-----+-----+-----+
144 + 1110 + 14 + X + X + X + + 153 | 1110 | 14 | X | X | X | |
145 +-------+-----+-----+-----+-----+-----+ 154 +-------+-----+-----+-----+-----+-----+
146 + 1111 + 15 + X + X + X + X + 155 | 1111 | 15 | X | X | X | X |
147 +-------+-----+-----+-----+-----+-----+ 156 +-------+-----+-----+-----+-----+-----+
148 157
149 In most cases, the appropriate displays must be plugged in for the above 158 In most cases, the appropriate displays must be plugged in for the above
150 combinations to work. TV-Out may need to be initialized at boot time. 159 combinations to work. TV-Out may need to be initialized at boot time.
151 160
152 Debugging: 161 Debugging:
162
153 1) Check whether the Fn+F8 key: 163 1) Check whether the Fn+F8 key:
164
154 a) does not lock the laptop (try a boot with noapic / nolapic if it does) 165 a) does not lock the laptop (try a boot with noapic / nolapic if it does)
155 b) generates events (0x6n, where n is the value corresponding to the 166 b) generates events (0x6n, where n is the value corresponding to the
156 configuration above) 167 configuration above)
157 c) actually works 168 c) actually works
169
158 Record the disp value at every configuration. 170 Record the disp value at every configuration.
159 2) Echo values from 0 to 15 to /sys/devices/platform/asus-laptop/display. 171 2) Echo values from 0 to 15 to /sys/devices/platform/asus-laptop/display.
160 Record its value, note any change. If nothing changes, try a broader range, 172 Record its value, note any change. If nothing changes, try a broader range,
@@ -164,7 +176,7 @@ Display switching
164 176
165 Note: on some machines (e.g. L3C), after the module has been loaded, only 0x6n 177 Note: on some machines (e.g. L3C), after the module has been loaded, only 0x6n
166 events are generated and no actual switching occurs. In such a case, a line 178 events are generated and no actual switching occurs. In such a case, a line
167 like: 179 like::
168 180
169 echo $((10#$arg-60)) > /sys/devices/platform/asus-laptop/display 181 echo $((10#$arg-60)) > /sys/devices/platform/asus-laptop/display
170 182
@@ -180,15 +192,16 @@ LED display
180 several items of information. 192 several items of information.
181 193
182 LED display works for the following models: 194 LED display works for the following models:
183 W1000N
184 W1J
185 195
186 To control the LED display, use the following : 196 - W1000N
197 - W1J
198
199 To control the LED display, use the following::
187 200
188 echo 0x0T000DDD > /sys/devices/platform/asus-laptop/ 201 echo 0x0T000DDD > /sys/devices/platform/asus-laptop/
189 202
190 where T control the 3 letters display, and DDD the 3 digits display, 203 where T control the 3 letters display, and DDD the 3 digits display,
191 according to the tables below. 204 according to the tables below::
192 205
193 DDD (digits) 206 DDD (digits)
194 000 to 999 = display digits 207 000 to 999 = display digits
@@ -208,8 +221,8 @@ LED display
208 For example "echo 0x01000001 >/sys/devices/platform/asus-laptop/ledd" 221 For example "echo 0x01000001 >/sys/devices/platform/asus-laptop/ledd"
209 would display "DVD001". 222 would display "DVD001".
210 223
211Driver options: 224Driver options
212--------------- 225--------------
213 226
214 Options can be passed to the asus-laptop driver using the standard 227 Options can be passed to the asus-laptop driver using the standard
215 module argument syntax (<param>=<value> when passing the option to the 228 module argument syntax (<param>=<value> when passing the option to the
@@ -219,6 +232,7 @@ Driver options:
219 wapf: WAPF defines the behavior of the Fn+Fx wlan key 232 wapf: WAPF defines the behavior of the Fn+Fx wlan key
220 The significance of values is yet to be found, but 233 The significance of values is yet to be found, but
221 most of the time: 234 most of the time:
235
222 - 0x0 should do nothing 236 - 0x0 should do nothing
223 - 0x1 should allow to control the device with Fn+Fx key. 237 - 0x1 should allow to control the device with Fn+Fx key.
224 - 0x4 should send an ACPI event (0x88) while pressing the Fn+Fx key 238 - 0x4 should send an ACPI event (0x88) while pressing the Fn+Fx key
@@ -237,7 +251,7 @@ Unsupported models
237 - ASUS L7300G 251 - ASUS L7300G
238 - ASUS L8400 252 - ASUS L8400
239 253
240Patches, Errors, Questions: 254Patches, Errors, Questions
241-------------------------- 255--------------------------
242 256
243 I appreciate any success or failure 257 I appreciate any success or failure
@@ -253,5 +267,5 @@ Patches, Errors, Questions:
253 Any other comments or patches are also more than welcome. 267 Any other comments or patches are also more than welcome.
254 268
255 acpi4asus-user@lists.sourceforge.net 269 acpi4asus-user@lists.sourceforge.net
256 http://sourceforge.net/projects/acpi4asus
257 270
271 http://sourceforge.net/projects/acpi4asus
diff --git a/Documentation/laptops/disk-shock-protection.txt b/Documentation/laptops/disk-shock-protection.rst
index 0e6ba2663834..e97c5f78d8c3 100644
--- a/Documentation/laptops/disk-shock-protection.txt
+++ b/Documentation/laptops/disk-shock-protection.rst
@@ -1,17 +1,18 @@
1==========================
1Hard disk shock protection 2Hard disk shock protection
2========================== 3==========================
3 4
4Author: Elias Oltmanns <eo@nebensachen.de> 5Author: Elias Oltmanns <eo@nebensachen.de>
6
5Last modified: 2008-10-03 7Last modified: 2008-10-03
6 8
7 9
80. Contents 10.. 0. Contents
9-----------
10 11
111. Intro 12 1. Intro
122. The interface 13 2. The interface
133. References 14 3. References
144. CREDITS 15 4. CREDITS
15 16
16 17
171. Intro 181. Intro
@@ -36,8 +37,8 @@ that).
36---------------- 37----------------
37 38
38For each ATA device, the kernel exports the file 39For each ATA device, the kernel exports the file
39block/*/device/unload_heads in sysfs (here assumed to be mounted under 40`block/*/device/unload_heads` in sysfs (here assumed to be mounted under
40/sys). Access to /sys/block/*/device/unload_heads is denied with 41/sys). Access to `/sys/block/*/device/unload_heads` is denied with
41-EOPNOTSUPP if the device does not support the unload feature. 42-EOPNOTSUPP if the device does not support the unload feature.
42Otherwise, writing an integer value to this file will take the heads 43Otherwise, writing an integer value to this file will take the heads
43of the respective drive off the platter and block all I/O operations 44of the respective drive off the platter and block all I/O operations
@@ -54,18 +55,18 @@ cancel a previously set timeout and resume normal operation
54immediately by specifying a timeout of 0. Values below -2 are rejected 55immediately by specifying a timeout of 0. Values below -2 are rejected
55with -EINVAL (see below for the special meaning of -1 and -2). If the 56with -EINVAL (see below for the special meaning of -1 and -2). If the
56timeout specified for a recent head park request has not yet expired, 57timeout specified for a recent head park request has not yet expired,
57reading from /sys/block/*/device/unload_heads will report the number 58reading from `/sys/block/*/device/unload_heads` will report the number
58of milliseconds remaining until normal operation will be resumed; 59of milliseconds remaining until normal operation will be resumed;
59otherwise, reading the unload_heads attribute will return 0. 60otherwise, reading the unload_heads attribute will return 0.
60 61
61For example, do the following in order to park the heads of drive 62For example, do the following in order to park the heads of drive
62/dev/sda and stop all I/O operations for five seconds: 63/dev/sda and stop all I/O operations for five seconds::
63 64
64# echo 5000 > /sys/block/sda/device/unload_heads 65 # echo 5000 > /sys/block/sda/device/unload_heads
65 66
66A simple 67A simple::
67 68
68# cat /sys/block/sda/device/unload_heads 69 # cat /sys/block/sda/device/unload_heads
69 70
70will show you how many milliseconds are left before normal operation 71will show you how many milliseconds are left before normal operation
71will be resumed. 72will be resumed.
@@ -112,9 +113,9 @@ unload_heads attribute. If you know that your device really does
112support the unload feature (for instance, because the vendor of your 113support the unload feature (for instance, because the vendor of your
113laptop or the hard drive itself told you so), then you can tell the 114laptop or the hard drive itself told you so), then you can tell the
114kernel to enable the usage of this feature for that drive by writing 115kernel to enable the usage of this feature for that drive by writing
115the special value -1 to the unload_heads attribute: 116the special value -1 to the unload_heads attribute::
116 117
117# echo -1 > /sys/block/sda/device/unload_heads 118 # echo -1 > /sys/block/sda/device/unload_heads
118 119
119will enable the feature for /dev/sda, and giving -2 instead of -1 will 120will enable the feature for /dev/sda, and giving -2 instead of -1 will
120disable it again. 121disable it again.
@@ -135,6 +136,7 @@ for use. Please feel free to add projects that have been the victims
135of my ignorance. 136of my ignorance.
136 137
137- http://www.thinkwiki.org/wiki/HDAPS 138- http://www.thinkwiki.org/wiki/HDAPS
139
138 See this page for information about Linux support of the hard disk 140 See this page for information about Linux support of the hard disk
139 active protection system as implemented in IBM/Lenovo Thinkpads. 141 active protection system as implemented in IBM/Lenovo Thinkpads.
140 142
diff --git a/Documentation/laptops/index.rst b/Documentation/laptops/index.rst
new file mode 100644
index 000000000000..001a30910d09
--- /dev/null
+++ b/Documentation/laptops/index.rst
@@ -0,0 +1,17 @@
1:orphan:
2
3==============
4Laptop Drivers
5==============
6
7.. toctree::
8 :maxdepth: 1
9
10 asus-laptop
11 disk-shock-protection
12 laptop-mode
13 lg-laptop
14 sony-laptop
15 sonypi
16 thinkpad-acpi
17 toshiba_haps
diff --git a/Documentation/laptops/laptop-mode.txt b/Documentation/laptops/laptop-mode.rst
index 1c707fc9b141..c984c4262f2e 100644
--- a/Documentation/laptops/laptop-mode.txt
+++ b/Documentation/laptops/laptop-mode.rst
@@ -1,8 +1,11 @@
1===============================================
1How to conserve battery power using laptop-mode 2How to conserve battery power using laptop-mode
2----------------------------------------------- 3===============================================
3 4
4Document Author: Bart Samwel (bart@samwel.tk) 5Document Author: Bart Samwel (bart@samwel.tk)
6
5Date created: January 2, 2004 7Date created: January 2, 2004
8
6Last modified: December 06, 2004 9Last modified: December 06, 2004
7 10
8Introduction 11Introduction
@@ -12,17 +15,16 @@ Laptop mode is used to minimize the time that the hard disk needs to be spun up,
12to conserve battery power on laptops. It has been reported to cause significant 15to conserve battery power on laptops. It has been reported to cause significant
13power savings. 16power savings.
14 17
15Contents 18.. Contents
16--------
17 19
18* Introduction 20 * Introduction
19* Installation 21 * Installation
20* Caveats 22 * Caveats
21* The Details 23 * The Details
22* Tips & Tricks 24 * Tips & Tricks
23* Control script 25 * Control script
24* ACPI integration 26 * ACPI integration
25* Monitoring tool 27 * Monitoring tool
26 28
27 29
28Installation 30Installation
@@ -33,7 +35,7 @@ or anything. Simply install all the files included in this document, and
33laptop mode will automatically be started when you're on battery. For 35laptop mode will automatically be started when you're on battery. For
34your convenience, a tarball containing an installer can be downloaded at: 36your convenience, a tarball containing an installer can be downloaded at:
35 37
36http://www.samwel.tk/laptop_mode/laptop_mode/ 38 http://www.samwel.tk/laptop_mode/laptop_mode/
37 39
38To configure laptop mode, you need to edit the configuration file, which is 40To configure laptop mode, you need to edit the configuration file, which is
39located in /etc/default/laptop-mode on Debian-based systems, or in 41located in /etc/default/laptop-mode on Debian-based systems, or in
@@ -209,7 +211,7 @@ Tips & Tricks
209 this on powerbooks too. I hope that this is a piece of information that 211 this on powerbooks too. I hope that this is a piece of information that
210 might be useful to the Laptop Mode patch or its users." 212 might be useful to the Laptop Mode patch or its users."
211 213
212* In syslog.conf, you can prefix entries with a dash ``-'' to omit syncing the 214* In syslog.conf, you can prefix entries with a dash `-` to omit syncing the
213 file after every logging. When you're using laptop-mode and your disk doesn't 215 file after every logging. When you're using laptop-mode and your disk doesn't
214 spin down, this is a likely culprit. 216 spin down, this is a likely culprit.
215 217
@@ -233,83 +235,82 @@ configuration file
233It should be installed as /etc/default/laptop-mode on Debian, and as 235It should be installed as /etc/default/laptop-mode on Debian, and as
234/etc/sysconfig/laptop-mode on Red Hat, SUSE, Mandrake, and other work-alikes. 236/etc/sysconfig/laptop-mode on Red Hat, SUSE, Mandrake, and other work-alikes.
235 237
236--------------------CONFIG FILE BEGIN------------------------------------------- 238Config file::
237# Maximum time, in seconds, of hard drive spindown time that you are 239
238# comfortable with. Worst case, it's possible that you could lose this 240 # Maximum time, in seconds, of hard drive spindown time that you are
239# amount of work if your battery fails you while in laptop mode. 241 # comfortable with. Worst case, it's possible that you could lose this
240#MAX_AGE=600 242 # amount of work if your battery fails you while in laptop mode.
241 243 #MAX_AGE=600
242# Automatically disable laptop mode when the number of minutes of battery 244
243# that you have left goes below this threshold. 245 # Automatically disable laptop mode when the number of minutes of battery
244MINIMUM_BATTERY_MINUTES=10 246 # that you have left goes below this threshold.
245 247 MINIMUM_BATTERY_MINUTES=10
246# Read-ahead, in 512-byte sectors. You can spin down the disk while playing MP3/OGG 248
247# by setting the disk readahead to 8MB (READAHEAD=16384). Effectively, the disk 249 # Read-ahead, in 512-byte sectors. You can spin down the disk while playing MP3/OGG
248# will read a complete MP3 at once, and will then spin down while the MP3/OGG is 250 # by setting the disk readahead to 8MB (READAHEAD=16384). Effectively, the disk
249# playing. 251 # will read a complete MP3 at once, and will then spin down while the MP3/OGG is
250#READAHEAD=4096 252 # playing.
251 253 #READAHEAD=4096
252# Shall we remount journaled fs. with appropriate commit interval? (1=yes) 254
253#DO_REMOUNTS=1 255 # Shall we remount journaled fs. with appropriate commit interval? (1=yes)
254 256 #DO_REMOUNTS=1
255# And shall we add the "noatime" option to that as well? (1=yes) 257
256#DO_REMOUNT_NOATIME=1 258 # And shall we add the "noatime" option to that as well? (1=yes)
257 259 #DO_REMOUNT_NOATIME=1
258# Dirty synchronous ratio. At this percentage of dirty pages the process 260
259# which 261 # Dirty synchronous ratio. At this percentage of dirty pages the process
260# calls write() does its own writeback 262 # which
261#DIRTY_RATIO=40 263 # calls write() does its own writeback
262 264 #DIRTY_RATIO=40
263# 265
264# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been 266 #
265# exceeded, the kernel will wake flusher threads which will then reduce the 267 # Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been
266# amount of dirty memory to dirty_background_ratio. Set this nice and low, 268 # exceeded, the kernel will wake flusher threads which will then reduce the
267# so once some writeout has commenced, we do a lot of it. 269 # amount of dirty memory to dirty_background_ratio. Set this nice and low,
268# 270 # so once some writeout has commenced, we do a lot of it.
269#DIRTY_BACKGROUND_RATIO=5 271 #
270 272 #DIRTY_BACKGROUND_RATIO=5
271# kernel default dirty buffer age 273
272#DEF_AGE=30 274 # kernel default dirty buffer age
273#DEF_UPDATE=5 275 #DEF_AGE=30
274#DEF_DIRTY_BACKGROUND_RATIO=10 276 #DEF_UPDATE=5
275#DEF_DIRTY_RATIO=40 277 #DEF_DIRTY_BACKGROUND_RATIO=10
276#DEF_XFS_AGE_BUFFER=15 278 #DEF_DIRTY_RATIO=40
277#DEF_XFS_SYNC_INTERVAL=30 279 #DEF_XFS_AGE_BUFFER=15
278#DEF_XFS_BUFD_INTERVAL=1 280 #DEF_XFS_SYNC_INTERVAL=30
279 281 #DEF_XFS_BUFD_INTERVAL=1
280# This must be adjusted manually to the value of HZ in the running kernel 282
281# on 2.4, until the XFS people change their 2.4 external interfaces to work in 283 # This must be adjusted manually to the value of HZ in the running kernel
282# centisecs. This can be automated, but it's a work in progress that still 284 # on 2.4, until the XFS people change their 2.4 external interfaces to work in
283# needs# some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for 285 # centisecs. This can be automated, but it's a work in progress that still
284# external interfaces, and that is currently always set to 100. So you don't 286 # needs# some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for
285# need to change this on 2.6. 287 # external interfaces, and that is currently always set to 100. So you don't
286#XFS_HZ=100 288 # need to change this on 2.6.
287 289 #XFS_HZ=100
288# Should the maximum CPU frequency be adjusted down while on battery? 290
289# Requires CPUFreq to be setup. 291 # Should the maximum CPU frequency be adjusted down while on battery?
290# See Documentation/admin-guide/pm/cpufreq.rst for more info 292 # Requires CPUFreq to be setup.
291#DO_CPU=0 293 # See Documentation/admin-guide/pm/cpufreq.rst for more info
292 294 #DO_CPU=0
293# When on battery what is the maximum CPU speed that the system should 295
294# use? Legal values are "slowest" for the slowest speed that your 296 # When on battery what is the maximum CPU speed that the system should
295# CPU is able to operate at, or a value listed in: 297 # use? Legal values are "slowest" for the slowest speed that your
296# /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 298 # CPU is able to operate at, or a value listed in:
297# Only applicable if DO_CPU=1. 299 # /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
298#CPU_MAXFREQ=slowest 300 # Only applicable if DO_CPU=1.
299 301 #CPU_MAXFREQ=slowest
300# Idle timeout for your hard drive (man hdparm for valid values, -S option) 302
301# Default is 2 hours on AC (AC_HD=244) and 20 seconds for battery (BATT_HD=4). 303 # Idle timeout for your hard drive (man hdparm for valid values, -S option)
302#AC_HD=244 304 # Default is 2 hours on AC (AC_HD=244) and 20 seconds for battery (BATT_HD=4).
303#BATT_HD=4 305 #AC_HD=244
304 306 #BATT_HD=4
305# The drives for which to adjust the idle timeout. Separate them by a space, 307
306# e.g. HD="/dev/hda /dev/hdb". 308 # The drives for which to adjust the idle timeout. Separate them by a space,
307#HD="/dev/hda" 309 # e.g. HD="/dev/hda /dev/hdb".
308 310 #HD="/dev/hda"
309# Set the spindown timeout on a hard drive? 311
310#DO_HD=1 312 # Set the spindown timeout on a hard drive?
311 313 #DO_HD=1
312--------------------CONFIG FILE END---------------------------------------------
313 314
314 315
315Control script 316Control script
@@ -318,125 +319,126 @@ Control script
318Please note that this control script works for the Linux 2.4 and 2.6 series (thanks 319Please note that this control script works for the Linux 2.4 and 2.6 series (thanks
319to Kiko Piris). 320to Kiko Piris).
320 321
321--------------------CONTROL SCRIPT BEGIN---------------------------------------- 322Control script::
322#!/bin/bash 323
323 324 #!/bin/bash
324# start or stop laptop_mode, best run by a power management daemon when 325
325# ac gets connected/disconnected from a laptop 326 # start or stop laptop_mode, best run by a power management daemon when
326# 327 # ac gets connected/disconnected from a laptop
327# install as /sbin/laptop_mode 328 #
328# 329 # install as /sbin/laptop_mode
329# Contributors to this script: Kiko Piris 330 #
330# Bart Samwel 331 # Contributors to this script: Kiko Piris
331# Micha Feigin 332 # Bart Samwel
332# Andrew Morton 333 # Micha Feigin
333# Herve Eychenne 334 # Andrew Morton
334# Dax Kelson 335 # Herve Eychenne
335# 336 # Dax Kelson
336# Original Linux 2.4 version by: Jens Axboe 337 #
337 338 # Original Linux 2.4 version by: Jens Axboe
338############################################################################# 339
339 340 #############################################################################
340# Source config 341
341if [ -f /etc/default/laptop-mode ] ; then 342 # Source config
343 if [ -f /etc/default/laptop-mode ] ; then
342 # Debian 344 # Debian
343 . /etc/default/laptop-mode 345 . /etc/default/laptop-mode
344elif [ -f /etc/sysconfig/laptop-mode ] ; then 346 elif [ -f /etc/sysconfig/laptop-mode ] ; then
345 # Others 347 # Others
346 . /etc/sysconfig/laptop-mode 348 . /etc/sysconfig/laptop-mode
347fi 349 fi
348 350
349# Don't raise an error if the config file is incomplete 351 # Don't raise an error if the config file is incomplete
350# set defaults instead: 352 # set defaults instead:
351 353
352# Maximum time, in seconds, of hard drive spindown time that you are 354 # Maximum time, in seconds, of hard drive spindown time that you are
353# comfortable with. Worst case, it's possible that you could lose this 355 # comfortable with. Worst case, it's possible that you could lose this
354# amount of work if your battery fails you while in laptop mode. 356 # amount of work if your battery fails you while in laptop mode.
355MAX_AGE=${MAX_AGE:-'600'} 357 MAX_AGE=${MAX_AGE:-'600'}
356 358
357# Read-ahead, in kilobytes 359 # Read-ahead, in kilobytes
358READAHEAD=${READAHEAD:-'4096'} 360 READAHEAD=${READAHEAD:-'4096'}
359 361
360# Shall we remount journaled fs. with appropriate commit interval? (1=yes) 362 # Shall we remount journaled fs. with appropriate commit interval? (1=yes)
361DO_REMOUNTS=${DO_REMOUNTS:-'1'} 363 DO_REMOUNTS=${DO_REMOUNTS:-'1'}
362 364
363# And shall we add the "noatime" option to that as well? (1=yes) 365 # And shall we add the "noatime" option to that as well? (1=yes)
364DO_REMOUNT_NOATIME=${DO_REMOUNT_NOATIME:-'1'} 366 DO_REMOUNT_NOATIME=${DO_REMOUNT_NOATIME:-'1'}
365 367
366# Shall we adjust the idle timeout on a hard drive? 368 # Shall we adjust the idle timeout on a hard drive?
367DO_HD=${DO_HD:-'1'} 369 DO_HD=${DO_HD:-'1'}
368 370
369# Adjust idle timeout on which hard drive? 371 # Adjust idle timeout on which hard drive?
370HD="${HD:-'/dev/hda'}" 372 HD="${HD:-'/dev/hda'}"
371 373
372# spindown time for HD (hdparm -S values) 374 # spindown time for HD (hdparm -S values)
373AC_HD=${AC_HD:-'244'} 375 AC_HD=${AC_HD:-'244'}
374BATT_HD=${BATT_HD:-'4'} 376 BATT_HD=${BATT_HD:-'4'}
375 377
376# Dirty synchronous ratio. At this percentage of dirty pages the process which 378 # Dirty synchronous ratio. At this percentage of dirty pages the process which
377# calls write() does its own writeback 379 # calls write() does its own writeback
378DIRTY_RATIO=${DIRTY_RATIO:-'40'} 380 DIRTY_RATIO=${DIRTY_RATIO:-'40'}
379 381
380# cpu frequency scaling 382 # cpu frequency scaling
381# See Documentation/admin-guide/pm/cpufreq.rst for more info 383 # See Documentation/admin-guide/pm/cpufreq.rst for more info
382DO_CPU=${CPU_MANAGE:-'0'} 384 DO_CPU=${CPU_MANAGE:-'0'}
383CPU_MAXFREQ=${CPU_MAXFREQ:-'slowest'} 385 CPU_MAXFREQ=${CPU_MAXFREQ:-'slowest'}
384 386
385# 387 #
386# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been 388 # Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been
387# exceeded, the kernel will wake flusher threads which will then reduce the 389 # exceeded, the kernel will wake flusher threads which will then reduce the
388# amount of dirty memory to dirty_background_ratio. Set this nice and low, 390 # amount of dirty memory to dirty_background_ratio. Set this nice and low,
389# so once some writeout has commenced, we do a lot of it. 391 # so once some writeout has commenced, we do a lot of it.
390# 392 #
391DIRTY_BACKGROUND_RATIO=${DIRTY_BACKGROUND_RATIO:-'5'} 393 DIRTY_BACKGROUND_RATIO=${DIRTY_BACKGROUND_RATIO:-'5'}
392 394
393# kernel default dirty buffer age 395 # kernel default dirty buffer age
394DEF_AGE=${DEF_AGE:-'30'} 396 DEF_AGE=${DEF_AGE:-'30'}
395DEF_UPDATE=${DEF_UPDATE:-'5'} 397 DEF_UPDATE=${DEF_UPDATE:-'5'}
396DEF_DIRTY_BACKGROUND_RATIO=${DEF_DIRTY_BACKGROUND_RATIO:-'10'} 398 DEF_DIRTY_BACKGROUND_RATIO=${DEF_DIRTY_BACKGROUND_RATIO:-'10'}
397DEF_DIRTY_RATIO=${DEF_DIRTY_RATIO:-'40'} 399 DEF_DIRTY_RATIO=${DEF_DIRTY_RATIO:-'40'}
398DEF_XFS_AGE_BUFFER=${DEF_XFS_AGE_BUFFER:-'15'} 400 DEF_XFS_AGE_BUFFER=${DEF_XFS_AGE_BUFFER:-'15'}
399DEF_XFS_SYNC_INTERVAL=${DEF_XFS_SYNC_INTERVAL:-'30'} 401 DEF_XFS_SYNC_INTERVAL=${DEF_XFS_SYNC_INTERVAL:-'30'}
400DEF_XFS_BUFD_INTERVAL=${DEF_XFS_BUFD_INTERVAL:-'1'} 402 DEF_XFS_BUFD_INTERVAL=${DEF_XFS_BUFD_INTERVAL:-'1'}
401 403
402# This must be adjusted manually to the value of HZ in the running kernel 404 # This must be adjusted manually to the value of HZ in the running kernel
403# on 2.4, until the XFS people change their 2.4 external interfaces to work in 405 # on 2.4, until the XFS people change their 2.4 external interfaces to work in
404# centisecs. This can be automated, but it's a work in progress that still needs 406 # centisecs. This can be automated, but it's a work in progress that still needs
405# some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for external 407 # some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for external
406# interfaces, and that is currently always set to 100. So you don't need to 408 # interfaces, and that is currently always set to 100. So you don't need to
407# change this on 2.6. 409 # change this on 2.6.
408XFS_HZ=${XFS_HZ:-'100'} 410 XFS_HZ=${XFS_HZ:-'100'}
409 411
410############################################################################# 412 #############################################################################
411 413
412KLEVEL="$(uname -r | 414 KLEVEL="$(uname -r |
413 { 415 {
414 IFS='.' read a b c 416 IFS='.' read a b c
415 echo $a.$b 417 echo $a.$b
416 } 418 }
417)" 419 )"
418case "$KLEVEL" in 420 case "$KLEVEL" in
419 "2.4"|"2.6") 421 "2.4"|"2.6")
420 ;; 422 ;;
421 *) 423 *)
422 echo "Unhandled kernel version: $KLEVEL ('uname -r' = '$(uname -r)')" >&2 424 echo "Unhandled kernel version: $KLEVEL ('uname -r' = '$(uname -r)')" >&2
423 exit 1 425 exit 1
424 ;; 426 ;;
425esac 427 esac
426 428
427if [ ! -e /proc/sys/vm/laptop_mode ] ; then 429 if [ ! -e /proc/sys/vm/laptop_mode ] ; then
428 echo "Kernel is not patched with laptop_mode patch." >&2 430 echo "Kernel is not patched with laptop_mode patch." >&2
429 exit 1 431 exit 1
430fi 432 fi
431 433
432if [ ! -w /proc/sys/vm/laptop_mode ] ; then 434 if [ ! -w /proc/sys/vm/laptop_mode ] ; then
433 echo "You do not have enough privileges to enable laptop_mode." >&2 435 echo "You do not have enough privileges to enable laptop_mode." >&2
434 exit 1 436 exit 1
435fi 437 fi
436 438
437# Remove an option (the first parameter) of the form option=<number> from 439 # Remove an option (the first parameter) of the form option=<number> from
438# a mount options string (the rest of the parameters). 440 # a mount options string (the rest of the parameters).
439parse_mount_opts () { 441 parse_mount_opts () {
440 OPT="$1" 442 OPT="$1"
441 shift 443 shift
442 echo ",$*," | sed \ 444 echo ",$*," | sed \
@@ -444,11 +446,11 @@ parse_mount_opts () {
444 -e 's/,,*/,/g' \ 446 -e 's/,,*/,/g' \
445 -e 's/^,//' \ 447 -e 's/^,//' \
446 -e 's/,$//' 448 -e 's/,$//'
447} 449 }
448 450
449# Remove an option (the first parameter) without any arguments from 451 # Remove an option (the first parameter) without any arguments from
450# a mount option string (the rest of the parameters). 452 # a mount option string (the rest of the parameters).
451parse_nonumber_mount_opts () { 453 parse_nonumber_mount_opts () {
452 OPT="$1" 454 OPT="$1"
453 shift 455 shift
454 echo ",$*," | sed \ 456 echo ",$*," | sed \
@@ -456,20 +458,20 @@ parse_nonumber_mount_opts () {
456 -e 's/,,*/,/g' \ 458 -e 's/,,*/,/g' \
457 -e 's/^,//' \ 459 -e 's/^,//' \
458 -e 's/,$//' 460 -e 's/,$//'
459} 461 }
460 462
461# Find out the state of a yes/no option (e.g. "atime"/"noatime") in 463 # Find out the state of a yes/no option (e.g. "atime"/"noatime") in
462# fstab for a given filesystem, and use this state to replace the 464 # fstab for a given filesystem, and use this state to replace the
463# value of the option in another mount options string. The device 465 # value of the option in another mount options string. The device
464# is the first argument, the option name the second, and the default 466 # is the first argument, the option name the second, and the default
465# value the third. The remainder is the mount options string. 467 # value the third. The remainder is the mount options string.
466# 468 #
467# Example: 469 # Example:
468# parse_yesno_opts_wfstab /dev/hda1 atime atime defaults,noatime 470 # parse_yesno_opts_wfstab /dev/hda1 atime atime defaults,noatime
469# 471 #
470# If fstab contains, say, "rw" for this filesystem, then the result 472 # If fstab contains, say, "rw" for this filesystem, then the result
471# will be "defaults,atime". 473 # will be "defaults,atime".
472parse_yesno_opts_wfstab () { 474 parse_yesno_opts_wfstab () {
473 L_DEV="$1" 475 L_DEV="$1"
474 OPT="$2" 476 OPT="$2"
475 DEF_OPT="$3" 477 DEF_OPT="$3"
@@ -491,21 +493,21 @@ parse_yesno_opts_wfstab () {
491 # option not specified in fstab -- choose the default. 493 # option not specified in fstab -- choose the default.
492 echo "$PARSEDOPTS1,$DEF_OPT" 494 echo "$PARSEDOPTS1,$DEF_OPT"
493 fi 495 fi
494} 496 }
495 497
496# Find out the state of a numbered option (e.g. "commit=NNN") in 498 # Find out the state of a numbered option (e.g. "commit=NNN") in
497# fstab for a given filesystem, and use this state to replace the 499 # fstab for a given filesystem, and use this state to replace the
498# value of the option in another mount options string. The device 500 # value of the option in another mount options string. The device
499# is the first argument, and the option name the second. The 501 # is the first argument, and the option name the second. The
500# remainder is the mount options string in which the replacement 502 # remainder is the mount options string in which the replacement
501# must be done. 503 # must be done.
502# 504 #
503# Example: 505 # Example:
504# parse_mount_opts_wfstab /dev/hda1 commit defaults,commit=7 506 # parse_mount_opts_wfstab /dev/hda1 commit defaults,commit=7
505# 507 #
506# If fstab contains, say, "commit=3,rw" for this filesystem, then the 508 # If fstab contains, say, "commit=3,rw" for this filesystem, then the
507# result will be "rw,commit=3". 509 # result will be "rw,commit=3".
508parse_mount_opts_wfstab () { 510 parse_mount_opts_wfstab () {
509 L_DEV="$1" 511 L_DEV="$1"
510 OPT="$2" 512 OPT="$2"
511 shift 2 513 shift 2
@@ -523,9 +525,9 @@ parse_mount_opts_wfstab () {
523 # option not specified in fstab: set it to 0 525 # option not specified in fstab: set it to 0
524 echo "$PARSEDOPTS1,$OPT=0" 526 echo "$PARSEDOPTS1,$OPT=0"
525 fi 527 fi
526} 528 }
527 529
528deduce_fstype () { 530 deduce_fstype () {
529 MP="$1" 531 MP="$1"
530 # My root filesystem unfortunately has 532 # My root filesystem unfortunately has
531 # type "unknown" in /etc/mtab. If we encounter 533 # type "unknown" in /etc/mtab. If we encounter
@@ -538,13 +540,13 @@ deduce_fstype () {
538 exit 0 540 exit 0
539 fi 541 fi
540 done 542 done
541} 543 }
542 544
543if [ $DO_REMOUNT_NOATIME -eq 1 ] ; then 545 if [ $DO_REMOUNT_NOATIME -eq 1 ] ; then
544 NOATIME_OPT=",noatime" 546 NOATIME_OPT=",noatime"
545fi 547 fi
546 548
547case "$1" in 549 case "$1" in
548 start) 550 start)
549 AGE=$((100*$MAX_AGE)) 551 AGE=$((100*$MAX_AGE))
550 XFS_AGE=$(($XFS_HZ*$MAX_AGE)) 552 XFS_AGE=$(($XFS_HZ*$MAX_AGE))
@@ -687,10 +689,9 @@ case "$1" in
687 exit 1 689 exit 1
688 ;; 690 ;;
689 691
690esac 692 esac
691 693
692exit 0 694 exit 0
693--------------------CONTROL SCRIPT END------------------------------------------
694 695
695 696
696ACPI integration 697ACPI integration
@@ -701,78 +702,76 @@ kick off the laptop_mode script and run hdparm. The part that
701automatically disables laptop mode when the battery is low was 702automatically disables laptop mode when the battery is low was
702written by Jan Topinski. 703written by Jan Topinski.
703 704
704-----------------/etc/acpi/events/ac_adapter BEGIN------------------------------ 705/etc/acpi/events/ac_adapter::
705event=ac_adapter 706
706action=/etc/acpi/actions/ac.sh %e 707 event=ac_adapter
707----------------/etc/acpi/events/ac_adapter END--------------------------------- 708 action=/etc/acpi/actions/ac.sh %e
709
710/etc/acpi/events/battery::
708 711
712 event=battery.*
713 action=/etc/acpi/actions/battery.sh %e
709 714
710-----------------/etc/acpi/events/battery BEGIN--------------------------------- 715/etc/acpi/actions/ac.sh::
711event=battery.*
712action=/etc/acpi/actions/battery.sh %e
713----------------/etc/acpi/events/battery END------------------------------------
714 716
717 #!/bin/bash
715 718
716----------------/etc/acpi/actions/ac.sh BEGIN----------------------------------- 719 # ac on/offline event handler
717#!/bin/bash
718 720
719# ac on/offline event handler 721 status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/$2/state`
720 722
721status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/$2/state` 723 case $status in
724 "on-line")
725 /sbin/laptop_mode stop
726 exit 0
727 ;;
728 "off-line")
729 /sbin/laptop_mode start
730 exit 0
731 ;;
732 esac
722 733
723case $status in
724 "on-line")
725 /sbin/laptop_mode stop
726 exit 0
727 ;;
728 "off-line")
729 /sbin/laptop_mode start
730 exit 0
731 ;;
732esac
733---------------------------/etc/acpi/actions/ac.sh END--------------------------
734 734
735/etc/acpi/actions/battery.sh::
735 736
736---------------------------/etc/acpi/actions/battery.sh BEGIN------------------- 737 #! /bin/bash
737#! /bin/bash
738 738
739# Automatically disable laptop mode when the battery almost runs out. 739 # Automatically disable laptop mode when the battery almost runs out.
740 740
741BATT_INFO=/proc/acpi/battery/$2/state 741 BATT_INFO=/proc/acpi/battery/$2/state
742 742
743if [[ -f /proc/sys/vm/laptop_mode ]] 743 if [[ -f /proc/sys/vm/laptop_mode ]]
744then 744 then
745 LM=`cat /proc/sys/vm/laptop_mode` 745 LM=`cat /proc/sys/vm/laptop_mode`
746 if [[ $LM -gt 0 ]] 746 if [[ $LM -gt 0 ]]
747 then
748 if [[ -f $BATT_INFO ]]
749 then 747 then
750 # Source the config file only now that we know we need 748 if [[ -f $BATT_INFO ]]
751 if [ -f /etc/default/laptop-mode ] ; then 749 then
752 # Debian 750 # Source the config file only now that we know we need
753 . /etc/default/laptop-mode 751 if [ -f /etc/default/laptop-mode ] ; then
754 elif [ -f /etc/sysconfig/laptop-mode ] ; then 752 # Debian
755 # Others 753 . /etc/default/laptop-mode
756 . /etc/sysconfig/laptop-mode 754 elif [ -f /etc/sysconfig/laptop-mode ] ; then
757 fi 755 # Others
758 MINIMUM_BATTERY_MINUTES=${MINIMUM_BATTERY_MINUTES:-'10'} 756 . /etc/sysconfig/laptop-mode
759 757 fi
760 ACTION="`cat $BATT_INFO | grep charging | cut -c 26-`" 758 MINIMUM_BATTERY_MINUTES=${MINIMUM_BATTERY_MINUTES:-'10'}
761 if [[ ACTION -eq "discharging" ]] 759
762 then 760 ACTION="`cat $BATT_INFO | grep charging | cut -c 26-`"
763 PRESENT_RATE=`cat $BATT_INFO | grep "present rate:" | sed "s/.* \([0-9][0-9]* \).*/\1/" ` 761 if [[ ACTION -eq "discharging" ]]
764 REMAINING=`cat $BATT_INFO | grep "remaining capacity:" | sed "s/.* \([0-9][0-9]* \).*/\1/" ` 762 then
765 fi 763 PRESENT_RATE=`cat $BATT_INFO | grep "present rate:" | sed "s/.* \([0-9][0-9]* \).*/\1/" `
766 if (($REMAINING * 60 / $PRESENT_RATE < $MINIMUM_BATTERY_MINUTES)) 764 REMAINING=`cat $BATT_INFO | grep "remaining capacity:" | sed "s/.* \([0-9][0-9]* \).*/\1/" `
767 then 765 fi
768 /sbin/laptop_mode stop 766 if (($REMAINING * 60 / $PRESENT_RATE < $MINIMUM_BATTERY_MINUTES))
769 fi 767 then
770 else 768 /sbin/laptop_mode stop
771 logger -p daemon.warning "You are using laptop mode and your battery interface $BATT_INFO is missing. This may lead to loss of data when the battery runs out. Check kernel ACPI support and /proc/acpi/battery folder, and edit /etc/acpi/battery.sh to set BATT_INFO to the correct path." 769 fi
770 else
771 logger -p daemon.warning "You are using laptop mode and your battery interface $BATT_INFO is missing. This may lead to loss of data when the battery runs out. Check kernel ACPI support and /proc/acpi/battery folder, and edit /etc/acpi/battery.sh to set BATT_INFO to the correct path."
772 fi
772 fi 773 fi
773 fi 774 fi
774fi
775---------------------------/etc/acpi/actions/battery.sh END--------------------
776 775
777 776
778Monitoring tool 777Monitoring tool
diff --git a/Documentation/laptops/sony-laptop.txt b/Documentation/laptops/sony-laptop.rst
index 978b1e615155..9edcc7f6612f 100644
--- a/Documentation/laptops/sony-laptop.txt
+++ b/Documentation/laptops/sony-laptop.rst
@@ -1,7 +1,9 @@
1=========================================
1Sony Notebook Control Driver (SNC) Readme 2Sony Notebook Control Driver (SNC) Readme
2----------------------------------------- 3=========================================
3 Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net> 4
4 Copyright (C) 2007 Mattia Dongili <malattia@linux.it> 5 - Copyright (C) 2004- 2005 Stelian Pop <stelian@popies.net>
6 - Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5 7
6This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the 8This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
7Sony Vaio laptops. This driver mixes both devices functions under the same 9Sony Vaio laptops. This driver mixes both devices functions under the same
@@ -10,6 +12,7 @@ obsoleted by sony-laptop now.
10 12
11Fn keys (hotkeys): 13Fn keys (hotkeys):
12------------------ 14------------------
15
13Some models report hotkeys through the SNC or SPIC devices, such events are 16Some models report hotkeys through the SNC or SPIC devices, such events are
14reported both through the ACPI subsystem as acpi events and through the INPUT 17reported both through the ACPI subsystem as acpi events and through the INPUT
15subsystem. See the logs of /proc/bus/input/devices to find out what those 18subsystem. See the logs of /proc/bus/input/devices to find out what those
@@ -28,11 +31,14 @@ If your laptop model supports it, you will find sysfs files in the
28/sys/class/backlight/sony/ 31/sys/class/backlight/sony/
29directory. You will be able to query and set the current screen 32directory. You will be able to query and set the current screen
30brightness: 33brightness:
34
35 ====================== =========================================
31 brightness get/set screen brightness (an integer 36 brightness get/set screen brightness (an integer
32 between 0 and 7) 37 between 0 and 7)
33 actual_brightness reading from this file will query the HW 38 actual_brightness reading from this file will query the HW
34 to get real brightness value 39 to get real brightness value
35 max_brightness the maximum brightness value 40 max_brightness the maximum brightness value
41 ====================== =========================================
36 42
37 43
38Platform specific: 44Platform specific:
@@ -45,6 +51,8 @@ You then read/write integer values from/to those files by using
45standard UNIX tools. 51standard UNIX tools.
46 52
47The files are: 53The files are:
54
55 ====================== ==========================================
48 brightness_default screen brightness which will be set 56 brightness_default screen brightness which will be set
49 when the laptop will be rebooted 57 when the laptop will be rebooted
50 cdpower power on/off the internal CD drive 58 cdpower power on/off the internal CD drive
@@ -53,21 +61,39 @@ The files are:
53 (only in debug mode) 61 (only in debug mode)
54 bluetoothpower power on/off the internal bluetooth device 62 bluetoothpower power on/off the internal bluetooth device
55 fanspeed get/set the fan speed 63 fanspeed get/set the fan speed
64 ====================== ==========================================
56 65
57Note that some files may be missing if they are not supported 66Note that some files may be missing if they are not supported
58by your particular laptop model. 67by your particular laptop model.
59 68
60Example usage: 69Example usage::
70
61 # echo "1" > /sys/devices/platform/sony-laptop/brightness_default 71 # echo "1" > /sys/devices/platform/sony-laptop/brightness_default
62sets the lowest screen brightness for the next and later reboots, 72
73sets the lowest screen brightness for the next and later reboots
74
75::
76
63 # echo "8" > /sys/devices/platform/sony-laptop/brightness_default 77 # echo "8" > /sys/devices/platform/sony-laptop/brightness_default
64sets the highest screen brightness for the next and later reboots, 78
79sets the highest screen brightness for the next and later reboots
80
81::
82
65 # cat /sys/devices/platform/sony-laptop/brightness_default 83 # cat /sys/devices/platform/sony-laptop/brightness_default
66retrieves the value. 84
85retrieves the value
86
87::
67 88
68 # echo "0" > /sys/devices/platform/sony-laptop/audiopower 89 # echo "0" > /sys/devices/platform/sony-laptop/audiopower
69powers off the sound card, 90
91powers off the sound card
92
93::
94
70 # echo "1" > /sys/devices/platform/sony-laptop/audiopower 95 # echo "1" > /sys/devices/platform/sony-laptop/audiopower
96
71powers on the sound card. 97powers on the sound card.
72 98
73 99
@@ -76,7 +102,8 @@ RFkill control:
76More recent Vaio models expose a consistent set of ACPI methods to 102More recent Vaio models expose a consistent set of ACPI methods to
77control radio frequency emitting devices. If you are a lucky owner of 103control radio frequency emitting devices. If you are a lucky owner of
78such a laptop you will find the necessary rfkill devices under 104such a laptop you will find the necessary rfkill devices under
79/sys/class/rfkill. Check those starting with sony-* in 105/sys/class/rfkill. Check those starting with sony-* in::
106
80 # grep . /sys/class/rfkill/*/{state,name} 107 # grep . /sys/class/rfkill/*/{state,name}
81 108
82 109
@@ -88,26 +115,29 @@ you are not afraid of any side effects doing strange things with
88your ACPI BIOS could have on your laptop), load the driver and 115your ACPI BIOS could have on your laptop), load the driver and
89pass the option 'debug=1'. 116pass the option 'debug=1'.
90 117
91REPEAT: DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS. 118REPEAT:
119 **DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS.**
92 120
93In your kernel logs you will find the list of all ACPI methods 121In your kernel logs you will find the list of all ACPI methods
94the SNC device has on your laptop. 122the SNC device has on your laptop.
95 123
96* For new models you will see a long list of meaningless method names, 124* For new models you will see a long list of meaningless method names,
97reading the DSDT table source should reveal that: 125 reading the DSDT table source should reveal that:
126
98(1) the SNC device uses an internal capability lookup table 127(1) the SNC device uses an internal capability lookup table
99(2) SN00 is used to find values in the lookup table 128(2) SN00 is used to find values in the lookup table
100(3) SN06 and SN07 are used to call into the real methods based on 129(3) SN06 and SN07 are used to call into the real methods based on
101 offsets you can obtain iterating the table using SN00 130 offsets you can obtain iterating the table using SN00
102(4) SN02 used to enable events. 131(4) SN02 used to enable events.
132
103Some values in the capability lookup table are more or less known, see 133Some values in the capability lookup table are more or less known, see
104the code for all sony_call_snc_handle calls, others are more obscure. 134the code for all sony_call_snc_handle calls, others are more obscure.
105 135
106* For old models you can see the GCDP/GCDP methods used to pwer on/off 136* For old models you can see the GCDP/GCDP methods used to pwer on/off
107the CD drive, but there are others and they are usually different from 137 the CD drive, but there are others and they are usually different from
108model to model. 138 model to model.
109 139
110I HAVE NO IDEA WHAT THOSE METHODS DO. 140**I HAVE NO IDEA WHAT THOSE METHODS DO.**
111 141
112The sony-laptop driver creates, for some of those methods (the most 142The sony-laptop driver creates, for some of those methods (the most
113current ones found on several Vaio models), an entry under 143current ones found on several Vaio models), an entry under
diff --git a/Documentation/laptops/sonypi.txt b/Documentation/laptops/sonypi.rst
index 606bdb9ce036..2a1975ed7ee4 100644
--- a/Documentation/laptops/sonypi.txt
+++ b/Documentation/laptops/sonypi.rst
@@ -1,11 +1,13 @@
1==================================================
1Sony Programmable I/O Control Device Driver Readme 2Sony Programmable I/O Control Device Driver Readme
2-------------------------------------------------- 3==================================================
3 Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net> 4
4 Copyright (C) 2001-2002 Alcôve <www.alcove.com> 5 - Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
5 Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au> 6 - Copyright (C) 2001-2002 Alcôve <www.alcove.com>
6 Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp> 7 - Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
7 Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp> 8 - Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
8 Copyright (C) 2000 Andrew Tridgell <tridge@samba.org> 9 - Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp>
10 - Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
9 11
10This driver enables access to the Sony Programmable I/O Control Device which 12This driver enables access to the Sony Programmable I/O Control Device which
11can be found in many Sony Vaio laptops. Some newer Sony laptops (seems to be 13can be found in many Sony Vaio laptops. Some newer Sony laptops (seems to be
@@ -14,6 +16,7 @@ sonypi device and are not supported at all by this driver.
14 16
15It will give access (through a user space utility) to some events those laptops 17It will give access (through a user space utility) to some events those laptops
16generate, like: 18generate, like:
19
17 - jogdial events (the small wheel on the side of Vaios) 20 - jogdial events (the small wheel on the side of Vaios)
18 - capture button events (only on Vaio Picturebook series) 21 - capture button events (only on Vaio Picturebook series)
19 - Fn keys 22 - Fn keys
@@ -49,6 +52,7 @@ module argument syntax (<param>=<value> when passing the option to the
49module or sonypi.<param>=<value> on the kernel boot line when sonypi is 52module or sonypi.<param>=<value> on the kernel boot line when sonypi is
50statically linked into the kernel). Those options are: 53statically linked into the kernel). Those options are:
51 54
55 =============== =======================================================
52 minor: minor number of the misc device /dev/sonypi, 56 minor: minor number of the misc device /dev/sonypi,
53 default is -1 (automatic allocation, see /proc/misc 57 default is -1 (automatic allocation, see /proc/misc
54 or kernel logs) 58 or kernel logs)
@@ -86,6 +90,8 @@ statically linked into the kernel). Those options are:
86 will be tried. You can use the following bits to 90 will be tried. You can use the following bits to
87 construct your own event mask (from 91 construct your own event mask (from
88 drivers/char/sonypi.h): 92 drivers/char/sonypi.h):
93
94 ======================== ======
89 SONYPI_JOGGER_MASK 0x0001 95 SONYPI_JOGGER_MASK 0x0001
90 SONYPI_CAPTURE_MASK 0x0002 96 SONYPI_CAPTURE_MASK 0x0002
91 SONYPI_FNKEY_MASK 0x0004 97 SONYPI_FNKEY_MASK 0x0004
@@ -100,22 +106,24 @@ statically linked into the kernel). Those options are:
100 SONYPI_MEMORYSTICK_MASK 0x0800 106 SONYPI_MEMORYSTICK_MASK 0x0800
101 SONYPI_BATTERY_MASK 0x1000 107 SONYPI_BATTERY_MASK 0x1000
102 SONYPI_WIRELESS_MASK 0x2000 108 SONYPI_WIRELESS_MASK 0x2000
109 ======================== ======
103 110
104 useinput: if set (which is the default) two input devices are 111 useinput: if set (which is the default) two input devices are
105 created, one which interprets the jogdial events as 112 created, one which interprets the jogdial events as
106 mouse events, the other one which acts like a 113 mouse events, the other one which acts like a
107 keyboard reporting the pressing of the special keys. 114 keyboard reporting the pressing of the special keys.
115 =============== =======================================================
108 116
109Module use: 117Module use:
110----------- 118-----------
111 119
112In order to automatically load the sonypi module on use, you can put those 120In order to automatically load the sonypi module on use, you can put those
113lines a configuration file in /etc/modprobe.d/: 121lines a configuration file in /etc/modprobe.d/::
114 122
115 alias char-major-10-250 sonypi 123 alias char-major-10-250 sonypi
116 options sonypi minor=250 124 options sonypi minor=250
117 125
118This supposes the use of minor 250 for the sonypi device: 126This supposes the use of minor 250 for the sonypi device::
119 127
120 # mknod /dev/sonypi c 10 250 128 # mknod /dev/sonypi c 10 250
121 129
@@ -148,5 +156,5 @@ Bugs:
148 http://www.acc.umu.se/~erikw/program/smartdimmer-0.1.tar.bz2 156 http://www.acc.umu.se/~erikw/program/smartdimmer-0.1.tar.bz2
149 157
150 - since all development was done by reverse engineering, there is 158 - since all development was done by reverse engineering, there is
151 _absolutely no guarantee_ that this driver will not crash your 159 *absolutely no guarantee* that this driver will not crash your
152 laptop. Permanently. 160 laptop. Permanently.
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.rst
index 75ef063622d2..19d52fc3c5e9 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.rst
@@ -1,12 +1,15 @@
1 ThinkPad ACPI Extras Driver 1===========================
2ThinkPad ACPI Extras Driver
3===========================
2 4
3 Version 0.25 5Version 0.25
4 October 16th, 2013
5 6
6 Borislav Deianov <borislav@users.sf.net> 7October 16th, 2013
7 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
8 http://ibm-acpi.sf.net/
9 8
9- Borislav Deianov <borislav@users.sf.net>
10- Henrique de Moraes Holschuh <hmh@hmh.eng.br>
11
12http://ibm-acpi.sf.net/
10 13
11This is a Linux driver for the IBM and Lenovo ThinkPad laptops. It 14This is a Linux driver for the IBM and Lenovo ThinkPad laptops. It
12supports various features of these laptops which are accessible 15supports various features of these laptops which are accessible
@@ -91,7 +94,8 @@ yet ready or stabilized, it is expected that this interface will change,
91and any and all userspace programs must deal with it. 94and any and all userspace programs must deal with it.
92 95
93 96
94Notes about the sysfs interface: 97Notes about the sysfs interface
98^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95 99
96Unlike what was done with the procfs interface, correctness when talking 100Unlike what was done with the procfs interface, correctness when talking
97to the sysfs interfaces will be enforced, as will correctness in the 101to the sysfs interfaces will be enforced, as will correctness in the
@@ -129,6 +133,7 @@ Driver version
129-------------- 133--------------
130 134
131procfs: /proc/acpi/ibm/driver 135procfs: /proc/acpi/ibm/driver
136
132sysfs driver attribute: version 137sysfs driver attribute: version
133 138
134The driver name and version. No commands can be written to this file. 139The driver name and version. No commands can be written to this file.
@@ -141,9 +146,13 @@ sysfs driver attribute: interface_version
141 146
142Version of the thinkpad-acpi sysfs interface, as an unsigned long 147Version of the thinkpad-acpi sysfs interface, as an unsigned long
143(output in hex format: 0xAAAABBCC), where: 148(output in hex format: 0xAAAABBCC), where:
144 AAAA - major revision 149
145 BB - minor revision 150 AAAA
146 CC - bugfix revision 151 - major revision
152 BB
153 - minor revision
154 CC
155 - bugfix revision
147 156
148The sysfs interface version changelog for the driver can be found at the 157The sysfs interface version changelog for the driver can be found at the
149end of this document. Changes to the sysfs interface done by the kernel 158end of this document. Changes to the sysfs interface done by the kernel
@@ -170,6 +179,7 @@ Hot keys
170-------- 179--------
171 180
172procfs: /proc/acpi/ibm/hotkey 181procfs: /proc/acpi/ibm/hotkey
182
173sysfs device attribute: hotkey_* 183sysfs device attribute: hotkey_*
174 184
175In a ThinkPad, the ACPI HKEY handler is responsible for communicating 185In a ThinkPad, the ACPI HKEY handler is responsible for communicating
@@ -181,7 +191,7 @@ firmware will behave in many situations.
181The driver enables the HKEY ("hot key") event reporting automatically 191The driver enables the HKEY ("hot key") event reporting automatically
182when loaded, and disables it when it is removed. 192when loaded, and disables it when it is removed.
183 193
184The driver will report HKEY events in the following format: 194The driver will report HKEY events in the following format::
185 195
186 ibm/hotkey HKEY 00000080 0000xxxx 196 ibm/hotkey HKEY 00000080 0000xxxx
187 197
@@ -217,9 +227,10 @@ ThinkPads, it is still possible to support some extra hotkeys by
217polling the "CMOS NVRAM" at least 10 times per second. The driver 227polling the "CMOS NVRAM" at least 10 times per second. The driver
218attempts to enables this functionality automatically when required. 228attempts to enables this functionality automatically when required.
219 229
220procfs notes: 230procfs notes
231^^^^^^^^^^^^
221 232
222The following commands can be written to the /proc/acpi/ibm/hotkey file: 233The following commands can be written to the /proc/acpi/ibm/hotkey file::
223 234
224 echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys 235 echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
225 echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys 236 echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
@@ -227,7 +238,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
227 echo reset > /proc/acpi/ibm/hotkey -- restore the recommended mask 238 echo reset > /proc/acpi/ibm/hotkey -- restore the recommended mask
228 239
229The following commands have been deprecated and will cause the kernel 240The following commands have been deprecated and will cause the kernel
230to log a warning: 241to log a warning::
231 242
232 echo enable > /proc/acpi/ibm/hotkey -- does nothing 243 echo enable > /proc/acpi/ibm/hotkey -- does nothing
233 echo disable > /proc/acpi/ibm/hotkey -- returns an error 244 echo disable > /proc/acpi/ibm/hotkey -- returns an error
@@ -237,7 +248,8 @@ maintain maximum bug-to-bug compatibility, it does not report any masks,
237nor does it allow one to manipulate the hot key mask when the firmware 248nor does it allow one to manipulate the hot key mask when the firmware
238does not support masks at all, even if NVRAM polling is in use. 249does not support masks at all, even if NVRAM polling is in use.
239 250
240sysfs notes: 251sysfs notes
252^^^^^^^^^^^
241 253
242 hotkey_bios_enabled: 254 hotkey_bios_enabled:
243 DEPRECATED, WILL BE REMOVED SOON. 255 DEPRECATED, WILL BE REMOVED SOON.
@@ -349,7 +361,8 @@ sysfs notes:
349 361
350 This attribute has poll()/select() support. 362 This attribute has poll()/select() support.
351 363
352input layer notes: 364input layer notes
365^^^^^^^^^^^^^^^^^
353 366
354A Hot key is mapped to a single input layer EV_KEY event, possibly 367A Hot key is mapped to a single input layer EV_KEY event, possibly
355followed by an EV_MSC MSC_SCAN event that shall contain that key's scan 368followed by an EV_MSC MSC_SCAN event that shall contain that key's scan
@@ -362,11 +375,13 @@ remapping KEY_UNKNOWN keys.
362 375
363The events are available in an input device, with the following id: 376The events are available in an input device, with the following id:
364 377
365 Bus: BUS_HOST 378 ============== ==============================
366 vendor: 0x1014 (PCI_VENDOR_ID_IBM) or 379 Bus BUS_HOST
380 vendor 0x1014 (PCI_VENDOR_ID_IBM) or
367 0x17aa (PCI_VENDOR_ID_LENOVO) 381 0x17aa (PCI_VENDOR_ID_LENOVO)
368 product: 0x5054 ("TP") 382 product 0x5054 ("TP")
369 version: 0x4101 383 version 0x4101
384 ============== ==============================
370 385
371The version will have its LSB incremented if the keymap changes in a 386The version will have its LSB incremented if the keymap changes in a
372backwards-compatible way. The MSB shall always be 0x41 for this input 387backwards-compatible way. The MSB shall always be 0x41 for this input
@@ -380,9 +395,10 @@ backwards-compatible change for this input device.
380 395
381Thinkpad-acpi Hot Key event map (version 0x4101): 396Thinkpad-acpi Hot Key event map (version 0x4101):
382 397
398======= ======= ============== ==============================================
383ACPI Scan 399ACPI Scan
384event code Key Notes 400event code Key Notes
385 401======= ======= ============== ==============================================
3860x1001 0x00 FN+F1 - 4020x1001 0x00 FN+F1 -
387 403
3880x1002 0x01 FN+F2 IBM: battery (rare) 4040x1002 0x01 FN+F2 IBM: battery (rare)
@@ -426,7 +442,9 @@ event code Key Notes
426 or toggle screen expand 442 or toggle screen expand
427 443
4280x1009 0x08 FN+F9 - 4440x1009 0x08 FN+F9 -
429 .. .. .. 445
446... ... ... ...
447
4300x100B 0x0A FN+F11 - 4480x100B 0x0A FN+F11 -
431 449
4320x100C 0x0B FN+F12 Sleep to disk. You are always 4500x100C 0x0B FN+F12 Sleep to disk. You are always
@@ -480,8 +498,11 @@ event code Key Notes
4800x1018 0x17 THINKPAD ThinkPad/Access IBM/Lenovo key 4980x1018 0x17 THINKPAD ThinkPad/Access IBM/Lenovo key
481 499
4820x1019 0x18 unknown 5000x1019 0x18 unknown
483.. .. .. 501
502... ... ...
503
4840x1020 0x1F unknown 5040x1020 0x1F unknown
505======= ======= ============== ==============================================
485 506
486The ThinkPad firmware does not allow one to differentiate when most hot 507The ThinkPad firmware does not allow one to differentiate when most hot
487keys are pressed or released (either that, or we don't know how to, yet). 508keys are pressed or released (either that, or we don't know how to, yet).
@@ -499,14 +520,17 @@ generate input device EV_KEY events.
499In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW 520In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW
500events for switches: 521events for switches:
501 522
523============== ==============================================
502SW_RFKILL_ALL T60 and later hardware rfkill rocker switch 524SW_RFKILL_ALL T60 and later hardware rfkill rocker switch
503SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A 525SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A
526============== ==============================================
504 527
505Non hotkey ACPI HKEY event map: 528Non hotkey ACPI HKEY event map
506------------------------------- 529------------------------------
507 530
508Events that are never propagated by the driver: 531Events that are never propagated by the driver:
509 532
533====== ==================================================
5100x2304 System is waking up from suspend to undock 5340x2304 System is waking up from suspend to undock
5110x2305 System is waking up from suspend to eject bay 5350x2305 System is waking up from suspend to eject bay
5120x2404 System is waking up from hibernation to undock 5360x2404 System is waking up from hibernation to undock
@@ -519,10 +543,12 @@ Events that are never propagated by the driver:
5190x6000 KEYBOARD: Numlock key pressed 5430x6000 KEYBOARD: Numlock key pressed
5200x6005 KEYBOARD: Fn key pressed (TO BE VERIFIED) 5440x6005 KEYBOARD: Fn key pressed (TO BE VERIFIED)
5210x7000 Radio Switch may have changed state 5450x7000 Radio Switch may have changed state
546====== ==================================================
522 547
523 548
524Events that are propagated by the driver to userspace: 549Events that are propagated by the driver to userspace:
525 550
551====== =====================================================
5260x2313 ALARM: System is waking up from suspend because 5520x2313 ALARM: System is waking up from suspend because
527 the battery is nearly empty 553 the battery is nearly empty
5280x2413 ALARM: System is waking up from hibernation because 5540x2413 ALARM: System is waking up from hibernation because
@@ -544,6 +570,7 @@ Events that are propagated by the driver to userspace:
5440x6040 Nvidia Optimus/AC adapter related (TO BE VERIFIED) 5700x6040 Nvidia Optimus/AC adapter related (TO BE VERIFIED)
5450x60C0 X1 Yoga 2016, Tablet mode status changed 5710x60C0 X1 Yoga 2016, Tablet mode status changed
5460x60F0 Thermal Transformation changed (GMTS, Windows) 5720x60F0 Thermal Transformation changed (GMTS, Windows)
573====== =====================================================
547 574
548Battery nearly empty alarms are a last resort attempt to get the 575Battery nearly empty alarms are a last resort attempt to get the
549operating system to hibernate or shutdown cleanly (0x2313), or shutdown 576operating system to hibernate or shutdown cleanly (0x2313), or shutdown
@@ -562,7 +589,8 @@ cycle, or a system shutdown. Obviously, something is very wrong if this
562happens. 589happens.
563 590
564 591
565Brightness hotkey notes: 592Brightness hotkey notes
593^^^^^^^^^^^^^^^^^^^^^^^
566 594
567Don't mess with the brightness hotkeys in a Thinkpad. If you want 595Don't mess with the brightness hotkeys in a Thinkpad. If you want
568notifications for OSD, use the sysfs backlight class event support. 596notifications for OSD, use the sysfs backlight class event support.
@@ -579,7 +607,9 @@ Bluetooth
579--------- 607---------
580 608
581procfs: /proc/acpi/ibm/bluetooth 609procfs: /proc/acpi/ibm/bluetooth
610
582sysfs device attribute: bluetooth_enable (deprecated) 611sysfs device attribute: bluetooth_enable (deprecated)
612
583sysfs rfkill class: switch "tpacpi_bluetooth_sw" 613sysfs rfkill class: switch "tpacpi_bluetooth_sw"
584 614
585This feature shows the presence and current state of a ThinkPad 615This feature shows the presence and current state of a ThinkPad
@@ -588,22 +618,25 @@ Bluetooth device in the internal ThinkPad CDC slot.
588If the ThinkPad supports it, the Bluetooth state is stored in NVRAM, 618If the ThinkPad supports it, the Bluetooth state is stored in NVRAM,
589so it is kept across reboots and power-off. 619so it is kept across reboots and power-off.
590 620
591Procfs notes: 621Procfs notes
622^^^^^^^^^^^^
592 623
593If Bluetooth is installed, the following commands can be used: 624If Bluetooth is installed, the following commands can be used::
594 625
595 echo enable > /proc/acpi/ibm/bluetooth 626 echo enable > /proc/acpi/ibm/bluetooth
596 echo disable > /proc/acpi/ibm/bluetooth 627 echo disable > /proc/acpi/ibm/bluetooth
597 628
598Sysfs notes: 629Sysfs notes
630^^^^^^^^^^^
599 631
600 If the Bluetooth CDC card is installed, it can be enabled / 632 If the Bluetooth CDC card is installed, it can be enabled /
601 disabled through the "bluetooth_enable" thinkpad-acpi device 633 disabled through the "bluetooth_enable" thinkpad-acpi device
602 attribute, and its current status can also be queried. 634 attribute, and its current status can also be queried.
603 635
604 enable: 636 enable:
605 0: disables Bluetooth / Bluetooth is disabled 637
606 1: enables Bluetooth / Bluetooth is enabled. 638 - 0: disables Bluetooth / Bluetooth is disabled
639 - 1: enables Bluetooth / Bluetooth is enabled.
607 640
608 Note: this interface has been superseded by the generic rfkill 641 Note: this interface has been superseded by the generic rfkill
609 class. It has been deprecated, and it will be removed in year 642 class. It has been deprecated, and it will be removed in year
@@ -617,7 +650,7 @@ Video output control -- /proc/acpi/ibm/video
617-------------------------------------------- 650--------------------------------------------
618 651
619This feature allows control over the devices used for video output - 652This feature allows control over the devices used for video output -
620LCD, CRT or DVI (if available). The following commands are available: 653LCD, CRT or DVI (if available). The following commands are available::
621 654
622 echo lcd_enable > /proc/acpi/ibm/video 655 echo lcd_enable > /proc/acpi/ibm/video
623 echo lcd_disable > /proc/acpi/ibm/video 656 echo lcd_disable > /proc/acpi/ibm/video
@@ -630,9 +663,10 @@ LCD, CRT or DVI (if available). The following commands are available:
630 echo expand_toggle > /proc/acpi/ibm/video 663 echo expand_toggle > /proc/acpi/ibm/video
631 echo video_switch > /proc/acpi/ibm/video 664 echo video_switch > /proc/acpi/ibm/video
632 665
633NOTE: Access to this feature is restricted to processes owning the 666NOTE:
634CAP_SYS_ADMIN capability for safety reasons, as it can interact badly 667 Access to this feature is restricted to processes owning the
635enough with some versions of X.org to crash it. 668 CAP_SYS_ADMIN capability for safety reasons, as it can interact badly
669 enough with some versions of X.org to crash it.
636 670
637Each video output device can be enabled or disabled individually. 671Each video output device can be enabled or disabled individually.
638Reading /proc/acpi/ibm/video shows the status of each device. 672Reading /proc/acpi/ibm/video shows the status of each device.
@@ -665,18 +699,21 @@ ThinkLight control
665------------------ 699------------------
666 700
667procfs: /proc/acpi/ibm/light 701procfs: /proc/acpi/ibm/light
702
668sysfs attributes: as per LED class, for the "tpacpi::thinklight" LED 703sysfs attributes: as per LED class, for the "tpacpi::thinklight" LED
669 704
670procfs notes: 705procfs notes
706^^^^^^^^^^^^
671 707
672The ThinkLight status can be read and set through the procfs interface. A 708The ThinkLight status can be read and set through the procfs interface. A
673few models which do not make the status available will show the ThinkLight 709few models which do not make the status available will show the ThinkLight
674status as "unknown". The available commands are: 710status as "unknown". The available commands are::
675 711
676 echo on > /proc/acpi/ibm/light 712 echo on > /proc/acpi/ibm/light
677 echo off > /proc/acpi/ibm/light 713 echo off > /proc/acpi/ibm/light
678 714
679sysfs notes: 715sysfs notes
716^^^^^^^^^^^
680 717
681The ThinkLight sysfs interface is documented by the LED class 718The ThinkLight sysfs interface is documented by the LED class
682documentation, in Documentation/leds/leds-class.rst. The ThinkLight LED name 719documentation, in Documentation/leds/leds-class.rst. The ThinkLight LED name
@@ -691,6 +728,7 @@ CMOS/UCMS control
691----------------- 728-----------------
692 729
693procfs: /proc/acpi/ibm/cmos 730procfs: /proc/acpi/ibm/cmos
731
694sysfs device attribute: cmos_command 732sysfs device attribute: cmos_command
695 733
696This feature is mostly used internally by the ACPI firmware to keep the legacy 734This feature is mostly used internally by the ACPI firmware to keep the legacy
@@ -707,16 +745,16 @@ The range of valid cmos command numbers is 0 to 21, but not all have an
707effect and the behavior varies from model to model. Here is the behavior 745effect and the behavior varies from model to model. Here is the behavior
708on the X40 (tpb is the ThinkPad Buttons utility): 746on the X40 (tpb is the ThinkPad Buttons utility):
709 747
710 0 - Related to "Volume down" key press 748 - 0 - Related to "Volume down" key press
711 1 - Related to "Volume up" key press 749 - 1 - Related to "Volume up" key press
712 2 - Related to "Mute on" key press 750 - 2 - Related to "Mute on" key press
713 3 - Related to "Access IBM" key press 751 - 3 - Related to "Access IBM" key press
714 4 - Related to "LCD brightness up" key press 752 - 4 - Related to "LCD brightness up" key press
715 5 - Related to "LCD brightness down" key press 753 - 5 - Related to "LCD brightness down" key press
716 11 - Related to "toggle screen expansion" key press/function 754 - 11 - Related to "toggle screen expansion" key press/function
717 12 - Related to "ThinkLight on" 755 - 12 - Related to "ThinkLight on"
718 13 - Related to "ThinkLight off" 756 - 13 - Related to "ThinkLight off"
719 14 - Related to "ThinkLight" key press (toggle ThinkLight) 757 - 14 - Related to "ThinkLight" key press (toggle ThinkLight)
720 758
721The cmos command interface is prone to firmware split-brain problems, as 759The cmos command interface is prone to firmware split-brain problems, as
722in newer ThinkPads it is just a compatibility layer. Do not use it, it is 760in newer ThinkPads it is just a compatibility layer. Do not use it, it is
@@ -748,9 +786,10 @@ are aware of the consequences are welcome to enabling it.
748Audio mute and microphone mute LEDs are supported, but currently not 786Audio mute and microphone mute LEDs are supported, but currently not
749visible to userspace. They are used by the snd-hda-intel audio driver. 787visible to userspace. They are used by the snd-hda-intel audio driver.
750 788
751procfs notes: 789procfs notes
790^^^^^^^^^^^^
752 791
753The available commands are: 792The available commands are::
754 793
755 echo '<LED number> on' >/proc/acpi/ibm/led 794 echo '<LED number> on' >/proc/acpi/ibm/led
756 echo '<LED number> off' >/proc/acpi/ibm/led 795 echo '<LED number> off' >/proc/acpi/ibm/led
@@ -760,23 +799,24 @@ The <LED number> range is 0 to 15. The set of LEDs that can be
760controlled varies from model to model. Here is the common ThinkPad 799controlled varies from model to model. Here is the common ThinkPad
761mapping: 800mapping:
762 801
763 0 - power 802 - 0 - power
764 1 - battery (orange) 803 - 1 - battery (orange)
765 2 - battery (green) 804 - 2 - battery (green)
766 3 - UltraBase/dock 805 - 3 - UltraBase/dock
767 4 - UltraBay 806 - 4 - UltraBay
768 5 - UltraBase battery slot 807 - 5 - UltraBase battery slot
769 6 - (unknown) 808 - 6 - (unknown)
770 7 - standby 809 - 7 - standby
771 8 - dock status 1 810 - 8 - dock status 1
772 9 - dock status 2 811 - 9 - dock status 2
773 10, 11 - (unknown) 812 - 10, 11 - (unknown)
774 12 - thinkvantage 813 - 12 - thinkvantage
775 13, 14, 15 - (unknown) 814 - 13, 14, 15 - (unknown)
776 815
777All of the above can be turned on and off and can be made to blink. 816All of the above can be turned on and off and can be made to blink.
778 817
779sysfs notes: 818sysfs notes
819^^^^^^^^^^^
780 820
781The ThinkPad LED sysfs interface is described in detail by the LED class 821The ThinkPad LED sysfs interface is described in detail by the LED class
782documentation, in Documentation/leds/leds-class.rst. 822documentation, in Documentation/leds/leds-class.rst.
@@ -815,7 +855,7 @@ The BEEP method is used internally by the ACPI firmware to provide
815audible alerts in various situations. This feature allows the same 855audible alerts in various situations. This feature allows the same
816sounds to be triggered manually. 856sounds to be triggered manually.
817 857
818The commands are non-negative integer numbers: 858The commands are non-negative integer numbers::
819 859
820 echo <number> >/proc/acpi/ibm/beep 860 echo <number> >/proc/acpi/ibm/beep
821 861
@@ -823,25 +863,26 @@ The valid <number> range is 0 to 17. Not all numbers trigger sounds
823and the sounds vary from model to model. Here is the behavior on the 863and the sounds vary from model to model. Here is the behavior on the
824X40: 864X40:
825 865
826 0 - stop a sound in progress (but use 17 to stop 16) 866 - 0 - stop a sound in progress (but use 17 to stop 16)
827 2 - two beeps, pause, third beep ("low battery") 867 - 2 - two beeps, pause, third beep ("low battery")
828 3 - single beep 868 - 3 - single beep
829 4 - high, followed by low-pitched beep ("unable") 869 - 4 - high, followed by low-pitched beep ("unable")
830 5 - single beep 870 - 5 - single beep
831 6 - very high, followed by high-pitched beep ("AC/DC") 871 - 6 - very high, followed by high-pitched beep ("AC/DC")
832 7 - high-pitched beep 872 - 7 - high-pitched beep
833 9 - three short beeps 873 - 9 - three short beeps
834 10 - very long beep 874 - 10 - very long beep
835 12 - low-pitched beep 875 - 12 - low-pitched beep
836 15 - three high-pitched beeps repeating constantly, stop with 0 876 - 15 - three high-pitched beeps repeating constantly, stop with 0
837 16 - one medium-pitched beep repeating constantly, stop with 17 877 - 16 - one medium-pitched beep repeating constantly, stop with 17
838 17 - stop 16 878 - 17 - stop 16
839 879
840 880
841Temperature sensors 881Temperature sensors
842------------------- 882-------------------
843 883
844procfs: /proc/acpi/ibm/thermal 884procfs: /proc/acpi/ibm/thermal
885
845sysfs device attributes: (hwmon "thinkpad") temp*_input 886sysfs device attributes: (hwmon "thinkpad") temp*_input
846 887
847Most ThinkPads include six or more separate temperature sensors but only 888Most ThinkPads include six or more separate temperature sensors but only
@@ -850,10 +891,14 @@ feature shows readings from up to eight different sensors on older
850ThinkPads, and up to sixteen different sensors on newer ThinkPads. 891ThinkPads, and up to sixteen different sensors on newer ThinkPads.
851 892
852For example, on the X40, a typical output may be: 893For example, on the X40, a typical output may be:
853temperatures: 42 42 45 41 36 -128 33 -128 894
895temperatures:
896 42 42 45 41 36 -128 33 -128
854 897
855On the T43/p, a typical output may be: 898On the T43/p, a typical output may be:
856temperatures: 48 48 36 52 38 -128 31 -128 48 52 48 -128 -128 -128 -128 -128 899
900temperatures:
901 48 48 36 52 38 -128 31 -128 48 52 48 -128 -128 -128 -128 -128
857 902
858The mapping of thermal sensors to physical locations varies depending on 903The mapping of thermal sensors to physical locations varies depending on
859system-board model (and thus, on ThinkPad model). 904system-board model (and thus, on ThinkPad model).
@@ -863,46 +908,53 @@ tries to track down these locations for various models.
863 908
864Most (newer?) models seem to follow this pattern: 909Most (newer?) models seem to follow this pattern:
865 910
8661: CPU 911- 1: CPU
8672: (depends on model) 912- 2: (depends on model)
8683: (depends on model) 913- 3: (depends on model)
8694: GPU 914- 4: GPU
8705: Main battery: main sensor 915- 5: Main battery: main sensor
8716: Bay battery: main sensor 916- 6: Bay battery: main sensor
8727: Main battery: secondary sensor 917- 7: Main battery: secondary sensor
8738: Bay battery: secondary sensor 918- 8: Bay battery: secondary sensor
8749-15: (depends on model) 919- 9-15: (depends on model)
875 920
876For the R51 (source: Thomas Gruber): 921For the R51 (source: Thomas Gruber):
8772: Mini-PCI 922
8783: Internal HDD 923- 2: Mini-PCI
924- 3: Internal HDD
879 925
880For the T43, T43/p (source: Shmidoax/Thinkwiki.org) 926For the T43, T43/p (source: Shmidoax/Thinkwiki.org)
881http://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_T43.2C_T43p 927http://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_T43.2C_T43p
8822: System board, left side (near PCMCIA slot), reported as HDAPS temp 928
8833: PCMCIA slot 929- 2: System board, left side (near PCMCIA slot), reported as HDAPS temp
8849: MCH (northbridge) to DRAM Bus 930- 3: PCMCIA slot
88510: Clock-generator, mini-pci card and ICH (southbridge), under Mini-PCI 931- 9: MCH (northbridge) to DRAM Bus
886 card, under touchpad 932- 10: Clock-generator, mini-pci card and ICH (southbridge), under Mini-PCI
88711: Power regulator, underside of system board, below F2 key 933 card, under touchpad
934- 11: Power regulator, underside of system board, below F2 key
888 935
889The A31 has a very atypical layout for the thermal sensors 936The A31 has a very atypical layout for the thermal sensors
890(source: Milos Popovic, http://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_A31) 937(source: Milos Popovic, http://thinkwiki.org/wiki/Thermal_Sensors#ThinkPad_A31)
8911: CPU
8922: Main Battery: main sensor
8933: Power Converter
8944: Bay Battery: main sensor
8955: MCH (northbridge)
8966: PCMCIA/ambient
8977: Main Battery: secondary sensor
8988: Bay Battery: secondary sensor
899 938
939- 1: CPU
940- 2: Main Battery: main sensor
941- 3: Power Converter
942- 4: Bay Battery: main sensor
943- 5: MCH (northbridge)
944- 6: PCMCIA/ambient
945- 7: Main Battery: secondary sensor
946- 8: Bay Battery: secondary sensor
947
948
949Procfs notes
950^^^^^^^^^^^^
900 951
901Procfs notes:
902 Readings from sensors that are not available return -128. 952 Readings from sensors that are not available return -128.
903 No commands can be written to this file. 953 No commands can be written to this file.
904 954
905Sysfs notes: 955Sysfs notes
956^^^^^^^^^^^
957
906 Sensors that are not available return the ENXIO error. This 958 Sensors that are not available return the ENXIO error. This
907 status may change at runtime, as there are hotplug thermal 959 status may change at runtime, as there are hotplug thermal
908 sensors, like those inside the batteries and docks. 960 sensors, like those inside the batteries and docks.
@@ -921,6 +973,7 @@ ftp://ftp.suse.com/pub/people/trenn/sources/ec
921 973
922Use it to determine the register holding the fan 974Use it to determine the register holding the fan
923speed on some models. To do that, do the following: 975speed on some models. To do that, do the following:
976
924 - make sure the battery is fully charged 977 - make sure the battery is fully charged
925 - make sure the fan is running 978 - make sure the fan is running
926 - use above mentioned tool to read out the EC 979 - use above mentioned tool to read out the EC
@@ -941,6 +994,7 @@ LCD brightness control
941---------------------- 994----------------------
942 995
943procfs: /proc/acpi/ibm/brightness 996procfs: /proc/acpi/ibm/brightness
997
944sysfs backlight device "thinkpad_screen" 998sysfs backlight device "thinkpad_screen"
945 999
946This feature allows software control of the LCD brightness on ThinkPad 1000This feature allows software control of the LCD brightness on ThinkPad
@@ -985,15 +1039,17 @@ brightness_enable=0 forces it to be disabled. brightness_enable=1
985forces it to be enabled when available, even if the standard ACPI 1039forces it to be enabled when available, even if the standard ACPI
986interface is also available. 1040interface is also available.
987 1041
988Procfs notes: 1042Procfs notes
1043^^^^^^^^^^^^
989 1044
990 The available commands are: 1045The available commands are::
991 1046
992 echo up >/proc/acpi/ibm/brightness 1047 echo up >/proc/acpi/ibm/brightness
993 echo down >/proc/acpi/ibm/brightness 1048 echo down >/proc/acpi/ibm/brightness
994 echo 'level <level>' >/proc/acpi/ibm/brightness 1049 echo 'level <level>' >/proc/acpi/ibm/brightness
995 1050
996Sysfs notes: 1051Sysfs notes
1052^^^^^^^^^^^
997 1053
998The interface is implemented through the backlight sysfs class, which is 1054The interface is implemented through the backlight sysfs class, which is
999poorly documented at this time. 1055poorly documented at this time.
@@ -1038,6 +1094,7 @@ Volume control (Console Audio control)
1038-------------------------------------- 1094--------------------------------------
1039 1095
1040procfs: /proc/acpi/ibm/volume 1096procfs: /proc/acpi/ibm/volume
1097
1041ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC" 1098ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC"
1042 1099
1043NOTE: by default, the volume control interface operates in read-only 1100NOTE: by default, the volume control interface operates in read-only
@@ -1053,7 +1110,8 @@ Software volume control should be done only in the main AC97/HDA
1053mixer. 1110mixer.
1054 1111
1055 1112
1056About the ThinkPad Console Audio control: 1113About the ThinkPad Console Audio control
1114^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1057 1115
1058ThinkPads have a built-in amplifier and muting circuit that drives the 1116ThinkPads have a built-in amplifier and muting circuit that drives the
1059console headphone and speakers. This circuit is after the main AC97 1117console headphone and speakers. This circuit is after the main AC97
@@ -1092,13 +1150,14 @@ normal key presses to the operating system (thinkpad-acpi is not
1092involved). 1150involved).
1093 1151
1094 1152
1095The ThinkPad-ACPI volume control: 1153The ThinkPad-ACPI volume control
1154^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1096 1155
1097The preferred way to interact with the Console Audio control is the 1156The preferred way to interact with the Console Audio control is the
1098ALSA interface. 1157ALSA interface.
1099 1158
1100The legacy procfs interface allows one to read the current state, 1159The legacy procfs interface allows one to read the current state,
1101and if volume control is enabled, accepts the following commands: 1160and if volume control is enabled, accepts the following commands::
1102 1161
1103 echo up >/proc/acpi/ibm/volume 1162 echo up >/proc/acpi/ibm/volume
1104 echo down >/proc/acpi/ibm/volume 1163 echo down >/proc/acpi/ibm/volume
@@ -1137,13 +1196,15 @@ Fan control and monitoring: fan speed, fan enable/disable
1137--------------------------------------------------------- 1196---------------------------------------------------------
1138 1197
1139procfs: /proc/acpi/ibm/fan 1198procfs: /proc/acpi/ibm/fan
1140sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1, 1199
1141 pwm1_enable, fan2_input 1200sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1, pwm1_enable, fan2_input
1201
1142sysfs hwmon driver attributes: fan_watchdog 1202sysfs hwmon driver attributes: fan_watchdog
1143 1203
1144NOTE NOTE NOTE: fan control operations are disabled by default for 1204NOTE NOTE NOTE:
1145safety reasons. To enable them, the module parameter "fan_control=1" 1205 fan control operations are disabled by default for
1146must be given to thinkpad-acpi. 1206 safety reasons. To enable them, the module parameter "fan_control=1"
1207 must be given to thinkpad-acpi.
1147 1208
1148This feature attempts to show the current fan speed, control mode and 1209This feature attempts to show the current fan speed, control mode and
1149other fan data that might be available. The speed is read directly 1210other fan data that might be available. The speed is read directly
@@ -1154,7 +1215,8 @@ value on other models.
1154Some Lenovo ThinkPads support a secondary fan. This fan cannot be 1215Some Lenovo ThinkPads support a secondary fan. This fan cannot be
1155controlled separately, it shares the main fan control. 1216controlled separately, it shares the main fan control.
1156 1217
1157Fan levels: 1218Fan levels
1219^^^^^^^^^^
1158 1220
1159Most ThinkPad fans work in "levels" at the firmware interface. Level 0 1221Most ThinkPad fans work in "levels" at the firmware interface. Level 0
1160stops the fan. The higher the level, the higher the fan speed, although 1222stops the fan. The higher the level, the higher the fan speed, although
@@ -1209,9 +1271,10 @@ therefore, not suitable to protect against fan mode changes made through
1209means other than the "enable", "disable", and "level" procfs fan 1271means other than the "enable", "disable", and "level" procfs fan
1210commands, or the hwmon fan control sysfs interface. 1272commands, or the hwmon fan control sysfs interface.
1211 1273
1212Procfs notes: 1274Procfs notes
1275^^^^^^^^^^^^
1213 1276
1214The fan may be enabled or disabled with the following commands: 1277The fan may be enabled or disabled with the following commands::
1215 1278
1216 echo enable >/proc/acpi/ibm/fan 1279 echo enable >/proc/acpi/ibm/fan
1217 echo disable >/proc/acpi/ibm/fan 1280 echo disable >/proc/acpi/ibm/fan
@@ -1219,7 +1282,7 @@ The fan may be enabled or disabled with the following commands:
1219Placing a fan on level 0 is the same as disabling it. Enabling a fan 1282Placing a fan on level 0 is the same as disabling it. Enabling a fan
1220will try to place it in a safe level if it is too slow or disabled. 1283will try to place it in a safe level if it is too slow or disabled.
1221 1284
1222The fan level can be controlled with the command: 1285The fan level can be controlled with the command::
1223 1286
1224 echo 'level <level>' > /proc/acpi/ibm/fan 1287 echo 'level <level>' > /proc/acpi/ibm/fan
1225 1288
@@ -1231,7 +1294,7 @@ compatibility.
1231 1294
1232On the X31 and X40 (and ONLY on those models), the fan speed can be 1295On the X31 and X40 (and ONLY on those models), the fan speed can be
1233controlled to a certain degree. Once the fan is running, it can be 1296controlled to a certain degree. Once the fan is running, it can be
1234forced to run faster or slower with the following command: 1297forced to run faster or slower with the following command::
1235 1298
1236 echo 'speed <speed>' > /proc/acpi/ibm/fan 1299 echo 'speed <speed>' > /proc/acpi/ibm/fan
1237 1300
@@ -1241,13 +1304,14 @@ effect or the fan speed eventually settles somewhere in that range. The
1241fan cannot be stopped or started with this command. This functionality 1304fan cannot be stopped or started with this command. This functionality
1242is incomplete, and not available through the sysfs interface. 1305is incomplete, and not available through the sysfs interface.
1243 1306
1244To program the safety watchdog, use the "watchdog" command. 1307To program the safety watchdog, use the "watchdog" command::
1245 1308
1246 echo 'watchdog <interval in seconds>' > /proc/acpi/ibm/fan 1309 echo 'watchdog <interval in seconds>' > /proc/acpi/ibm/fan
1247 1310
1248If you want to disable the watchdog, use 0 as the interval. 1311If you want to disable the watchdog, use 0 as the interval.
1249 1312
1250Sysfs notes: 1313Sysfs notes
1314^^^^^^^^^^^
1251 1315
1252The sysfs interface follows the hwmon subsystem guidelines for the most 1316The sysfs interface follows the hwmon subsystem guidelines for the most
1253part, and the exception is the fan safety watchdog. 1317part, and the exception is the fan safety watchdog.
@@ -1261,10 +1325,10 @@ to the firmware).
1261Features not yet implemented by the driver return ENOSYS. 1325Features not yet implemented by the driver return ENOSYS.
1262 1326
1263hwmon device attribute pwm1_enable: 1327hwmon device attribute pwm1_enable:
1264 0: PWM offline (fan is set to full-speed mode) 1328 - 0: PWM offline (fan is set to full-speed mode)
1265 1: Manual PWM control (use pwm1 to set fan level) 1329 - 1: Manual PWM control (use pwm1 to set fan level)
1266 2: Hardware PWM control (EC "auto" mode) 1330 - 2: Hardware PWM control (EC "auto" mode)
1267 3: reserved (Software PWM control, not implemented yet) 1331 - 3: reserved (Software PWM control, not implemented yet)
1268 1332
1269 Modes 0 and 2 are not supported by all ThinkPads, and the 1333 Modes 0 and 2 are not supported by all ThinkPads, and the
1270 driver is not always able to detect this. If it does know a 1334 driver is not always able to detect this. If it does know a
@@ -1304,7 +1368,9 @@ WAN
1304--- 1368---
1305 1369
1306procfs: /proc/acpi/ibm/wan 1370procfs: /proc/acpi/ibm/wan
1371
1307sysfs device attribute: wwan_enable (deprecated) 1372sysfs device attribute: wwan_enable (deprecated)
1373
1308sysfs rfkill class: switch "tpacpi_wwan_sw" 1374sysfs rfkill class: switch "tpacpi_wwan_sw"
1309 1375
1310This feature shows the presence and current state of the built-in 1376This feature shows the presence and current state of the built-in
@@ -1316,22 +1382,24 @@ so it is kept across reboots and power-off.
1316It was tested on a Lenovo ThinkPad X60. It should probably work on other 1382It was tested on a Lenovo ThinkPad X60. It should probably work on other
1317ThinkPad models which come with this module installed. 1383ThinkPad models which come with this module installed.
1318 1384
1319Procfs notes: 1385Procfs notes
1386^^^^^^^^^^^^
1320 1387
1321If the W-WAN card is installed, the following commands can be used: 1388If the W-WAN card is installed, the following commands can be used::
1322 1389
1323 echo enable > /proc/acpi/ibm/wan 1390 echo enable > /proc/acpi/ibm/wan
1324 echo disable > /proc/acpi/ibm/wan 1391 echo disable > /proc/acpi/ibm/wan
1325 1392
1326Sysfs notes: 1393Sysfs notes
1394^^^^^^^^^^^
1327 1395
1328 If the W-WAN card is installed, it can be enabled / 1396 If the W-WAN card is installed, it can be enabled /
1329 disabled through the "wwan_enable" thinkpad-acpi device 1397 disabled through the "wwan_enable" thinkpad-acpi device
1330 attribute, and its current status can also be queried. 1398 attribute, and its current status can also be queried.
1331 1399
1332 enable: 1400 enable:
1333 0: disables WWAN card / WWAN card is disabled 1401 - 0: disables WWAN card / WWAN card is disabled
1334 1: enables WWAN card / WWAN card is enabled. 1402 - 1: enables WWAN card / WWAN card is enabled.
1335 1403
1336 Note: this interface has been superseded by the generic rfkill 1404 Note: this interface has been superseded by the generic rfkill
1337 class. It has been deprecated, and it will be removed in year 1405 class. It has been deprecated, and it will be removed in year
@@ -1354,7 +1422,8 @@ sysfs rfkill class: switch "tpacpi_uwb_sw"
1354This feature exports an rfkill controller for the UWB device, if one is 1422This feature exports an rfkill controller for the UWB device, if one is
1355present and enabled in the BIOS. 1423present and enabled in the BIOS.
1356 1424
1357Sysfs notes: 1425Sysfs notes
1426^^^^^^^^^^^
1358 1427
1359 rfkill controller switch "tpacpi_uwb_sw": refer to 1428 rfkill controller switch "tpacpi_uwb_sw": refer to
1360 Documentation/rfkill.txt for details. 1429 Documentation/rfkill.txt for details.
@@ -1368,11 +1437,11 @@ This sysfs attribute controls the keyboard "face" that will be shown on the
1368Lenovo X1 Carbon 2nd gen (2014)'s adaptive keyboard. The value can be read 1437Lenovo X1 Carbon 2nd gen (2014)'s adaptive keyboard. The value can be read
1369and set. 1438and set.
1370 1439
13711 = Home mode 1440- 1 = Home mode
13722 = Web-browser mode 1441- 2 = Web-browser mode
13733 = Web-conference mode 1442- 3 = Web-conference mode
13744 = Function mode 1443- 4 = Function mode
13755 = Layflat mode 1444- 5 = Layflat mode
1376 1445
1377For more details about which buttons will appear depending on the mode, please 1446For more details about which buttons will appear depending on the mode, please
1378review the laptop's user guide: 1447review the laptop's user guide:
@@ -1382,13 +1451,13 @@ Multiple Commands, Module Parameters
1382------------------------------------ 1451------------------------------------
1383 1452
1384Multiple commands can be written to the proc files in one shot by 1453Multiple commands can be written to the proc files in one shot by
1385separating them with commas, for example: 1454separating them with commas, for example::
1386 1455
1387 echo enable,0xffff > /proc/acpi/ibm/hotkey 1456 echo enable,0xffff > /proc/acpi/ibm/hotkey
1388 echo lcd_disable,crt_enable > /proc/acpi/ibm/video 1457 echo lcd_disable,crt_enable > /proc/acpi/ibm/video
1389 1458
1390Commands can also be specified when loading the thinkpad-acpi module, 1459Commands can also be specified when loading the thinkpad-acpi module,
1391for example: 1460for example::
1392 1461
1393 modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable 1462 modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable
1394 1463
@@ -1397,14 +1466,16 @@ Enabling debugging output
1397------------------------- 1466-------------------------
1398 1467
1399The module takes a debug parameter which can be used to selectively 1468The module takes a debug parameter which can be used to selectively
1400enable various classes of debugging output, for example: 1469enable various classes of debugging output, for example::
1401 1470
1402 modprobe thinkpad_acpi debug=0xffff 1471 modprobe thinkpad_acpi debug=0xffff
1403 1472
1404will enable all debugging output classes. It takes a bitmask, so 1473will enable all debugging output classes. It takes a bitmask, so
1405to enable more than one output class, just add their values. 1474to enable more than one output class, just add their values.
1406 1475
1476 ============= ======================================
1407 Debug bitmask Description 1477 Debug bitmask Description
1478 ============= ======================================
1408 0x8000 Disclose PID of userspace programs 1479 0x8000 Disclose PID of userspace programs
1409 accessing some functions of the driver 1480 accessing some functions of the driver
1410 0x0001 Initialization and probing 1481 0x0001 Initialization and probing
@@ -1415,6 +1486,7 @@ to enable more than one output class, just add their values.
1415 0x0010 Fan control 1486 0x0010 Fan control
1416 0x0020 Backlight brightness 1487 0x0020 Backlight brightness
1417 0x0040 Audio mixer/volume control 1488 0x0040 Audio mixer/volume control
1489 ============= ======================================
1418 1490
1419There is also a kernel build option to enable more debugging 1491There is also a kernel build option to enable more debugging
1420information, which may be necessary to debug driver problems. 1492information, which may be necessary to debug driver problems.
@@ -1432,8 +1504,10 @@ the module parameter force_load=1. Regardless of whether this works or
1432not, please contact ibm-acpi-devel@lists.sourceforge.net with a report. 1504not, please contact ibm-acpi-devel@lists.sourceforge.net with a report.
1433 1505
1434 1506
1435Sysfs interface changelog: 1507Sysfs interface changelog
1508^^^^^^^^^^^^^^^^^^^^^^^^^
1436 1509
1510========= ===============================================================
14370x000100: Initial sysfs support, as a single platform driver and 15110x000100: Initial sysfs support, as a single platform driver and
1438 device. 1512 device.
14390x000200: Hot key support for 32 hot keys, and radio slider switch 15130x000200: Hot key support for 32 hot keys, and radio slider switch
@@ -1485,3 +1559,4 @@ Sysfs interface changelog:
14850x030000: Thermal and fan sysfs attributes were moved to the hwmon 15590x030000: Thermal and fan sysfs attributes were moved to the hwmon
1486 device instead of being attached to the backing platform 1560 device instead of being attached to the backing platform
1487 device. 1561 device.
1562========= ===============================================================
diff --git a/Documentation/laptops/toshiba_haps.txt b/Documentation/laptops/toshiba_haps.rst
index 0c1d88dedbde..11dfc428c080 100644
--- a/Documentation/laptops/toshiba_haps.txt
+++ b/Documentation/laptops/toshiba_haps.rst
@@ -1,18 +1,19 @@
1Kernel driver toshiba_haps 1====================================
2Toshiba HDD Active Protection Sensor 2Toshiba HDD Active Protection Sensor
3==================================== 3====================================
4 4
5Kernel driver: toshiba_haps
6
5Author: Azael Avalos <coproscefalo@gmail.com> 7Author: Azael Avalos <coproscefalo@gmail.com>
6 8
7 9
80. Contents 10.. 0. Contents
9-----------
10 11
111. Description 12 1. Description
122. Interface 13 2. Interface
133. Accelerometer axes 14 3. Accelerometer axes
144. Supported devices 15 4. Supported devices
155. Usage 16 5. Usage
16 17
17 18
181. Description 191. Description
@@ -32,17 +33,20 @@ file to set the desired protection level or sensor sensibility.
32------------ 33------------
33 34
34This device comes with 3 methods: 35This device comes with 3 methods:
35_STA - Checks existence of the device, returning Zero if the device does not 36
37==== =====================================================================
38_STA Checks existence of the device, returning Zero if the device does not
36 exists or is not supported. 39 exists or is not supported.
37PTLV - Sets the desired protection level. 40PTLV Sets the desired protection level.
38RSSS - Shuts down the HDD protection interface for a few seconds, 41RSSS Shuts down the HDD protection interface for a few seconds,
39 then restores normal operation. 42 then restores normal operation.
43==== =====================================================================
40 44
41Note: 45Note:
42The presence of Solid State Drives (SSD) can make this driver to fail loading, 46 The presence of Solid State Drives (SSD) can make this driver to fail loading,
43given the fact that such drives have no movable parts, and thus, not requiring 47 given the fact that such drives have no movable parts, and thus, not requiring
44any "protection" as well as failing during the evaluation of the _STA method 48 any "protection" as well as failing during the evaluation of the _STA method
45found under this device. 49 found under this device.
46 50
47 51
483. Accelerometer axes 523. Accelerometer axes
@@ -66,11 +70,18 @@ conventional HDD and not only SSD, or a combination of both HDD and SSD.
66-------- 70--------
67 71
68The sysfs files under /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS620A:00/ are: 72The sysfs files under /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS620A:00/ are:
69protection_level - The protection_level is readable and writeable, and 73
74================ ============================================================
75protection_level The protection_level is readable and writeable, and
70 provides a way to let userspace query the current protection 76 provides a way to let userspace query the current protection
71 level, as well as set the desired protection level, the 77 level, as well as set the desired protection level, the
72 available protection levels are: 78 available protection levels are:
73 0 - Disabled | 1 - Low | 2 - Medium | 3 - High 79
74reset_protection - The reset_protection entry is writeable only, being "1" 80 ============ ======= ========== ========
81 0 - Disabled 1 - Low 2 - Medium 3 - High
82 ============ ======= ========== ========
83
84reset_protection The reset_protection entry is writeable only, being "1"
75 the only parameter it accepts, it is used to trigger 85 the only parameter it accepts, it is used to trigger
76 a reset of the protection interface. 86 a reset of the protection interface.
87================ ============================================================
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 749322060f10..c5f0d44433a2 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -102,7 +102,7 @@ Changing this takes effect whenever an application requests memory.
102block_dump 102block_dump
103 103
104block_dump enables block I/O debugging when set to a nonzero value. More 104block_dump enables block I/O debugging when set to a nonzero value. More
105information on block I/O debugging is in Documentation/laptops/laptop-mode.txt. 105information on block I/O debugging is in Documentation/laptops/laptop-mode.rst.
106 106
107============================================================== 107==============================================================
108 108
@@ -286,7 +286,7 @@ shared memory segment using hugetlb page.
286laptop_mode 286laptop_mode
287 287
288laptop_mode is a knob that controls "laptop mode". All the things that are 288laptop_mode is a knob that controls "laptop mode". All the things that are
289controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt. 289controlled by this knob are discussed in Documentation/laptops/laptop-mode.rst.
290 290
291============================================================== 291==============================================================
292 292
diff --git a/MAINTAINERS b/MAINTAINERS
index c30b52c9049a..3ee73751f56c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14888,7 +14888,7 @@ M: Mattia Dongili <malattia@linux.it>
14888L: platform-driver-x86@vger.kernel.org 14888L: platform-driver-x86@vger.kernel.org
14889W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers 14889W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
14890S: Maintained 14890S: Maintained
14891F: Documentation/laptops/sony-laptop.txt 14891F: Documentation/laptops/sony-laptop.rst
14892F: drivers/char/sonypi.c 14892F: drivers/char/sonypi.c
14893F: drivers/platform/x86/sony-laptop.c 14893F: drivers/platform/x86/sony-laptop.c
14894F: include/linux/sony-laptop.h 14894F: include/linux/sony-laptop.h
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 466ebd84ad17..bb734066075f 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -382,7 +382,7 @@ config SONYPI
382 Device which can be found in many (all ?) Sony Vaio laptops. 382 Device which can be found in many (all ?) Sony Vaio laptops.
383 383
384 If you have one of those laptops, read 384 If you have one of those laptops, read
385 <file:Documentation/laptops/sonypi.txt>, and say Y or M here. 385 <file:Documentation/laptops/sonypi.rst>, and say Y or M here.
386 386
387 To compile this driver as a module, choose M here: the 387 To compile this driver as a module, choose M here: the
388 module will be called sonypi. 388 module will be called sonypi.
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index cc29fe79c283..8f91d9ef8a7b 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -448,7 +448,7 @@ config SONY_LAPTOP
448 screen brightness control, Fn keys and allows powering on/off some 448 screen brightness control, Fn keys and allows powering on/off some
449 devices. 449 devices.
450 450
451 Read <file:Documentation/laptops/sony-laptop.txt> for more information. 451 Read <file:Documentation/laptops/sony-laptop.rst> for more information.
452 452
453config SONYPI_COMPAT 453config SONYPI_COMPAT
454 bool "Sonypi compatibility" 454 bool "Sonypi compatibility"
@@ -500,7 +500,7 @@ config THINKPAD_ACPI
500 support for Fn-Fx key combinations, Bluetooth control, video 500 support for Fn-Fx key combinations, Bluetooth control, video
501 output switching, ThinkLight control, UltraBay eject and more. 501 output switching, ThinkLight control, UltraBay eject and more.
502 For more information about this driver see 502 For more information about this driver see
503 <file:Documentation/laptops/thinkpad-acpi.txt> and 503 <file:Documentation/laptops/thinkpad-acpi.rst> and
504 <http://ibm-acpi.sf.net/> . 504 <http://ibm-acpi.sf.net/> .
505 505
506 This driver was formerly known as ibm-acpi. 506 This driver was formerly known as ibm-acpi.