Commit 1ba616bd authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: soc-dai: fix DAI startup/shutdown sequence

The addition of a single flag to track the DAI status prevents the DAI
startup sequence from being called on capture if the DAI is already
used for playback.

Fix by extending the existing code with one flag per direction.

Fixes: b56be800 ("ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once")
Reported-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20200330160602.10180-1-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0ab07091
...@@ -351,7 +351,7 @@ struct snd_soc_dai { ...@@ -351,7 +351,7 @@ struct snd_soc_dai {
/* bit field */ /* bit field */
unsigned int probed:1; unsigned int probed:1;
unsigned int started:1; unsigned int started[SNDRV_PCM_STREAM_LAST + 1];
}; };
static inline struct snd_soc_pcm_stream * static inline struct snd_soc_pcm_stream *
......
...@@ -295,12 +295,12 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, ...@@ -295,12 +295,12 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
{ {
int ret = 0; int ret = 0;
if (!dai->started && if (!dai->started[substream->stream] &&
dai->driver->ops->startup) dai->driver->ops->startup)
ret = dai->driver->ops->startup(substream, dai); ret = dai->driver->ops->startup(substream, dai);
if (ret == 0) if (ret == 0)
dai->started = 1; dai->started[substream->stream] = 1;
return ret; return ret;
} }
...@@ -308,11 +308,11 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, ...@@ -308,11 +308,11 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
void snd_soc_dai_shutdown(struct snd_soc_dai *dai, void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
{ {
if (dai->started && if (dai->started[substream->stream] &&
dai->driver->ops->shutdown) dai->driver->ops->shutdown)
dai->driver->ops->shutdown(substream, dai); dai->driver->ops->shutdown(substream, dai);
dai->started = 0; dai->started[substream->stream] = 0;
} }
int snd_soc_dai_prepare(struct snd_soc_dai *dai, int snd_soc_dai_prepare(struct snd_soc_dai *dai,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment