ASoC: soc-pcm: add soc_rtd_trigger()
Add soc_rtd_trigger() to make the code easier to read Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/871rrsmi9j.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
49f020e571
Коммит
ad2bf9f252
|
@ -72,6 +72,16 @@ static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd,
|
||||||
rtd->dai_link->ops->hw_free(substream);
|
rtd->dai_link->ops->hw_free(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int soc_rtd_trigger(struct snd_soc_pcm_runtime *rtd,
|
||||||
|
struct snd_pcm_substream *substream,
|
||||||
|
int cmd)
|
||||||
|
{
|
||||||
|
if (rtd->dai_link->ops &&
|
||||||
|
rtd->dai_link->ops->trigger)
|
||||||
|
return rtd->dai_link->ops->trigger(substream, cmd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
|
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
|
||||||
* @rtd: ASoC PCM runtime that is activated
|
* @rtd: ASoC PCM runtime that is activated
|
||||||
|
@ -1013,11 +1023,9 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
|
||||||
struct snd_soc_dai *codec_dai;
|
struct snd_soc_dai *codec_dai;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (rtd->dai_link->ops->trigger) {
|
ret = soc_rtd_trigger(rtd, substream, cmd);
|
||||||
ret = rtd->dai_link->ops->trigger(substream, cmd);
|
if (ret < 0)
|
||||||
if (ret < 0)
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
for_each_rtd_components(rtd, i, component) {
|
for_each_rtd_components(rtd, i, component) {
|
||||||
ret = snd_soc_component_trigger(component, substream, cmd);
|
ret = snd_soc_component_trigger(component, substream, cmd);
|
||||||
|
@ -1062,11 +1070,9 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtd->dai_link->ops->trigger) {
|
ret = soc_rtd_trigger(rtd, substream, cmd);
|
||||||
ret = rtd->dai_link->ops->trigger(substream, cmd);
|
if (ret < 0)
|
||||||
if (ret < 0)
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче