ASoC: imx dma tx burst size set to 6 and to 4 ?
Subsystems (3)
Hello,
There is an inconsistency in this code:
/sound/soc/imx/imx-ssi.c: ssi->dma_params_tx.burstsize = 4;
/sound/soc/imx/imx-pcm-dma-mx2.c: ssi->dma_params_tx.burstsize = 6;
Datasheet:
This sets the field TFWM0 in register SFCSR (SSI_SFCSR_TFWM0): the number of data words needed to set the empty flag (TFE0). Can be set from 1 to 8; FIFO size is 8 words (of 24b). And this is also the DMA burst size.
Which is best depends on the application (the higher the more efficient, but the more risk for a FIFO underrun). I would take 4.
But I guess it should only be set at 1 place, and what is then the best place?
Regards,
J?rgen
details:
/sound/soc/imx/imx-ssi.c: ssi->dma_params_tx.burstsize = 4; Set in commit
commit 0a93421b6adf8ba127b3eafc4c16e3a14017e2ae
Author: Javier Martin <[email protected]> Date: Tue Mar 1 15:02:06 2011 +0100
ASoC: Fix burstsize and DSP_B format problems in imx-ssi.
When choosing IMX_DMA flag, burtsizes are set to its default value (0) which leads to driver malfunction. Change them to 4.
DSP_B interface needs additional flag to match DSP_B formats as described in several codecs as wm8741 and aic3205.
Index in diff:
sound/soc/imx/imx-ssi.c +0 -0
/sound/soc/imx/imx-pcm-dma-mx2.c: ssi->dma_params_tx.burstsize = 6; Set in commit
commit 2c4cf17a52f04fbe929977252d5b8ab81d2c6e9b
Author: Wolfram Sang <[email protected]> Date: Fri Mar 25 16:51:44 2011 +0100
ASoC: imx: set watermarks for mx2-dma
They got accidently removed by f0fba2a (ASoC: multi-component - ASoC Multi-Component Support). Reintroduce them and get rid of the superfluous defines because the fiq-driver has its own hardcoded
values.
Index in diff:
(quoted diff) +0 -0
b/sound/soc/imx/imx-pcm-dma-mx2.c
index 671ef8d..b2ed764 100644
Signature · 6 lines
J?rgen Lambrecht R&D Associate Tel: +32 (0)51 303045 Fax: +32 (0)51 310670 http://www.televic-rail.com Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium Company number 0825.539.581 - RPR Kortrijk
Sascha Hauer
maintainer(Added Javier to Cc)
Quoted 13 lines · Lambrecht J?rgen
Hello,
There is an inconsistency in this code:
/sound/soc/imx/imx-ssi.c:
ssi->dma_params_tx.burstsize= 4;
/sound/soc/imx/imx-pcm-dma-mx2.c:ssi->dma_params_tx.burstsize= 6;Datasheet:
This sets the field TFWM0 in register SFCSR (SSI_SFCSR_TFWM0): the number of data words needed to set the empty flag (TFE0). Can be set from 1 to 8; FIFO size is 8 words (of 24b). And this is also the DMA burst size.
Quoted 5 lines
Which is best depends on the application (the higher the more efficient, but the more risk for a FIFO underrun). I would take 4.
But I guess it should only be set at 1 place, and what is then the best place?
We need different burstsize settings for the FIQ driver and for the DMA driver. For this reason the original intention was to set these values in sound/soc/imx/imx-pcm-dma-mx2.c and in sound/soc/imx/imx-pcm-fiq.c.
Quoted 30 lines
commit
0a93421b6adf8ba127b3eafc4c16e3a14017e2aeAuthor: Javier Martin <[email protected]> Date: Tue Mar 1 15:02:06 2011 +0100ASoC: Fix burstsize and
DSP_Bformat problems in imx-ssi.When choosing
IMX_DMAflag, burtsizes are set to its default value (0) which leads to driver malfunction. Change them to 4.
DSP_Binterface needs additional flag to matchDSP_Bformats as described in several codecs as wm8741 and aic3205.Signed-off-by Javier Martin <[email protected]>Acked-by Liam Girdwood <[email protected]>Signed-off-by Mark Brown <[email protected]>sound/soc/imx/imx-ssi.c +1
-1@@ -108,7 +108,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL ; + strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */
sound/soc/imx/imx-ssi.c static int imx_ssi_probe(struct platform_device *pdev) · line 661
Quoted 6 lines
sound/soc/imx/imx-ssi.c +3
-0@@ -656,6 +656,9 @@ static int imx_ssi_probe(struct platform_device *pdev) ssi->dma_params_rx.dma_addr = res->start +SSI_SRX0 ; ssi->dma_params_tx.dma_addr = res->start +SSI_STX0 ; + ssi->dma_params_tx.burstsize =4 ; + ssi->dma_params_rx.burstsize =4 ; +
Javier, is this hunk necessary? From what I see these values should be overwritten later anyway.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
2011/7/4 Sascha Hauer <[email protected]>:
Quoted 60 lines
(Added Javier to Cc)
Quoted 13 lines · Lambrecht J?rgen
Hello,
There is an inconsistency in this code:
/sound/soc/imx/imx-ssi.c: ? ? ? ?
ssi->dma_params_tx.burstsize= 4; /sound/soc/imx/imx-pcm-dma-mx2.c:ssi->dma_params_tx.burstsize= 6;Datasheet:
This sets the field TFWM0 in register SFCSR (SSI_SFCSR_TFWM0): the number of data words needed to set the empty flag (TFE0). Can be set from 1 to 8; FIFO size is 8 words (of 24b). And this is also the DMA burst size.Quoted 5 lines
Which is best depends on the application (the higher the more efficient, but the more risk for a FIFO underrun). I would take 4.
But I guess it should only be set at 1 place, and what is then the best place?
We need different burstsize settings for the FIQ driver and for the DMA driver. For this reason the original intention was to set these values in
sound/soc/imx/imx-pcm-dma-mx2.cand insound/soc/imx/imx-pcm-fiq.c.Quoted 33 lines
commit
0a93421b6adf8ba127b3eafc4c16e3a14017e2ae
Author: Javier Martin <[email protected]>
Date: ? Tue Mar 1 15:02:06 2011 +0100? ? ASoC: Fix burstsize and
DSP_Bformat problems in imx-ssi.? ? When choosing
IMX_DMAflag, burtsizes are set to its default ? ? value (0) which leads to driver malfunction. Change them to 4.? ?
DSP_Binterface needs additional flag to matchDSP_Bformats ? ? as described in several codecs as wm8741 and aic3205.? ? Signed-off-by: Javier Martin <[email protected]> ? ? Acked-by: Liam Girdwood <[email protected]>
? ? Signed-off-by: Mark Brown <[email protected]>sound/soc/imx/imx-ssi.c +0
-0@@ -108,7 +108,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) ? ? ? ? ? ? ? break;? ? ? case
SND_SOC_DAIFMT_DSP_B:
? ? ? ? ? ? ? /* data on rising edge of bclk, frame high with data */
- ? ? ? ? ? ? strcr |=SSI_STCR_TFSL;
+ ? ? ? ? ? ? strcr |=SSI_STCR_TFSL|SSI_STCR_TXBIT0;
? ? ? ? ? ? ? break;
? ? ? caseSND_SOC_DAIFMT_DSP_A:
? ? ? ? ? ? ? /* data on rising edge of bclk, frame high 1clk before data */sound/soc/imx/imx-ssi.c +0
-0@@ -656,6 +656,9 @@ static int imx_ssi_probe(struct platform_device *pdev) ? ? ? ssi->dma_params_rx.dma_addr = res->start + SSI_SRX0; ? ? ? ssi->dma_params_tx.dma_addr = res->start + SSI_STX0;
Quoted 8 lines
sound/soc/imx/imx-ssi.c static int imx_ssi_probe(struct platform_device *pdev) · line 661
Quoted 3 lines
sound/soc/imx/imx-ssi.c +3
-0+ ? ? ssi->dma_params_tx.burstsize = 4; + ? ? ssi->dma_params_rx.burstsize = 4; +Javier, is this hunk necessary? From what I see these values should be overwritten later anyway.
Sascha
Hi,
without this hunk, both burstsizes where set to 0. This was checked experimentally:
- Audio didn't work properly.
- Some runtime printk's showed that burstsizes where set to 0.
It seems assignments in imx-pcm-dma-mx2.c file are done at a place they do not take effect.
Signature · 7 lines
Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com
Sascha Hauer
maintainerQuoted 74 lines · javier Martin
2011/7/4 Sascha Hauer <[email protected]>:
Quoted 60 lines
(Added Javier to Cc)
Quoted 13 lines · Lambrecht J?rgen
Hello,
There is an inconsistency in this code:
/sound/soc/imx/imx-ssi.c: ? ? ? ?
ssi->dma_params_tx.burstsize= 4; /sound/soc/imx/imx-pcm-dma-mx2.c:ssi->dma_params_tx.burstsize= 6;Datasheet:
This sets the field TFWM0 in register SFCSR (SSI_SFCSR_TFWM0): the number of data words needed to set the empty flag (TFE0). Can be set from 1 to 8; FIFO size is 8 words (of 24b). And this is also the DMA burst size.Quoted 5 lines
Which is best depends on the application (the higher the more efficient, but the more risk for a FIFO underrun). I would take 4.
But I guess it should only be set at 1 place, and what is then the best place?
We need different burstsize settings for the FIQ driver and for the DMA driver. For this reason the original intention was to set these values in
sound/soc/imx/imx-pcm-dma-mx2.cand insound/soc/imx/imx-pcm-fiq.c.Quoted 33 lines
commit
0a93421b6adf8ba127b3eafc4c16e3a14017e2ae
Author: Javier Martin <[email protected]>
Date: ? Tue Mar 1 15:02:06 2011 +0100? ? ASoC: Fix burstsize and
DSP_Bformat problems in imx-ssi.? ? When choosing
IMX_DMAflag, burtsizes are set to its default ? ? value (0) which leads to driver malfunction. Change them to 4.? ?
DSP_Binterface needs additional flag to matchDSP_Bformats ? ? as described in several codecs as wm8741 and aic3205.? ? Signed-off-by: Javier Martin <[email protected]> ? ? Acked-by: Liam Girdwood <[email protected]>
? ? Signed-off-by: Mark Brown <[email protected]>sound/soc/imx/imx-ssi.c +0
-0@@ -108,7 +108,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) ? ? ? ? ? ? ? break;? ? ? case
SND_SOC_DAIFMT_DSP_B:
? ? ? ? ? ? ? /* data on rising edge of bclk, frame high with data */
- ? ? ? ? ? ? strcr |=SSI_STCR_TFSL;
+ ? ? ? ? ? ? strcr |=SSI_STCR_TFSL|SSI_STCR_TXBIT0;
? ? ? ? ? ? ? break;
? ? ? caseSND_SOC_DAIFMT_DSP_A:
? ? ? ? ? ? ? /* data on rising edge of bclk, frame high 1clk before data */sound/soc/imx/imx-ssi.c +0
-0@@ -656,6 +656,9 @@ static int imx_ssi_probe(struct platform_device *pdev) ? ? ? ssi->dma_params_rx.dma_addr = res->start + SSI_SRX0; ? ? ? ssi->dma_params_tx.dma_addr = res->start + SSI_STX0;Quoted 8 lines
sound/soc/imx/imx-ssi.c static int imx_ssi_probe(struct platform_device *pdev) · line 661
Quoted 3 lines
sound/soc/imx/imx-ssi.c +3
-0+ ? ? ssi->dma_params_tx.burstsize = 4; + ? ? ssi->dma_params_rx.burstsize = 4; +Javier, is this hunk necessary? From what I see these values should be overwritten later anyway.
Sascha
Hi,
without this hunk, both burstsizes where set to 0. This was checked experimentally:
Quoted 5 lines
- Audio didn't work properly.
- Some runtime printk's showed that burstsizes where set to 0.It seems assignments in
imx-pcm-dma-mx2.cfile are done at a place they do not take effect.
I just did a quick test. In imx_ssi_dai_probe where the values are actually used they are correctly initialized.
Anyway, the current way to initialize these values seems a bit strange. Maybe we should pass the burstsize parameters in imx_pcm_new instead.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |