sleep: add SleepMemMode= setting for configuring /sys/power/mem_sleep

The setting is used when /sys/power/state is set to 'mem'
(common for suspend) or /sys/power/disk is set to 'suspend'
(hybrid-sleep). We default to kernel choice here, i.e.
respect what's set through 'mem_sleep_default=' kernel
cmdline option.
This commit is contained in:
Mike Yuan
2024-03-28 17:19:35 +08:00
parent b786128322
commit a2124b35e9
5 changed files with 54 additions and 1 deletions
+6
View File
@@ -237,6 +237,12 @@ static int execute(
if (state_fd < 0)
return log_error_errno(errno, "Failed to open /sys/power/state: %m");
if (SLEEP_NEEDS_MEM_SLEEP(sleep_config, operation)) {
r = write_mode("/sys/power/mem_sleep", sleep_config->mem_modes);
if (r < 0)
return log_error_errno(r, "Failed to write mode to /sys/power/mem_sleep: %m");
}
/* Configure hibernation settings if we are supposed to hibernate */
if (SLEEP_OPERATION_IS_HIBERNATION(operation)) {
_cleanup_(hibernation_device_done) HibernationDevice hibernation_device = {};
+1
View File
@@ -23,5 +23,6 @@
#AllowHybridSleep=yes
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#SleepMemMode=
#HibernateDelaySec=
#SuspendEstimationSec=60min