184ed64eeSRafael J. WysockiWhat: /sys/power/ 284ed64eeSRafael J. WysockiDate: August 2006 349db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 484ed64eeSRafael J. WysockiDescription: 584ed64eeSRafael J. Wysocki The /sys/power directory will contain files that will 684ed64eeSRafael J. Wysocki provide a unified interface to the power management 784ed64eeSRafael J. Wysocki subsystem. 884ed64eeSRafael J. Wysocki 984ed64eeSRafael J. WysockiWhat: /sys/power/state 10406e7938SRafael J. WysockiDate: November 2016 1149db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 1284ed64eeSRafael J. WysockiDescription: 130399d4dbSRafael J. Wysocki The /sys/power/state file controls system sleep states. 140399d4dbSRafael J. Wysocki Reading from this file returns the available sleep state 15406e7938SRafael J. Wysocki labels, which may be "mem" (suspend), "standby" (power-on 16406e7938SRafael J. Wysocki suspend), "freeze" (suspend-to-idle) and "disk" (hibernation). 1784ed64eeSRafael J. Wysocki 18406e7938SRafael J. Wysocki Writing one of the above strings to this file causes the system 19406e7938SRafael J. Wysocki to transition into the corresponding state, if available. 20406e7938SRafael J. Wysocki 21406e7938SRafael J. Wysocki See Documentation/power/states.txt for more information. 22406e7938SRafael J. Wysocki 23406e7938SRafael J. WysockiWhat: /sys/power/mem_sleep 24406e7938SRafael J. WysockiDate: November 2016 25406e7938SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 26406e7938SRafael J. WysockiDescription: 27406e7938SRafael J. Wysocki The /sys/power/mem_sleep file controls the operating mode of 28406e7938SRafael J. Wysocki system suspend. Reading from it returns the available modes 29406e7938SRafael J. Wysocki as "s2idle" (always present), "shallow" and "deep" (present if 30406e7938SRafael J. Wysocki supported). The mode that will be used on subsequent attempts 31406e7938SRafael J. Wysocki to suspend the system (by writing "mem" to the /sys/power/state 32406e7938SRafael J. Wysocki file described above) is enclosed in square brackets. 33406e7938SRafael J. Wysocki 34406e7938SRafael J. Wysocki Writing one of the above strings to this file causes the mode 35406e7938SRafael J. Wysocki represented by it to be used on subsequent attempts to suspend 36406e7938SRafael J. Wysocki the system. 37406e7938SRafael J. Wysocki 38406e7938SRafael J. Wysocki See Documentation/power/states.txt for more information. 3984ed64eeSRafael J. Wysocki 4084ed64eeSRafael J. WysockiWhat: /sys/power/disk 41b918f6e6SRafael J. WysockiDate: September 2006 4249db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 4384ed64eeSRafael J. WysockiDescription: 4484ed64eeSRafael J. Wysocki The /sys/power/disk file controls the operating mode of the 4584ed64eeSRafael J. Wysocki suspend-to-disk mechanism. Reading from this file returns 4684ed64eeSRafael J. Wysocki the name of the method by which the system will be put to 4784ed64eeSRafael J. Wysocki sleep on the next suspend. There are four methods supported: 4884ed64eeSRafael J. Wysocki 'firmware' - means that the memory image will be saved to disk 4984ed64eeSRafael J. Wysocki by some firmware, in which case we also assume that the 5084ed64eeSRafael J. Wysocki firmware will handle the system suspend. 5184ed64eeSRafael J. Wysocki 'platform' - the memory image will be saved by the kernel and 5284ed64eeSRafael J. Wysocki the system will be put to sleep by the platform driver (e.g. 5384ed64eeSRafael J. Wysocki ACPI or other PM registers). 5484ed64eeSRafael J. Wysocki 'shutdown' - the memory image will be saved by the kernel and 5584ed64eeSRafael J. Wysocki the system will be powered off. 5684ed64eeSRafael J. Wysocki 'reboot' - the memory image will be saved by the kernel and 5784ed64eeSRafael J. Wysocki the system will be rebooted. 5884ed64eeSRafael J. Wysocki 59b918f6e6SRafael J. Wysocki Additionally, /sys/power/disk can be used to turn on one of the 60b918f6e6SRafael J. Wysocki two testing modes of the suspend-to-disk mechanism: 'testproc' 61b918f6e6SRafael J. Wysocki or 'test'. If the suspend-to-disk mechanism is in the 62b918f6e6SRafael J. Wysocki 'testproc' mode, writing 'disk' to /sys/power/state will cause 63b918f6e6SRafael J. Wysocki the kernel to disable nonboot CPUs and freeze tasks, wait for 5 64b918f6e6SRafael J. Wysocki seconds, unfreeze tasks and enable nonboot CPUs. If it is in 65b918f6e6SRafael J. Wysocki the 'test' mode, writing 'disk' to /sys/power/state will cause 66b918f6e6SRafael J. Wysocki the kernel to disable nonboot CPUs and freeze tasks, shrink 67b918f6e6SRafael J. Wysocki memory, suspend devices, wait for 5 seconds, resume devices, 68b918f6e6SRafael J. Wysocki unfreeze tasks and enable nonboot CPUs. Then, we are able to 69b918f6e6SRafael J. Wysocki look in the log messages and work out, for example, which code 70b918f6e6SRafael J. Wysocki is being slow and which device drivers are misbehaving. 71b918f6e6SRafael J. Wysocki 7284ed64eeSRafael J. Wysocki The suspend-to-disk method may be chosen by writing to this 7384ed64eeSRafael J. Wysocki file one of the accepted strings: 7484ed64eeSRafael J. Wysocki 7584ed64eeSRafael J. Wysocki 'firmware' 7684ed64eeSRafael J. Wysocki 'platform' 7784ed64eeSRafael J. Wysocki 'shutdown' 7884ed64eeSRafael J. Wysocki 'reboot' 79b918f6e6SRafael J. Wysocki 'testproc' 80b918f6e6SRafael J. Wysocki 'test' 8184ed64eeSRafael J. Wysocki 8284ed64eeSRafael J. Wysocki It will only change to 'firmware' or 'platform' if the system 8384ed64eeSRafael J. Wysocki supports that. 8484ed64eeSRafael J. Wysocki 8584ed64eeSRafael J. WysockiWhat: /sys/power/image_size 8684ed64eeSRafael J. WysockiDate: August 2006 8749db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 8884ed64eeSRafael J. WysockiDescription: 8984ed64eeSRafael J. Wysocki The /sys/power/image_size file controls the size of the image 9084ed64eeSRafael J. Wysocki created by the suspend-to-disk mechanism. It can be written a 9184ed64eeSRafael J. Wysocki string representing a non-negative integer that will be used 9284ed64eeSRafael J. Wysocki as an upper limit of the image size, in bytes. The kernel's 9384ed64eeSRafael J. Wysocki suspend-to-disk code will do its best to ensure the image size 9484ed64eeSRafael J. Wysocki will not exceed this number. However, if it turns out to be 9584ed64eeSRafael J. Wysocki impossible, the kernel will try to suspend anyway using the 9684ed64eeSRafael J. Wysocki smallest image possible. In particular, if "0" is written to 9784ed64eeSRafael J. Wysocki this file, the suspend image will be as small as possible. 9884ed64eeSRafael J. Wysocki 9984ed64eeSRafael J. Wysocki Reading from this file will display the current image size 10084ed64eeSRafael J. Wysocki limit, which is set to 500 MB by default. 10184ed64eeSRafael J. Wysocki 10284ed64eeSRafael J. WysockiWhat: /sys/power/pm_trace 10384ed64eeSRafael J. WysockiDate: August 2006 10449db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 10584ed64eeSRafael J. WysockiDescription: 10684ed64eeSRafael J. Wysocki The /sys/power/pm_trace file controls the code which saves the 10784ed64eeSRafael J. Wysocki last PM event point in the RTC across reboots, so that you can 10884ed64eeSRafael J. Wysocki debug a machine that just hangs during suspend (or more 10984ed64eeSRafael J. Wysocki commonly, during resume). Namely, the RTC is only used to save 11084ed64eeSRafael J. Wysocki the last PM event point if this file contains '1'. Initially 11184ed64eeSRafael J. Wysocki it contains '0' which may be changed to '1' by writing a 11284ed64eeSRafael J. Wysocki string representing a nonzero integer into it. 11384ed64eeSRafael J. Wysocki 11484ed64eeSRafael J. Wysocki To use this debugging feature you should attempt to suspend 11584ed64eeSRafael J. Wysocki the machine, then reboot it and run 11684ed64eeSRafael J. Wysocki 11784ed64eeSRafael J. Wysocki dmesg -s 1000000 | grep 'hash matches' 11884ed64eeSRafael J. Wysocki 119d33ac60bSJames Hogan If you do not get any matches (or they appear to be false 120d33ac60bSJames Hogan positives), it is possible that the last PM event point 121d33ac60bSJames Hogan referred to a device created by a loadable kernel module. In 122d33ac60bSJames Hogan this case cat /sys/power/pm_trace_dev_match (see below) after 123d33ac60bSJames Hogan your system is started up and the kernel modules are loaded. 124d33ac60bSJames Hogan 12584ed64eeSRafael J. Wysocki CAUTION: Using it will cause your machine's real-time (CMOS) 12684ed64eeSRafael J. Wysocki clock to be set to a random invalid time after a resume. 1270e06b4a8SRafael J. Wysocki 128d33ac60bSJames HoganWhat; /sys/power/pm_trace_dev_match 129d33ac60bSJames HoganDate: October 2010 130*e0a86312SJames HoganContact: James Hogan <jhogan@kernel.org> 131d33ac60bSJames HoganDescription: 132d33ac60bSJames Hogan The /sys/power/pm_trace_dev_match file contains the name of the 133d33ac60bSJames Hogan device associated with the last PM event point saved in the RTC 134d33ac60bSJames Hogan across reboots when pm_trace has been used. More precisely it 135d33ac60bSJames Hogan contains the list of current devices (including those 136d33ac60bSJames Hogan registered by loadable kernel modules since boot) which match 137d33ac60bSJames Hogan the device hash in the RTC at boot, with a newline after each 138d33ac60bSJames Hogan one. 139d33ac60bSJames Hogan 140d33ac60bSJames Hogan The advantage of this file over the hash matches printed to the 141d33ac60bSJames Hogan kernel log (see /sys/power/pm_trace), is that it includes 142d33ac60bSJames Hogan devices created after boot by loadable kernel modules. 143d33ac60bSJames Hogan 144d33ac60bSJames Hogan Due to the small hash size necessary to fit in the RTC, it is 145d33ac60bSJames Hogan possible that more than one device matches the hash, in which 146d33ac60bSJames Hogan case further investigation is required to determine which 147d33ac60bSJames Hogan device is causing the problem. Note that genuine RTC clock 148d33ac60bSJames Hogan values (such as when pm_trace has not been used), can still 149d33ac60bSJames Hogan match a device and output it's name here. 150d33ac60bSJames Hogan 1510e06b4a8SRafael J. WysockiWhat: /sys/power/pm_async 1520e06b4a8SRafael J. WysockiDate: January 2009 15349db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 1540e06b4a8SRafael J. WysockiDescription: 1550e06b4a8SRafael J. Wysocki The /sys/power/pm_async file controls the switch allowing the 1560e06b4a8SRafael J. Wysocki user space to enable or disable asynchronous suspend and resume 1570e06b4a8SRafael J. Wysocki of devices. If enabled, this feature will cause some device 1580e06b4a8SRafael J. Wysocki drivers' suspend and resume callbacks to be executed in parallel 1590e06b4a8SRafael J. Wysocki with each other and with the main suspend thread. It is enabled 1600e06b4a8SRafael J. Wysocki if this file contains "1", which is the default. It may be 1610e06b4a8SRafael J. Wysocki disabled by writing "0" to this file, in which case all devices 1620e06b4a8SRafael J. Wysocki will be suspended and resumed synchronously. 163c125e96fSRafael J. Wysocki 164c125e96fSRafael J. WysockiWhat: /sys/power/wakeup_count 165c125e96fSRafael J. WysockiDate: July 2010 16649db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 167c125e96fSRafael J. WysockiDescription: 168c125e96fSRafael J. Wysocki The /sys/power/wakeup_count file allows user space to put the 169c125e96fSRafael J. Wysocki system into a sleep state while taking into account the 170c125e96fSRafael J. Wysocki concurrent arrival of wakeup events. Reading from it returns 171c125e96fSRafael J. Wysocki the current number of registered wakeup events and it blocks if 172c125e96fSRafael J. Wysocki some wakeup events are being processed at the time the file is 173c125e96fSRafael J. Wysocki read from. Writing to it will only succeed if the current 174c125e96fSRafael J. Wysocki number of wakeup events is equal to the written value and, if 175c125e96fSRafael J. Wysocki successful, will make the kernel abort a subsequent transition 176c125e96fSRafael J. Wysocki to a sleep state if any wakeup events are reported after the 177c125e96fSRafael J. Wysocki write has returned. 178ddeb6487SRafael J. Wysocki 179ddeb6487SRafael J. WysockiWhat: /sys/power/reserved_size 180ddeb6487SRafael J. WysockiDate: May 2011 18149db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 182ddeb6487SRafael J. WysockiDescription: 183ddeb6487SRafael J. Wysocki The /sys/power/reserved_size file allows user space to control 184ddeb6487SRafael J. Wysocki the amount of memory reserved for allocations made by device 185ddeb6487SRafael J. Wysocki drivers during the "device freeze" stage of hibernation. It can 186ddeb6487SRafael J. Wysocki be written a string representing a non-negative integer that 187ddeb6487SRafael J. Wysocki will be used as the amount of memory to reserve for allocations 188ddeb6487SRafael J. Wysocki made by device drivers' "freeze" callbacks, in bytes. 189ddeb6487SRafael J. Wysocki 190ddeb6487SRafael J. Wysocki Reading from this file will display the current value, which is 191ddeb6487SRafael J. Wysocki set to 1 MB by default. 1927483b4a4SRafael J. Wysocki 1937483b4a4SRafael J. WysockiWhat: /sys/power/autosleep 1947483b4a4SRafael J. WysockiDate: April 2012 19549db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 1967483b4a4SRafael J. WysockiDescription: 1977483b4a4SRafael J. Wysocki The /sys/power/autosleep file can be written one of the strings 1987483b4a4SRafael J. Wysocki returned by reads from /sys/power/state. If that happens, a 1997483b4a4SRafael J. Wysocki work item attempting to trigger a transition of the system to 2007483b4a4SRafael J. Wysocki the sleep state represented by that string is queued up. This 2017483b4a4SRafael J. Wysocki attempt will only succeed if there are no active wakeup sources 2027483b4a4SRafael J. Wysocki in the system at that time. After every execution, regardless 2037483b4a4SRafael J. Wysocki of whether or not the attempt to put the system to sleep has 2047483b4a4SRafael J. Wysocki succeeded, the work item requeues itself until user space 2057483b4a4SRafael J. Wysocki writes "off" to /sys/power/autosleep. 2067483b4a4SRafael J. Wysocki 2077483b4a4SRafael J. Wysocki Reading from this file causes the last string successfully 2087483b4a4SRafael J. Wysocki written to it to be returned. 209b86ff982SRafael J. Wysocki 210b86ff982SRafael J. WysockiWhat: /sys/power/wake_lock 211b86ff982SRafael J. WysockiDate: February 2012 21249db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 213b86ff982SRafael J. WysockiDescription: 214b86ff982SRafael J. Wysocki The /sys/power/wake_lock file allows user space to create 215b86ff982SRafael J. Wysocki wakeup source objects and activate them on demand (if one of 216b86ff982SRafael J. Wysocki those wakeup sources is active, reads from the 217b86ff982SRafael J. Wysocki /sys/power/wakeup_count file block or return false). When a 218b86ff982SRafael J. Wysocki string without white space is written to /sys/power/wake_lock, 219b86ff982SRafael J. Wysocki it will be assumed to represent a wakeup source name. If there 220b86ff982SRafael J. Wysocki is a wakeup source object with that name, it will be activated 221b86ff982SRafael J. Wysocki (unless active already). Otherwise, a new wakeup source object 222b86ff982SRafael J. Wysocki will be registered, assigned the given name and activated. 223b86ff982SRafael J. Wysocki If a string written to /sys/power/wake_lock contains white 224b86ff982SRafael J. Wysocki space, the part of the string preceding the white space will be 225b86ff982SRafael J. Wysocki regarded as a wakeup source name and handled as descrived above. 226b86ff982SRafael J. Wysocki The other part of the string will be regarded as a timeout (in 227b86ff982SRafael J. Wysocki nanoseconds) such that the wakeup source will be automatically 228b86ff982SRafael J. Wysocki deactivated after it has expired. The timeout, if present, is 229b86ff982SRafael J. Wysocki set regardless of the current state of the wakeup source object 230b86ff982SRafael J. Wysocki in question. 231b86ff982SRafael J. Wysocki 232b86ff982SRafael J. Wysocki Reads from this file return a string consisting of the names of 233b86ff982SRafael J. Wysocki wakeup sources created with the help of it that are active at 234b86ff982SRafael J. Wysocki the moment, separated with spaces. 235b86ff982SRafael J. Wysocki 236b86ff982SRafael J. Wysocki 237b86ff982SRafael J. WysockiWhat: /sys/power/wake_unlock 238b86ff982SRafael J. WysockiDate: February 2012 23949db1903SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 240b86ff982SRafael J. WysockiDescription: 241b86ff982SRafael J. Wysocki The /sys/power/wake_unlock file allows user space to deactivate 242b86ff982SRafael J. Wysocki wakeup sources created with the help of /sys/power/wake_lock. 243b86ff982SRafael J. Wysocki When a string is written to /sys/power/wake_unlock, it will be 244b86ff982SRafael J. Wysocki assumed to represent the name of a wakeup source to deactivate. 245b86ff982SRafael J. Wysocki If a wakeup source object of that name exists and is active at 246b86ff982SRafael J. Wysocki the moment, it will be deactivated. 247b86ff982SRafael J. Wysocki 248b86ff982SRafael J. Wysocki Reads from this file return a string consisting of the names of 249b86ff982SRafael J. Wysocki wakeup sources created with the help of /sys/power/wake_lock 250b86ff982SRafael J. Wysocki that are inactive at the moment, separated with spaces. 2514b7760baSSameer Nanda 2524b7760baSSameer NandaWhat: /sys/power/pm_print_times 2534b7760baSSameer NandaDate: May 2012 2544b7760baSSameer NandaContact: Sameer Nanda <snanda@chromium.org> 2554b7760baSSameer NandaDescription: 2564b7760baSSameer Nanda The /sys/power/pm_print_times file allows user space to 2574b7760baSSameer Nanda control whether the time taken by devices to suspend and 2584b7760baSSameer Nanda resume is printed. These prints are useful for hunting down 2594b7760baSSameer Nanda devices that take too long to suspend or resume. 2604b7760baSSameer Nanda 2614b7760baSSameer Nanda Writing a "1" enables this printing while writing a "0" 2624b7760baSSameer Nanda disables it. The default value is "0". Reading from this file 2634b7760baSSameer Nanda will display the current value. 264a6f5f0ddSAlexandra Yates 265a6f5f0ddSAlexandra YatesWhat: /sys/power/pm_wakeup_irq 266a6f5f0ddSAlexandra YatesDate: April 2015 267a6f5f0ddSAlexandra YatesContact: Alexandra Yates <alexandra.yates@linux.intel.org> 268a6f5f0ddSAlexandra YatesDescription: 269a6f5f0ddSAlexandra Yates The /sys/power/pm_wakeup_irq file reports to user space the IRQ 270a6f5f0ddSAlexandra Yates number of the first wakeup interrupt (that is, the first 271a6f5f0ddSAlexandra Yates interrupt from an IRQ line armed for system wakeup) seen by the 272a6f5f0ddSAlexandra Yates kernel during the most recent system suspend/resume cycle. 273a6f5f0ddSAlexandra Yates 274a6f5f0ddSAlexandra Yates This output is useful for system wakeup diagnostics of spurious 275a6f5f0ddSAlexandra Yates wakeup interrupts. 2768d8b2441SRafael J. Wysocki 2778d8b2441SRafael J. WysockiWhat: /sys/power/pm_debug_messages 2788d8b2441SRafael J. WysockiDate: July 2017 2798d8b2441SRafael J. WysockiContact: Rafael J. Wysocki <rjw@rjwysocki.net> 2808d8b2441SRafael J. WysockiDescription: 2818d8b2441SRafael J. Wysocki The /sys/power/pm_debug_messages file controls the printing 2828d8b2441SRafael J. Wysocki of debug messages from the system suspend/hiberbation 2838d8b2441SRafael J. Wysocki infrastructure to the kernel log. 2848d8b2441SRafael J. Wysocki 2858d8b2441SRafael J. Wysocki Writing a "1" to this file enables the debug messages and 2868d8b2441SRafael J. Wysocki writing a "0" (default) to it disables them. Reads from 2878d8b2441SRafael J. Wysocki this file return the current value. 288