diff options
| author | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-05-31 09:23:04 +0100 |
|---|---|---|
| committer | Andy Green <andy.green@linaro.org> | 2011-05-31 11:04:33 +0100 |
| commit | 26b3a1d62cdd4e68d1ef00b8540f1ae170c6811f (patch) | |
| tree | 8d7a58f7ec45b571cdf478450f21ddb101dd26fe /sound | |
| parent | 5a1279c7cf21470ccb2cc8a63c35f007cf297563 (diff) | |
ASoC: sdp4430: Add BE hw_params fixups
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 <lrg@slimlogic.co.uk>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Diffstat (limited to 'sound')
| -rw-r--r-- | 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 637d8e42f74..a6c371ad52b 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -24,6 +24,7 @@ #include <sound/core.h> #include <linux/i2c.h> #include <sound/pcm.h> +#include <sound/pcm_params.h> #include <sound/soc.h> #include <sound/jack.h> @@ -253,6 +254,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; @@ -1061,6 +1091,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, }, @@ -1077,6 +1108,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, }, @@ -1093,6 +1125,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, }, @@ -1110,6 +1143,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, }, { @@ -1126,6 +1160,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, }, { @@ -1142,6 +1177,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, }, }; |
