1# Copyright (c) 2014-2015 Wind River Systems, Inc. 2# Copyright (c) 2016 Intel Corporation 3# SPDX-License-Identifier: Apache-2.0 4 5menu "Power Management" 6 7config HAS_PM 8 bool 9 help 10 This option must be selected by SoCs that provide PM hooks, that is, 11 calls to configure low-power states. 12 13config HAS_PM_S2RAM_CUSTOM_MARKING 14 bool 15 depends on HAS_PM 16 help 17 By default a magic word in RAM is used to mark entering suspend-to-RAM. If this 18 option is selected, a custom implementation of functions which handle the marking 19 must be provided. 20 21config PM 22 bool "System Power Management" 23 depends on SYS_CLOCK_EXISTS && HAS_PM 24 help 25 This option enables the board to implement extra power management 26 policies whenever the kernel becomes idle. The kernel informs the 27 power management subsystem of the number of ticks until the next kernel 28 timer is due to expire. 29 30rsource "policy/Kconfig" 31 32if PM 33 34module = PM 35module-str = System Power Management 36source "subsys/logging/Kconfig.template.log_config" 37 38config PM_STATS 39 bool "System Power Management Stats" 40 depends on STATS 41 help 42 Enable System Power Management Stats. 43 44DT_POWER_STATE_COMPAT := zephyr,power-state 45 46config PM_S2RAM 47 bool 48 default y 49 depends on ARCH_HAS_SUSPEND_TO_RAM 50 depends on $(dt_compat_any_has_prop,$(DT_POWER_STATE_COMPAT),power-state-name,suspend-to-ram) 51 help 52 This option enables the SoC specific implementations of suspend-to-ram (S2RAM) 53 sleep states if PM is enabled and one or more suspend-to-ram sleep states are 54 enabled in the devicetree. 55 56config PM_NEED_ALL_DEVICES_IDLE 57 bool "System Low Power Mode Needs All Devices Idle" 58 depends on PM_DEVICE && !SMP 59 help 60 When this option is enabled, check that no devices are busy before 61 entering into system low power mode. 62 63choice PM_PREWAKEUP_CONV_MODE 64 prompt "Pre-wakeup microseconds to ticks conversion method" 65 default PM_PREWAKEUP_CONV_MODE_NEAR 66 help 67 Exit latency for each power state is given in microseconds. It is converted 68 to ticks and system clock is set to wake up the core earlier before scheduled 69 wake up. This option specifies rounding that is used when converting exit 70 latency from microseconds to system ticks. 71 72config PM_PREWAKEUP_CONV_MODE_NEAR 73 bool "Nearest" 74 75config PM_PREWAKEUP_CONV_MODE_CEIL 76 bool "Round up" 77 78config PM_PREWAKEUP_CONV_MODE_FLOOR 79 bool "Round down" 80 81endchoice 82 83endif # PM 84 85config PM_DEVICE 86 bool "Device Power Management" 87 help 88 This option enables the device power management interface. The 89 interface implemented by device drivers are called by the power 90 management subsystem. This allows device drivers to do any 91 necessary power management operations like turning off 92 device clocks and peripherals. Device drivers may also save 93 and restore states in these hook functions. 94 95if PM_DEVICE 96 97module = PM_DEVICE 98module-str = Device Power Management 99source "subsys/logging/Kconfig.template.log_config" 100 101config PM_DEVICE_POWER_DOMAIN 102 bool "Power domain" 103 depends on PM_DEVICE 104 default y 105 help 106 Enable support for Power Domain. With power domain enabled, 107 devices that depend on a domain will be notified when this 108 domain is suspended or resumed. 109 110config PM_DEVICE_POWER_DOMAIN_DYNAMIC 111 bool "Dynamically bind devices to a Power Domain" 112 depends on PM_DEVICE_POWER_DOMAIN && DEVICE_DEPS_DYNAMIC 113 help 114 Enable support for dynamically bind devices to a Power Domain. 115 116config PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM 117 int "Number of devices that can dynamically be bind to a Power Domain" 118 depends on PM_DEVICE_POWER_DOMAIN_DYNAMIC 119 default 1 120 help 121 The number of devices that can dynamically be bind to a Power Domain. 122 123config PM_DEVICE_RUNTIME 124 bool "Runtime Device Power Management" 125 help 126 Enable Runtime Power Management to save power. With device runtime PM 127 enabled, devices can be suspended or resumed based on the device 128 usage even while the CPU or system is running. 129 130if PM_DEVICE_RUNTIME 131 132config PM_DEVICE_DRIVER_NEEDS_DEDICATED_WQ 133 bool 134 135config PM_DEVICE_RUNTIME_ASYNC 136 bool "Asynchronous device runtime power management" 137 select EVENTS 138 default y 139 help 140 Use this option to enable support for asynchronous operation 141 in the power management device runtime. 142 143if PM_DEVICE_RUNTIME_ASYNC 144 145choice PM_DEVICE_RUNTIME_WQ 146 prompt "Work queue to be used by pm device runtime async" 147 default PM_DEVICE_RUNTIME_USE_DEDICATED_WQ if PM_DEVICE_DRIVER_NEEDS_DEDICATED_WQ 148 default PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 149 150config PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 151 bool "Use the system workqueue" 152 help 153 When this option is enabled the power management subsystem will 154 use the system workqueue instead of defining its own queue. 155 156config PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 157 bool "Use a dedicated workqueue" 158 help 159 When this option is enabled the power management subsystem will 160 use a dedicated workqueue instead of the system work queue. 161 162if PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 163config PM_DEVICE_RUNTIME_DEDICATED_WQ_STACK_SIZE 164 int "Stack size for pm runtime async workqueue" 165 default 1024 166 help 167 Defines the size of the stack on the workqueue used for 168 async operations. 169 170config PM_DEVICE_RUNTIME_DEDICATED_WQ_PRIO 171 int "PM device runtime workqueue priority. Should be pre-emptible." 172 default SYSTEM_WORKQUEUE_PRIORITY if PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 173 default 0 174 175config PM_DEVICE_RUNTIME_DEDICATED_WQ_INIT_PRIO 176 int "PM device runtime workqueue init priority" 177 default 50 178 help 179 Init priority level to setup the device runtime workqueue. 180endif #PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 181endchoice 182 183endif # PM_DEVICE_RUNTIME_ASYNC 184 185config PM_DEVICE_RUNTIME_DEFAULT_ENABLE 186 bool "PM device runtime enable by default" 187 help 188 Enable PM device runtime by default for all devices when they are 189 initialized. This option is identical to adding the devicetree 190 property zephyr,pm-device-runtime-auto to all nodes in the 191 devicetree. 192 193endif # PM_DEVICE_RUNTIME 194 195config PM_DEVICE_SHELL 196 bool "Device Power Management shell" 197 depends on SHELL 198 help 199 Enable the device power management shell, for triggering device power 200 management events through the shell interface. 201 202config PM_DEVICE_SYSTEM_MANAGED 203 bool "System-Managed Device Power Management" 204 default y if !PM_DEVICE_RUNTIME 205 help 206 This option enables the system-managed device power 207 management. The power management subsystem will suspend 208 devices before entering a low power state. Conversely, after 209 the core wakes up from low power mode all suspended devices 210 are resumed. 211 212 213endif # PM_DEVICE 214 215config PM_CPU_SHELL 216 bool "CPU Power Management shell" 217 depends on SHELL 218 help 219 Enable the cpu power management shell, for triggering cpu power 220 management events through the shell interface. 221 The shell allows: 222 - listing supported CPU low power states from devicetree; 223 - checking whether states are currently available; 224 - idling the shell thread so the system naturally enters low power; 225 226endmenu 227