All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl: Disable SSI in trigger() if RE/TE are both cleared
@ 2013-07-10 10:43 ` Nicolin Chen
  0 siblings, 0 replies; 24+ messages in thread
From: Nicolin Chen @ 2013-07-10 10:43 UTC (permalink / raw)
  To: broonie, timur; +Cc: fabio.estevam, alsa-devel, shawn.guo, linuxppc-dev

The code enabled SSIEN when triggered by SNDRV_PCM_TRIGGER_START,
so move the disable code to SNDRV_PCM_TRIGGER_STOP for symmetric.

This also allows us to use the SSI driver more flexible so that
it can support some use cases like "aplay S16_LE.wav S24_LE.wav"
which would call the driver in sequence like:
 startup()->hw_params(S16_LE)->trigger(START)->tirgger(STOP)->
 hw_params(S24_LE)->trigger(START)->tirgger(STOP)->shutdown()

If we disable SSIEN in shutdown(), the second hw_params() would
bypass the sample bits setting while using symmetric_rate.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
 sound/soc/fsl/fsl_ssi.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2f2d837..b6ab341 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -510,6 +510,9 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 			write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TE, 0);
 		else
 			write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_RE, 0);
+
+		if ((read_ssi(&ssi->scr) & (CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE)) == 0)
+			write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
 		break;
 
 	default:
@@ -534,15 +537,6 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
 		ssi_private->first_stream = ssi_private->second_stream;
 
 	ssi_private->second_stream = NULL;
-
-	/*
-	 * If this is the last active substream, disable the SSI.
-	 */
-	if (!ssi_private->first_stream) {
-		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
-
-		write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
-	}
 }
 
 static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
-- 
1.7.1

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

end of thread, other threads:[~2013-07-12 14:23 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10 10:43 [PATCH] ASoC: fsl: Disable SSI in trigger() if RE/TE are both cleared Nicolin Chen
2013-07-10 10:43 ` Nicolin Chen
2013-07-11 14:07 ` Shawn Guo
2013-07-11 16:54 ` Mark Brown
2013-07-11 16:54   ` Mark Brown
2013-07-11 17:14   ` timur
2013-07-12  3:57     ` Nicolin Chen
2013-07-12  3:57       ` [alsa-devel] " Nicolin Chen
2013-07-12  4:00       ` Timur Tabi
2013-07-12  4:00         ` [alsa-devel] " Timur Tabi
2013-07-12  4:09         ` Nicolin Chen
2013-07-12  4:09           ` [alsa-devel] " Nicolin Chen
2013-07-12  4:13           ` Timur Tabi
2013-07-12  4:13             ` [alsa-devel] " Timur Tabi
2013-07-12  4:19             ` Nicolin Chen
2013-07-12  4:19               ` [alsa-devel] " Nicolin Chen
2013-07-12  8:43         ` Mark Brown
2013-07-12  8:43           ` Mark Brown
2013-07-12 12:11           ` Timur Tabi
2013-07-12 12:11             ` [alsa-devel] " Timur Tabi
2013-07-12 13:32             ` Shawn Guo
2013-07-12 13:32               ` [alsa-devel] " Shawn Guo
2013-07-12 14:23             ` Mark Brown
2013-07-12 14:23               ` [alsa-devel] " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.