1What: /sys/power/ 2Date: August 2006 3Contact: Rafael J. Wysocki <rjw@sisk.pl> 4Description: 5 The /sys/power directory will contain files that will 6 provide a unified interface to the power management 7 subsystem. 8 9What: /sys/power/state 10Date: August 2006 11Contact: Rafael J. Wysocki <rjw@sisk.pl> 12Description: 13 The /sys/power/state file controls the system power state. 14 Reading from this file returns what states are supported, 15 which is hard-coded to 'standby' (Power-On Suspend), 'mem' 16 (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). 17 18 Writing to this file one of these strings causes the system to 19 transition into that state. Please see the file 20 Documentation/power/states.txt for a description of each of 21 these states. 22 23What: /sys/power/disk 24Date: September 2006 25Contact: Rafael J. Wysocki <rjw@sisk.pl> 26Description: 27 The /sys/power/disk file controls the operating mode of the 28 suspend-to-disk mechanism. Reading from this file returns 29 the name of the method by which the system will be put to 30 sleep on the next suspend. There are four methods supported: 31 'firmware' - means that the memory image will be saved to disk 32 by some firmware, in which case we also assume that the 33 firmware will handle the system suspend. 34 'platform' - the memory image will be saved by the kernel and 35 the system will be put to sleep by the platform driver (e.g. 36 ACPI or other PM registers). 37 'shutdown' - the memory image will be saved by the kernel and 38 the system will be powered off. 39 'reboot' - the memory image will be saved by the kernel and 40 the system will be rebooted. 41 42 Additionally, /sys/power/disk can be used to turn on one of the 43 two testing modes of the suspend-to-disk mechanism: 'testproc' 44 or 'test'. If the suspend-to-disk mechanism is in the 45 'testproc' mode, writing 'disk' to /sys/power/state will cause 46 the kernel to disable nonboot CPUs and freeze tasks, wait for 5 47 seconds, unfreeze tasks and enable nonboot CPUs. If it is in 48 the 'test' mode, writing 'disk' to /sys/power/state will cause 49 the kernel to disable nonboot CPUs and freeze tasks, shrink 50 memory, suspend devices, wait for 5 seconds, resume devices, 51 unfreeze tasks and enable nonboot CPUs. Then, we are able to 52 look in the log messages and work out, for example, which code 53 is being slow and which device drivers are misbehaving. 54 55 The suspend-to-disk method may be chosen by writing to this 56 file one of the accepted strings: 57 58 'firmware' 59 'platform' 60 'shutdown' 61 'reboot' 62 'testproc' 63 'test' 64 65 It will only change to 'firmware' or 'platform' if the system 66 supports that. 67 68What: /sys/power/image_size 69Date: August 2006 70Contact: Rafael J. Wysocki <rjw@sisk.pl> 71Description: 72 The /sys/power/image_size file controls the size of the image 73 created by the suspend-to-disk mechanism. It can be written a 74 string representing a non-negative integer that will be used 75 as an upper limit of the image size, in bytes. The kernel's 76 suspend-to-disk code will do its best to ensure the image size 77 will not exceed this number. However, if it turns out to be 78 impossible, the kernel will try to suspend anyway using the 79 smallest image possible. In particular, if "0" is written to 80 this file, the suspend image will be as small as possible. 81 82 Reading from this file will display the current image size 83 limit, which is set to 500 MB by default. 84 85What: /sys/power/pm_trace 86Date: August 2006 87Contact: Rafael J. Wysocki <rjw@sisk.pl> 88Description: 89 The /sys/power/pm_trace file controls the code which saves the 90 last PM event point in the RTC across reboots, so that you can 91 debug a machine that just hangs during suspend (or more 92 commonly, during resume). Namely, the RTC is only used to save 93 the last PM event point if this file contains '1'. Initially 94 it contains '0' which may be changed to '1' by writing a 95 string representing a nonzero integer into it. 96 97 To use this debugging feature you should attempt to suspend 98 the machine, then reboot it and run 99 100 dmesg -s 1000000 | grep 'hash matches' 101 102 If you do not get any matches (or they appear to be false 103 positives), it is possible that the last PM event point 104 referred to a device created by a loadable kernel module. In 105 this case cat /sys/power/pm_trace_dev_match (see below) after 106 your system is started up and the kernel modules are loaded. 107 108 CAUTION: Using it will cause your machine's real-time (CMOS) 109 clock to be set to a random invalid time after a resume. 110 111What; /sys/power/pm_trace_dev_match 112Date: October 2010 113Contact: James Hogan <james@albanarts.com> 114Description: 115 The /sys/power/pm_trace_dev_match file contains the name of the 116 device associated with the last PM event point saved in the RTC 117 across reboots when pm_trace has been used. More precisely it 118 contains the list of current devices (including those 119 registered by loadable kernel modules since boot) which match 120 the device hash in the RTC at boot, with a newline after each 121 one. 122 123 The advantage of this file over the hash matches printed to the 124 kernel log (see /sys/power/pm_trace), is that it includes 125 devices created after boot by loadable kernel modules. 126 127 Due to the small hash size necessary to fit in the RTC, it is 128 possible that more than one device matches the hash, in which 129 case further investigation is required to determine which 130 device is causing the problem. Note that genuine RTC clock 131 values (such as when pm_trace has not been used), can still 132 match a device and output it's name here. 133 134What: /sys/power/pm_async 135Date: January 2009 136Contact: Rafael J. Wysocki <rjw@sisk.pl> 137Description: 138 The /sys/power/pm_async file controls the switch allowing the 139 user space to enable or disable asynchronous suspend and resume 140 of devices. If enabled, this feature will cause some device 141 drivers' suspend and resume callbacks to be executed in parallel 142 with each other and with the main suspend thread. It is enabled 143 if this file contains "1", which is the default. It may be 144 disabled by writing "0" to this file, in which case all devices 145 will be suspended and resumed synchronously. 146 147What: /sys/power/wakeup_count 148Date: July 2010 149Contact: Rafael J. Wysocki <rjw@sisk.pl> 150Description: 151 The /sys/power/wakeup_count file allows user space to put the 152 system into a sleep state while taking into account the 153 concurrent arrival of wakeup events. Reading from it returns 154 the current number of registered wakeup events and it blocks if 155 some wakeup events are being processed at the time the file is 156 read from. Writing to it will only succeed if the current 157 number of wakeup events is equal to the written value and, if 158 successful, will make the kernel abort a subsequent transition 159 to a sleep state if any wakeup events are reported after the 160 write has returned. 161 162What: /sys/power/reserved_size 163Date: May 2011 164Contact: Rafael J. Wysocki <rjw@sisk.pl> 165Description: 166 The /sys/power/reserved_size file allows user space to control 167 the amount of memory reserved for allocations made by device 168 drivers during the "device freeze" stage of hibernation. It can 169 be written a string representing a non-negative integer that 170 will be used as the amount of memory to reserve for allocations 171 made by device drivers' "freeze" callbacks, in bytes. 172 173 Reading from this file will display the current value, which is 174 set to 1 MB by default. 175 176What: /sys/power/autosleep 177Date: April 2012 178Contact: Rafael J. Wysocki <rjw@sisk.pl> 179Description: 180 The /sys/power/autosleep file can be written one of the strings 181 returned by reads from /sys/power/state. If that happens, a 182 work item attempting to trigger a transition of the system to 183 the sleep state represented by that string is queued up. This 184 attempt will only succeed if there are no active wakeup sources 185 in the system at that time. After every execution, regardless 186 of whether or not the attempt to put the system to sleep has 187 succeeded, the work item requeues itself until user space 188 writes "off" to /sys/power/autosleep. 189 190 Reading from this file causes the last string successfully 191 written to it to be returned. 192 193What: /sys/power/wake_lock 194Date: February 2012 195Contact: Rafael J. Wysocki <rjw@sisk.pl> 196Description: 197 The /sys/power/wake_lock file allows user space to create 198 wakeup source objects and activate them on demand (if one of 199 those wakeup sources is active, reads from the 200 /sys/power/wakeup_count file block or return false). When a 201 string without white space is written to /sys/power/wake_lock, 202 it will be assumed to represent a wakeup source name. If there 203 is a wakeup source object with that name, it will be activated 204 (unless active already). Otherwise, a new wakeup source object 205 will be registered, assigned the given name and activated. 206 If a string written to /sys/power/wake_lock contains white 207 space, the part of the string preceding the white space will be 208 regarded as a wakeup source name and handled as descrived above. 209 The other part of the string will be regarded as a timeout (in 210 nanoseconds) such that the wakeup source will be automatically 211 deactivated after it has expired. The timeout, if present, is 212 set regardless of the current state of the wakeup source object 213 in question. 214 215 Reads from this file return a string consisting of the names of 216 wakeup sources created with the help of it that are active at 217 the moment, separated with spaces. 218 219 220What: /sys/power/wake_unlock 221Date: February 2012 222Contact: Rafael J. Wysocki <rjw@sisk.pl> 223Description: 224 The /sys/power/wake_unlock file allows user space to deactivate 225 wakeup sources created with the help of /sys/power/wake_lock. 226 When a string is written to /sys/power/wake_unlock, it will be 227 assumed to represent the name of a wakeup source to deactivate. 228 If a wakeup source object of that name exists and is active at 229 the moment, it will be deactivated. 230 231 Reads from this file return a string consisting of the names of 232 wakeup sources created with the help of /sys/power/wake_lock 233 that are inactive at the moment, separated with spaces. 234 235What: /sys/power/pm_print_times 236Date: May 2012 237Contact: Sameer Nanda <snanda@chromium.org> 238Description: 239 The /sys/power/pm_print_times file allows user space to 240 control whether the time taken by devices to suspend and 241 resume is printed. These prints are useful for hunting down 242 devices that take too long to suspend or resume. 243 244 Writing a "1" enables this printing while writing a "0" 245 disables it. The default value is "0". Reading from this file 246 will display the current value. 247