From 4f6c115360068c5a15cd15d1b75b91549c72a43e Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Fri, 24 Nov 2023 11:16:21 +0200 Subject: [PATCH] audio: dai-zephyr: Set source/destination address adjustment Some DMACs (e.g: NXP's EDMA) can automatically adjust the source and destination addresses upon transfer completion. As such, we need to indicate how the adjustment should be performed. In the case of playback, the source address should be decremented, while in the case of capture, the destination address should be decremented. Signed-off-by: Laurentiu Mihalcea --- src/audio/dai-zephyr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 3b2bfc48f439..134f73f71cd3 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -718,6 +718,13 @@ static int dai_set_dma_config(struct dai_data *dd, struct comp_dev *dev) dma_block_cfg->block_size = config->elem_array.elems[i].size; dma_block_cfg->source_address = config->elem_array.elems[i].src; dma_block_cfg->dest_address = config->elem_array.elems[i].dest; + if (dev->direction == SOF_IPC_STREAM_PLAYBACK) { + dma_block_cfg->source_addr_adj = DMA_ADDR_ADJ_DECREMENT; + dma_block_cfg->dest_addr_adj = DMA_ADDR_ADJ_INCREMENT; + } else { + dma_block_cfg->source_addr_adj = DMA_ADDR_ADJ_INCREMENT; + dma_block_cfg->dest_addr_adj = DMA_ADDR_ADJ_DECREMENT; + } prev = dma_block_cfg; prev->next_block = ++dma_block_cfg; }