blob: 974916ff6608e7b55f390d69e64a8fbe7396a9e9 [file] [log] [blame]
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02001Power Management Interface for System Sleep
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02003Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02005The 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).
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020010/sys/power/state is the system sleep state control file.
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020012Reading from it returns a list of supported sleep states, encoded as:
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020014'freeze' (Suspend-to-Idle)
15'standby' (Power-On Suspend)
16'mem' (Suspend-to-RAM)
17'disk' (Suspend-to-Disk)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020019Suspend-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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020025If 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/power/states.txt for a description of each of those states.
Rafael J. Wysockib918f6e2006-11-02 22:07:19 -080028
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020029/sys/power/disk controls the operating mode of hibernation (Suspend-to-Disk).
30Specifically, it tells the kernel what to do after creating a hibernation image.
Johannes Bergf0ced9b2007-05-06 14:50:50 -070031
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020032Reading from it returns a list of supported options encoded as:
Johannes Bergf0ced9b2007-05-06 14:50:50 -070033
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020034'platform' (put the system into sleep using a platform-provided method)
35'shutdown' (shut the system down)
36'reboot' (reboot the system)
37'suspend' (trigger a Suspend-to-RAM transition)
38'test_resume' (resume-after-hibernation test mode)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020040The currently selected option is printed in square brackets.
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020042The 'platform' option is only available if the platform provides a special
43mechanism to put the system to sleep after creating a hibernation image (ACPI
44does that, for example). The 'suspend' option is available if Suspend-to-RAM
45is supported. Refer to Documentation/power/basic_pm_debugging.txt for the
46description of the 'test_resume' option.
Rafael J. Wysockica0aec02006-01-06 00:15:56 -080047
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020048To select an option, write the string representing it to /sys/power/disk.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070049
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020050/sys/power/image_size controls the size of hibernation images.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070051
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020052It can be written a string representing a non-negative integer that will be
53used as a best-effort upper limit of the image size, in bytes. The hibernation
54core will do its best to ensure that the image size will not exceed that number.
55However, if that turns out to be impossible to achieve, a hibernation image will
56still be created and its size will be as small as possible. In particular,
57writing '0' to this file will enforce hibernation images to be as small as
58possible.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070059
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020060Reading from this file returns the current image size limit, which is set to
61around 2/5 of available RAM by default.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070062
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020063/sys/power/pm_trace controls the PM trace mechanism saving the last suspend
64or resume event point in the RTC across reboots.
65
66It helps to debug hard lockups or reboots due to device driver failures that
67occur during system suspend or resume (which is more common) more effectively.
68
69If /sys/power/pm_trace contains '1', the fingerprint of each suspend/resume
70event point in turn will be stored in the RTC memory (overwriting the actual
71RTC information), so it will survive a system crash if one occurs right after
72storing it and it can be used later to identify the driver that caused the crash
73to happen (see Documentation/power/s2ram.txt for more information).
74
75Initially it contains '0' which may be changed to '1' by writing a string
76representing a nonzero integer into it.