linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl_sai: sw reset consumer on pause/stop
@ 2023-09-21  8:48 Emil Abildgaard Svendsen
  2023-09-21 14:00 ` Fabio Estevam
  0 siblings, 1 reply; 2+ messages in thread
From: Emil Abildgaard Svendsen @ 2023-09-21  8:48 UTC (permalink / raw)
  To: Shengjiu Wang, Xiubo Li, Fabio Estevam, Nicolin Chen,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Matus Gajdos
  Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
	Emil Abildgaard Svendsen

When in consumer mode with BCLK disabled (FSL_SAI_CSR_BCE = 0) the
FIFO's can still contain data when resumed. It might also be possible
with BCLK enabled but just less likely.

When the FIFO's still contain data on resume it can cause channel
shifting on e.g. XRUNS. A Software Reset will reset the FIFO's and make
sure channels are aligned.

Fixes: 269f399dc19f ("ASoC: fsl_sai: Disable bit clock with transmitter")
Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>
---
 sound/soc/fsl/fsl_sai.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 1e4020fae05a..1da5c17cd329 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -730,13 +730,18 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir)
 	 * anymore. Add software reset to fix this issue.
 	 * This is a hardware bug, and will be fix in the
 	 * next sai version.
+	 *
+	 * When in consumer mode with BCLK disabled
+	 * (FSL_SAI_CSR_BCE = 0) the FIFO's can still contain
+	 * data when resumed. This can cause channel shifting
+	 * on e.g. XRUNS. A Software Reset will reset the
+	 * FIFO's and make sure the channels aren't shifted.
 	 */
-	if (!sai->is_consumer_mode) {
-		/* Software Reset */
-		regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR);
-		/* Clear SR bit to finish the reset */
-		regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), 0);
-	}
+
+	/* Software Reset */
+	regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR);
+	/* Clear SR bit to finish the reset */
+	regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), 0);
 }
 
 static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: fsl_sai: sw reset consumer on pause/stop
  2023-09-21  8:48 [PATCH] ASoC: fsl_sai: sw reset consumer on pause/stop Emil Abildgaard Svendsen
@ 2023-09-21 14:00 ` Fabio Estevam
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2023-09-21 14:00 UTC (permalink / raw)
  To: Emil Abildgaard Svendsen
  Cc: alsa-devel@alsa-project.org, Xiubo Li,
	linuxppc-dev@lists.ozlabs.org, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Nicolin Chen, Mark Brown, Matus Gajdos,
	Shengjiu Wang

On Thu, Sep 21, 2023 at 5:48 AM Emil Abildgaard Svendsen
<EMAS@bang-olufsen.dk> wrote:
>
> When in consumer mode with BCLK disabled (FSL_SAI_CSR_BCE = 0) the
> FIFO's can still contain data when resumed. It might also be possible
> with BCLK enabled but just less likely.
>
> When the FIFO's still contain data on resume it can cause channel
> shifting on e.g. XRUNS. A Software Reset will reset the FIFO's and make
> sure channels are aligned.
>
> Fixes: 269f399dc19f ("ASoC: fsl_sai: Disable bit clock with transmitter")
> Signed-off-by: Emil Svendsen <emas@bang-olufsen.dk>

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-21 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-21  8:48 [PATCH] ASoC: fsl_sai: sw reset consumer on pause/stop Emil Abildgaard Svendsen
2023-09-21 14:00 ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).