linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 7/8] ASoC: fsl-ssi: imx-pcm-fiq bugfix
Date: Mon, 19 Aug 2013 17:06:00 +0200	[thread overview]
Message-ID: <1376924761-4054-8-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1376924761-4054-1-git-send-email-mpa@pengutronix.de>

From: Michael Grzeschik <m.grzeschik@pengutronix.de>

imx-pcm-fiq is checking for TE RE bits, so enable them only if
necessary.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 3af15e9..8407d59 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -383,30 +383,11 @@ static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
 		&ssi->sfcsr);
 
 	/*
-	 * For non-ac97 setups, we keep the SSI disabled because if we enable
-	 * it, then the DMA controller will start. It's not supposed to start
-	 * until the SCR.TE (or SCR.RE) bit is set, but it does anyway. The DMA
-	 * controller will transfer one "BWC" of data (i.e. the amount of data
-	 * that the MR.BWC bits are set to). The reason this is bad is because
-	 * at this point, the PCM driver has not finished initializing the DMA
-	 * controller.
-	 */
-
-
-	/*
 	 * For ac97 interrupts are enabled with the startup of the substream
 	 * because it is also running without an active substream. Normally SSI
 	 * is only enabled when there is a substream.
 	 */
-	if (!ssi_private->imx_ac97) {
-		/* Enable the interrupts and DMA requests */
-		if (ssi_private->use_dma)
-			write_ssi(SIER_FLAGS, &ssi->sier);
-		else
-			write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
-					CCSR_SSI_SIER_RIE |
-					CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
-	} else {
+	if (ssi_private->imx_ac97) {
 		/*
 		 * Setup the clock control register
 		 */
@@ -574,6 +555,27 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(rtd->cpu_dai);
 	struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+	unsigned int sier_bits;
+
+	/*
+	 *  Enable only the interrupts and DMA requests
+	 *  that are needed for the channel. As the fiq
+	 *  is polling for this bits, we have to ensure
+	 *  that this are aligned with the preallocated
+	 *  buffers
+	 */
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (ssi_private->use_dma)
+			sier_bits = SIER_FLAGS;
+		else
+			sier_bits = CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN;
+	} else {
+		if (ssi_private->use_dma)
+			sier_bits = SIER_FLAGS;
+		else
+			sier_bits = CCSR_SSI_SIER_RIE | CCSR_SSI_SIER_RFF0_EN;
+	}
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
@@ -602,6 +604,8 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 		return -EINVAL;
 	}
 
+	write_ssi(sier_bits, &ssi->sier);
+
 	return 0;
 }
 
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-08-19 15:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 15:05 [PATCH v11 0/7] ASoC: fsl-ssi: ac97-slave support Markus Pargmann
2013-08-19 15:05 ` [PATCH v11 1/8] ASoC: imx-pcm-dma: Add missing include Markus Pargmann
2013-08-19 16:42   ` Mark Brown
2013-08-19 15:05 ` [PATCH v11 2/8] ASoC: core: Generic ac97 link reset functions Markus Pargmann
2013-08-20 10:22   ` Mark Brown
2014-06-18 18:42   ` S. Fricke
2014-06-18 21:19     ` Markus Pargmann
2013-08-19 15:05 ` [PATCH v11 3/8] ASoC: generic: simple DT sound card Markus Pargmann
2013-08-23  9:58   ` Mark Brown
2013-08-31  7:17     ` Markus Pargmann
2013-08-19 15:05 ` [PATCH v11 4/8] ASoC: fsl: Kconfig, visible config items for simple card Markus Pargmann
2013-08-19 15:05 ` [PATCH v11 5/8] ASoC: fsl-ssi: ac97-slave support Markus Pargmann
2013-08-22 10:09   ` Mark Brown
2013-08-19 15:05 ` [PATCH v11 6/8] ASoC: fsl-ssi: add SSIEN errata work around Markus Pargmann
2013-08-22 10:10   ` Mark Brown
2013-08-19 15:06 ` Markus Pargmann [this message]
2013-08-22 10:10   ` [PATCH v11 7/8] ASoC: fsl-ssi: imx-pcm-fiq bugfix Mark Brown
2013-08-19 15:06 ` [PATCH v11 8/8] ASoC: fsl: disable ssi irq for imx Markus Pargmann
2013-08-22 10:11   ` Mark Brown
2013-08-19 15:13 ` [PATCH v11 0/7] ASoC: fsl-ssi: ac97-slave support Marc Kleine-Budde
2013-08-19 15:13   ` Marc Kleine-Budde
2013-08-19 15:29     ` Markus Pargmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376924761-4054-8-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).