From 5ca3bc92c8e00def6b071cc0f1cd6b831f362b38 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 30 Apr 2024 15:50:40 -0700 Subject: [PATCH] intel_adsp: power: SoC restores the clock The SoC restores the clock only when leaving soft-off only. Signed-off-by: Flavio Ceolin --- drivers/timer/intel_adsp_timer.c | 10 +++------- .../intel_adsp/ace/include/ace15_mtpm/adsp_power.h | 6 ++++++ .../intel_adsp/ace/include/ace20_lnl/adsp_power.h | 6 ++++++ soc/intel/intel_adsp/ace/power.c | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/timer/intel_adsp_timer.c b/drivers/timer/intel_adsp_timer.c index d1f37b123c2..2636e506bfe 100644 --- a/drivers/timer/intel_adsp_timer.c +++ b/drivers/timer/intel_adsp_timer.c @@ -212,7 +212,6 @@ void smp_timer_init(void) { } -/* Runs on core 0 only */ static int sys_clock_driver_init(void) { uint64_t curr = count(); @@ -224,14 +223,11 @@ static int sys_clock_driver_init(void) return 0; } -#ifdef CONFIG_PM - -void sys_clock_idle_exit(void) +/* Runs on core 0 only */ +void intel_adsp_clock_soft_off_exit(void) { - sys_clock_driver_init(); + (void)sys_clock_driver_init(); } -#endif - SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); diff --git a/soc/intel/intel_adsp/ace/include/ace15_mtpm/adsp_power.h b/soc/intel/intel_adsp/ace/include/ace15_mtpm/adsp_power.h index 4da0e07508c..b52ba820fd2 100644 --- a/soc/intel/intel_adsp/ace/include/ace15_mtpm/adsp_power.h +++ b/soc/intel/intel_adsp/ace/include/ace15_mtpm/adsp_power.h @@ -88,6 +88,12 @@ static ALWAYS_INLINE bool soc_cpu_is_powered(int cpu_num) return (ACE_PWRSTS->dsphpxpgs & BIT(cpu_num)) == BIT(cpu_num); } +/** + * @brief Restore timer after leaving soft-off. + * + */ +void intel_adsp_clock_soft_off_exit(void); + /** * @brief Retrieve node identifier for Intel ADSP HOST power domain. */ diff --git a/soc/intel/intel_adsp/ace/include/ace20_lnl/adsp_power.h b/soc/intel/intel_adsp/ace/include/ace20_lnl/adsp_power.h index d25ffba2ae3..7ad97c4c7d8 100644 --- a/soc/intel/intel_adsp/ace/include/ace20_lnl/adsp_power.h +++ b/soc/intel/intel_adsp/ace/include/ace20_lnl/adsp_power.h @@ -89,6 +89,12 @@ static ALWAYS_INLINE bool soc_cpu_is_powered(int cpu_num) return (ACE_PWRSTS->dsphpxpgs & BIT(cpu_num)) == BIT(cpu_num); } +/** + * @brief Restore timer after leaving soft-off. + * + */ +void intel_adsp_clock_soft_off_exit(void); + /** * @brief Retrieve node identifier for Intel ADSP HOST power domain. */ diff --git a/soc/intel/intel_adsp/ace/power.c b/soc/intel/intel_adsp/ace/power.c index 4dadb89378a..afc270f9afa 100644 --- a/soc/intel/intel_adsp/ace/power.c +++ b/soc/intel/intel_adsp/ace/power.c @@ -388,7 +388,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) imr_layout->imr_state.header.adsp_imr_magic = 0; imr_layout->imr_state.header.imr_restore_vector = NULL; imr_layout->imr_state.header.imr_ram_storage = NULL; - sys_clock_idle_exit(); + intel_adsp_clock_soft_off_exit(); mem_window_idle_exit(); soc_mp_on_d3_exit(); }