1# SPDX-License-Identifier: GPL-2.0-only 2config SUSPEND 3 bool "Suspend to RAM and standby" 4 depends on ARCH_SUSPEND_POSSIBLE 5 default y 6 help 7 Allow the system to enter sleep states in which main memory is 8 powered and thus its contents are preserved, such as the 9 suspend-to-RAM state (e.g. the ACPI S3 state). 10 11config SUSPEND_FREEZER 12 bool "Enable freezer for suspend to RAM/standby" \ 13 if ARCH_WANTS_FREEZER_CONTROL || BROKEN 14 depends on SUSPEND 15 default y 16 help 17 This allows you to turn off the freezer for suspend. If this is 18 done, no tasks are frozen for suspend to RAM/standby. 19 20 Turning OFF this setting is NOT recommended! If in doubt, say Y. 21 22config SUSPEND_SKIP_SYNC 23 bool "Skip kernel's sys_sync() on suspend to RAM/standby" 24 depends on SUSPEND 25 depends on EXPERT 26 help 27 Skip the kernel sys_sync() before freezing user processes. 28 Some systems prefer not to pay this cost on every invocation 29 of suspend, or they are content with invoking sync() from 30 user-space before invoking suspend. There's a run-time switch 31 at '/sys/power/sync_on_suspend' to configure this behaviour. 32 This setting changes the default for the run-tim switch. Say Y 33 to change the default to disable the kernel sys_sync(). 34 35config HIBERNATE_CALLBACKS 36 bool 37 38config HIBERNATION 39 bool "Hibernation (aka 'suspend to disk')" 40 depends on SWAP && ARCH_HIBERNATION_POSSIBLE 41 select HIBERNATE_CALLBACKS 42 select CRC32 43 select CRYPTO 44 select CRYPTO_LZO 45 select CRYPTO_LZ4 46 help 47 Enable the suspend to disk (STD) functionality, which is usually 48 called "hibernation" in user interfaces. STD checkpoints the 49 system and powers it off; and restores that checkpoint on reboot. 50 51 You can suspend your machine with 'echo disk > /sys/power/state' 52 after placing resume=/dev/swappartition on the kernel command line 53 in your bootloader's configuration file. 54 55 Alternatively, you can use the additional userland tools available 56 from <http://suspend.sf.net>. 57 58 In principle it does not require ACPI or APM, although for example 59 ACPI will be used for the final steps when it is available. One 60 of the reasons to use software suspend is that the firmware hooks 61 for suspend states like suspend-to-RAM (STR) often don't work very 62 well with Linux. 63 64 It creates an image which is saved in your active swap. Upon the next 65 boot, pass the 'resume=/dev/swappartition' argument to the kernel to 66 have it detect the saved image, restore memory state from it, and 67 continue to run as before. If you do not want the previous state to 68 be reloaded, then use the 'noresume' kernel command line argument. 69 Note, however, that fsck will be run on your filesystems and you will 70 need to run mkswap against the swap partition used for the suspend. 71 72 It also works with swap files to a limited extent (for details see 73 <file:Documentation/power/swsusp-and-swap-files.rst>). 74 75 Right now you may boot without resuming and resume later but in the 76 meantime you cannot use the swap partition(s)/file(s) involved in 77 suspending. Also in this case you must not use the filesystems 78 that were mounted before the suspend. In particular, you MUST NOT 79 MOUNT any journaled filesystems mounted before the suspend or they 80 will get corrupted in a nasty way. 81 82 For more information take a look at <file:Documentation/power/swsusp.rst>. 83 84config HIBERNATION_SNAPSHOT_DEV 85 bool "Userspace snapshot device" 86 depends on HIBERNATION 87 default y 88 help 89 Device used by the uswsusp tools. 90 91 Say N if no snapshotting from userspace is needed, this also 92 reduces the attack surface of the kernel. 93 94 If in doubt, say Y. 95 96choice 97 prompt "Default compressor" 98 default HIBERNATION_COMP_LZO 99 depends on HIBERNATION 100 101config HIBERNATION_COMP_LZO 102 bool "lzo" 103 depends on CRYPTO_LZO 104 105config HIBERNATION_COMP_LZ4 106 bool "lz4" 107 depends on CRYPTO_LZ4 108 109endchoice 110 111config HIBERNATION_DEF_COMP 112 string 113 default "lzo" if HIBERNATION_COMP_LZO 114 default "lz4" if HIBERNATION_COMP_LZ4 115 help 116 Default compressor to be used for hibernation. 117 118config PM_STD_PARTITION 119 string "Default resume partition" 120 depends on HIBERNATION 121 default "" 122 help 123 The default resume partition is the partition that the suspend- 124 to-disk implementation will look for a suspended disk image. 125 126 The partition specified here will be different for almost every user. 127 It should be a valid swap partition (at least for now) that is turned 128 on before suspending. 129 130 The partition specified can be overridden by specifying: 131 132 resume=/dev/<other device> 133 134 which will set the resume partition to the device specified. 135 136 Note there is currently not a way to specify which device to save the 137 suspended image to. It will simply pick the first available swap 138 device. 139 140config PM_SLEEP 141 def_bool y 142 depends on SUSPEND || HIBERNATE_CALLBACKS 143 select PM 144 145config PM_SLEEP_SMP 146 def_bool y 147 depends on SMP 148 depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE 149 depends on PM_SLEEP 150 select HOTPLUG_CPU 151 152config PM_SLEEP_SMP_NONZERO_CPU 153 def_bool y 154 depends on PM_SLEEP_SMP 155 depends on ARCH_SUSPEND_NONZERO_CPU 156 help 157 If an arch can suspend (for suspend, hibernate, kexec, etc) on a 158 non-zero numbered CPU, it may define ARCH_SUSPEND_NONZERO_CPU. This 159 will allow nohz_full mask to include CPU0. 160 161config PM_AUTOSLEEP 162 bool "Opportunistic sleep" 163 depends on PM_SLEEP 164 help 165 Allow the kernel to trigger a system transition into a global sleep 166 state automatically whenever there are no active wakeup sources. 167 168config PM_USERSPACE_AUTOSLEEP 169 bool "Userspace opportunistic sleep" 170 depends on PM_SLEEP 171 help 172 Notify kernel of aggressive userspace autosleep power management policy. 173 174 This option changes the behavior of various sleep-sensitive code to deal 175 with frequent userspace-initiated transitions into a global sleep state. 176 177 Saying Y here, disables code paths that most users really should keep 178 enabled. In particular, only enable this if it is very common to be 179 asleep/awake for very short periods of time (<= 2 seconds). 180 181 Only platforms, such as Android, that implement opportunistic sleep from 182 a userspace power manager service should enable this option; and not 183 other machines. Therefore, you should say N here, unless you are 184 extremely certain that this is what you want. The option otherwise has 185 bad, undesirable effects, and should not be enabled just for fun. 186 187 188config PM_WAKELOCKS 189 bool "User space wakeup sources interface" 190 depends on PM_SLEEP 191 help 192 Allow user space to create, activate and deactivate wakeup source 193 objects with the help of a sysfs-based interface. 194 195config PM_WAKELOCKS_LIMIT 196 int "Maximum number of user space wakeup sources (0 = no limit)" 197 range 0 100000 198 default 100 199 depends on PM_WAKELOCKS 200 201config PM_WAKELOCKS_GC 202 bool "Garbage collector for user space wakeup sources" 203 depends on PM_WAKELOCKS 204 default y 205 206config PM_QOS_CPU_SYSTEM_WAKEUP 207 bool "User space interface for CPU system wakeup QoS" 208 depends on CPU_IDLE 209 help 210 Enable this to allow user space via the cpu_wakeup_latency file to 211 specify a CPU system wakeup latency limit. 212 213 This may be particularly useful for platforms supporting multiple low 214 power states for CPUs during system-wide suspend and s2idle in 215 particular. 216 217config PM 218 bool "Device power management core functionality" 219 help 220 Enable functionality allowing I/O devices to be put into energy-saving 221 (low power) states, for example after a specified period of inactivity 222 (autosuspended), and woken up in response to a hardware-generated 223 wake-up event or a driver's request. 224 225 Hardware support is generally required for this functionality to work 226 and the bus type drivers of the buses the devices are on are 227 responsible for the actual handling of device suspend requests and 228 wake-up events. 229 230config PM_DEBUG 231 bool "Power Management Debug Support" 232 depends on PM 233 help 234 This option enables various debugging support in the Power Management 235 code. This is helpful when debugging and reporting PM bugs, like 236 suspend support. 237 238config PM_ADVANCED_DEBUG 239 bool "Extra PM attributes in sysfs for low-level debugging/testing" 240 depends on PM_DEBUG 241 help 242 Add extra sysfs attributes allowing one to access some Power Management 243 fields of device objects from user space. If you are not a kernel 244 developer interested in debugging/testing Power Management, say "no". 245 246config PM_TEST_SUSPEND 247 bool "Test suspend/resume and wakealarm during bootup" 248 depends on SUSPEND && PM_DEBUG && RTC_CLASS=y 249 help 250 This option will let you suspend your machine during bootup, and 251 make it wake up a few seconds later using an RTC wakeup alarm. 252 Enable this with a kernel parameter like "test_suspend=mem". 253 254 You probably want to have your system's RTC driver statically 255 linked, ensuring that it's available when this test runs. 256 257config PM_SLEEP_DEBUG 258 def_bool y 259 depends on PM_DEBUG && PM_SLEEP 260 261config DPM_WATCHDOG 262 bool "Device suspend/resume watchdog" 263 depends on PM_DEBUG && PSTORE && EXPERT 264 help 265 Sets up a watchdog timer to capture drivers that are 266 locked up attempting to suspend/resume a device. 267 A detected lockup causes system panic with message 268 captured in pstore device for inspection in subsequent 269 boot session. 270 271config DPM_WATCHDOG_TIMEOUT 272 int "Watchdog timeout to panic in seconds" 273 range 1 120 274 default 120 275 depends on DPM_WATCHDOG 276 277config DPM_WATCHDOG_WARNING_TIMEOUT 278 int "Watchdog timeout to warn in seconds" 279 range 1 DPM_WATCHDOG_TIMEOUT 280 default DPM_WATCHDOG_TIMEOUT 281 depends on DPM_WATCHDOG 282 help 283 If the DPM watchdog warning timeout and main timeout are 284 different then a non-fatal warning (with a stack trace of 285 the stuck suspend routine) will be printed when the warning 286 timeout expires. If the suspend routine gets un-stuck 287 before the main timeout expires then no other action is 288 taken. If the routine continues to be stuck and the main 289 timeout expires then an emergency-level message and stack 290 trace will be printed and the system will panic. 291 292 If the warning timeout is equal to the main timeout (the 293 default) then the warning will never happen and the system 294 will jump straight to panic when the main timeout expires. 295 296config PM_TRACE 297 bool 298 help 299 This enables code to save the last PM event point across 300 reboot. The architecture needs to support this, x86 for 301 example does by saving things in the RTC, see below. 302 303 The architecture specific code must provide the extern 304 functions from <linux/resume-trace.h> as well as the 305 <asm/resume-trace.h> header with a TRACE_RESUME() macro. 306 307 The way the information is presented is architecture- 308 dependent, x86 will print the information during a 309 late_initcall. 310 311config PM_TRACE_RTC 312 bool "Suspend/resume event tracing" 313 depends on PM_SLEEP_DEBUG 314 depends on X86 315 select PM_TRACE 316 help 317 This enables some cheesy code to save the last PM event point in the 318 RTC across reboots, so that you can debug a machine that just hangs 319 during suspend (or more commonly, during resume). 320 321 To use this debugging feature you should attempt to suspend the 322 machine, reboot it and then run 323 324 dmesg -s 1000000 | grep 'hash matches' 325 326 CAUTION: this option will cause your machine's real-time clock to be 327 set to an invalid time after a resume. 328 329config APM_EMULATION 330 tristate "Advanced Power Management Emulation" 331 depends on SYS_SUPPORTS_APM_EMULATION 332 help 333 APM is a BIOS specification for saving power using several different 334 techniques. This is mostly useful for battery powered laptops with 335 APM compliant BIOSes. If you say Y here, the system time will be 336 reset after a RESUME operation, the /proc/apm device will provide 337 battery status information, and user-space programs will receive 338 notification of APM "events" (e.g. battery status change). 339 340 In order to use APM, you will need supporting software. For location 341 and more information, read <file:Documentation/power/apm-acpi.rst> 342 and the Battery Powered Linux mini-HOWTO, available from 343 <http://www.tldp.org/docs.html#howto>. 344 345 This driver does not spin down disk drives (see the hdparm(8) 346 manpage ("man 8 hdparm") for that), and it doesn't turn off 347 VESA-compliant "green" monitors. 348 349 Generally, if you don't have a battery in your machine, there isn't 350 much point in using this driver and you should say N. If you get 351 random kernel OOPSes or reboots that don't seem to be related to 352 anything, try disabling/enabling this option (or disabling/enabling 353 APM in your BIOS). 354 355config PM_CLK 356 def_bool y 357 depends on PM && HAVE_CLK 358 359config PM_GENERIC_DOMAINS 360 bool 361 depends on PM 362 363config WQ_POWER_EFFICIENT_DEFAULT 364 bool "Enable workqueue power-efficient mode by default" 365 depends on PM 366 help 367 Per-cpu workqueues are generally preferred because they show 368 better performance thanks to cache locality; unfortunately, 369 per-cpu workqueues tend to be more power hungry than unbound 370 workqueues. 371 372 Enabling workqueue.power_efficient kernel parameter makes the 373 per-cpu workqueues which were observed to contribute 374 significantly to power consumption unbound, leading to measurably 375 lower power usage at the cost of small performance overhead. 376 377 This config option determines whether workqueue.power_efficient 378 is enabled by default. 379 380 If in doubt, say N. 381 382config PM_GENERIC_DOMAINS_SLEEP 383 def_bool y 384 depends on PM_SLEEP && PM_GENERIC_DOMAINS 385 386config PM_GENERIC_DOMAINS_OF 387 def_bool y 388 depends on PM_GENERIC_DOMAINS && OF 389 390config CPU_PM 391 bool 392 393config ENERGY_MODEL 394 bool "Energy Model for devices with DVFS (CPUs, GPUs, etc)" 395 depends on CPU_FREQ || PM_DEVFREQ 396 help 397 Several subsystems (thermal and/or the task scheduler for example) 398 can leverage information about the energy consumed by devices to 399 make smarter decisions. This config option enables the framework 400 from which subsystems can access the energy models. 401 402 The exact usage of the energy model is subsystem-dependent. 403 404 If in doubt, say N. 405