Skip to content

Commit 15e07dd

Browse files
ford-prefectgregkh
authored andcommitted
ASoC: fsl_sai: Force a software reset when starting in consumer mode
commit dc78f7e59169d3f0e6c3c95d23dc8e55e95741e2 upstream. On an imx8mm platform with an external clock provider, when running the receiver (arecord) and triggering an xrun with xrun_injection, we see a channel swap/offset. This happens sometimes when running only the receiver, but occurs reliably if a transmitter (aplay) is also concurrently running. It seems that the SAI loses track of frame sync during the trigger stop -> trigger start cycle that occurs during an xrun. Doing just a FIFO reset in this case does not suffice, and only a software reset seems to get it back on track. This looks like the same h/w bug that is already handled for the producer case, so we now do the reset unconditionally on config disable. Signed-off-by: Arun Raghavan <[email protected]> Reported-by: Pieterjan Camerlynck <[email protected]> Fixes: 3e3f8bd ("ASoC: fsl_sai: fix no frame clk in master mode") Cc: [email protected] Reviewed-by: Fabio Estevam <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dacb58a commit 15e07dd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sound/soc/fsl/fsl_sai.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,15 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir)
762762
* anymore. Add software reset to fix this issue.
763763
* This is a hardware bug, and will be fix in the
764764
* next sai version.
765+
*
766+
* In consumer mode, this can happen even after a
767+
* single open/close, especially if both tx and rx
768+
* are running concurrently.
765769
*/
766-
if (!sai->is_consumer_mode) {
767-
/* Software Reset */
768-
regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR);
769-
/* Clear SR bit to finish the reset */
770-
regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), 0);
771-
}
770+
/* Software Reset */
771+
regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR);
772+
/* Clear SR bit to finish the reset */
773+
regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), 0);
772774
}
773775

774776
static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,

0 commit comments

Comments
 (0)