-----Original Message----- From: Girdwood, Liam R Sent: Friday, December 15, 2017 11:48 PM To: Keyon Jie yang.jie@linux.intel.com; sound-open-firmware@alsa- project.org Cc: Jie, Yang yang.jie@intel.com Subject: Re: [Sound-open-firmware] [PATCH] dai: set dai dma msize according to slot number
On Fri, 2017-12-15 at 23:02 +0800, Keyon Jie wrote:
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@linux.intel.com
src/audio/dai.c | 13 +++++++++++++
msize is something specific to the DW dma driver only, so this logic should be in dw-dma.c
Right, actually what here do is only calculate/generate the setting, the value will be passed in to dma, inside dma it still have logic whether to use it, that is in the subsequent next patch.
I put the calculating here, as it is dai/ssp(hardware) specific, it's black box for dma actually, the num_slots is what dai/ssp knows well but not dma.
1 file changed, 13 insertions(+)
diff --git a/src/audio/dai.c b/src/audio/dai.c index c50a274..e04943b 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -599,8 +599,21 @@ static int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn) return 0; }
comment here describing how array index aligns with msize
OK, let me add it.
+static uint32_t msize[] = {1, 2, 4, 8};
const
OK, will change it in next version
Thanks, ~Keyon
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: