Skip to content

Commit c828b62

Browse files
bjarki-andreasennordic-segl
authored andcommitted
[nrf fromtree] pm: bind the PM_S2RAM kconfig option to devicetree
Currently it is possible to have an enabled (status="okay") "suspend-to-ram" "zephyr,power-state" in the devicetree, CONFIG_PM=y, but CONFIG_PM_S2RAM=n This means the presence and state of the "suspend-to-ram" power state in the devicetree does not match the PM_S2RAM option, despite PM_S2RAM being dependent on the devicetree state. This commit makes the devicetree the "source of truth" for whether one or more s2ram power states shall be included and supported, by enabling PM_S2RAM if any s2ram power state with status "okay" is present in the devicetree. To disable the s2ram power state, like with any other state, disable it by setting its state to "disabled". The help of the now promptless PM_S2RAM config has been updated to reflect the new meaning. It previously held cortex-m specific implementation details, these have been removed as these details are already present in the file pointed to as well (arch/arm/core/cortex_m/pm_s2ram.c line 22) Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit 4626f6b)
1 parent 3a3b437 commit c828b62

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

samples/boards/nordic/spis_wakeup/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ CONFIG_SPI_SLAVE=y
33
CONFIG_GPIO=y
44

55
CONFIG_PM=y
6-
CONFIG_PM_S2RAM=y
76
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
87
CONFIG_PM_DEVICE=y
98
CONFIG_PM_DEVICE_RUNTIME=y

samples/boards/nordic/spis_wakeup/wakeup_trigger/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ CONFIG_SPI_NRFX_WAKE_TIMEOUT_US=500
33
CONFIG_GPIO=y
44

55
CONFIG_PM=y
6-
CONFIG_PM_S2RAM=y
76
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
87
CONFIG_PM_DEVICE=y
98
CONFIG_PM_DEVICE_RUNTIME=y

samples/boards/st/power_mgmt/suspend_to_ram/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ CONFIG_PM=y
22
CONFIG_PM_DEVICE=y
33
CONFIG_PM_DEVICE_RUNTIME=y
44
CONFIG_PM_DEVICE_SYSTEM_MANAGED=y
5-
CONFIG_PM_S2RAM=y
65
CONFIG_ADC=y
76
CONFIG_ENTROPY_GENERATOR=y
87
CONFIG_SPI=y

subsys/pm/Kconfig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@ config PM_STATS
3333
help
3434
Enable System Power Management Stats.
3535

36+
DT_POWER_STATE_COMPAT := zephyr,power-state
37+
3638
config PM_S2RAM
37-
bool "Suspend-to-RAM (S2RAM)"
39+
bool
40+
default y
3841
depends on ARCH_HAS_SUSPEND_TO_RAM
42+
depends on $(dt_compat_any_has_prop,$(DT_POWER_STATE_COMPAT),power-state-name,suspend-to-ram)
3943
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+
This option enables the SoC specific implementations of suspend-to-ram (S2RAM)
45+
sleep states if PM is enabled and one or more suspend-to-ram sleep states are
46+
enabled in the devicetree.
4447

4548
config PM_S2RAM_CUSTOM_MARKING
4649
bool "Use custom marking functions"

0 commit comments

Comments
 (0)