Battery Life: System Sleep - junaruga/framework-laptop-config GitHub Wiki

On Framework Laptop, Fedora 35.

First check supported sleep statuses. I could see S0, S3, S4, S5 are supported.

$ dmesg | grep S0
[    0.402157] ACPI: PM: (supports S0 S3 S4 S5)

However according to this thread on Framework community, S3 might not be supported by BIOS and Tiger Lake.

Next here is my current setting about sleep.

$ cat /sys/power/mem_sleep
[s2idle] deep

As the current kernel version 5.15.10, check the kernel document.

$ uname -r
5.15.10-200.fc35.x86_64

This Kernel version 5.15 System Sleep Status - sysfs interfaces page explains what /sys/power/mem_sleep is.

mem_sleep

This file contains a list of strings representing supported system suspend variants and allows user space to select the variant to be associated with the “mem” string in the state file described above.

The strings that may be present in this file are “s2idle”, “shallow” and “deep”. The “s2idle” string always represents suspend-to-idle and, by convention, “shallow” and “deep” represent standby and suspend-to-RAM, respectively.

OK. The followings are actual meaning of values in /sys/power/mem_sleep.

  • s2idle: suspend-to-idle
  • shallow: standby = mapped to the S1 system state defined by ACPI according to Standby document.
  • deep: suspend-to-RAM = mapped to the S3 system state defined by ACPI according to Suspend to RAM document.

By the way, here are the contents of other 2 files written in the document.

$ cat /sys/power/state
freeze mem

$ cat /sys/power/disk
[disabled]

Checking the "ACPI" in the above dmesg again, There is acpi command.

$ rpm -qf /bin/acpi
acpi-1.7-17.fc35.x86_64

Here is the upstream project URL.

$ rpm -qi acpi | grep ^URL
URL         : http://sourceforge.net/projects/acpiclient/

I was lookning for the explanation of S0, S1, S2, S3, S4, S5.

https://www.linuxquestions.org/questions/linux-kernel-70/acpi-in-linux-643741/

/usr/src/kernels/5.15.10-200.fc35.x86_64/Documentation/

I need information about ACPI in linux. How can we change the acpi states (S0,S1,S2,S3.S4,S5). I want more information about these states. Where can I find it.

See /usr/src/{linux,kernels}/$kernelversion/Documentation/(laptops/)?

But I couldn't find documents I expected under /usr/src/kernels/5.15.10-200.fc35.x86_64/Documentation/. Then I noticed I need to install kernel-doc RPM package.

$ sudo dnf search kernel-doc
...

$ sudo dnf install kernel-doc

$ rpm -ql kernel-doc

OK I found something.

$ cd /usr/share/doc/kernel-doc-5.15.12-200/Documentation

$ grep -r 'ACPI S0'
output/_sources/power/pci.rst.txt:(ACPI S0), they should be translated into interrupts so that the kernel can
output/_sources/power/pci.rst.txt:state (ACPI S0) and in that case the system's core logic generates a System
output/_sources/power/pci.rst.txt:S1-S3, into the working state (ACPI S0), the phases are:
output/power/pci.html:(ACPI S0), they should be translated into interrupts so that the kernel can
output/power/pci.html:state (ACPI S0) and in that case the system’s core logic generates a System
output/power/pci.html:S1-S3, into the working state (ACPI S0), the phases are:</p>
power/pci.rst:(ACPI S0), they should be translated into interrupts so that the kernel can
power/pci.rst:state (ACPI S0) and in that case the system's core logic generates a System
power/pci.rst:S1-S3, into the working state (ACPI S0), the phases are:

Searching online kernel menu by "PCI Power Management", I found the following document.

https://www.kernel.org/doc/html/v5.15/power/pci.html#acpi-device-power-management

ACPI defines four system sleep states, S1, S2, S3, and S4, and denotes the system working state as S0. In general, the target system sleep (or working) state determines the highest power (lowest number) state the device can be put into and the kernel is supposed to obtain this information by executing the device’s _SxD control method (where x is a number between 0 and 4 inclusive). If the device is required to wake up the system from the target sleep state, the lowest power (highest number) state it can be put into is also determined by the target state of the system.

The sleep status S4 can see in the hibernation. https://www.kernel.org/doc/html/v5.15/power/pci.html#system-hibernation

After saving the image, devices need to be powered down before the system can enter the target sleep state (ACPI S4 for ACPI-based systems).

https://www.kernel.org/doc/html/v5.15/admin-guide/pm/sleep-states.html#hibernation

Once the snapshot image has been written out, the system may either enter a special low-power state (like ACPI S4), or it may simply power down itself.