Skip to content

Commit

Permalink
intel_adsp: power: add custom cpu idle
Browse files Browse the repository at this point in the history
This patch adds custom implementation of CPU idle for ACE platforms.
Currently there is no difference between it and the default one for all
xtensa boards. Custome part will be added in next steps.

Inline function wait_for_interrupt was added to avoid code repetitions
in future.

Signed-off-by: Tomasz Leman <[email protected]>
  • Loading branch information
tmleman authored and abonislawski committed Nov 15, 2023
1 parent 1de4667 commit 19b5337
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion soc/xtensa/intel_adsp/ace/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ struct lpsram_header {
uint8_t rom_bypass_vectors_reserved[0xC00 - 0x14];
};

static ALWAYS_INLINE void wait_for_interrupt(const uint32_t immediate)
{
__asm__ volatile ("waiti %0" :: "i" (immediate));
}

static ALWAYS_INLINE void _save_core_context(uint32_t core_id)
{
core_desc[core_id].vecbase = XTENSA_RSR("VECBASE");
Expand Down Expand Up @@ -165,7 +170,7 @@ void power_gate_entry(uint32_t core_id)

soc_cpus_active[core_id] = false;
sys_cache_data_flush_range(soc_cpus_active, sizeof(soc_cpus_active));
k_cpu_idle();
wait_for_interrupt(0);
z_xt_ints_off(0xffffffff);
}

Expand Down Expand Up @@ -373,4 +378,13 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
z_xt_ints_on(core_desc[cpu].intenable);
}

#ifdef CONFIG_ARCH_CPU_IDLE_CUSTOM

void arch_cpu_idle(void)
{
sys_trace_idle();
wait_for_interrupt(0);
}
#endif

#endif

0 comments on commit 19b5337

Please sign in to comment.