Skip to content

Commit

Permalink
intel_adsp: power: clock gating in idle
Browse files Browse the repository at this point in the history
This patch add implementation of the dynamic clock gating for ACE
platforms. Clock gating will be enabled/disabled by each DSP core before
enter WAITI state. If clock gating is not desired, an application or
other subsystem can prevent it via PM policy lock API.

Signed-off-by: Tomasz Leman <[email protected]>
  • Loading branch information
tmleman authored and abonislawski committed Nov 15, 2023
1 parent 19b5337 commit e7a093e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions soc/xtensa/intel_adsp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,11 @@ config ADSP_IMR_CONTEXT_SAVE
entering D3 state. Later this context can be used to FW restore
when Host power up DSP again.

config ADSP_CPU_DYNAMIC_CLOCK_GATING
bool "DSP clock gating in Idle"
help
When true, FW will enable clock gating before core enter WAITI state
(wait for interrupt) during idle. Clock gating will be disabled in which
there is dependence on dependency to CCOUNT value or DSP clock interrupt.

endif # SOC_FAMILY_INTEL_ADSP
10 changes: 10 additions & 0 deletions soc/xtensa/intel_adsp/ace/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <adsp_imr_layout.h>
#include <zephyr/drivers/mm/mm_drv_intel_adsp_mtl_tlb.h>
#include <zephyr/drivers/timer/system_timer.h>
#include <zephyr/pm/policy.h>
#include <mem_window.h>

#define LPSRAM_MAGIC_VALUE 0x13579BDF
Expand Down Expand Up @@ -383,6 +384,15 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
void arch_cpu_idle(void)
{
sys_trace_idle();

#if CONFIG_ADSP_CPU_DYNAMIC_CLOCK_GATING
/* TODO: Add enum for substates (1 -> clock gating) */
if (pm_policy_state_lock_is_active(PM_STATE_ACTIVE, 1)) {
DSPCS.bootctl[arch_proc_id()].bctl |= DSPBR_BCTL_WAITIPCG;
} else {
DSPCS.bootctl[arch_proc_id()].bctl &= ~DSPBR_BCTL_WAITIPCG;
}
#endif
wait_for_interrupt(0);
}
#endif
Expand Down

0 comments on commit e7a093e

Please sign in to comment.