From 84e6857d3d454a427b72a07476e4b7a5b9a1361b Mon Sep 17 00:00:00 2001 From: Anish Kumar Date: Tue, 9 Sep 2014 00:57:49 -0700 Subject: ASoC: pcm: Add support for fixup callback Fixup callback is added for dais which do not follow the FE and BE convention and is directly controlled by userspace such as hostless dais. This will restrict the hw_params based on what is supported by hardware rather than blindly setting what is given by userspace. Change-Id: I401c70ab5de1df10363ec808cb68f72d8d74af96 Signed-off-by: Anish Kumar Signed-off-by: Sudheer Papothi --- sound/soc/soc-pcm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound/soc') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 256b7e210f31..b4ffe3904dcc 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -887,6 +887,16 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); + /* perform any hw_params fixups */ + if ((rtd->dai_link->no_host_mode == SND_SOC_DAI_LINK_NO_HOST) && + rtd->dai_link->be_hw_params_fixup) { + ret = rtd->dai_link->be_hw_params_fixup(rtd, + params); + if (ret < 0) + dev_err(rtd->card->dev, "ASoC: fixup failed for %s\n", + rtd->dai_link->name); + } + ret = soc_pcm_params_symmetry(substream, params); if (ret) goto out; -- cgit v1.2.3