[Sound-open-firmware] [PATCH] comp: use comp_sample_bytes() to set DMA transfer size.

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Nov 17 16:56:45 CET 2017


Use comp_sample_bytes() to set DMA transfer size in DAI component and
comment why host always copies using word size transfers.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/audio/dai.c  | 8 ++++----
 src/audio/host.c | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/audio/dai.c b/src/audio/dai.c
index 13f7e10..cc61e83 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -264,8 +264,8 @@ static int dai_playback_params(struct comp_dev *dev)
 
 	/* set up DMA configuration */
 	config->direction = DMA_DIR_MEM_TO_DEV;
-	config->src_width = sizeof(uint32_t);
-	config->dest_width = sizeof(uint32_t);
+	config->src_width = comp_sample_bytes(dev);
+	config->dest_width = comp_sample_bytes(dev);
 	config->cyclic = 1;
 	config->dest_dev = dd->dai->plat_data.fifo[0].handshake;
 
@@ -331,8 +331,8 @@ static int dai_capture_params(struct comp_dev *dev)
 
 	/* set up DMA configuration */
 	config->direction = DMA_DIR_DEV_TO_MEM;
-	config->src_width = sizeof(uint32_t);
-	config->dest_width = sizeof(uint32_t);
+	config->src_width = comp_sample_bytes(dev);
+	config->dest_width = comp_sample_bytes(dev);
 	config->cyclic = 1;
 	config->src_dev = dd->dai->plat_data.fifo[1].handshake;
 
diff --git a/src/audio/host.c b/src/audio/host.c
index 88d45e4..b731dd6 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -441,7 +441,8 @@ static int host_params(struct comp_dev *dev)
 	if (err < 0)
 		return err;
 
-	/* set up DMA configuration */
+	/* set up DMA configuration - copy in words for all formats as
+	   this is most optimal for memory <-> memory copies. */
 	config->src_width = sizeof(uint32_t);
 	config->dest_width = sizeof(uint32_t);
 	config->cyclic = 0;
-- 
2.11.0



More information about the Sound-open-firmware mailing list