Commit 0cbbf8a0 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-link: add snd_soc_link_be_hw_params_fixup()

dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_be_hw_params_fixup().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87wo503k73.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7cf3c5b4
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#define __SOC_LINK_H #define __SOC_LINK_H
int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd); int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd);
int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
int snd_soc_link_startup(struct snd_pcm_substream *substream); int snd_soc_link_startup(struct snd_pcm_substream *substream);
void snd_soc_link_shutdown(struct snd_pcm_substream *substream); void snd_soc_link_shutdown(struct snd_pcm_substream *substream);
int snd_soc_link_prepare(struct snd_pcm_substream *substream); int snd_soc_link_prepare(struct snd_pcm_substream *substream);
......
...@@ -1656,7 +1656,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) ...@@ -1656,7 +1656,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
dai_link->dpcm_playback = 1; dai_link->dpcm_playback = 1;
dai_link->dpcm_capture = 1; dai_link->dpcm_capture = 1;
/* override any BE fixups */ /*
* override any BE fixups
* see
* snd_soc_link_be_hw_params_fixup()
*/
dai_link->be_hw_params_fixup = dai_link->be_hw_params_fixup =
component->driver->be_hw_params_fixup; component->driver->be_hw_params_fixup;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-dai.h> #include <sound/soc-dai.h>
#include <sound/soc-link.h>
#define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret) #define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret)
static inline int _soc_dai_ret(struct snd_soc_dai *dai, static inline int _soc_dai_ret(struct snd_soc_dai *dai,
...@@ -313,11 +314,9 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai, ...@@ -313,11 +314,9 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
int ret = 0; int ret = 0;
/* perform any topology hw_params fixups before DAI */ /* perform any topology hw_params fixups before DAI */
if (rtd->dai_link->be_hw_params_fixup) { ret = snd_soc_link_be_hw_params_fixup(rtd, params);
ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
if (ret < 0) if (ret < 0)
goto end; goto end;
}
if (dai->driver->ops && if (dai->driver->ops &&
dai->driver->ops->hw_params) dai->driver->ops->hw_params)
......
...@@ -36,6 +36,17 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd) ...@@ -36,6 +36,17 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd)
return soc_link_ret(rtd, ret); return soc_link_ret(rtd, ret);
} }
int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
int ret = 0;
if (rtd->dai_link->be_hw_params_fixup)
ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
return soc_link_ret(rtd, ret);
}
int snd_soc_link_startup(struct snd_pcm_substream *substream) int snd_soc_link_startup(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
......
...@@ -2079,16 +2079,9 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -2079,16 +2079,9 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
sizeof(struct snd_pcm_hw_params)); sizeof(struct snd_pcm_hw_params));
/* perform any hw_params fixups */ /* perform any hw_params fixups */
if (be->dai_link->be_hw_params_fixup) { ret = snd_soc_link_be_hw_params_fixup(be, &dpcm->hw_params);
ret = be->dai_link->be_hw_params_fixup(be, if (ret < 0)
&dpcm->hw_params);
if (ret < 0) {
dev_err(be->dev,
"ASoC: hw_params BE fixup failed %d\n",
ret);
goto unwind; goto unwind;
}
}
/* copy the fixed-up hw params for BE dai */ /* copy the fixed-up hw params for BE dai */
memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_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