1System Power Management Sleep States
2
3(C) 2014 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
4
5The kernel supports up to four system sleep states generically, although three
6of them depend on the platform support code to implement the low-level details
7for each state.
8
9The states are represented by strings that can be read or written to the
10/sys/power/state file.  Those strings may be "mem", "standby", "freeze" and
11"disk", where the last one always represents hibernation (Suspend-To-Disk) and
12the meaning of the remaining ones depends on the relative_sleep_states command
13line argument.
14
15For relative_sleep_states=1, the strings "mem", "standby" and "freeze" label the
16available non-hibernation sleep states from the deepest to the shallowest,
17respectively.  In that case, "mem" is always present in /sys/power/state,
18because there is at least one non-hibernation sleep state in every system.  If
19the given system supports two non-hibernation sleep states, "standby" is present
20in /sys/power/state in addition to "mem".  If the system supports three
21non-hibernation sleep states, "freeze" will be present in /sys/power/state in
22addition to "mem" and "standby".
23
24For relative_sleep_states=0, which is the default, the following descriptions
25apply.
26
27state:		Suspend-To-Idle
28ACPI state:	S0
29Label:		"freeze"
30
31This state is a generic, pure software, light-weight, system sleep state.
32It allows more energy to be saved relative to runtime idle by freezing user
33space and putting all I/O devices into low-power states (possibly
34lower-power than available at run time), such that the processors can
35spend more time in their idle states.
36
37This state can be used for platforms without Power-On Suspend/Suspend-to-RAM
38support, or it can be used in addition to Suspend-to-RAM (memory sleep)
39to provide reduced resume latency.  It is always supported.
40
41
42State:		Standby / Power-On Suspend
43ACPI State:	S1
44Label:		"standby"
45
46This state, if supported, offers moderate, though real, power savings, while
47providing a relatively low-latency transition back to a working system.  No
48operating state is lost (the CPU retains power), so the system easily starts up
49again where it left off. 
50
51In addition to freezing user space and putting all I/O devices into low-power
52states, which is done for Suspend-To-Idle too, nonboot CPUs are taken offline
53and all low-level system functions are suspended during transitions into this
54state.  For this reason, it should allow more energy to be saved relative to
55Suspend-To-Idle, but the resume latency will generally be greater than for that
56state.
57
58
59State:		Suspend-to-RAM
60ACPI State:	S3
61Label:		"mem"
62
63This state, if supported, offers significant power savings as everything in the
64system is put into a low-power state, except for memory, which should be placed
65into the self-refresh mode to retain its contents.  All of the steps carried out
66when entering Power-On Suspend are also carried out during transitions to STR.
67Additional operations may take place depending on the platform capabilities.  In
68particular, on ACPI systems the kernel passes control to the BIOS (platform
69firmware) as the last step during STR transitions and that usually results in
70powering down some more low-level components that aren't directly controlled by
71the kernel.
72
73System and device state is saved and kept in memory.  All devices are suspended
74and put into low-power states.  In many cases, all peripheral buses lose power
75when entering STR, so devices must be able to handle the transition back to the
76"on" state.
77
78For at least ACPI, STR requires some minimal boot-strapping code to resume the
79system from it.  This may be the case on other platforms too.
80
81
82State:		Suspend-to-disk
83ACPI State:	S4
84Label:		"disk"
85
86This state offers the greatest power savings, and can be used even in
87the absence of low-level platform support for power management. This
88state operates similarly to Suspend-to-RAM, but includes a final step
89of writing memory contents to disk. On resume, this is read and memory
90is restored to its pre-suspend state. 
91
92STD can be handled by the firmware or the kernel. If it is handled by
93the firmware, it usually requires a dedicated partition that must be
94setup via another operating system for it to use. Despite the
95inconvenience, this method requires minimal work by the kernel, since
96the firmware will also handle restoring memory contents on resume. 
97
98For suspend-to-disk, a mechanism called 'swsusp' (Swap Suspend) is used
99to write memory contents to free swap space. swsusp has some restrictive
100requirements, but should work in most cases. Some, albeit outdated,
101documentation can be found in Documentation/power/swsusp.txt.
102Alternatively, userspace can do most of the actual suspend to disk work,
103see userland-swsusp.txt.
104
105Once memory state is written to disk, the system may either enter a
106low-power state (like ACPI S4), or it may simply power down. Powering
107down offers greater savings, and allows this mechanism to work on any
108system. However, entering a real low-power state allows the user to
109trigger wake up events (e.g. pressing a key or opening a laptop lid).
110