From 359c3c88a125c2d917609d71de307c277587f7bb Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 21 Mar 2019 10:28:57 +0100 Subject: [PATCH] dai: fix getting DW-DMA copy size for DMA_CB_TYPE_LLIST Fixes DW-DMA copy size calculations for transfers, which are not using auto reloadable linked lists. They require manual linked list reload to update current position, so it should happen before call to DMA copy. Signed-off-by: Tomasz Lauda --- src/audio/dai.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/audio/dai.c b/src/audio/dai.c index a649520d1693..a60f531bc02d 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -100,8 +100,9 @@ static void dai_buffer_process(struct comp_dev *dev, struct dma_sg_elem *next) tracev_dai_with_ids(dev, "dai_buffer_process()"); - /* reload lli by default */ - next->size = DMA_RELOAD_LLI; + /* reload lli if the last callback wasn't of llist type */ + next->size = dd->cb_type == DMA_CB_TYPE_LLIST ? DMA_RELOAD_IGNORE : + DMA_RELOAD_LLI; /* stop dma copy for pause/stop/xrun */ if (dev->state != COMP_STATE_ACTIVE || dd->xrun) { @@ -171,11 +172,15 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next) switch (type) { case DMA_CB_TYPE_BLOCK: - case DMA_CB_TYPE_LLIST: dd->cb_type = type; next->size = DMA_RELOAD_IGNORE; pipeline_schedule_copy(dev->pipeline, 0); break; + case DMA_CB_TYPE_LLIST: + dd->cb_type = type; + next->size = DMA_RELOAD_LLI; + pipeline_schedule_copy(dev->pipeline, 0); + break; case DMA_CB_TYPE_PROCESS: dai_buffer_process(dev, next); break;