Skip to content

Commit f2db66c

Browse files
committed
[nrf fromtree] pm: policy: split policy APIs implementations
policy.c has grown organically, it contained many independent pieces of code. This patch splits each logical unit into its own C file, making it easier to browse the code. Signed-off-by: Gerard Marull-Paretas <[email protected]> (cherry picked from commit 6f4bb11)
1 parent e3aaf1a commit f2db66c

File tree

10 files changed

+546
-486
lines changed

10 files changed

+546
-486
lines changed

subsys/pm/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# SPDX-License-Identifier: Apache-2.0
22

33
if(CONFIG_PM)
4-
zephyr_sources(pm.c policy.c state.c)
4+
zephyr_sources(pm.c state.c)
55
zephyr_sources_ifdef(CONFIG_PM_STATS pm_stats.c)
66
endif()
77

8+
add_subdirectory(policy)
9+
810
zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c)
911
zephyr_sources_ifdef(CONFIG_PM_DEVICE_RUNTIME device_runtime.c)
1012
zephyr_sources_ifdef(CONFIG_PM_DEVICE_SHELL pm_shell.c)

subsys/pm/Kconfig

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ config PM
1919
power management subsystem of the number of ticks until the next kernel
2020
timer is due to expire.
2121

22+
rsource "policy/Kconfig"
23+
2224
if PM
2325

2426
module = PM
@@ -51,35 +53,6 @@ config PM_NEED_ALL_DEVICES_IDLE
5153
When this option is enabled, check that no devices are busy before
5254
entering into system low power mode.
5355

54-
choice PM_POLICY
55-
prompt "Idle State Power Management Policy"
56-
default PM_POLICY_DEFAULT
57-
help
58-
Select the idle state power management policy.
59-
60-
config PM_POLICY_DEFAULT
61-
bool "Default PM policy"
62-
help
63-
This option selects the default PM policy. Default policy is based
64-
on CPU residency times and other constraints imposed by the drivers or
65-
application.
66-
67-
config PM_POLICY_CUSTOM
68-
bool "Custom PM Policy"
69-
help
70-
This options allows applications to override the default policy with
71-
a custom implementation.
72-
73-
endchoice
74-
75-
config PM_POLICY_DEVICE_CONSTRAINTS
76-
bool "Power state constraints per device"
77-
help
78-
This option allows devices to have a list of power states
79-
that when the system transition to them, cause power loss in the device.
80-
This used to set and release power state constraints when
81-
it is needed by the device.
82-
8356
endif # PM
8457

8558
config PM_DEVICE

0 commit comments

Comments
 (0)