Commit de9ad990 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: add soc_rtd_hw_params()

Add soc_rtd_hw_params() to make the code easier to read
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874kwomi9r.wl-kuninori.morimoto.gx@renesas.comReviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 44c1a75b
...@@ -54,6 +54,16 @@ static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, ...@@ -54,6 +54,16 @@ static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd,
return 0; return 0;
} }
static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
if (rtd->dai_link->ops &&
rtd->dai_link->ops->hw_params)
return rtd->dai_link->ops->hw_params(substream, params);
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
...@@ -826,14 +836,12 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -826,14 +836,12 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (ret) if (ret)
goto out; goto out;
if (rtd->dai_link->ops->hw_params) { ret = soc_rtd_hw_params(rtd, substream, params);
ret = rtd->dai_link->ops->hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
dev_err(rtd->card->dev, "ASoC: machine hw_params" dev_err(rtd->card->dev,
" failed: %d\n", ret); "ASoC: machine hw_params failed: %d\n", ret);
goto out; goto out;
} }
}
for_each_rtd_codec_dai(rtd, i, codec_dai) { for_each_rtd_codec_dai(rtd, i, codec_dai) {
struct snd_pcm_hw_params codec_params; struct snd_pcm_hw_params codec_params;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment