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 PM 14 bool "System Power Management" 15 depends on SYS_CLOCK_EXISTS && HAS_PM 16 help 17 This option enables the board to implement extra power management 18 policies whenever the kernel becomes idle. The kernel informs the 19 power management subsystem of the number of ticks until the next kernel 20 timer is due to expire. 21 22rsource "policy/Kconfig" 23 24if PM 25 26module = PM 27module-str = System Power Management 28source "subsys/logging/Kconfig.template.log_config" 29 30config PM_STATS 31 bool "System Power Management Stats" 32 depends on STATS 33 help 34 Enable System Power Management Stats. 35 36config PM_S2RAM 37 bool "Suspend-to-RAM (S2RAM)" 38 depends on ARCH_HAS_SUSPEND_TO_RAM 39 help 40 This option enables suspend-to-RAM (S2RAM). 41 When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel 42 'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c) 43 is placed in linker section given by 'zephyr,memory-region' property of aforementioned node. 44 45config PM_S2RAM_CUSTOM_MARKING 46 bool "Use custom marking functions" 47 depends on PM_S2RAM 48 help 49 By default a magic word in RAM is used to mark entering suspend-to-RAM. Enabling 50 this option allows custom implementation of functions which handle the marking. 51 52config PM_NEED_ALL_DEVICES_IDLE 53 bool "System Low Power Mode Needs All Devices Idle" 54 depends on PM_DEVICE && !SMP 55 help 56 When this option is enabled, check that no devices are busy before 57 entering into system low power mode. 58 59choice PM_PREWAKEUP_CONV_MODE 60 prompt "Pre-wakeup microseconds to ticks conversion method" 61 default PM_PREWAKEUP_CONV_MODE_NEAR 62 help 63 Exit latency for each power state is given in microseconds. It is converted 64 to ticks and system clock is set to wake up the core earlier before scheduled 65 wake up. This option specifies rounding that is used when converting exit 66 latency from microseconds to system ticks. 67 68config PM_PREWAKEUP_CONV_MODE_NEAR 69 bool "Nearest" 70 71config PM_PREWAKEUP_CONV_MODE_CEIL 72 bool "Round up" 73 74config PM_PREWAKEUP_CONV_MODE_FLOOR 75 bool "Round down" 76 77endchoice 78 79endif # PM 80 81config PM_DEVICE 82 bool "Device Power Management" 83 help 84 This option enables the device power management interface. The 85 interface implemented by device drivers are called by the power 86 management subsystem. This allows device drivers to do any 87 necessary power management operations like turning off 88 device clocks and peripherals. Device drivers may also save 89 and restore states in these hook functions. 90 91if PM_DEVICE 92 93module = PM_DEVICE 94module-str = Device Power Management 95source "subsys/logging/Kconfig.template.log_config" 96 97config PM_DEVICE_POWER_DOMAIN 98 bool "Power domain" 99 depends on PM_DEVICE 100 default y 101 help 102 Enable support for Power Domain. With power domain enabled, 103 devices that depend on a domain will be notified when this 104 domain is suspended or resumed. 105 106config PM_DEVICE_POWER_DOMAIN_DYNAMIC 107 bool "Dynamically bind devices to a Power Domain" 108 depends on PM_DEVICE_POWER_DOMAIN && DEVICE_DEPS_DYNAMIC 109 help 110 Enable support for dynamically bind devices to a Power Domain. 111 112config PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM 113 int "Number of devices that can dynamically be bind to a Power Domain" 114 depends on PM_DEVICE_POWER_DOMAIN_DYNAMIC 115 default 1 116 help 117 The number of devices that can dynamically be bind to a Power Domain. 118 119config PM_DEVICE_RUNTIME 120 bool "Runtime Device Power Management" 121 select EVENTS 122 help 123 Enable Runtime Power Management to save power. With device runtime PM 124 enabled, devices can be suspended or resumed based on the device 125 usage even while the CPU or system is running. 126 127if PM_DEVICE_RUNTIME 128 129config PM_DEVICE_DRIVER_NEEDS_DEDICATED_WQ 130 bool 131 132config PM_DEVICE_RUNTIME_ASYNC 133 bool "Asynchronous device runtime power management" 134 default y 135 help 136 Use this option to enable support for asynchronous operation 137 in the power management device runtime. 138 139if PM_DEVICE_RUNTIME_ASYNC 140 141choice PM_DEVICE_RUNTIME_WQ 142 prompt "Work queue to be used by pm device runtime async" 143 default PM_DEVICE_RUNTIME_USE_DEDICATED_WQ if PM_DEVICE_DRIVER_NEEDS_DEDICATED_WQ 144 default PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 145 146config PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 147 bool "Use the system workqueue" 148 help 149 When this option is enabled the power management subsystem will 150 use the system workqueue instead of defining its own queue. 151 152config PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 153 bool "Use a dedicated workqueue" 154 help 155 When this option is enabled the power management subsystem will 156 use a dedicated workqueue instead of the system work queue. 157 158if PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 159config PM_DEVICE_RUNTIME_DEDICATED_WQ_STACK_SIZE 160 int "Stack size for pm runtime async workqueue" 161 default 1024 162 help 163 Defines the size of the stack on the workqueue used for 164 async operations. 165 166config PM_DEVICE_RUNTIME_DEDICATED_WQ_PRIO 167 int "PM device runtime workqueue priority. Should be pre-emptible." 168 default SYSTEM_WORKQUEUE_PRIORITY if PM_DEVICE_RUNTIME_USE_SYSTEM_WQ 169 default 0 170 171config PM_DEVICE_RUNTIME_DEDICATED_WQ_INIT_PRIO 172 int "PM device runtime workqueue init priority" 173 default 50 174 help 175 Init priority level to setup the device runtime workqueue. 176endif #PM_DEVICE_RUNTIME_USE_DEDICATED_WQ 177endchoice 178 179endif # PM_DEVICE_RUNTIME_ASYNC 180endif # PM_DEVICE_RUNTIME 181 182config PM_DEVICE_SHELL 183 bool "Device Power Management shell" 184 depends on SHELL 185 help 186 Enable the device power management shell, for triggering device power 187 management events through the shell interface. 188 189config PM_DEVICE_SYSTEM_MANAGED 190 bool "System-Managed Device Power Management" 191 default y if !PM_DEVICE_RUNTIME 192 help 193 This option enables the system-managed device power 194 management. The power management subsystem will suspend 195 devices before entering a low power state. Conversely, after 196 the core wakes up from low power mode all suspended devices 197 are resumed. 198 199 200endif # PM_DEVICE 201 202endmenu 203