From 51ee66240a336f627cc8aab75363dea67bdd592f Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 20 Oct 2010 01:01:57 +0100 Subject: [PATCH 47/60] ASoC: sdp4430: Add BE hw_params fixups commit 8ac018b40af14a258304ee2ef8a03aaa4cec899a upstream Add fixup for McBSP and DMIC backends. Backend hw_params are fixed regardless of frontend configuration as follow: McBSP configuration for the backends shall be fixed as follow: BT_VX -> McBSP1 : Mono, S16_LE MM_EXT -> McBSP2 : Stere, S16_LE DMIC configuration for backends is restricted to S32_LE. Change-Id: I256bdcb7caffbadc549826663591c2b8ffb8caf1 Signed-off-by: Liam Girdwood Signed-off-by: Margarita Olaya Cabrera Integrated-by: Jingdong Lu --- sound/soc/omap/sdp4430.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index a385e79..7bb65d1 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -251,6 +252,35 @@ static struct snd_soc_ops sdp4430_dmic_ops = { .hw_free = sdp4430_dmic_hw_free, }; +static int mcbsp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); + unsigned int be_id; + + be_id = rtd->dai_link->be_id; + + if (be_id == OMAP_ABE_DAI_MM_FM) + channels->min = 2; + else if (be_id == OMAP_ABE_DAI_BT_VX) + channels->min = 1; + + snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - + SNDRV_PCM_HW_PARAM_FIRST_MASK], + SNDRV_PCM_FORMAT_S16_LE); + return 0; +} + +static int dmic_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - + SNDRV_PCM_HW_PARAM_FIRST_MASK], + SNDRV_PCM_FORMAT_S32_LE); + return 0; +} + /* Headset jack */ static struct snd_soc_jack hs_jack; @@ -727,6 +757,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .no_pcm = 1, /* don't create ALSA pcm for this */ .no_codec = 1, /* TODO: have a dummy CODEC */ + .be_hw_params_fixup = mcbsp_be_hw_params_fixup, .ops = &sdp4430_mcbsp_ops, .be_id = OMAP_ABE_DAI_BT_VX, }, @@ -743,6 +774,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .no_pcm = 1, /* don't create ALSA pcm for this */ .no_codec = 1, /* TODO: have a dummy CODEC */ + .be_hw_params_fixup = mcbsp_be_hw_params_fixup, .ops = &sdp4430_mcbsp_ops, .be_id = OMAP_ABE_DAI_MM_FM, }, @@ -759,6 +791,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .no_pcm = 1, /* don't create ALSA pcm for this */ .no_codec = 1, /* TODO: have a dummy CODEC */ + .be_hw_params_fixup = mcbsp_be_hw_params_fixup, .ops = &sdp4430_mcbsp_ops, .be_id = OMAP_ABE_DAI_MODEM, }, @@ -776,6 +809,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .ops = &sdp4430_dmic_ops, .no_pcm = 1, /* don't create ALSA pcm for this */ + .be_hw_params_fixup = dmic_be_hw_params_fixup, .be_id = OMAP_ABE_DAI_DMIC0, }, { @@ -792,6 +826,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .ops = &sdp4430_dmic_ops, .no_pcm = 1, /* don't create ALSA pcm for this */ + .be_hw_params_fixup = dmic_be_hw_params_fixup, .be_id = OMAP_ABE_DAI_DMIC1, }, { @@ -808,6 +843,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .ops = &sdp4430_dmic_ops, .no_pcm = 1, /* don't create ALSA pcm for this */ + .be_hw_params_fixup = dmic_be_hw_params_fixup, .be_id = OMAP_ABE_DAI_DMIC2, }, }; -- 1.7.4.1