summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnish Kumar <kanish@codeaurora.org>2014-09-09 00:57:49 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:10:54 -0700
commit80e8ef2c046ea5daeea06a5d0f6feaf9a360c1b1 (patch)
treea2c9f967e51b477a316f4e3b3ddbe9f84c3331af
parentd57ab70296e862da350be9797d4a7c8edc77c62d (diff)
ASoC: pcm: Add support for fixup callback
Fixup callback is added for dai's which do not follow the FE and BE convention and is directly controlled by userspace such as hostless dai's. 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 <kanish@codeaurora.org>
-rw-r--r--sound/soc/soc-pcm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ee59de5c1ee1..da457f0b7a56 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -867,6 +867,17 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (ret)
goto out;
+ /* 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);
+ }
+ }
+
if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) {
ret = rtd->dai_link->ops->hw_params(substream, params);
if (ret < 0) {