Skip to content

Commit c81d242

Browse files
MarekPietapdunaj
authored andcommitted
caf: power_manager: Use sys_poweroff API on nRF54H20
The `pm_state_force` should not be used to enter `PM_STATE_SOFT_OFF`. We need to use `sys_poweroff` API instead. Jira: NCSDK-31683 Signed-off-by: Marek Pieta <[email protected]>
1 parent 1d59812 commit c81d242

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

subsys/caf/modules/Kconfig.power_manager

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ config CAF_POWER_MANAGER
1717
Enable power management, which will put the device to low-power mode
1818
if it is idle.
1919

20+
The sys_poweroff API is not yet fully supported on nRF54H SoC Series.
21+
Because of that, it's not enabled by default for now.
22+
2023
if CAF_POWER_MANAGER
2124

2225
config CAF_POWER_MANAGER_STAY_ON
23-
bool "Stay on while no connections"
24-
depends on PM || POWEROFF
26+
bool "Stay on while no connections" if POWEROFF
27+
default y if !POWEROFF
2528
help
2629
If disabled the device will switch SoC to OFF mode after power
2730
manager timeout is done. If enabled the device will stay on

subsys/caf/modules/power_manager.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#endif
1414
#include <zephyr/sys/reboot.h>
1515
#include <zephyr/sys/poweroff.h>
16-
#include <zephyr/pm/pm.h>
1716

1817
#include <app_event_manager.h>
1918
#include <nrf_profiler.h>
@@ -149,18 +148,9 @@ static void system_off_post_action(void)
149148
/* Ensure that logs are displayed. */
150149
LOG_PANIC();
151150

152-
/* You shouldn't enable CONFIG_POWEROFF and CONFIG_PM simultaneously */
153-
BUILD_ASSERT(!(IS_ENABLED(CONFIG_POWEROFF) && IS_ENABLED(CONFIG_PM)),
154-
"CAF Power Manager uses either power off or power management, but never both");
155-
156-
#if CONFIG_PM
157-
(void)pm_state_force(0u, &(struct pm_state_info){.state = PM_STATE_SOFT_OFF,
158-
.substate_id = 0,
159-
.min_residency_us = 0,
160-
.exit_latency_us = 0 });
161-
#elif CONFIG_POWEROFF
151+
if (IS_ENABLED(CONFIG_POWEROFF)) {
162152
sys_poweroff();
163-
#endif
153+
}
164154
}
165155

166156
static void submit_power_off_event(bool error)

0 commit comments

Comments
 (0)