Skip to content

Commit

Permalink
drivers: dma: intel-adsp-hda: add delay to stop host dma
Browse files Browse the repository at this point in the history
According to hardware spec, host dma needs some delay to completely stop.
In the bug the host dma is disabled in different path in a few microseonds.
The first setting disabled the host dma and called pm_device_runtime_put
to power off it. The second setting found the host dma was still alive
and calle pm_device_runtime_put again. This results to pm->usage
checking failed.

BugLink: thesofproject/sof#8686
Signed-off-by: Rander Wang <rander.wang@intel.com>
  • Loading branch information
RanderWang committed Jan 3, 2024
1 parent 89982b7 commit a83ecc9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/dma/dma_intel_adsp_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,18 @@ int intel_adsp_hda_dma_stop(const struct device *dev, uint32_t channel)

intel_adsp_hda_disable(cfg->base, cfg->regblock_size, channel);

/* host dma needs some cycles to completely stop */
if (cfg->direction == HOST_TO_MEMORY || cfg->direction == MEMORY_TO_HOST) {
uint32_t delay_cnt = 500;

do {
k_busy_wait(1);
} while ((*DGCS(cfg->base, cfg->regblock_size, channel) & DGCS_GBUSY) && (delay_cnt-- > 0));

if (*DGCS(cfg->base, cfg->regblock_size, channel) & DGCS_GBUSY)
return -EBUSY;
}

return pm_device_runtime_put(dev);
}

Expand Down

0 comments on commit a83ecc9

Please sign in to comment.