184ed64eeSRafael J. WysockiWhat: /sys/power/ 284ed64eeSRafael J. WysockiDate: August 2006 384ed64eeSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 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 1084ed64eeSRafael J. WysockiDate: August 2006 1184ed64eeSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 1284ed64eeSRafael J. WysockiDescription: 1384ed64eeSRafael J. Wysocki The /sys/power/state file controls the system power state. 1484ed64eeSRafael J. Wysocki Reading from this file returns what states are supported, 1584ed64eeSRafael J. Wysocki which is hard-coded to 'standby' (Power-On Suspend), 'mem' 1684ed64eeSRafael J. Wysocki (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). 1784ed64eeSRafael J. Wysocki 1884ed64eeSRafael J. Wysocki Writing to this file one of these strings causes the system to 1984ed64eeSRafael J. Wysocki transition into that state. Please see the file 2084ed64eeSRafael J. Wysocki Documentation/power/states.txt for a description of each of 2184ed64eeSRafael J. Wysocki these states. 2284ed64eeSRafael J. Wysocki 2384ed64eeSRafael J. WysockiWhat: /sys/power/disk 24b918f6e6SRafael J. WysockiDate: September 2006 2584ed64eeSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 2684ed64eeSRafael J. WysockiDescription: 2784ed64eeSRafael J. Wysocki The /sys/power/disk file controls the operating mode of the 2884ed64eeSRafael J. Wysocki suspend-to-disk mechanism. Reading from this file returns 2984ed64eeSRafael J. Wysocki the name of the method by which the system will be put to 3084ed64eeSRafael J. Wysocki sleep on the next suspend. There are four methods supported: 3184ed64eeSRafael J. Wysocki 'firmware' - means that the memory image will be saved to disk 3284ed64eeSRafael J. Wysocki by some firmware, in which case we also assume that the 3384ed64eeSRafael J. Wysocki firmware will handle the system suspend. 3484ed64eeSRafael J. Wysocki 'platform' - the memory image will be saved by the kernel and 3584ed64eeSRafael J. Wysocki the system will be put to sleep by the platform driver (e.g. 3684ed64eeSRafael J. Wysocki ACPI or other PM registers). 3784ed64eeSRafael J. Wysocki 'shutdown' - the memory image will be saved by the kernel and 3884ed64eeSRafael J. Wysocki the system will be powered off. 3984ed64eeSRafael J. Wysocki 'reboot' - the memory image will be saved by the kernel and 4084ed64eeSRafael J. Wysocki the system will be rebooted. 4184ed64eeSRafael J. Wysocki 42b918f6e6SRafael J. Wysocki Additionally, /sys/power/disk can be used to turn on one of the 43b918f6e6SRafael J. Wysocki two testing modes of the suspend-to-disk mechanism: 'testproc' 44b918f6e6SRafael J. Wysocki or 'test'. If the suspend-to-disk mechanism is in the 45b918f6e6SRafael J. Wysocki 'testproc' mode, writing 'disk' to /sys/power/state will cause 46b918f6e6SRafael J. Wysocki the kernel to disable nonboot CPUs and freeze tasks, wait for 5 47b918f6e6SRafael J. Wysocki seconds, unfreeze tasks and enable nonboot CPUs. If it is in 48b918f6e6SRafael J. Wysocki the 'test' mode, writing 'disk' to /sys/power/state will cause 49b918f6e6SRafael J. Wysocki the kernel to disable nonboot CPUs and freeze tasks, shrink 50b918f6e6SRafael J. Wysocki memory, suspend devices, wait for 5 seconds, resume devices, 51b918f6e6SRafael J. Wysocki unfreeze tasks and enable nonboot CPUs. Then, we are able to 52b918f6e6SRafael J. Wysocki look in the log messages and work out, for example, which code 53b918f6e6SRafael J. Wysocki is being slow and which device drivers are misbehaving. 54b918f6e6SRafael J. Wysocki 5584ed64eeSRafael J. Wysocki The suspend-to-disk method may be chosen by writing to this 5684ed64eeSRafael J. Wysocki file one of the accepted strings: 5784ed64eeSRafael J. Wysocki 5884ed64eeSRafael J. Wysocki 'firmware' 5984ed64eeSRafael J. Wysocki 'platform' 6084ed64eeSRafael J. Wysocki 'shutdown' 6184ed64eeSRafael J. Wysocki 'reboot' 62b918f6e6SRafael J. Wysocki 'testproc' 63b918f6e6SRafael J. Wysocki 'test' 6484ed64eeSRafael J. Wysocki 6584ed64eeSRafael J. Wysocki It will only change to 'firmware' or 'platform' if the system 6684ed64eeSRafael J. Wysocki supports that. 6784ed64eeSRafael J. Wysocki 6884ed64eeSRafael J. WysockiWhat: /sys/power/image_size 6984ed64eeSRafael J. WysockiDate: August 2006 7084ed64eeSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 7184ed64eeSRafael J. WysockiDescription: 7284ed64eeSRafael J. Wysocki The /sys/power/image_size file controls the size of the image 7384ed64eeSRafael J. Wysocki created by the suspend-to-disk mechanism. It can be written a 7484ed64eeSRafael J. Wysocki string representing a non-negative integer that will be used 7584ed64eeSRafael J. Wysocki as an upper limit of the image size, in bytes. The kernel's 7684ed64eeSRafael J. Wysocki suspend-to-disk code will do its best to ensure the image size 7784ed64eeSRafael J. Wysocki will not exceed this number. However, if it turns out to be 7884ed64eeSRafael J. Wysocki impossible, the kernel will try to suspend anyway using the 7984ed64eeSRafael J. Wysocki smallest image possible. In particular, if "0" is written to 8084ed64eeSRafael J. Wysocki this file, the suspend image will be as small as possible. 8184ed64eeSRafael J. Wysocki 8284ed64eeSRafael J. Wysocki Reading from this file will display the current image size 8384ed64eeSRafael J. Wysocki limit, which is set to 500 MB by default. 8484ed64eeSRafael J. Wysocki 8584ed64eeSRafael J. WysockiWhat: /sys/power/pm_trace 8684ed64eeSRafael J. WysockiDate: August 2006 8784ed64eeSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 8884ed64eeSRafael J. WysockiDescription: 8984ed64eeSRafael J. Wysocki The /sys/power/pm_trace file controls the code which saves the 9084ed64eeSRafael J. Wysocki last PM event point in the RTC across reboots, so that you can 9184ed64eeSRafael J. Wysocki debug a machine that just hangs during suspend (or more 9284ed64eeSRafael J. Wysocki commonly, during resume). Namely, the RTC is only used to save 9384ed64eeSRafael J. Wysocki the last PM event point if this file contains '1'. Initially 9484ed64eeSRafael J. Wysocki it contains '0' which may be changed to '1' by writing a 9584ed64eeSRafael J. Wysocki string representing a nonzero integer into it. 9684ed64eeSRafael J. Wysocki 9784ed64eeSRafael J. Wysocki To use this debugging feature you should attempt to suspend 9884ed64eeSRafael J. Wysocki the machine, then reboot it and run 9984ed64eeSRafael J. Wysocki 10084ed64eeSRafael J. Wysocki dmesg -s 1000000 | grep 'hash matches' 10184ed64eeSRafael J. Wysocki 102*d33ac60bSJames Hogan If you do not get any matches (or they appear to be false 103*d33ac60bSJames Hogan positives), it is possible that the last PM event point 104*d33ac60bSJames Hogan referred to a device created by a loadable kernel module. In 105*d33ac60bSJames Hogan this case cat /sys/power/pm_trace_dev_match (see below) after 106*d33ac60bSJames Hogan your system is started up and the kernel modules are loaded. 107*d33ac60bSJames Hogan 10884ed64eeSRafael J. Wysocki CAUTION: Using it will cause your machine's real-time (CMOS) 10984ed64eeSRafael J. Wysocki clock to be set to a random invalid time after a resume. 1100e06b4a8SRafael J. Wysocki 111*d33ac60bSJames HoganWhat; /sys/power/pm_trace_dev_match 112*d33ac60bSJames HoganDate: October 2010 113*d33ac60bSJames HoganContact: James Hogan <james@albanarts.com> 114*d33ac60bSJames HoganDescription: 115*d33ac60bSJames Hogan The /sys/power/pm_trace_dev_match file contains the name of the 116*d33ac60bSJames Hogan device associated with the last PM event point saved in the RTC 117*d33ac60bSJames Hogan across reboots when pm_trace has been used. More precisely it 118*d33ac60bSJames Hogan contains the list of current devices (including those 119*d33ac60bSJames Hogan registered by loadable kernel modules since boot) which match 120*d33ac60bSJames Hogan the device hash in the RTC at boot, with a newline after each 121*d33ac60bSJames Hogan one. 122*d33ac60bSJames Hogan 123*d33ac60bSJames Hogan The advantage of this file over the hash matches printed to the 124*d33ac60bSJames Hogan kernel log (see /sys/power/pm_trace), is that it includes 125*d33ac60bSJames Hogan devices created after boot by loadable kernel modules. 126*d33ac60bSJames Hogan 127*d33ac60bSJames Hogan Due to the small hash size necessary to fit in the RTC, it is 128*d33ac60bSJames Hogan possible that more than one device matches the hash, in which 129*d33ac60bSJames Hogan case further investigation is required to determine which 130*d33ac60bSJames Hogan device is causing the problem. Note that genuine RTC clock 131*d33ac60bSJames Hogan values (such as when pm_trace has not been used), can still 132*d33ac60bSJames Hogan match a device and output it's name here. 133*d33ac60bSJames Hogan 1340e06b4a8SRafael J. WysockiWhat: /sys/power/pm_async 1350e06b4a8SRafael J. WysockiDate: January 2009 1360e06b4a8SRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 1370e06b4a8SRafael J. WysockiDescription: 1380e06b4a8SRafael J. Wysocki The /sys/power/pm_async file controls the switch allowing the 1390e06b4a8SRafael J. Wysocki user space to enable or disable asynchronous suspend and resume 1400e06b4a8SRafael J. Wysocki of devices. If enabled, this feature will cause some device 1410e06b4a8SRafael J. Wysocki drivers' suspend and resume callbacks to be executed in parallel 1420e06b4a8SRafael J. Wysocki with each other and with the main suspend thread. It is enabled 1430e06b4a8SRafael J. Wysocki if this file contains "1", which is the default. It may be 1440e06b4a8SRafael J. Wysocki disabled by writing "0" to this file, in which case all devices 1450e06b4a8SRafael J. Wysocki will be suspended and resumed synchronously. 146c125e96fSRafael J. Wysocki 147c125e96fSRafael J. WysockiWhat: /sys/power/wakeup_count 148c125e96fSRafael J. WysockiDate: July 2010 149c125e96fSRafael J. WysockiContact: Rafael J. Wysocki <rjw@sisk.pl> 150c125e96fSRafael J. WysockiDescription: 151c125e96fSRafael J. Wysocki The /sys/power/wakeup_count file allows user space to put the 152c125e96fSRafael J. Wysocki system into a sleep state while taking into account the 153c125e96fSRafael J. Wysocki concurrent arrival of wakeup events. Reading from it returns 154c125e96fSRafael J. Wysocki the current number of registered wakeup events and it blocks if 155c125e96fSRafael J. Wysocki some wakeup events are being processed at the time the file is 156c125e96fSRafael J. Wysocki read from. Writing to it will only succeed if the current 157c125e96fSRafael J. Wysocki number of wakeup events is equal to the written value and, if 158c125e96fSRafael J. Wysocki successful, will make the kernel abort a subsequent transition 159c125e96fSRafael J. Wysocki to a sleep state if any wakeup events are reported after the 160c125e96fSRafael J. Wysocki write has returned. 161