2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 20:23:57 +08:00

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: Kuninori Morimoto <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>
Link: https://lore.kernel.org/r/87wo503k73.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2020-05-25 09:57:36 +09:00 committed by Mark Brown
parent 7cf3c5b4a0
commit 0cbbf8a039
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
5 changed files with 26 additions and 16 deletions

View File

@ -9,6 +9,9 @@
#define __SOC_LINK_H
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);
void snd_soc_link_shutdown(struct snd_pcm_substream *substream);
int snd_soc_link_prepare(struct snd_pcm_substream *substream);

View File

@ -1656,7 +1656,11 @@ match:
dai_link->dpcm_playback = 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 =
component->driver->be_hw_params_fixup;

View File

@ -8,6 +8,7 @@
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include <sound/soc-link.h>
#define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret)
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,
int ret = 0;
/* perform any topology hw_params fixups before DAI */
if (rtd->dai_link->be_hw_params_fixup) {
ret = rtd->dai_link->be_hw_params_fixup(rtd, params);
if (ret < 0)
goto end;
}
ret = snd_soc_link_be_hw_params_fixup(rtd, params);
if (ret < 0)
goto end;
if (dai->driver->ops &&
dai->driver->ops->hw_params)

View File

@ -36,6 +36,17 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd)
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)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;

View File

@ -2079,16 +2079,9 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
sizeof(struct snd_pcm_hw_params));
/* perform any hw_params fixups */
if (be->dai_link->be_hw_params_fixup) {
ret = be->dai_link->be_hw_params_fixup(be,
&dpcm->hw_params);
if (ret < 0) {
dev_err(be->dev,
"ASoC: hw_params BE fixup failed %d\n",
ret);
goto unwind;
}
}
ret = snd_soc_link_be_hw_params_fixup(be, &dpcm->hw_params);
if (ret < 0)
goto unwind;
/* copy the fixed-up hw params for BE dai */
memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params,