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