All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@sirena.org.uk>
To: ext-jukka.hynninen@vaisala.com
Cc: alsa-devel@alsa-project.org
Subject: Re: ASoC: Merging at91 and avr32 dirs - test report
Date: Tue, 14 Oct 2008 13:58:36 +0100	[thread overview]
Message-ID: <20081014125835.GF14538@sirena.org.uk> (raw)
In-Reply-To: <B9D3C48C98930741A166756A50C44A610F17B564@helx1.corp.vaisala.com>

On Tue, Oct 14, 2008 at 03:38:22PM +0300, ext-jukka.hynninen@vaisala.com wrote:

> This is propably a false alarm, exactly the same happens with at91-ssc.c

OK, so you're happy that the new and old AT91 drivers perform
equivalently?

> Using mpg123, the soc_pcm_prepare() never gets called, which makes me
> suspect 
> that the real problem might lie in mpg123 code. A similar issue has been

The drivers should be robust against buggy applications, though.

> reported here in the past, but I couldn't find a solution:

> http://thread.gmane.org/gmane.linux.alsa.devel/47908

Yes, I think it's the same issue -  looks like a core bug which is still
present in current ASoC.  The patch below is *entirely* untested but may
help.  It needs more thought and (obviously) testing to make sure it's
safe before it can be merged.

[BTW, your mailer is doing some *really* strange line-wrapping.]


diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ad38113..725b30b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -429,51 +429,42 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
 		}
 	}
 
-	/* we only want to start a DAPM playback stream if we are not waiting
-	 * on an existing one stopping */
-	if (codec_dai->pop_wait) {
-		/* we are waiting for the delayed work to start */
-		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
-				snd_soc_dapm_stream_event(socdev->codec,
-					codec_dai->capture.stream_name,
-					SND_SOC_DAPM_STREAM_START);
-		else {
-			codec_dai->pop_wait = 0;
-			cancel_delayed_work(&socdev->delayed_work);
-			snd_soc_dai_digital_mute(codec_dai, 0);
-		}
-	} else {
-		/* no delayed work - do we need to power up codec */
-		if (codec->bias_level != SND_SOC_BIAS_ON) {
+	/* cancel any delayed stream shutdown that is pending */
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+	    codec_dai->pop_wait) {
+		codec_dai->pop_wait = 0;
+		cancel_delayed_work(&socdev->delayed_work);
+	}
 
-			snd_soc_dapm_set_bias_level(socdev,
-						    SND_SOC_BIAS_PREPARE);
+        /* do we need to power up codec */
+	if (codec->bias_level != SND_SOC_BIAS_ON) {
+		snd_soc_dapm_set_bias_level(socdev,
+					    SND_SOC_BIAS_PREPARE);
 
-			if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-				snd_soc_dapm_stream_event(codec,
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			snd_soc_dapm_stream_event(codec,
 					codec_dai->playback.stream_name,
 					SND_SOC_DAPM_STREAM_START);
-			else
-				snd_soc_dapm_stream_event(codec,
+		else
+			snd_soc_dapm_stream_event(codec,
 					codec_dai->capture.stream_name,
 					SND_SOC_DAPM_STREAM_START);
 
-			snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_ON);
-			snd_soc_dai_digital_mute(codec_dai, 0);
+		snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_ON);
+		snd_soc_dai_digital_mute(codec_dai, 0);
 
-		} else {
-			/* codec already powered - power on widgets */
-			if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-				snd_soc_dapm_stream_event(codec,
+	} else {
+		/* codec already powered - power on widgets */
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			snd_soc_dapm_stream_event(codec,
 					codec_dai->playback.stream_name,
 					SND_SOC_DAPM_STREAM_START);
-			else
-				snd_soc_dapm_stream_event(codec,
+		else
+			snd_soc_dapm_stream_event(codec,
 					codec_dai->capture.stream_name,
 					SND_SOC_DAPM_STREAM_START);
 
-			snd_soc_dai_digital_mute(codec_dai, 0);
-		}
+		snd_soc_dai_digital_mute(codec_dai, 0);
 	}
 
 out:

  reply	other threads:[~2008-10-14 12:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10 15:15 ASoC: Merging at91 and avr32 dirs - test report ext-jukka.hynninen
2008-10-10 18:53 ` Mark Brown
2008-10-14  7:28   ` ext-jukka.hynninen
2008-10-14 12:38     ` ext-jukka.hynninen
2008-10-14 12:58       ` Mark Brown [this message]
2008-10-14 14:00         ` ext-jukka.hynninen
2008-10-27  9:57           ` Sedji Gaouaou
2008-10-27 10:42             ` Mark Brown
2008-10-27 11:13               ` ext-jukka.hynninen
2008-10-27 11:29                 ` Mark Brown
2008-10-27 13:34                   ` ext-jukka.hynninen
2008-10-13 14:22 ` Sedji Gaouaou
2008-10-13 14:34   ` Mark Brown

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=20081014125835.GF14538@sirena.org.uk \
    --to=broonie@sirena.org.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=ext-jukka.hynninen@vaisala.com \
    /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 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.