From e62bc59137cd7da911b6740b23e4cff121c440fb Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Fri, 22 Dec 2023 13:39:03 +0100 Subject: [PATCH] zephyr: ll-schedule: restore clock after idle in scheduler The adsp_clock_idle_exit function is invoked at the beginning of the scheduler thread function to reset the clock frequency if it was lowered during idle periods. This change is crucial for maintaining the performance and responsiveness of the system when it resumes work after being idle. This patch is conditionally compiled with CONFIG_ADSP_DYNAMIC_CLOCK_SWITCHING to ensure that the functionality is available only on systems that support dynamic clock management. Signed-off-by: Tomasz Leman --- src/schedule/zephyr_domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/schedule/zephyr_domain.c b/src/schedule/zephyr_domain.c index 7fb9b4ae0465..2b8e8b8a05cc 100644 --- a/src/schedule/zephyr_domain.c +++ b/src/schedule/zephyr_domain.c @@ -93,6 +93,10 @@ static void zephyr_domain_thread_fn(void *p1, void *p2, void *p3) #endif cycles0 = k_cycle_get_32(); +#if CONFIG_ADSP_DYNAMIC_CLOCK_SWITCHING + /* If the DSP has been in Idle we may need to restore previous clock. */ + soc_adsp_clock_idle_exit(); +#endif dt->handler(dt->arg); cycles1 = k_cycle_get_32();