Skip to content

Commit cdb9394

Browse files
audio: dai-zephyr: convert DMA src/dst addresses to host-relative addresses
The DMAC has the same view of the address space as the HOST. As such, the source and destination addresses need to be converted to HOST-relative addresses before attempting to perform a DMA transfer. This is only relevant for platforms for which the DSP and HOST have different views of the address space (e.g: i.MX8ULP). Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
1 parent 727ad82 commit cdb9394

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/audio/dai-zephyr.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,17 @@ static int dai_set_dma_config(struct dai_data *dd, struct comp_dev *dev)
751751
for (i = 0; i < dma_cfg->block_count; i++) {
752752
dma_block_cfg->dest_scatter_en = config->scatter;
753753
dma_block_cfg->block_size = config->elem_array.elems[i].size;
754-
dma_block_cfg->source_address = config->elem_array.elems[i].src;
755-
dma_block_cfg->dest_address = config->elem_array.elems[i].dest;
754+
if (dev->direction == SOF_IPC_STREAM_PLAYBACK) {
755+
dma_block_cfg->source_address =
756+
local_to_host(config->elem_array.elems[i].src);
757+
dma_block_cfg->dest_address =
758+
config->elem_array.elems[i].dest;
759+
} else {
760+
dma_block_cfg->source_address =
761+
config->elem_array.elems[i].src;
762+
dma_block_cfg->dest_address =
763+
local_to_host(config->elem_array.elems[i].dest);
764+
}
756765
if (dev->direction == SOF_IPC_STREAM_PLAYBACK) {
757766
dma_block_cfg->source_addr_adj = DMA_ADDR_ADJ_DECREMENT;
758767
dma_block_cfg->dest_addr_adj = DMA_ADDR_ADJ_INCREMENT;

0 commit comments

Comments
 (0)