mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-03 11:13:56 +08:00
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>
This commit is contained in:
parent
e82ebffce3
commit
b56be800f1
@ -324,7 +324,6 @@ struct snd_soc_dai {
|
|||||||
/* DAI runtime info */
|
/* DAI runtime info */
|
||||||
unsigned int capture_active; /* stream usage count */
|
unsigned int capture_active; /* stream usage count */
|
||||||
unsigned int playback_active; /* stream usage count */
|
unsigned int playback_active; /* stream usage count */
|
||||||
unsigned int probed:1;
|
|
||||||
|
|
||||||
unsigned int active;
|
unsigned int active;
|
||||||
|
|
||||||
@ -348,6 +347,10 @@ struct snd_soc_dai {
|
|||||||
unsigned int rx_mask;
|
unsigned int rx_mask;
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
|
||||||
|
/* bit field */
|
||||||
|
unsigned int probed:1;
|
||||||
|
unsigned int started:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
|
static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
|
||||||
|
@ -295,17 +295,24 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (dai->driver->ops->startup)
|
if (!dai->started &&
|
||||||
|
dai->driver->ops->startup)
|
||||||
ret = dai->driver->ops->startup(substream, dai);
|
ret = dai->driver->ops->startup(substream, dai);
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
|
dai->started = 1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
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->driver->ops->shutdown)
|
if (dai->started &&
|
||||||
|
dai->driver->ops->shutdown)
|
||||||
dai->driver->ops->shutdown(substream, dai);
|
dai->driver->ops->shutdown(substream, dai);
|
||||||
|
|
||||||
|
dai->started = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_soc_dai_prepare(struct snd_soc_dai *dai,
|
int snd_soc_dai_prepare(struct snd_soc_dai *dai,
|
||||||
|
@ -568,7 +568,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("ASoC: %s startup failed: %d\n",
|
pr_err("ASoC: %s startup failed: %d\n",
|
||||||
rtd->dai_link->name, ret);
|
rtd->dai_link->name, ret);
|
||||||
goto machine_err;
|
goto codec_dai_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dynamic PCM DAI links compat checks use dynamic capabilities */
|
/* Dynamic PCM DAI links compat checks use dynamic capabilities */
|
||||||
@ -637,11 +637,8 @@ dynamic:
|
|||||||
config_err:
|
config_err:
|
||||||
soc_rtd_shutdown(rtd, substream);
|
soc_rtd_shutdown(rtd, substream);
|
||||||
|
|
||||||
machine_err:
|
|
||||||
i = rtd->num_codecs;
|
|
||||||
|
|
||||||
codec_dai_err:
|
codec_dai_err:
|
||||||
for_each_rtd_codec_dai_rollback(rtd, i, codec_dai)
|
for_each_rtd_codec_dai(rtd, i, codec_dai)
|
||||||
snd_soc_dai_shutdown(codec_dai, substream);
|
snd_soc_dai_shutdown(codec_dai, substream);
|
||||||
|
|
||||||
component_err:
|
component_err:
|
||||||
|
Loading…
Reference in New Issue
Block a user