3 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
5 The /sys/power directory will contain files that will
6 provide a unified interface to the power management
11 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
13 The /sys/power/state file controls system sleep states.
14 Reading from this file returns the available sleep state
15 labels, which may be "mem" (suspend), "standby" (power-on
16 suspend), "freeze" (suspend-to-idle) and "disk" (hibernation).
18 Writing one of the above strings to this file causes the system
19 to transition into the corresponding state, if available.
21 See Documentation/admin-guide/pm/sleep-states.rst for more
24 What: /sys/power/mem_sleep
26 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
28 The /sys/power/mem_sleep file controls the operating mode of
29 system suspend. Reading from it returns the available modes
30 as "s2idle" (always present), "shallow" and "deep" (present if
31 supported). The mode that will be used on subsequent attempts
32 to suspend the system (by writing "mem" to the /sys/power/state
33 file described above) is enclosed in square brackets.
35 Writing one of the above strings to this file causes the mode
36 represented by it to be used on subsequent attempts to suspend
39 See Documentation/admin-guide/pm/sleep-states.rst for more
44 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
46 The /sys/power/disk file controls the operating mode of the
47 suspend-to-disk mechanism. Reading from this file returns
48 the name of the method by which the system will be put to
49 sleep on the next suspend. There are four methods supported:
50 'firmware' - means that the memory image will be saved to disk
51 by some firmware, in which case we also assume that the
52 firmware will handle the system suspend.
53 'platform' - the memory image will be saved by the kernel and
54 the system will be put to sleep by the platform driver (e.g.
55 ACPI or other PM registers).
56 'shutdown' - the memory image will be saved by the kernel and
57 the system will be powered off.
58 'reboot' - the memory image will be saved by the kernel and
59 the system will be rebooted.
61 Additionally, /sys/power/disk can be used to turn on one of the
62 two testing modes of the suspend-to-disk mechanism: 'testproc'
63 or 'test'. If the suspend-to-disk mechanism is in the
64 'testproc' mode, writing 'disk' to /sys/power/state will cause
65 the kernel to disable nonboot CPUs and freeze tasks, wait for 5
66 seconds, unfreeze tasks and enable nonboot CPUs. If it is in
67 the 'test' mode, writing 'disk' to /sys/power/state will cause
68 the kernel to disable nonboot CPUs and freeze tasks, shrink
69 memory, suspend devices, wait for 5 seconds, resume devices,
70 unfreeze tasks and enable nonboot CPUs. Then, we are able to
71 look in the log messages and work out, for example, which code
72 is being slow and which device drivers are misbehaving.
74 The suspend-to-disk method may be chosen by writing to this
75 file one of the accepted strings:
84 It will only change to 'firmware' or 'platform' if the system
87 What: /sys/power/image_size
89 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
91 The /sys/power/image_size file controls the size of the image
92 created by the suspend-to-disk mechanism. It can be written a
93 string representing a non-negative integer that will be used
94 as an upper limit of the image size, in bytes. The kernel's
95 suspend-to-disk code will do its best to ensure the image size
96 will not exceed this number. However, if it turns out to be
97 impossible, the kernel will try to suspend anyway using the
98 smallest image possible. In particular, if "0" is written to
99 this file, the suspend image will be as small as possible.
101 Reading from this file will display the current image size
102 limit, which is set to 500 MB by default.
104 What: /sys/power/pm_trace
106 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
108 The /sys/power/pm_trace file controls the code which saves the
109 last PM event point in the RTC across reboots, so that you can
110 debug a machine that just hangs during suspend (or more
111 commonly, during resume). Namely, the RTC is only used to save
112 the last PM event point if this file contains '1'. Initially
113 it contains '0' which may be changed to '1' by writing a
114 string representing a nonzero integer into it.
116 To use this debugging feature you should attempt to suspend
117 the machine, then reboot it and run
119 dmesg -s 1000000 | grep 'hash matches'
121 If you do not get any matches (or they appear to be false
122 positives), it is possible that the last PM event point
123 referred to a device created by a loadable kernel module. In
124 this case cat /sys/power/pm_trace_dev_match (see below) after
125 your system is started up and the kernel modules are loaded.
127 CAUTION: Using it will cause your machine's real-time (CMOS)
128 clock to be set to a random invalid time after a resume.
130 What; /sys/power/pm_trace_dev_match
132 Contact: James Hogan <jhogan@kernel.org>
134 The /sys/power/pm_trace_dev_match file contains the name of the
135 device associated with the last PM event point saved in the RTC
136 across reboots when pm_trace has been used. More precisely it
137 contains the list of current devices (including those
138 registered by loadable kernel modules since boot) which match
139 the device hash in the RTC at boot, with a newline after each
142 The advantage of this file over the hash matches printed to the
143 kernel log (see /sys/power/pm_trace), is that it includes
144 devices created after boot by loadable kernel modules.
146 Due to the small hash size necessary to fit in the RTC, it is
147 possible that more than one device matches the hash, in which
148 case further investigation is required to determine which
149 device is causing the problem. Note that genuine RTC clock
150 values (such as when pm_trace has not been used), can still
151 match a device and output it's name here.
153 What: /sys/power/pm_async
155 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
157 The /sys/power/pm_async file controls the switch allowing the
158 user space to enable or disable asynchronous suspend and resume
159 of devices. If enabled, this feature will cause some device
160 drivers' suspend and resume callbacks to be executed in parallel
161 with each other and with the main suspend thread. It is enabled
162 if this file contains "1", which is the default. It may be
163 disabled by writing "0" to this file, in which case all devices
164 will be suspended and resumed synchronously.
166 What: /sys/power/wakeup_count
168 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
170 The /sys/power/wakeup_count file allows user space to put the
171 system into a sleep state while taking into account the
172 concurrent arrival of wakeup events. Reading from it returns
173 the current number of registered wakeup events and it blocks if
174 some wakeup events are being processed at the time the file is
175 read from. Writing to it will only succeed if the current
176 number of wakeup events is equal to the written value and, if
177 successful, will make the kernel abort a subsequent transition
178 to a sleep state if any wakeup events are reported after the
181 What: /sys/power/reserved_size
183 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
185 The /sys/power/reserved_size file allows user space to control
186 the amount of memory reserved for allocations made by device
187 drivers during the "device freeze" stage of hibernation. It can
188 be written a string representing a non-negative integer that
189 will be used as the amount of memory to reserve for allocations
190 made by device drivers' "freeze" callbacks, in bytes.
192 Reading from this file will display the current value, which is
193 set to 1 MB by default.
195 What: /sys/power/autosleep
197 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
199 The /sys/power/autosleep file can be written one of the strings
200 returned by reads from /sys/power/state. If that happens, a
201 work item attempting to trigger a transition of the system to
202 the sleep state represented by that string is queued up. This
203 attempt will only succeed if there are no active wakeup sources
204 in the system at that time. After every execution, regardless
205 of whether or not the attempt to put the system to sleep has
206 succeeded, the work item requeues itself until user space
207 writes "off" to /sys/power/autosleep.
209 Reading from this file causes the last string successfully
210 written to it to be returned.
212 What: /sys/power/wake_lock
214 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
216 The /sys/power/wake_lock file allows user space to create
217 wakeup source objects and activate them on demand (if one of
218 those wakeup sources is active, reads from the
219 /sys/power/wakeup_count file block or return false). When a
220 string without white space is written to /sys/power/wake_lock,
221 it will be assumed to represent a wakeup source name. If there
222 is a wakeup source object with that name, it will be activated
223 (unless active already). Otherwise, a new wakeup source object
224 will be registered, assigned the given name and activated.
225 If a string written to /sys/power/wake_lock contains white
226 space, the part of the string preceding the white space will be
227 regarded as a wakeup source name and handled as descrived above.
228 The other part of the string will be regarded as a timeout (in
229 nanoseconds) such that the wakeup source will be automatically
230 deactivated after it has expired. The timeout, if present, is
231 set regardless of the current state of the wakeup source object
234 Reads from this file return a string consisting of the names of
235 wakeup sources created with the help of it that are active at
236 the moment, separated with spaces.
239 What: /sys/power/wake_unlock
241 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
243 The /sys/power/wake_unlock file allows user space to deactivate
244 wakeup sources created with the help of /sys/power/wake_lock.
245 When a string is written to /sys/power/wake_unlock, it will be
246 assumed to represent the name of a wakeup source to deactivate.
247 If a wakeup source object of that name exists and is active at
248 the moment, it will be deactivated.
250 Reads from this file return a string consisting of the names of
251 wakeup sources created with the help of /sys/power/wake_lock
252 that are inactive at the moment, separated with spaces.
254 What: /sys/power/pm_print_times
256 Contact: Sameer Nanda <snanda@chromium.org>
258 The /sys/power/pm_print_times file allows user space to
259 control whether the time taken by devices to suspend and
260 resume is printed. These prints are useful for hunting down
261 devices that take too long to suspend or resume.
263 Writing a "1" enables this printing while writing a "0"
264 disables it. The default value is "0". Reading from this file
265 will display the current value.
267 What: /sys/power/pm_wakeup_irq
269 Contact: Alexandra Yates <alexandra.yates@linux.intel.org>
271 The /sys/power/pm_wakeup_irq file reports to user space the IRQ
272 number of the first wakeup interrupt (that is, the first
273 interrupt from an IRQ line armed for system wakeup) seen by the
274 kernel during the most recent system suspend/resume cycle.
276 This output is useful for system wakeup diagnostics of spurious
279 What: /sys/power/pm_debug_messages
281 Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
283 The /sys/power/pm_debug_messages file controls the printing
284 of debug messages from the system suspend/hiberbation
285 infrastructure to the kernel log.
287 Writing a "1" to this file enables the debug messages and
288 writing a "0" (default) to it disables them. Reads from
289 this file return the current value.