Skip to content

Commit

Permalink
ASoC: soc-dai: fix DAI startup/shutdown sequence
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Tested-by: Amadeusz Sławiński <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
plbossart authored and broonie committed Mar 30, 2020
1 parent 0ab0709 commit 1ba616b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ struct snd_soc_dai {

/* bit field */
unsigned int probed:1;
unsigned int started:1;
unsigned int started[SNDRV_PCM_STREAM_LAST + 1];
};

static inline struct snd_soc_pcm_stream *
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/soc-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,24 +295,24 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
{
int ret = 0;

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

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

return ret;
}

void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream)
{
if (dai->started &&
if (dai->started[substream->stream] &&
dai->driver->ops->shutdown)
dai->driver->ops->shutdown(substream, dai);

dai->started = 0;
dai->started[substream->stream] = 0;
}

int snd_soc_dai_prepare(struct snd_soc_dai *dai,
Expand Down

0 comments on commit 1ba616b

Please sign in to comment.