[Sound-open-firmware] [PATCH 1/4] Add DMA callback for dma_copy_to_host() and dma_copy_from_host().
From: Yan Wang yan.wang@linux.intel.com
It is necessary to add dma callback to set completion_t variable to notify DMA copying is finished. Otherwise it will always enter into error handler.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- src/ipc/dma-copy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/src/ipc/dma-copy.c b/src/ipc/dma-copy.c index b8d27be..d295089 100644 --- a/src/ipc/dma-copy.c +++ b/src/ipc/dma-copy.c @@ -64,6 +64,14 @@ static struct dma_sg_elem *sg_get_elem_at(struct dma_sg_config *host_sg, return NULL; }
+static void dma_complete(void *data, uint32_t type, struct dma_sg_elem *next) +{ + completion_t *comp = (completion_t *)data; + + if (type == DMA_IRQ_TYPE_LLIST) + wait_completed(comp); +} + int dma_copy_to_host(struct dma_sg_config *host_sg, int32_t host_offset, void *local_ptr, int32_t size) { @@ -102,6 +110,8 @@ int dma_copy_to_host(struct dma_sg_config *host_sg, int32_t host_offset, local_sg_elem.size = HOST_PAGE_SIZE - offset; list_item_prepend(&local_sg_elem.list, &config.elem_list);
+ dma_set_cb(dma, chan, DMA_IRQ_TYPE_LLIST, dma_complete, &complete); + /* transfer max PAGE size at a time to SG buffer */ while (size > 0) {
@@ -179,6 +189,8 @@ int dma_copy_from_host(struct dma_sg_config *host_sg, int32_t host_offset, local_sg_elem.size = HOST_PAGE_SIZE - offset; list_item_prepend(&local_sg_elem.list, &config.elem_list);
+ dma_set_cb(dma, chan, DMA_IRQ_TYPE_LLIST, dma_complete, &complete); + /* transfer max PAGE size at a time to SG buffer */ while (size > 0) {
On Mon, 2017-09-18 at 11:23 +0800, yan.wang@linux.intel.com wrote:
From: Yan Wang yan.wang@linux.intel.com
It is necessary to add dma callback to set completion_t variable to notify DMA copying is finished. Otherwise it will always enter into error handler.
Signed-off-by: Yan Wang yan.wang@linux.intel.com
src/ipc/dma-copy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
All applied.
participants (2)
-
Liam Girdwood
-
yan.wang@linux.intel.com