[Sound-open-firmware] [PATCH 2/3] dai: set dai dma msize according to slot number

Keyon Jie yang.jie at linux.intel.com
Sat Dec 16 02:59:30 CET 2017


We should set src_msize and dest_msize for dma peripheral dev
copy, for dai/ssp, they should be set to valid slot number,
otherwise, the dma may copy in wrong burst size and data will
run with wrong speed.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/dai.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/audio/dai.c b/src/audio/dai.c
index c50a274..e67e5cf 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -599,8 +599,26 @@ static int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
 	return 0;
 }
 
+/*
+ * use array to get msize for specific slot number setting.
+ * the relation between msize and slot_num should be
+ * 2 ^ msize = slot_num
+ */
+static const uint32_t msize[] = {1, 2, 4, 8};
 static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
 {
+	struct dai_data *dd = comp_get_drvdata(dev);
+	int i;
+
+	/* set dma msize according to slot number */
+	for (i = 0; i < ARRAY_SIZE(msize); i++) {
+		if (msize[i] == config->num_slots) {
+			dd->config.src_msize = i;
+			dd->config.dest_msize = i;
+			break;
+		}
+	}
+
 	/* calc frame bytes */
 	switch (config->sample_valid_bits) {
 	case 16:
-- 
2.11.0



More information about the Sound-open-firmware mailing list