Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d45f6219 authored by Mark Brown's avatar Mark Brown Committed by Mark Brown
Browse files

ASoC: Fix handling of DAPM suspend work



Since we can query the playback stream power state directly we do not
need to infer if it is powered up from the timer being scheduled.  Doing
this avoids problems that previously existed with streams being
incorrectly determined to be powered up caused when the timer is
scheduled when streams are closed after being partially set up.

Reported-by: default avatarNobin Mathew <nobin.mathew@gmail.com>
Reported-by: default avatarJukka Hynninen <ext-jukka.hynninen@vaisala.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 12ef193d
Loading
Loading
Loading
Loading
+23 −32
Original line number Original line Diff line number Diff line
@@ -429,23 +429,15 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
		}
		}
	}
	}


	/* we only want to start a DAPM playback stream if we are not waiting
	/* cancel any delayed stream shutdown that is pending */
	 * on an existing one stopping */
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
	if (codec_dai->pop_wait) {
	    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;
		codec_dai->pop_wait = 0;
		cancel_delayed_work(&socdev->delayed_work);
		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) {


	/* do we need to power up codec */
	if (codec->bias_level != SND_SOC_BIAS_ON) {
		snd_soc_dapm_set_bias_level(socdev,
		snd_soc_dapm_set_bias_level(socdev,
					    SND_SOC_BIAS_PREPARE);
					    SND_SOC_BIAS_PREPARE);


@@ -474,7 +466,6 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)


		snd_soc_dai_digital_mute(codec_dai, 0);
		snd_soc_dai_digital_mute(codec_dai, 0);
	}
	}
	}


out:
out:
	mutex_unlock(&pcm_mutex);
	mutex_unlock(&pcm_mutex);