diff mbox

[v4,4/6] ASoC: fsl_ssi: Fix samples being dropped at Playback startup

Message ID 1462277640-20052-5-git-send-email-arnaud.mouiche@invoxia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arnaud Mouiche May 3, 2016, 12:13 p.m. UTC
If the capture is already running while playback is started, it is highly
probable (>80% in a 8 channels scenario) that samples are lost between
the DMA and TX fifo.

The reason is that SIER.TDMAE is set before STCR.TFEN0, leaving a time
window where the FIFO doesn't receive the samples written by the DMA.

This particular case happened only if capture is already enabled as
SCR.SSIEN is already set at the playback startup instant.

Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
---
 sound/soc/fsl/fsl_ssi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Fabio Estevam May 3, 2016, 12:24 p.m. UTC | #1
On Tue, May 3, 2016 at 9:13 AM, Arnaud Mouiche
<arnaud.mouiche@invoxia.com> wrote:
> If the capture is already running while playback is started, it is highly
> probable (>80% in a 8 channels scenario) that samples are lost between
> the DMA and TX fifo.
>
> The reason is that SIER.TDMAE is set before STCR.TFEN0, leaving a time
> window where the FIFO doesn't receive the samples written by the DMA.
>
> This particular case happened only if capture is already enabled as
> SCR.SSIEN is already set at the playback startup instant.
>
> Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Caleb Crome May 10, 2016, 4:34 p.m. UTC | #2
On Tue, May 3, 2016 at 5:24 AM, Fabio Estevam <festevam@gmail.com> wrote:
> On Tue, May 3, 2016 at 9:13 AM, Arnaud Mouiche
> <arnaud.mouiche@invoxia.com> wrote:
>> If the capture is already running while playback is started, it is highly
>> probable (>80% in a 8 channels scenario) that samples are lost between
>> the DMA and TX fifo.
>>
>> The reason is that SIER.TDMAE is set before STCR.TFEN0, leaving a time
>> window where the FIFO doesn't receive the samples written by the DMA.
>>
>> This particular case happened only if capture is already enabled as
>> SCR.SSIEN is already set at the playback startup instant.
>>
>> Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
>
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Caleb Crome <caleb@crome.org>
diff mbox

Patch

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 695f041..3917741 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -476,9 +476,9 @@  static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable,
 	 * (online configuration)
 	 */
 	if (enable) {
-		regmap_update_bits(regs, CCSR_SSI_SIER, vals->sier, vals->sier);
 		regmap_update_bits(regs, CCSR_SSI_SRCR, vals->srcr, vals->srcr);
 		regmap_update_bits(regs, CCSR_SSI_STCR, vals->stcr, vals->stcr);
+		regmap_update_bits(regs, CCSR_SSI_SIER, vals->sier, vals->sier);
 	} else {
 		u32 sier;
 		u32 srcr;