From 02e19199bfc99ec563895d6184bfac24bfc5a058 Mon Sep 17 00:00:00 2001 From: Shengjiu Wang Date: Thu, 25 Mar 2021 10:59:14 +0800 Subject: [PATCH] LF-3724-6: ASoC: fsl_asrc_dma: add sdma_audio_config support Add sdma_audio_config support especially for multi fifo Signed-off-by: Shengjiu Wang Reviewed-by: Robin Gong --- sound/soc/fsl/fsl_asrc_dma.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c index 096793f9261f..8b9a166cb722 100644 --- a/sound/soc/fsl/fsl_asrc_dma.c +++ b/sound/soc/fsl/fsl_asrc_dma.c @@ -139,6 +139,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, struct snd_soc_component *component_be = NULL; struct fsl_asrc *asrc = pair->asrc; struct dma_slave_config config_fe, config_be; + struct sdma_audio_config audio_config; enum asrc_pair_index index = pair->index; struct device *dev = component->dev; int stream = substream->stream; @@ -227,11 +228,6 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, if (!be_chan) dma_release_channel(tmp_chan); - if (tx && be_peripheral_type == IMX_DMATYPE_SSI_DUAL) - pair->dma_data.dst_dualfifo = true; - if (!tx && be_peripheral_type == IMX_DMATYPE_SSI_DUAL) - pair->dma_data.src_dualfifo = true; - /* Get DMA request of Front-End */ tmp_chan = asrc->get_dma_channel(pair, dir); tmp_data = tmp_chan->private; @@ -269,12 +265,24 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, else buswidth = DMA_SLAVE_BUSWIDTH_8_BYTES; + memset(&config_be, 0, sizeof(config_be)); config_be.direction = DMA_DEV_TO_DEV; config_be.src_addr_width = buswidth; config_be.src_maxburst = dma_params_be->maxburst; config_be.dst_addr_width = buswidth; config_be.dst_maxburst = dma_params_be->maxburst; + memset(&audio_config, 0, sizeof(audio_config)); + config_be.peripheral_config = &audio_config; + config_be.peripheral_size = sizeof(audio_config); + + if (tx && (be_peripheral_type == IMX_DMATYPE_SSI_DUAL || + be_peripheral_type == IMX_DMATYPE_SPDIF)) + audio_config.dst_fifo_num = 2; + if (!tx && (be_peripheral_type == IMX_DMATYPE_SSI_DUAL || + be_peripheral_type == IMX_DMATYPE_SPDIF)) + audio_config.src_fifo_num = 2; + if (tx) { config_be.src_addr = asrc->paddr + asrc->get_fifo_addr(OUT, index); config_be.dst_addr = dma_params_be->addr; -- 2.17.1