From b5c8f83c48e2abe79d6cc85b1e48efb42b61dbda Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Mon, 23 Sep 2019 20:30:48 +0200 Subject: [PATCH] platform: cavs: use pm-runtime api to power gate dsp cores Power control hw programming should go through the pm_runtime interface. It provides more granular control over the power gating of each single dsp core. Signed-off-by: Marcin Maka --- src/arch/xtensa/lib/cpu.c | 4 ++++ src/platform/intel/cavs/platform.c | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/arch/xtensa/lib/cpu.c b/src/arch/xtensa/lib/cpu.c index aa7bcc2a4..7e0a1085b 100644 --- a/src/arch/xtensa/lib/cpu.c +++ b/src/arch/xtensa/lib/cpu.c @@ -48,6 +48,8 @@ void arch_cpu_enable_core(int id) irq_local_disable(flags); if (!arch_cpu_is_core_enabled(id)) { + pm_runtime_get(PM_RUNTIME_DSP, id); + /* Turn on stack memory for core */ pm_runtime_get(CORE_MEMORY_POW, id); @@ -133,6 +135,8 @@ void cpu_power_down_core(void) /* Turn off stack memory for core */ pm_runtime_put(CORE_MEMORY_POW, cpu_get_id()); + pm_runtime_put(PM_RUNTIME_DSP, cpu_get_id()); + /* arch_wait_for_interrupt() not used, because it will cause panic. * This code is executed on irq lvl > 0, which is expected. * Core will be put into reset by host anyway. diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index e7628f780..3aa9083d5 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -405,9 +405,7 @@ int platform_init(struct sof *sof) shim_write(SHIM_GPDMA_CLKCTL(1), SHIM_CLKCTL_LPGPDMAFDCGB); /* prevent DSP Common power gating */ - shim_write16(SHIM_PWRCTL, SHIM_PWRCTL_TCPDSPPG(0) | - SHIM_PWRCTL_TCPDSPPG(1) | SHIM_PWRCTL_TCPDSPPG(2) | - SHIM_PWRCTL_TCPDSPPG(3)); + pm_runtime_get(PM_RUNTIME_DSP, PLATFORM_MASTER_CORE_ID); #elif CONFIG_ICELAKE || CONFIG_SUECREEK || CONFIG_TIGERLAKE /* TODO: need to merge as for APL */ @@ -422,9 +420,7 @@ int platform_init(struct sof *sof) io_reg_write(GPDMA_CLKCTL(1), GPDMA_FDCGB); /* prevent DSP Common power gating */ - shim_write16(SHIM_PWRCTL, SHIM_PWRCTL_TCPDSPPG(0) | - SHIM_PWRCTL_TCPDSPPG(1) | SHIM_PWRCTL_TCPDSPPG(2) | - SHIM_PWRCTL_TCPDSPPG(3)); + pm_runtime_get(PM_RUNTIME_DSP, PLATFORM_MASTER_CORE_ID); #endif /* init DMACs */