Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) .. include:: <isonum.txt>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) System Sleep States
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) :Copyright: |copy| 2017 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) :Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) Sleep states are global low-power states of the entire system in which user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) space code cannot be executed and the overall system activity is significantly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) reduced.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) Sleep States That Can Be Supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) ==================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) Depending on its configuration and the capabilities of the platform it runs on,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) the Linux kernel can support up to four system sleep states, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) hibernation and up to three variants of system suspend.  The sleep states that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) can be supported by the kernel are listed below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) .. _s2idle:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) Suspend-to-Idle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) This is a generic, pure software, light-weight variant of system suspend (also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) referred to as S2I or S2Idle).  It allows more energy to be saved relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) runtime idle by freezing user space, suspending the timekeeping and putting all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) I/O devices into low-power states (possibly lower-power than available in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) working state), such that the processors can spend time in their deepest idle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) states while the system is suspended.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) The system is woken up from this state by in-band interrupts, so theoretically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) any devices that can cause interrupts to be generated in the working state can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) also be set up as wakeup devices for S2Idle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) This state can be used on platforms without support for :ref:`standby <standby>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) or :ref:`suspend-to-RAM <s2ram>`, or it can be used in addition to any of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) deeper system suspend variants to provide reduced resume latency.  It is always
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) supported if the :c:macro:`CONFIG_SUSPEND` kernel configuration option is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) .. _standby:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) Standby
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) This state, if supported, offers moderate, but real, energy savings, while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) providing a relatively straightforward transition back to the working state.  No
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) operating state is lost (the system core logic retains power), so the system can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) go back to where it left off easily enough.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) In addition to freezing user space, suspending the timekeeping and putting all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) I/O devices into low-power states, which is done for :ref:`suspend-to-idle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) <s2idle>` too, nonboot CPUs are taken offline and all low-level system functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) are suspended during transitions into this state.  For this reason, it should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) allow more energy to be saved relative to :ref:`suspend-to-idle <s2idle>`, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) the resume latency will generally be greater than for that state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) The set of devices that can wake up the system from this state usually is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) reduced relative to :ref:`suspend-to-idle <s2idle>` and it may be necessary to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) rely on the platform for setting up the wakeup functionality as appropriate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) This state is supported if the :c:macro:`CONFIG_SUSPEND` kernel configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) option is set and the support for it is registered by the platform with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) core system suspend subsystem.  On ACPI-based systems this state is mapped to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) the S1 system state defined by ACPI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) .. _s2ram:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) Suspend-to-RAM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) This state (also referred to as STR or S2RAM), if supported, offers significant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) energy savings as everything in the system is put into a low-power state, except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) for memory, which should be placed into the self-refresh mode to retain its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) contents.  All of the steps carried out when entering :ref:`standby <standby>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) are also carried out during transitions to S2RAM.  Additional operations may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) take place depending on the platform capabilities.  In particular, on ACPI-based
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) systems the kernel passes control to the platform firmware (BIOS) as the last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) step during S2RAM transitions and that usually results in powering down some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) more low-level components that are not directly controlled by the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) The state of devices and CPUs is saved and held in memory.  All devices are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) suspended and put into low-power states.  In many cases, all peripheral buses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) lose power when entering S2RAM, so devices must be able to handle the transition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) back to the "on" state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) On ACPI-based systems S2RAM requires some minimal boot-strapping code in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) platform firmware to resume the system from it.  This may be the case on other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) platforms too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) The set of devices that can wake up the system from S2RAM usually is reduced
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) relative to :ref:`suspend-to-idle <s2idle>` and :ref:`standby <standby>` and it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) may be necessary to rely on the platform for setting up the wakeup functionality
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) as appropriate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) S2RAM is supported if the :c:macro:`CONFIG_SUSPEND` kernel configuration option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) is set and the support for it is registered by the platform with the core system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) suspend subsystem.  On ACPI-based systems it is mapped to the S3 system state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) defined by ACPI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .. _hibernation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) Hibernation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) This state (also referred to as Suspend-to-Disk or STD) offers the greatest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) energy savings and can be used even in the absence of low-level platform support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) for system suspend.  However, it requires some low-level code for resuming the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) system to be present for the underlying CPU architecture.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) Hibernation is significantly different from any of the system suspend variants.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) It takes three system state changes to put it into hibernation and two system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) state changes to resume it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) First, when hibernation is triggered, the kernel stops all system activity and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) creates a snapshot image of memory to be written into persistent storage.  Next,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) the system goes into a state in which the snapshot image can be saved, the image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) is written out and finally the system goes into the target low-power state in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) which power is cut from almost all of its hardware components, including memory,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) except for a limited set of wakeup devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Once the snapshot image has been written out, the system may either enter a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) special low-power state (like ACPI S4), or it may simply power down itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) Powering down means minimum power draw and it allows this mechanism to work on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) any system.  However, entering a special low-power state may allow additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) means of system wakeup to be used  (e.g. pressing a key on the keyboard or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) opening a laptop lid).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) After wakeup, control goes to the platform firmware that runs a boot loader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) which boots a fresh instance of the kernel (control may also go directly to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) the boot loader, depending on the system configuration, but anyway it causes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) a fresh instance of the kernel to be booted).  That new instance of the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) (referred to as the ``restore kernel``) looks for a hibernation image in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) persistent storage and if one is found, it is loaded into memory.  Next, all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) activity in the system is stopped and the restore kernel overwrites itself with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) the image contents and jumps into a special trampoline area in the original
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) kernel stored in the image (referred to as the ``image kernel``), which is where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) the special architecture-specific low-level code is needed.  Finally, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) image kernel restores the system to the pre-hibernation state and allows user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) space to run again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) Hibernation is supported if the :c:macro:`CONFIG_HIBERNATION` kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) configuration option is set.  However, this option can only be set if support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) for the given CPU architecture includes the low-level code for system resume.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) Basic ``sysfs`` Interfaces for System Suspend and Hibernation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) =============================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) The power management subsystem provides userspace with a unified ``sysfs``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) interface for system sleep regardless of the underlying system architecture or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) platform.  That interface is located in the :file:`/sys/power/` directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) (assuming that ``sysfs`` is mounted at :file:`/sys`) and it consists of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) following attributes (files):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ``state``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	This file contains a list of strings representing sleep states supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	by the kernel.  Writing one of these strings into it causes the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	to start a transition of the system into the sleep state represented by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	that string.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	In particular, the "disk", "freeze" and "standby" strings represent the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	:ref:`hibernation <hibernation>`, :ref:`suspend-to-idle <s2idle>` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	:ref:`standby <standby>` sleep states, respectively.  The "mem" string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	is interpreted in accordance with the contents of the ``mem_sleep`` file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	described below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	If the kernel does not support any system sleep states, this file is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	not present.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) ``mem_sleep``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	This file contains a list of strings representing supported system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	suspend	variants and allows user space to select the variant to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	associated with the "mem" string in the ``state`` file described above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	The strings that may be present in this file are "s2idle", "shallow"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	and "deep".  The "s2idle" string always represents :ref:`suspend-to-idle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	<s2idle>` and, by convention, "shallow" and "deep" represent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	:ref:`standby <standby>` and :ref:`suspend-to-RAM <s2ram>`,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	respectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	Writing one of the listed strings into this file causes the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	suspend variant represented by it to be associated with the "mem" string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	in the ``state`` file.  The string representing the suspend variant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	currently associated with the "mem" string in the ``state`` file is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	shown in square brackets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	If the kernel does not support system suspend, this file is not present.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ``disk``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	This file controls the operating mode of hibernation (Suspend-to-Disk).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	Specifically, it tells the kernel what to do after creating a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	hibernation image.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	Reading from it returns a list of supported options encoded as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	``platform``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		Put the system into a special low-power state (e.g. ACPI S4) to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		make additional wakeup options available and possibly allow the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		platform firmware to take a simplified initialization path after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		wakeup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		It is only available if the platform provides a special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		mechanism to put the system to sleep after creating a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		hibernation image (platforms with ACPI do that as a rule, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		example).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	``shutdown``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		Power off the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	``reboot``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		Reboot the system (useful for diagnostics mostly).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	``suspend``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		Hybrid system suspend.  Put the system into the suspend sleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		state selected through the ``mem_sleep`` file described above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		If the system is successfully woken up from that state, discard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		the hibernation image and continue.  Otherwise, use the image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		to restore the previous state of the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		It is available if system suspend is supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	``test_resume``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		Diagnostic operation.  Load the image as though the system had
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		just woken up from hibernation and the currently running kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		instance was a restore kernel and follow up with full system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		resume.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	Writing one of the strings listed above into this file causes the option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	represented by it to be selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	The currently selected option is shown in square brackets, which means
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	that the operation represented by it will be carried out after creating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	and saving the image when hibernation is triggered by writing ``disk``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	to :file:`/sys/power/state`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	If the kernel does not support hibernation, this file is not present.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ``image_size``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	This file controls the size of hibernation images.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	It can be written a string representing a non-negative integer that will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	be used as a best-effort upper limit of the image size, in bytes.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	hibernation core will do its best to ensure that the image size will not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	exceed that number, but if that turns out to be impossible to achieve, a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	hibernation image will still be created and its size will be as small as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	possible.  In particular, writing '0' to this file causes the size of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	hibernation images to be minimum.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	Reading from it returns the current image size limit, which is set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	around 2/5 of the available RAM size by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ``pm_trace``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	This file controls the "PM trace" mechanism saving the last suspend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	or resume event point in the RTC memory across reboots.  It helps to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	debug hard lockups or reboots due to device driver failures that occur
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	during system suspend or resume (which is more common) more effectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	If it contains "1", the fingerprint of each suspend/resume event point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	in turn will be stored in the RTC memory (overwriting the actual RTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	information), so it will survive a system crash if one occurs right
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	after storing it and it can be used later to identify the driver that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	caused the crash to happen.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	It contains "0" by default, which may be changed to "1" by writing a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	string representing a nonzero integer into it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) According to the above, there are two ways to make the system go into the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) :ref:`suspend-to-idle <s2idle>` state.  The first one is to write "freeze"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) directly to :file:`/sys/power/state`.  The second one is to write "s2idle" to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) :file:`/sys/power/mem_sleep` and then to write "mem" to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) :file:`/sys/power/state`.  Likewise, there are two ways to make the system go
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) into the :ref:`standby <standby>` state (the strings to write to the control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) files in that case are "standby" or "shallow" and "mem", respectively) if that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) state is supported by the platform.  However, there is only one way to make the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) system go into the :ref:`suspend-to-RAM <s2ram>` state (write "deep" into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) :file:`/sys/power/mem_sleep` and "mem" into :file:`/sys/power/state`).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) The default suspend variant (ie. the one to be used without writing anything
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) into :file:`/sys/power/mem_sleep`) is either "deep" (on the majority of systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) supporting :ref:`suspend-to-RAM <s2ram>`) or "s2idle", but it can be overridden
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) by the value of the ``mem_sleep_default`` parameter in the kernel command line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) On some systems with ACPI, depending on the information in the ACPI tables, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) default may be "s2idle" even if :ref:`suspend-to-RAM <s2ram>` is supported in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) principle.