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