1Power Management Interface for System Sleep 2 3Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com> 4 5The power management subsystem provides userspace with a unified sysfs interface 6for system sleep regardless of the underlying system architecture or platform. 7The interface is located in the /sys/power/ directory (assuming that sysfs is 8mounted at /sys). 9 10/sys/power/state is the system sleep state control file. 11 12Reading from it returns a list of supported sleep states, encoded as: 13 14'freeze' (Suspend-to-Idle) 15'standby' (Power-On Suspend) 16'mem' (Suspend-to-RAM) 17'disk' (Suspend-to-Disk) 18 19Suspend-to-Idle is always supported. Suspend-to-Disk is always supported 20too as long the kernel has been configured to support hibernation at all 21(ie. CONFIG_HIBERNATION is set in the kernel configuration file). Support 22for Suspend-to-RAM and Power-On Suspend depends on the capabilities of the 23platform. 24 25If one of the strings listed in /sys/power/state is written to it, the system 26will attempt to transition into the corresponding sleep state. Refer to 27Documentation/admin-guide/pm/sleep-states.rst for a description of each of 28those states. 29 30/sys/power/disk controls the operating mode of hibernation (Suspend-to-Disk). 31Specifically, it tells the kernel what to do after creating a hibernation image. 32 33Reading from it returns a list of supported options encoded as: 34 35'platform' (put the system into sleep using a platform-provided method) 36'shutdown' (shut the system down) 37'reboot' (reboot the system) 38'suspend' (trigger a Suspend-to-RAM transition) 39'test_resume' (resume-after-hibernation test mode) 40 41The currently selected option is printed in square brackets. 42 43The 'platform' option is only available if the platform provides a special 44mechanism to put the system to sleep after creating a hibernation image (ACPI 45does that, for example). The 'suspend' option is available if Suspend-to-RAM 46is supported. Refer to Documentation/power/basic-pm-debugging.txt for the 47description of the 'test_resume' option. 48 49To select an option, write the string representing it to /sys/power/disk. 50 51/sys/power/image_size controls the size of hibernation images. 52 53It can be written a string representing a non-negative integer that will be 54used as a best-effort upper limit of the image size, in bytes. The hibernation 55core will do its best to ensure that the image size will not exceed that number. 56However, if that turns out to be impossible to achieve, a hibernation image will 57still be created and its size will be as small as possible. In particular, 58writing '0' to this file will enforce hibernation images to be as small as 59possible. 60 61Reading from this file returns the current image size limit, which is set to 62around 2/5 of available RAM by default. 63 64/sys/power/pm_trace controls the PM trace mechanism saving the last suspend 65or resume event point in the RTC across reboots. 66 67It helps to debug hard lockups or reboots due to device driver failures that 68occur during system suspend or resume (which is more common) more effectively. 69 70If /sys/power/pm_trace contains '1', the fingerprint of each suspend/resume 71event point in turn will be stored in the RTC memory (overwriting the actual 72RTC information), so it will survive a system crash if one occurs right after 73storing it and it can be used later to identify the driver that caused the crash 74to happen (see Documentation/power/s2ram.txt for more information). 75 76Initially it contains '0' which may be changed to '1' by writing a string 77representing a nonzero integer into it. 78