Skip to content

Commit

Permalink
drivers: gpdma: enable clock gating
Browse files Browse the repository at this point in the history
This patch is adding function enabling DMA clock gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
  • Loading branch information
tmleman committed Mar 21, 2023
1 parent 08aaa1f commit d9c20c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions drivers/dma/dma_intel_adsp_gpdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,23 @@ static void intel_adsp_gpdma_clock_enable(const struct device *dev)
sys_write32(val, reg);
}

#ifdef CONFIG_PM_DEVICE
static void intel_adsp_gpdma_clock_disable(const struct device *dev)
{
const struct intel_adsp_gpdma_cfg *const dev_cfg = dev->config;
uint32_t reg = dev_cfg->shim + GPDMA_CTL_OFFSET;
uint32_t val;

if (IS_ENABLED(CONFIG_SOC_SERIES_INTEL_ACE)) {
val = sys_read32(reg) & ~GPDMA_CTL_DGCD;
} else {
val = sys_read32(reg) & ~GPDMA_CTL_FDCGB;
}

sys_write32(val, reg);
}
#endif

static void intel_adsp_gpdma_claim_ownership(const struct device *dev)
{
#ifdef CONFIG_DMA_INTEL_ADSP_GPDMA_NEED_CONTROLLER_OWNERSHIP
Expand Down Expand Up @@ -358,6 +375,9 @@ static int intel_adsp_gpdma_power_off(const struct device *dev)
{
LOG_INF("%s: dma %s power off", __func__,
dev->name);
/* Enabling dynamic clock gating */
intel_adsp_gpdma_clock_disable(dev);

/* Relesing DMA ownership*/
intel_adsp_gpdma_release_ownership(dev);
#ifdef CONFIG_SOC_SERIES_INTEL_ACE
Expand Down

0 comments on commit d9c20c0

Please sign in to comment.