diff --git a/include/zephyr/pm/pm.h b/include/zephyr/pm/pm.h index 09138bf1871..5c552947221 100644 --- a/include/zephyr/pm/pm.h +++ b/include/zephyr/pm/pm.h @@ -116,6 +116,10 @@ int pm_notifier_unregister(struct pm_notifier *notifier); */ const struct pm_state_info *pm_state_next_get(uint8_t cpu); +/** @cond INTERNAL_HIDDEN */ +void z_pm_save_idle_exit(void); +/** @endcond */ + /** * @} */ @@ -175,10 +179,11 @@ static inline const struct pm_state_info *pm_state_next_get(uint8_t cpu) return NULL; } +static inline void z_pm_save_idle_exit(void) +{ +} #endif /* CONFIG_PM */ -void z_pm_save_idle_exit(void); - #ifdef __cplusplus } #endif diff --git a/kernel/idle.c b/kernel/idle.c index bef193aa8e8..62ff84e4c88 100644 --- a/kernel/idle.c +++ b/kernel/idle.c @@ -18,21 +18,6 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -void z_pm_save_idle_exit(void) -{ -#ifdef CONFIG_PM - /* Some CPU low power states require notification at the ISR - * to allow any operations that needs to be done before kernel - * switches task or processes nested interrupts. - * This can be simply ignored if not required. - */ - pm_system_resume(); -#endif /* CONFIG_PM */ -#ifdef CONFIG_SYS_CLOCK_EXISTS - sys_clock_idle_exit(); -#endif /* CONFIG_SYS_CLOCK_EXISTS */ -} - void idle(void *unused1, void *unused2, void *unused3) { ARG_UNUSED(unused1); diff --git a/subsys/pm/pm.c b/subsys/pm/pm.c index bb586073fcb..7389f963db6 100644 --- a/subsys/pm/pm.c +++ b/subsys/pm/pm.c @@ -280,3 +280,16 @@ const struct pm_state_info *pm_state_next_get(uint8_t cpu) { return &z_cpus_pm_state[cpu]; } + +void z_pm_save_idle_exit(void) +{ + /* Some CPU low power states require notification at the ISR + * to allow any operations that needs to be done before kernel + * switches task or processes nested interrupts. + * This can be simply ignored if not required. + */ + pm_system_resume(); +#ifdef CONFIG_SYS_CLOCK_EXISTS + sys_clock_idle_exit(); +#endif /* CONFIG_SYS_CLOCK_EXISTS */ +}