diff options
author | 2020-02-10 12:14:33 +0900 | |
---|---|---|
committer | 2020-02-11 15:42:03 +0000 | |
commit | b56be800f1292c9b79c4f66571c701551bdf9e12 (patch) | |
tree | f41a73610442b8a5a7f1c478052d0f543f920d0d /sound/soc/soc-dai.c | |
parent | ASoC: soc-pcm: don't use bit-OR'ed error (diff) | |
download | linux-b56be800f1292c9b79c4f66571c701551bdf9e12.tar.gz linux-b56be800f1292c9b79c4f66571c701551bdf9e12.tar.bz2 linux-b56be800f1292c9b79c4f66571c701551bdf9e12.zip |
ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once
Current soc_pcm_open() calls snd_soc_dai_startup() under loop.
Thus, it needs to care about started/not-yet-started codec DAI.
But, if soc-dai.c is handling it, soc-pcm.c don't need to care
about it.
This patch adds started flag to soc-dai.h, and simplify soc-pcm.c.
This is one of prepare for cleanup soc-pcm-open()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875zgfcey5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dai.c')
-rw-r--r-- | sound/soc/soc-dai.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 51031e330179..73a829393652 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -295,17 +295,24 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, { int ret = 0; - if (dai->driver->ops->startup) + if (!dai->started && + dai->driver->ops->startup) ret = dai->driver->ops->startup(substream, dai); + if (ret == 0) + dai->started = 1; + return ret; } void snd_soc_dai_shutdown(struct snd_soc_dai *dai, struct snd_pcm_substream *substream) { - if (dai->driver->ops->shutdown) + if (dai->started && + dai->driver->ops->shutdown) dai->driver->ops->shutdown(substream, dai); + + dai->started = 0; } int snd_soc_dai_prepare(struct snd_soc_dai *dai, |