aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/power
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/power
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'Documentation/power')
-rw-r--r--Documentation/power/devices.txt319
-rw-r--r--Documentation/power/interface.txt43
-rw-r--r--Documentation/power/kernel_threads.txt41
-rw-r--r--Documentation/power/pci.txt332
-rw-r--r--Documentation/power/states.txt79
-rw-r--r--Documentation/power/swsusp.txt235
-rw-r--r--Documentation/power/tricks.txt27
-rw-r--r--Documentation/power/video.txt169
-rw-r--r--Documentation/power/video_extension.txt34
9 files changed, 1279 insertions, 0 deletions
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt
new file mode 100644
index 000000000000..5d4ae9a39f1d
--- /dev/null
+++ b/Documentation/power/devices.txt
@@ -0,0 +1,319 @@
1
2Device Power Management
3
4
5Device power management encompasses two areas - the ability to save
6state and transition a device to a low-power state when the system is
7entering a low-power state; and the ability to transition a device to
8a low-power state while the system is running (and independently of
9any other power management activity).
10
11
12Methods
13
14The methods to suspend and resume devices reside in struct bus_type:
15
16struct bus_type {
17 ...
18 int (*suspend)(struct device * dev, pm_message_t state);
19 int (*resume)(struct device * dev);
20};
21
22Each bus driver is responsible implementing these methods, translating
23the call into a bus-specific request and forwarding the call to the
24bus-specific drivers. For example, PCI drivers implement suspend() and
25resume() methods in struct pci_driver. The PCI core is simply
26responsible for translating the pointers to PCI-specific ones and
27calling the low-level driver.
28
29This is done to a) ease transition to the new power management methods
30and leverage the existing PM code in various bus drivers; b) allow
31buses to implement generic and default PM routines for devices, and c)
32make the flow of execution obvious to the reader.
33
34
35System Power Management
36
37When the system enters a low-power state, the device tree is walked in
38a depth-first fashion to transition each device into a low-power
39state. The ordering of the device tree is guaranteed by the order in
40which devices get registered - children are never registered before
41their ancestors, and devices are placed at the back of the list when
42registered. By walking the list in reverse order, we are guaranteed to
43suspend devices in the proper order.
44
45Devices are suspended once with interrupts enabled. Drivers are
46expected to stop I/O transactions, save device state, and place the
47device into a low-power state. Drivers may sleep, allocate memory,
48etc. at will.
49
50Some devices are broken and will inevitably have problems powering
51down or disabling themselves with interrupts enabled. For these
52special cases, they may return -EAGAIN. This will put the device on a
53list to be taken care of later. When interrupts are disabled, before
54we enter the low-power state, their drivers are called again to put
55their device to sleep.
56
57On resume, the devices that returned -EAGAIN will be called to power
58themselves back on with interrupts disabled. Once interrupts have been
59re-enabled, the rest of the drivers will be called to resume their
60devices. On resume, a driver is responsible for powering back on each
61device, restoring state, and re-enabling I/O transactions for that
62device.
63
64System devices follow a slightly different API, which can be found in
65
66 include/linux/sysdev.h
67 drivers/base/sys.c
68
69System devices will only be suspended with interrupts disabled, and
70after all other devices have been suspended. On resume, they will be
71resumed before any other devices, and also with interrupts disabled.
72
73
74Runtime Power Management
75
76Many devices are able to dynamically power down while the system is
77still running. This feature is useful for devices that are not being
78used, and can offer significant power savings on a running system.
79
80In each device's directory, there is a 'power' directory, which
81contains at least a 'state' file. Reading from this file displays what
82power state the device is currently in. Writing to this file initiates
83a transition to the specified power state, which must be a decimal in
84the range 1-3, inclusive; or 0 for 'On'.
85
86The PM core will call the ->suspend() method in the bus_type object
87that the device belongs to if the specified state is not 0, or
88->resume() if it is.
89
90Nothing will happen if the specified state is the same state the
91device is currently in.
92
93If the device is already in a low-power state, and the specified state
94is another, but different, low-power state, the ->resume() method will
95first be called to power the device back on, then ->suspend() will be
96called again with the new state.
97
98The driver is responsible for saving the working state of the device
99and putting it into the low-power state specified. If this was
100successful, it returns 0, and the device's power_state field is
101updated.
102
103The driver must take care to know whether or not it is able to
104properly resume the device, including all step of reinitialization
105necessary. (This is the hardest part, and the one most protected by
106NDA'd documents).
107
108The driver must also take care not to suspend a device that is
109currently in use. It is their responsibility to provide their own
110exclusion mechanisms.
111
112The runtime power transition happens with interrupts enabled. If a
113device cannot support being powered down with interrupts, it may
114return -EAGAIN (as it would during a system power management
115transition), but it will _not_ be called again, and the transaction
116will fail.
117
118There is currently no way to know what states a device or driver
119supports a priori. This will change in the future.
120
121pm_message_t meaning
122
123pm_message_t has two fields. event ("major"), and flags. If driver
124does not know event code, it aborts the request, returning error. Some
125drivers may need to deal with special cases based on the actual type
126of suspend operation being done at the system level. This is why
127there are flags.
128
129Event codes are:
130
131ON -- no need to do anything except special cases like broken
132HW.
133
134# NOTIFICATION -- pretty much same as ON?
135
136FREEZE -- stop DMA and interrupts, and be prepared to reinit HW from
137scratch. That probably means stop accepting upstream requests, the
138actual policy of what to do with them beeing specific to a given
139driver. It's acceptable for a network driver to just drop packets
140while a block driver is expected to block the queue so no request is
141lost. (Use IDE as an example on how to do that). FREEZE requires no
142power state change, and it's expected for drivers to be able to
143quickly transition back to operating state.
144
145SUSPEND -- like FREEZE, but also put hardware into low-power state. If
146there's need to distinguish several levels of sleep, additional flag
147is probably best way to do that.
148
149Transitions are only from a resumed state to a suspended state, never
150between 2 suspended states. (ON -> FREEZE or ON -> SUSPEND can happen,
151FREEZE -> SUSPEND or SUSPEND -> FREEZE can not).
152
153All events are:
154
155[NOTE NOTE NOTE: If you are driver author, you should not care; you
156should only look at event, and ignore flags.]
157
158#Prepare for suspend -- userland is still running but we are going to
159#enter suspend state. This gives drivers chance to load firmware from
160#disk and store it in memory, or do other activities taht require
161#operating userland, ability to kmalloc GFP_KERNEL, etc... All of these
162#are forbiden once the suspend dance is started.. event = ON, flags =
163#PREPARE_TO_SUSPEND
164
165Apm standby -- prepare for APM event. Quiesce devices to make life
166easier for APM BIOS. event = FREEZE, flags = APM_STANDBY
167
168Apm suspend -- same as APM_STANDBY, but it we should probably avoid
169spinning down disks. event = FREEZE, flags = APM_SUSPEND
170
171System halt, reboot -- quiesce devices to make life easier for BIOS. event
172= FREEZE, flags = SYSTEM_HALT or SYSTEM_REBOOT
173
174System shutdown -- at least disks need to be spun down, or data may be
175lost. Quiesce devices, just to make life easier for BIOS. event =
176FREEZE, flags = SYSTEM_SHUTDOWN
177
178Kexec -- turn off DMAs and put hardware into some state where new
179kernel can take over. event = FREEZE, flags = KEXEC
180
181Powerdown at end of swsusp -- very similar to SYSTEM_SHUTDOWN, except wake
182may need to be enabled on some devices. This actually has at least 3
183subtypes, system can reboot, enter S4 and enter S5 at the end of
184swsusp. event = FREEZE, flags = SWSUSP and one of SYSTEM_REBOOT,
185SYSTEM_SHUTDOWN, SYSTEM_S4
186
187Suspend to ram -- put devices into low power state. event = SUSPEND,
188flags = SUSPEND_TO_RAM
189
190Freeze for swsusp snapshot -- stop DMA and interrupts. No need to put
191devices into low power mode, but you must be able to reinitialize
192device from scratch in resume method. This has two flavors, its done
193once on suspending kernel, once on resuming kernel. event = FREEZE,
194flags = DURING_SUSPEND or DURING_RESUME
195
196Device detach requested from /sys -- deinitialize device; proably same as
197SYSTEM_SHUTDOWN, I do not understand this one too much. probably event
198= FREEZE, flags = DEV_DETACH.
199
200#These are not really events sent:
201#
202#System fully on -- device is working normally; this is probably never
203#passed to suspend() method... event = ON, flags = 0
204#
205#Ready after resume -- userland is now running, again. Time to free any
206#memory you ate during prepare to suspend... event = ON, flags =
207#READY_AFTER_RESUME
208#
209
210Driver Detach Power Management
211
212The kernel now supports the ability to place a device in a low-power
213state when it is detached from its driver, which happens when its
214module is removed.
215
216Each device contains a 'detach_state' file in its sysfs directory
217which can be used to control this state. Reading from this file
218displays what the current detach state is set to. This is 0 (On) by
219default. A user may write a positive integer value to this file in the
220range of 1-4 inclusive.
221
222A value of 1-3 will indicate the device should be placed in that
223low-power state, which will cause ->suspend() to be called for that
224device. A value of 4 indicates that the device should be shutdown, so
225->shutdown() will be called for that device.
226
227The driver is responsible for reinitializing the device when the
228module is re-inserted during it's ->probe() (or equivalent) method.
229The driver core will not call any extra functions when binding the
230device to the driver.
231
232pm_message_t meaning
233
234pm_message_t has two fields. event ("major"), and flags. If driver
235does not know event code, it aborts the request, returning error. Some
236drivers may need to deal with special cases based on the actual type
237of suspend operation being done at the system level. This is why
238there are flags.
239
240Event codes are:
241
242ON -- no need to do anything except special cases like broken
243HW.
244
245# NOTIFICATION -- pretty much same as ON?
246
247FREEZE -- stop DMA and interrupts, and be prepared to reinit HW from
248scratch. That probably means stop accepting upstream requests, the
249actual policy of what to do with them being specific to a given
250driver. It's acceptable for a network driver to just drop packets
251while a block driver is expected to block the queue so no request is
252lost. (Use IDE as an example on how to do that). FREEZE requires no
253power state change, and it's expected for drivers to be able to
254quickly transition back to operating state.
255
256SUSPEND -- like FREEZE, but also put hardware into low-power state. If
257there's need to distinguish several levels of sleep, additional flag
258is probably best way to do that.
259
260Transitions are only from a resumed state to a suspended state, never
261between 2 suspended states. (ON -> FREEZE or ON -> SUSPEND can happen,
262FREEZE -> SUSPEND or SUSPEND -> FREEZE can not).
263
264All events are:
265
266[NOTE NOTE NOTE: If you are driver author, you should not care; you
267should only look at event, and ignore flags.]
268
269#Prepare for suspend -- userland is still running but we are going to
270#enter suspend state. This gives drivers chance to load firmware from
271#disk and store it in memory, or do other activities taht require
272#operating userland, ability to kmalloc GFP_KERNEL, etc... All of these
273#are forbiden once the suspend dance is started.. event = ON, flags =
274#PREPARE_TO_SUSPEND
275
276Apm standby -- prepare for APM event. Quiesce devices to make life
277easier for APM BIOS. event = FREEZE, flags = APM_STANDBY
278
279Apm suspend -- same as APM_STANDBY, but it we should probably avoid
280spinning down disks. event = FREEZE, flags = APM_SUSPEND
281
282System halt, reboot -- quiesce devices to make life easier for BIOS. event
283= FREEZE, flags = SYSTEM_HALT or SYSTEM_REBOOT
284
285System shutdown -- at least disks need to be spun down, or data may be
286lost. Quiesce devices, just to make life easier for BIOS. event =
287FREEZE, flags = SYSTEM_SHUTDOWN
288
289Kexec -- turn off DMAs and put hardware into some state where new
290kernel can take over. event = FREEZE, flags = KEXEC
291
292Powerdown at end of swsusp -- very similar to SYSTEM_SHUTDOWN, except wake
293may need to be enabled on some devices. This actually has at least 3
294subtypes, system can reboot, enter S4 and enter S5 at the end of
295swsusp. event = FREEZE, flags = SWSUSP and one of SYSTEM_REBOOT,
296SYSTEM_SHUTDOWN, SYSTEM_S4
297
298Suspend to ram -- put devices into low power state. event = SUSPEND,
299flags = SUSPEND_TO_RAM
300
301Freeze for swsusp snapshot -- stop DMA and interrupts. No need to put
302devices into low power mode, but you must be able to reinitialize
303device from scratch in resume method. This has two flavors, its done
304once on suspending kernel, once on resuming kernel. event = FREEZE,
305flags = DURING_SUSPEND or DURING_RESUME
306
307Device detach requested from /sys -- deinitialize device; proably same as
308SYSTEM_SHUTDOWN, I do not understand this one too much. probably event
309= FREEZE, flags = DEV_DETACH.
310
311#These are not really events sent:
312#
313#System fully on -- device is working normally; this is probably never
314#passed to suspend() method... event = ON, flags = 0
315#
316#Ready after resume -- userland is now running, again. Time to free any
317#memory you ate during prepare to suspend... event = ON, flags =
318#READY_AFTER_RESUME
319#
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt
new file mode 100644
index 000000000000..f5ebda5f4276
--- /dev/null
+++ b/Documentation/power/interface.txt
@@ -0,0 +1,43 @@
1Power Management Interface
2
3
4The power management subsystem provides a unified sysfs interface to
5userspace, regardless of what architecture or platform one is
6running. The interface exists in /sys/power/ directory (assuming sysfs
7is mounted at /sys).
8
9/sys/power/state controls system power state. Reading from this file
10returns what states are supported, which is hard-coded to 'standby'
11(Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
12(Suspend-to-Disk).
13
14Writing to this file one of those strings causes the system to
15transition into that state. Please see the file
16Documentation/power/states.txt for a description of each of those
17states.
18
19
20/sys/power/disk controls the operating mode of the suspend-to-disk
21mechanism. Suspend-to-disk can be handled in several ways. The
22greatest distinction is who writes memory to disk - the firmware or
23the kernel. If the firmware does it, we assume that it also handles
24suspending the system.
25
26If the kernel does it, then we have three options for putting the system
27to sleep - using the platform driver (e.g. ACPI or other PM
28registers), powering off the system or rebooting the system (for
29testing). The system will support either 'firmware' or 'platform', and
30that is known a priori. But, the user may choose 'shutdown' or
31'reboot' as alternatives.
32
33Reading from this file will display what the mode is currently set
34to. Writing to this file will accept one of
35
36 'firmware'
37 'platform'
38 'shutdown'
39 'reboot'
40
41It will only change to 'firmware' or 'platform' if the system supports
42it.
43
diff --git a/Documentation/power/kernel_threads.txt b/Documentation/power/kernel_threads.txt
new file mode 100644
index 000000000000..60b548105edf
--- /dev/null
+++ b/Documentation/power/kernel_threads.txt
@@ -0,0 +1,41 @@
1KERNEL THREADS
2
3
4Freezer
5
6Upon entering a suspended state the system will freeze all
7tasks. This is done by delivering pseudosignals. This affects
8kernel threads, too. To successfully freeze a kernel thread
9the thread has to check for the pseudosignal and enter the
10refrigerator. Code to do this looks like this:
11
12 do {
13 hub_events();
14 wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
15 if (current->flags & PF_FREEZE)
16 refrigerator(PF_FREEZE);
17 } while (!signal_pending(current));
18
19from drivers/usb/core/hub.c::hub_thread()
20
21
22The Unfreezable
23
24Some kernel threads however, must not be frozen. The kernel must
25be able to finish pending IO operations and later on be able to
26write the memory image to disk. Kernel threads needed to do IO
27must stay awake. Such threads must mark themselves unfreezable
28like this:
29
30 /*
31 * This thread doesn't need any user-level access,
32 * so get rid of all our resources.
33 */
34 daemonize("usb-storage");
35
36 current->flags |= PF_NOFREEZE;
37
38from drivers/usb/storage/usb.c::usb_stor_control_thread()
39
40Such drivers are themselves responsible for staying quiet during
41the actual snapshotting.
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
new file mode 100644
index 000000000000..c85428e7ad92
--- /dev/null
+++ b/Documentation/power/pci.txt
@@ -0,0 +1,332 @@
1
2PCI Power Management
3~~~~~~~~~~~~~~~~~~~~
4
5An overview of the concepts and the related functions in the Linux kernel
6
7Patrick Mochel <mochel@transmeta.com>
8(and others)
9
10---------------------------------------------------------------------------
11
121. Overview
132. How the PCI Subsystem Does Power Management
143. PCI Utility Functions
154. PCI Device Drivers
165. Resources
17
181. Overview
19~~~~~~~~~~~
20
21The PCI Power Management Specification was introduced between the PCI 2.1 and
22PCI 2.2 Specifications. It a standard interface for controlling various
23power management operations.
24
25Implementation of the PCI PM Spec is optional, as are several sub-components of
26it. If a device supports the PCI PM Spec, the device will have an 8 byte
27capability field in its PCI configuration space. This field is used to describe
28and control the standard PCI power management features.
29
30The PCI PM spec defines 4 operating states for devices (D0 - D3) and for buses
31(B0 - B3). The higher the number, the less power the device consumes. However,
32the higher the number, the longer the latency is for the device to return to
33an operational state (D0).
34
35There are actually two D3 states. When someone talks about D3, they usually
36mean D3hot, which corresponds to an ACPI D2 state (power is reduced, the
37device may lose some context). But they may also mean D3cold, which is an
38ACPI D3 state (power is fully off, all state was discarded); or both.
39
40Bus power management is not covered in this version of this document.
41
42Note that all PCI devices support D0 and D3cold by default, regardless of
43whether or not they implement any of the PCI PM spec.
44
45The possible state transitions that a device can undergo are:
46
47+---------------------------+
48| Current State | New State |
49+---------------------------+
50| D0 | D1, D2, D3|
51+---------------------------+
52| D1 | D2, D3 |
53+---------------------------+
54| D2 | D3 |
55+---------------------------+
56| D1, D2, D3 | D0 |
57+---------------------------+
58
59Note that when the system is entering a global suspend state, all devices will
60be placed into D3 and when resuming, all devices will be placed into D0.
61However, when the system is running, other state transitions are possible.
62
632. How The PCI Subsystem Handles Power Management
64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
66The PCI suspend/resume functionality is accessed indirectly via the Power
67Management subsystem. At boot, the PCI driver registers a power management
68callback with that layer. Upon entering a suspend state, the PM layer iterates
69through all of its registered callbacks. This currently takes place only during
70APM state transitions.
71
72Upon going to sleep, the PCI subsystem walks its device tree twice. Both times,
73it does a depth first walk of the device tree. The first walk saves each of the
74device's state and checks for devices that will prevent the system from entering
75a global power state. The next walk then places the devices in a low power
76state.
77
78The first walk allows a graceful recovery in the event of a failure, since none
79of the devices have actually been powered down.
80
81In both walks, in particular the second, all children of a bridge are touched
82before the actual bridge itself. This allows the bridge to retain power while
83its children are being accessed.
84
85Upon resuming from sleep, just the opposite must be true: all bridges must be
86powered on and restored before their children are powered on. This is easily
87accomplished with a breadth-first walk of the PCI device tree.
88
89
903. PCI Utility Functions
91~~~~~~~~~~~~~~~~~~~~~~~~
92
93These are helper functions designed to be called by individual device drivers.
94Assuming that a device behaves as advertised, these should be applicable in most
95cases. However, results may vary.
96
97Note that these functions are never implicitly called for the driver. The driver
98is always responsible for deciding when and if to call these.
99
100
101pci_save_state
102--------------
103
104Usage:
105 pci_save_state(dev, buffer);
106
107Description:
108 Save first 64 bytes of PCI config space. Buffer must be allocated by
109 caller.
110
111
112pci_restore_state
113-----------------
114
115Usage:
116 pci_restore_state(dev, buffer);
117
118Description:
119 Restore previously saved config space. (First 64 bytes only);
120
121 If buffer is NULL, then restore what information we know about the
122 device from bootup: BARs and interrupt line.
123
124
125pci_set_power_state
126-------------------
127
128Usage:
129 pci_set_power_state(dev, state);
130
131Description:
132 Transition device to low power state using PCI PM Capabilities
133 registers.
134
135 Will fail under one of the following conditions:
136 - If state is less than current state, but not D0 (illegal transition)
137 - Device doesn't support PM Capabilities
138 - Device does not support requested state
139
140
141pci_enable_wake
142---------------
143
144Usage:
145 pci_enable_wake(dev, state, enable);
146
147Description:
148 Enable device to generate PME# during low power state using PCI PM
149 Capabilities.
150
151 Checks whether if device supports generating PME# from requested state
152 and fail if it does not, unless enable == 0 (request is to disable wake
153 events, which is implicit if it doesn't even support it in the first
154 place).
155
156 Note that the PMC Register in the device's PM Capabilties has a bitmask
157 of the states it supports generating PME# from. D3hot is bit 3 and
158 D3cold is bit 4. So, while a value of 4 as the state may not seem
159 semantically correct, it is.
160
161
1624. PCI Device Drivers
163~~~~~~~~~~~~~~~~~~~~~
164
165These functions are intended for use by individual drivers, and are defined in
166struct pci_driver:
167
168 int (*save_state) (struct pci_dev *dev, u32 state);
169 int (*suspend) (struct pci_dev *dev, u32 state);
170 int (*resume) (struct pci_dev *dev);
171 int (*enable_wake) (struct pci_dev *dev, u32 state, int enable);
172
173
174save_state
175----------
176
177Usage:
178
179if (dev->driver && dev->driver->save_state)
180 dev->driver->save_state(dev,state);
181
182The driver should use this callback to save device state. It should take into
183account the current state of the device and the requested state in order to
184avoid any unnecessary operations.
185
186For example, a video card that supports all 4 states (D0-D3), all controller
187context is preserved when entering D1, but the screen is placed into a low power
188state (blanked).
189
190The driver can also interpret this function as a notification that it may be
191entering a sleep state in the near future. If it knows that the device cannot
192enter the requested state, either because of lack of support for it, or because
193the device is middle of some critical operation, then it should fail.
194
195This function should not be used to set any state in the device or the driver
196because the device may not actually enter the sleep state (e.g. another driver
197later causes causes a global state transition to fail).
198
199Note that in intermediate low power states, a device's I/O and memory spaces may
200be disabled and may not be available in subsequent transitions to lower power
201states.
202
203
204suspend
205-------
206
207Usage:
208
209if (dev->driver && dev->driver->suspend)
210 dev->driver->suspend(dev,state);
211
212A driver uses this function to actually transition the device into a low power
213state. This should include disabling I/O, IRQs, and bus-mastering, as well as
214physically transitioning the device to a lower power state; it may also include
215calls to pci_enable_wake().
216
217Bus mastering may be disabled by doing:
218
219pci_disable_device(dev);
220
221For devices that support the PCI PM Spec, this may be used to set the device's
222power state to match the suspend() parameter:
223
224pci_set_power_state(dev,state);
225
226The driver is also responsible for disabling any other device-specific features
227(e.g blanking screen, turning off on-card memory, etc).
228
229The driver should be sure to track the current state of the device, as it may
230obviate the need for some operations.
231
232The driver should update the current_state field in its pci_dev structure in
233this function, except for PM-capable devices when pci_set_power_state is used.
234
235resume
236------
237
238Usage:
239
240if (dev->driver && dev->driver->suspend)
241 dev->driver->resume(dev)
242
243The resume callback may be called from any power state, and is always meant to
244transition the device to the D0 state.
245
246The driver is responsible for reenabling any features of the device that had
247been disabled during previous suspend calls, such as IRQs and bus mastering,
248as well as calling pci_restore_state().
249
250If the device is currently in D3, it may need to be reinitialized in resume().
251
252 * Some types of devices, like bus controllers, will preserve context in D3hot
253 (using Vcc power). Their drivers will often want to avoid re-initializing
254 them after re-entering D0 (perhaps to avoid resetting downstream devices).
255
256 * Other kinds of devices in D3hot will discard device context as part of a
257 soft reset when re-entering the D0 state.
258
259 * Devices resuming from D3cold always go through a power-on reset. Some
260 device context can also be preserved using Vaux power.
261
262 * Some systems hide D3cold resume paths from drivers. For example, on PCs
263 the resume path for suspend-to-disk often runs BIOS powerup code, which
264 will sometimes re-initialize the device.
265
266To handle resets during D3 to D0 transitions, it may be convenient to share
267device initialization code between probe() and resume(). Device parameters
268can also be saved before the driver suspends into D3, avoiding re-probe.
269
270If the device supports the PCI PM Spec, it can use this to physically transition
271the device to D0:
272
273pci_set_power_state(dev,0);
274
275Note that if the entire system is transitioning out of a global sleep state, all
276devices will be placed in the D0 state, so this is not necessary. However, in
277the event that the device is placed in the D3 state during normal operation,
278this call is necessary. It is impossible to determine which of the two events is
279taking place in the driver, so it is always a good idea to make that call.
280
281The driver should take note of the state that it is resuming from in order to
282ensure correct (and speedy) operation.
283
284The driver should update the current_state field in its pci_dev structure in
285this function, except for PM-capable devices when pci_set_power_state is used.
286
287
288enable_wake
289-----------
290
291Usage:
292
293if (dev->driver && dev->driver->enable_wake)
294 dev->driver->enable_wake(dev,state,enable);
295
296This callback is generally only relevant for devices that support the PCI PM
297spec and have the ability to generate a PME# (Power Management Event Signal)
298to wake the system up. (However, it is possible that a device may support
299some non-standard way of generating a wake event on sleep.)
300
301Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's
302PM Capabilties describe what power states the device supports generating a
303wake event from:
304
305+------------------+
306| Bit | State |
307+------------------+
308| 11 | D0 |
309| 12 | D1 |
310| 13 | D2 |
311| 14 | D3hot |
312| 15 | D3cold |
313+------------------+
314
315A device can use this to enable wake events:
316
317 pci_enable_wake(dev,state,enable);
318
319Note that to enable PME# from D3cold, a value of 4 should be passed to
320pci_enable_wake (since it uses an index into a bitmask). If a driver gets
321a request to enable wake events from D3, two calls should be made to
322pci_enable_wake (one for both D3hot and D3cold).
323
324
3255. Resources
326~~~~~~~~~~~~
327
328PCI Local Bus Specification
329PCI Bus Power Management Interface Specification
330
331 http://pcisig.org
332
diff --git a/Documentation/power/states.txt b/Documentation/power/states.txt
new file mode 100644
index 000000000000..3e5e5d3ff419
--- /dev/null
+++ b/Documentation/power/states.txt
@@ -0,0 +1,79 @@
1
2System Power Management States
3
4
5The kernel supports three power management states generically, though
6each is dependent on platform support code to implement the low-level
7details for each state. This file describes each state, what they are
8commonly called, what ACPI state they map to, and what string to write
9to /sys/power/state to enter that state
10
11
12State: Standby / Power-On Suspend
13ACPI State: S1
14String: "standby"
15
16This state offers minimal, though real, power savings, while providing
17a very low-latency transition back to a working system. No operating
18state is lost (the CPU retains power), so the system easily starts up
19again where it left off.
20
21We try to put devices in a low-power state equivalent to D1, which
22also offers low power savings, but low resume latency. Not all devices
23support D1, and those that don't are left on.
24
25A transition from Standby to the On state should take about 1-2
26seconds.
27
28
29State: Suspend-to-RAM
30ACPI State: S3
31String: "mem"
32
33This state offers significant power savings as everything in the
34system is put into a low-power state, except for memory, which is
35placed in self-refresh mode to retain its contents.
36
37System and device state is saved and kept in memory. All devices are
38suspended and put into D3. In many cases, all peripheral buses lose
39power when entering STR, so devices must be able to handle the
40transition back to the On state.
41
42For at least ACPI, STR requires some minimal boot-strapping code to
43resume the system from STR. This may be true on other platforms.
44
45A transition from Suspend-to-RAM to the On state should take about
463-5 seconds.
47
48
49State: Suspend-to-disk
50ACPI State: S4
51String: "disk"
52
53This state offers the greatest power savings, and can be used even in
54the absence of low-level platform support for power management. This
55state operates similarly to Suspend-to-RAM, but includes a final step
56of writing memory contents to disk. On resume, this is read and memory
57is restored to its pre-suspend state.
58
59STD can be handled by the firmware or the kernel. If it is handled by
60the firmware, it usually requires a dedicated partition that must be
61setup via another operating system for it to use. Despite the
62inconvenience, this method requires minimal work by the kernel, since
63the firmware will also handle restoring memory contents on resume.
64
65If the kernel is responsible for persistantly saving state, a mechanism
66called 'swsusp' (Swap Suspend) is used to write memory contents to
67free swap space. swsusp has some restrictive requirements, but should
68work in most cases. Some, albeit outdated, documentation can be found
69in Documentation/power/swsusp.txt.
70
71Once memory state is written to disk, the system may either enter a
72low-power state (like ACPI S4), or it may simply power down. Powering
73down offers greater savings, and allows this mechanism to work on any
74system. However, entering a real low-power state allows the user to
75trigger wake up events (e.g. pressing a key or opening a laptop lid).
76
77A transition from Suspend-to-Disk to the On state should take about 30
78seconds, though it's typically a bit more with the current
79implementation.
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
new file mode 100644
index 000000000000..c7c3459fde43
--- /dev/null
+++ b/Documentation/power/swsusp.txt
@@ -0,0 +1,235 @@
1From kernel/suspend.c:
2
3 * BIG FAT WARNING *********************************************************
4 *
5 * If you have unsupported (*) devices using DMA...
6 * ...say goodbye to your data.
7 *
8 * If you touch anything on disk between suspend and resume...
9 * ...kiss your data goodbye.
10 *
11 * If your disk driver does not support suspend... (IDE does)
12 * ...you'd better find out how to get along
13 * without your data.
14 *
15 * If you change kernel command line between suspend and resume...
16 * ...prepare for nasty fsck or worse.
17 *
18 * If you change your hardware while system is suspended...
19 * ...well, it was not good idea.
20 *
21 * (*) suspend/resume support is needed to make it safe.
22
23You need to append resume=/dev/your_swap_partition to kernel command
24line. Then you suspend by
25
26echo shutdown > /sys/power/disk; echo disk > /sys/power/state
27
28. If you feel ACPI works pretty well on your system, you might try
29
30echo platform > /sys/power/disk; echo disk > /sys/power/state
31
32
33
34Article about goals and implementation of Software Suspend for Linux
35~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36Author: G‚ábor Kuti
37Last revised: 2003-10-20 by Pavel Machek
38
39Idea and goals to achieve
40
41Nowadays it is common in several laptops that they have a suspend button. It
42saves the state of the machine to a filesystem or to a partition and switches
43to standby mode. Later resuming the machine the saved state is loaded back to
44ram and the machine can continue its work. It has two real benefits. First we
45save ourselves the time machine goes down and later boots up, energy costs
46are real high when running from batteries. The other gain is that we don't have to
47interrupt our programs so processes that are calculating something for a long
48time shouldn't need to be written interruptible.
49
50swsusp saves the state of the machine into active swaps and then reboots or
51powerdowns. You must explicitly specify the swap partition to resume from with
52``resume='' kernel option. If signature is found it loads and restores saved
53state. If the option ``noresume'' is specified as a boot parameter, it skips
54the resuming.
55
56In the meantime while the system is suspended you should not add/remove any
57of the hardware, write to the filesystems, etc.
58
59Sleep states summary
60====================
61
62There are three different interfaces you can use, /proc/acpi should
63work like this:
64
65In a really perfect world:
66echo 1 > /proc/acpi/sleep # for standby
67echo 2 > /proc/acpi/sleep # for suspend to ram
68echo 3 > /proc/acpi/sleep # for suspend to ram, but with more power conservative
69echo 4 > /proc/acpi/sleep # for suspend to disk
70echo 5 > /proc/acpi/sleep # for shutdown unfriendly the system
71
72and perhaps
73echo 4b > /proc/acpi/sleep # for suspend to disk via s4bios
74
75Frequently Asked Questions
76==========================
77
78Q: well, suspending a server is IMHO a really stupid thing,
79but... (Diego Zuccato):
80
81A: You bought new UPS for your server. How do you install it without
82bringing machine down? Suspend to disk, rearrange power cables,
83resume.
84
85You have your server on UPS. Power died, and UPS is indicating 30
86seconds to failure. What do you do? Suspend to disk.
87
88Ethernet card in your server died. You want to replace it. Your
89server is not hotplug capable. What do you do? Suspend to disk,
90replace ethernet card, resume. If you are fast your users will not
91even see broken connections.
92
93
94Q: Maybe I'm missing something, but why don't the regular I/O paths work?
95
96A: We do use the regular I/O paths. However we cannot restore the data
97to its original location as we load it. That would create an
98inconsistent kernel state which would certainly result in an oops.
99Instead, we load the image into unused memory and then atomically copy
100it back to it original location. This implies, of course, a maximum
101image size of half the amount of memory.
102
103There are two solutions to this:
104
105* require half of memory to be free during suspend. That way you can
106read "new" data onto free spots, then cli and copy
107
108* assume we had special "polling" ide driver that only uses memory
109between 0-640KB. That way, I'd have to make sure that 0-640KB is free
110during suspending, but otherwise it would work...
111
112suspend2 shares this fundamental limitation, but does not include user
113data and disk caches into "used memory" by saving them in
114advance. That means that the limitation goes away in practice.
115
116Q: Does linux support ACPI S4?
117
118A: Yes. That's what echo platform > /sys/power/disk does.
119
120Q: My machine doesn't work with ACPI. How can I use swsusp than ?
121
122A: Do a reboot() syscall with right parameters. Warning: glibc gets in
123its way, so check with strace:
124
125reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, 0xd000fce2)
126
127(Thanks to Peter Osterlund:)
128
129#include <unistd.h>
130#include <syscall.h>
131
132#define LINUX_REBOOT_MAGIC1 0xfee1dead
133#define LINUX_REBOOT_MAGIC2 672274793
134#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
135
136int main()
137{
138 syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
139 LINUX_REBOOT_CMD_SW_SUSPEND, 0);
140 return 0;
141}
142
143Also /sys/ interface should be still present.
144
145Q: What is 'suspend2'?
146
147A: suspend2 is 'Software Suspend 2', a forked implementation of
148suspend-to-disk which is available as separate patches for 2.4 and 2.6
149kernels from swsusp.sourceforge.net. It includes support for SMP, 4GB
150highmem and preemption. It also has a extensible architecture that
151allows for arbitrary transformations on the image (compression,
152encryption) and arbitrary backends for writing the image (eg to swap
153or an NFS share[Work In Progress]). Questions regarding suspend2
154should be sent to the mailing list available through the suspend2
155website, and not to the Linux Kernel Mailing List. We are working
156toward merging suspend2 into the mainline kernel.
157
158Q: A kernel thread must voluntarily freeze itself (call 'refrigerator').
159I found some kernel threads that don't do it, and they don't freeze
160so the system can't sleep. Is this a known behavior?
161
162A: All such kernel threads need to be fixed, one by one. Select the
163place where the thread is safe to be frozen (no kernel semaphores
164should be held at that point and it must be safe to sleep there), and
165add:
166
167 if (current->flags & PF_FREEZE)
168 refrigerator(PF_FREEZE);
169
170If the thread is needed for writing the image to storage, you should
171instead set the PF_NOFREEZE process flag when creating the thread.
172
173
174Q: What is the difference between between "platform", "shutdown" and
175"firmware" in /sys/power/disk?
176
177A:
178
179shutdown: save state in linux, then tell bios to powerdown
180
181platform: save state in linux, then tell bios to powerdown and blink
182 "suspended led"
183
184firmware: tell bios to save state itself [needs BIOS-specific suspend
185 partition, and has very little to do with swsusp]
186
187"platform" is actually right thing to do, but "shutdown" is most
188reliable.
189
190Q: I do not understand why you have such strong objections to idea of
191selective suspend.
192
193A: Do selective suspend during runtime power managment, that's okay. But
194its useless for suspend-to-disk. (And I do not see how you could use
195it for suspend-to-ram, I hope you do not want that).
196
197Lets see, so you suggest to
198
199* SUSPEND all but swap device and parents
200* Snapshot
201* Write image to disk
202* SUSPEND swap device and parents
203* Powerdown
204
205Oh no, that does not work, if swap device or its parents uses DMA,
206you've corrupted data. You'd have to do
207
208* SUSPEND all but swap device and parents
209* FREEZE swap device and parents
210* Snapshot
211* UNFREEZE swap device and parents
212* Write
213* SUSPEND swap device and parents
214
215Which means that you still need that FREEZE state, and you get more
216complicated code. (And I have not yet introduce details like system
217devices).
218
219Q: There don't seem to be any generally useful behavioral
220distinctions between SUSPEND and FREEZE.
221
222A: Doing SUSPEND when you are asked to do FREEZE is always correct,
223but it may be unneccessarily slow. If you want USB to stay simple,
224slowness may not matter to you. It can always be fixed later.
225
226For devices like disk it does matter, you do not want to spindown for
227FREEZE.
228
229Q: After resuming, system is paging heavilly, leading to very bad interactivity.
230
231A: Try running
232
233cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null
234
235after resume. swapoff -a; swapon -a may also be usefull.
diff --git a/Documentation/power/tricks.txt b/Documentation/power/tricks.txt
new file mode 100644
index 000000000000..c6d58d3da133
--- /dev/null
+++ b/Documentation/power/tricks.txt
@@ -0,0 +1,27 @@
1 swsusp/S3 tricks
2 ~~~~~~~~~~~~~~~~
3Pavel Machek <pavel@suse.cz>
4
5If you want to trick swsusp/S3 into working, you might want to try:
6
7* go with minimal config, turn off drivers like USB, AGP you don't
8 really need
9
10* turn off APIC and preempt
11
12* use ext2. At least it has working fsck. [If something seemes to go
13 wrong, force fsck when you have a chance]
14
15* turn off modules
16
17* use vga text console, shut down X. [If you really want X, you might
18 want to try vesafb later]
19
20* try running as few processes as possible, preferably go to single
21 user mode.
22
23* due to video issues, swsusp should be easier to get working than
24 S3. Try that first.
25
26When you make it work, try to find out what exactly was it that broke
27suspend, and preferably fix that.
diff --git a/Documentation/power/video.txt b/Documentation/power/video.txt
new file mode 100644
index 000000000000..8686968416ca
--- /dev/null
+++ b/Documentation/power/video.txt
@@ -0,0 +1,169 @@
1
2 Video issues with S3 resume
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2003-2005, Pavel Machek
5
6During S3 resume, hardware needs to be reinitialized. For most
7devices, this is easy, and kernel driver knows how to do
8it. Unfortunately there's one exception: video card. Those are usually
9initialized by BIOS, and kernel does not have enough information to
10boot video card. (Kernel usually does not even contain video card
11driver -- vesafb and vgacon are widely used).
12
13This is not problem for swsusp, because during swsusp resume, BIOS is
14run normally so video card is normally initialized. S3 has absolutely
15no chance of working with SMP/HT. Be sure it to turn it off before
16testing (swsusp should work ok, OTOH).
17
18There are a few types of systems where video works after S3 resume:
19
20(1) systems where video state is preserved over S3.
21
22(2) systems where it is possible to call the video BIOS during S3
23 resume. Unfortunately, it is not correct to call the video BIOS at
24 that point, but it happens to work on some machines. Use
25 acpi_sleep=s3_bios.
26
27(3) systems that initialize video card into vga text mode and where
28 the BIOS works well enough to be able to set video mode. Use
29 acpi_sleep=s3_mode on these.
30
31(4) on some systems s3_bios kicks video into text mode, and
32 acpi_sleep=s3_bios,s3_mode is needed.
33
34(5) radeon systems, where X can soft-boot your video card. You'll need
35 new enough X, and plain text console (no vesafb or radeonfb), see
36 http://www.doesi.gmxhome.de/linux/tm800s3/s3.html. Actually you
37 should probably use vbetool (6) instead.
38
39(6) other radeon systems, where vbetool is enough to bring system back
40 to life. It needs text console to be working. Do vbetool vbestate
41 save > /tmp/delme; echo 3 > /proc/acpi/sleep; vbetool post; vbetool
42 vbestate restore < /tmp/delme; setfont <whatever>, and your video
43 should work.
44
45(7) on some systems, it is possible to boot most of kernel, and then
46 POSTing bios works. Ole Rohne has patch to do just that at
47 http://dev.gentoo.org/~marineam/patch-radeonfb-2.6.11-rc2-mm2.
48
49Now, if you pass acpi_sleep=something, and it does not work with your
50bios, you'll get a hard crash during resume. Be careful. Also it is
51safest to do your experiments with plain old VGA console. The vesafb
52and radeonfb (etc) drivers have a tendency to crash the machine during
53resume.
54
55You may have a system where none of above works. At that point you
56either invent another ugly hack that works, or write proper driver for
57your video card (good luck getting docs :-(). Maybe suspending from X
58(proper X, knowing your hardware, not XF68_FBcon) might have better
59chance of working.
60
61Table of known working systems:
62
63Model hack (or "how to do it")
64------------------------------------------------------------------------------
65Acer Aspire 1406LC ole's late BIOS init (7), turn off DRI
66Acer TM 242FX vbetool (6)
67Acer TM C300 vga=normal (only suspend on console, not in X), vbetool (6)
68Acer TM 4052LCi s3_bios (2)
69Acer TM 636Lci s3_bios vga=normal (2)
70Acer TM 650 (Radeon M7) vga=normal plus boot-radeon (5) gets text console back
71Acer TM 660 ??? (*)
72Acer TM 800 vga=normal, X patches, see webpage (5) or vbetool (6)
73Acer TM 803 vga=normal, X patches, see webpage (5) or vbetool (6)
74Acer TM 803LCi vga=normal, vbetool (6)
75Arima W730a vbetool needed (6)
76Asus L2400D s3_mode (3)(***) (S1 also works OK)
77Asus L3800C (Radeon M7) s3_bios (2) (S1 also works OK)
78Asus M6NE ??? (*)
79Athlon64 desktop prototype s3_bios (2)
80Compal CL-50 ??? (*)
81Compaq Armada E500 - P3-700 none (1) (S1 also works OK)
82Compaq Evo N620c vga=normal, s3_bios (2)
83Dell 600m, ATI R250 Lf none (1), but needs xorg-x11-6.8.1.902-1
84Dell D600, ATI RV250 vga=normal and X, or try vbestate (6)
85Dell Inspiron 4000 ??? (*)
86Dell Inspiron 500m ??? (*)
87Dell Inspiron 600m ??? (*)
88Dell Inspiron 8200 ??? (*)
89Dell Inspiron 8500 ??? (*)
90Dell Inspiron 8600 ??? (*)
91eMachines athlon64 machines vbetool needed (6) (someone please get me model #s)
92HP NC6000 s3_bios, may not use radeonfb (2); or vbetool (6)
93HP NX7000 ??? (*)
94HP Pavilion ZD7000 vbetool post needed, need open-source nv driver for X
95HP Omnibook XE3 athlon version none (1)
96HP Omnibook XE3GC none (1), video is S3 Savage/IX-MV
97IBM TP T20, model 2647-44G none (1), video is S3 Inc. 86C270-294 Savage/IX-MV, vesafb gets "interesting" but X work.
98IBM TP A31 / Type 2652-M5G s3_mode (3) [works ok with BIOS 1.04 2002-08-23, but not at all with BIOS 1.11 2004-11-05 :-(]
99IBM TP R32 / Type 2658-MMG none (1)
100IBM TP R40 2722B3G ??? (*)
101IBM TP R50p / Type 1832-22U s3_bios (2)
102IBM TP R51 ??? (*)
103IBM TP T30 236681A ??? (*)
104IBM TP T40 / Type 2373-MU4 none (1)
105IBM TP T40p none (1)
106IBM TP R40p s3_bios (2)
107IBM TP T41p s3_bios (2), switch to X after resume
108IBM TP T42 ??? (*)
109IBM ThinkPad T42p (2373-GTG) s3_bios (2)
110IBM TP X20 ??? (*)
111IBM TP X30 ??? (*)
112IBM TP X31 / Type 2672-XXH none (1), use radeontool (http://fdd.com/software/radeon/) to turn off backlight.
113IBM Thinkpad X40 Type 2371-7JG s3_bios,s3_mode (4)
114Medion MD4220 ??? (*)
115Samsung P35 vbetool needed (6)
116Sharp PC-AR10 (ATI rage) none (1)
117Sony Vaio PCG-F403 ??? (*)
118Sony Vaio PCG-N505SN ??? (*)
119Sony Vaio vgn-s260 X or boot-radeon can init it (5)
120Toshiba Libretto L5 none (1)
121Toshiba Satellite 4030CDT s3_mode (3)
122Toshiba Satellite 4080XCDT s3_mode (3)
123Toshiba Satellite 4090XCDT ??? (*)
124Toshiba Satellite P10-554 s3_bios,s3_mode (4)(****)
125Uniwill 244IIO ??? (*)
126
127
128(*) from http://www.ubuntulinux.org/wiki/HoaryPMResults, not sure
129 which options to use. If you know, please tell me.
130
131(***) To be tested with a newer kernel.
132
133(****) Not with SMP kernel, UP only.
134
135VBEtool details
136~~~~~~~~~~~~~~~
137(with thanks to Carl-Daniel Hailfinger)
138
139First, boot into X and run the following script ONCE:
140#!/bin/bash
141statedir=/root/s3/state
142mkdir -p $statedir
143chvt 2
144sleep 1
145vbetool vbestate save >$statedir/vbe
146
147
148To suspend and resume properly, call the following script as root:
149#!/bin/bash
150statedir=/root/s3/state
151curcons=`fgconsole`
152fuser /dev/tty$curcons 2>/dev/null|xargs ps -o comm= -p|grep -q X && chvt 2
153cat /dev/vcsa >$statedir/vcsa
154sync
155echo 3 >/proc/acpi/sleep
156sync
157vbetool post
158vbetool vbestate restore <$statedir/vbe
159cat $statedir/vcsa >/dev/vcsa
160rckbd restart
161chvt $[curcons%6+1]
162chvt $curcons
163
164
165Unless you change your graphics card or other hardware configuration,
166the state once saved will be OK for every resume afterwards.
167NOTE: The "rckbd restart" command may be different for your
168distribution. Simply replace it with the command you would use to
169set the fonts on screen.
diff --git a/Documentation/power/video_extension.txt b/Documentation/power/video_extension.txt
new file mode 100644
index 000000000000..8e33d7c82c49
--- /dev/null
+++ b/Documentation/power/video_extension.txt
@@ -0,0 +1,34 @@
1This driver implement the ACPI Extensions For Display Adapters
2for integrated graphics devices on motherboard, as specified in
3ACPI 2.0 Specification, Appendix B, allowing to perform some basic
4control like defining the video POST device, retrieving EDID information
5or to setup a video output, etc. Note that this is an ref. implementation only.
6It may or may not work for your integrated video device.
7
8Interfaces exposed to userland through /proc/acpi/video:
9
10VGA/info : display the supported video bus device capability like ,Video ROM, CRT/LCD/TV.
11VGA/ROM : Used to get a copy of the display devices' ROM data (up to 4k).
12VGA/POST_info : Used to determine what options are implemented.
13VGA/POST : Used to get/set POST device.
14VGA/DOS : Used to get/set ownership of output switching:
15 Please refer ACPI spec B.4.1 _DOS
16VGA/CRT : CRT output
17VGA/LCD : LCD output
18VGA/TV : TV output
19VGA/*/brightness : Used to get/set brightness of output device
20
21Notify event through /proc/acpi/event:
22
23#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
24#define ACPI_VIDEO_NOTIFY_PROBE 0x81
25#define ACPI_VIDEO_NOTIFY_CYCLE 0x82
26#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
27#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
28
29#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82
30#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83
31#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84
32#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85
33#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86
34