blob: 8d270ed272286bf2db233cb08bd8184529fa018f [file] [log] [blame]
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03001===========================================
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02002Power Management Interface for System Sleep
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03003===========================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02005Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +02007The power management subsystem provides userspace with a unified sysfs interface
8for system sleep regardless of the underlying system architecture or platform.
9The interface is located in the /sys/power/ directory (assuming that sysfs is
10mounted at /sys).
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020012/sys/power/state is the system sleep state control file.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020014Reading from it returns a list of supported sleep states, encoded as:
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030016- 'freeze' (Suspend-to-Idle)
17- 'standby' (Power-On Suspend)
18- 'mem' (Suspend-to-RAM)
19- 'disk' (Suspend-to-Disk)
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020021Suspend-to-Idle is always supported. Suspend-to-Disk is always supported
22too as long the kernel has been configured to support hibernation at all
23(ie. CONFIG_HIBERNATION is set in the kernel configuration file). Support
24for Suspend-to-RAM and Power-On Suspend depends on the capabilities of the
25platform.
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020027If one of the strings listed in /sys/power/state is written to it, the system
28will attempt to transition into the corresponding sleep state. Refer to
Tom Saeger3ba9b1b2017-10-10 12:36:16 -050029Documentation/admin-guide/pm/sleep-states.rst for a description of each of
30those states.
Rafael J. Wysockib918f6e2006-11-02 22:07:19 -080031
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020032/sys/power/disk controls the operating mode of hibernation (Suspend-to-Disk).
33Specifically, it tells the kernel what to do after creating a hibernation image.
Johannes Bergf0ced9b2007-05-06 14:50:50 -070034
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020035Reading from it returns a list of supported options encoded as:
Johannes Bergf0ced9b2007-05-06 14:50:50 -070036
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030037- 'platform' (put the system into sleep using a platform-provided method)
38- 'shutdown' (shut the system down)
39- 'reboot' (reboot the system)
40- 'suspend' (trigger a Suspend-to-RAM transition)
41- 'test_resume' (resume-after-hibernation test mode)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020043The currently selected option is printed in square brackets.
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020045The 'platform' option is only available if the platform provides a special
46mechanism to put the system to sleep after creating a hibernation image (ACPI
47does that, for example). The 'suspend' option is available if Suspend-to-RAM
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030048is supported. Refer to Documentation/power/basic-pm-debugging.rst for the
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020049description of the 'test_resume' option.
Rafael J. Wysockica0aec02006-01-06 00:15:56 -080050
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020051To select an option, write the string representing it to /sys/power/disk.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070052
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020053/sys/power/image_size controls the size of hibernation images.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070054
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020055It can be written a string representing a non-negative integer that will be
56used as a best-effort upper limit of the image size, in bytes. The hibernation
57core will do its best to ensure that the image size will not exceed that number.
58However, if that turns out to be impossible to achieve, a hibernation image will
59still be created and its size will be as small as possible. In particular,
60writing '0' to this file will enforce hibernation images to be as small as
61possible.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070062
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020063Reading from this file returns the current image size limit, which is set to
64around 2/5 of available RAM by default.
Rafael J. Wysockic5c6ba42006-09-25 23:32:58 -070065
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020066/sys/power/pm_trace controls the PM trace mechanism saving the last suspend
67or resume event point in the RTC across reboots.
68
69It helps to debug hard lockups or reboots due to device driver failures that
70occur during system suspend or resume (which is more common) more effectively.
71
72If /sys/power/pm_trace contains '1', the fingerprint of each suspend/resume
73event point in turn will be stored in the RTC memory (overwriting the actual
74RTC information), so it will survive a system crash if one occurs right after
75storing it and it can be used later to identify the driver that caused the crash
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030076to happen (see Documentation/power/s2ram.rst for more information).
Rafael J. Wysocki947d2c22016-08-13 02:54:04 +020077
78Initially it contains '0' which may be changed to '1' by writing a string
79representing a nonzero integer into it.