Skip to content

Commit 1ba616b

Browse files
plbossartbroonie
authored andcommitted
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: b56be80 ("ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once") Reported-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Tested-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20200330160602.10180-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0ab0709 commit 1ba616b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/sound/soc-dai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct snd_soc_dai {
351351

352352
/* bit field */
353353
unsigned int probed:1;
354-
unsigned int started:1;
354+
unsigned int started[SNDRV_PCM_STREAM_LAST + 1];
355355
};
356356

357357
static inline struct snd_soc_pcm_stream *

sound/soc/soc-dai.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,24 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
295295
{
296296
int ret = 0;
297297

298-
if (!dai->started &&
298+
if (!dai->started[substream->stream] &&
299299
dai->driver->ops->startup)
300300
ret = dai->driver->ops->startup(substream, dai);
301301

302302
if (ret == 0)
303-
dai->started = 1;
303+
dai->started[substream->stream] = 1;
304304

305305
return ret;
306306
}
307307

308308
void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
309309
struct snd_pcm_substream *substream)
310310
{
311-
if (dai->started &&
311+
if (dai->started[substream->stream] &&
312312
dai->driver->ops->shutdown)
313313
dai->driver->ops->shutdown(substream, dai);
314314

315-
dai->started = 0;
315+
dai->started[substream->stream] = 0;
316316
}
317317

318318
int snd_soc_dai_prepare(struct snd_soc_dai *dai,

0 commit comments

Comments
 (0)