From 34c966895501632c8ab385a276558a68e7d43f6f Mon Sep 17 00:00:00 2001 From: Misael Lopez Cruz Date: Fri, 2 Dec 2011 09:58:32 +0800 Subject: ASoC: sdp4430 - Add Mic Bias for digital mics in legacy mode Add microphone bias for digital microphone in legacy mode. Change-Id: Idc37babbf7acd552c6fbefe51315492e861116eb Signed-off-by: Misael Lopez Cruz --- sound/soc/omap/sdp4430.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'sound') diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 8af88f53cf97..700323e50160 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -335,6 +335,39 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) return ret; } +/* SDP4430 digital microphones DAPM */ +static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = { + SND_SOC_DAPM_MIC("Digital Mic Legacy", NULL), +}; + +static const struct snd_soc_dapm_route dmic_audio_map[] = { + {"DMic", NULL, "Digital Mic1 Bias"}, + {"Digital Mic1 Bias", NULL, "Digital Mic Legacy"}, +}; + +static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_dapm_context *dapm = &codec->dapm; + int ret; + + ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets, + ARRAY_SIZE(sdp4430_dmic_dapm_widgets)); + if (ret) + return ret; + + ret = snd_soc_dapm_add_routes(dapm, dmic_audio_map, + ARRAY_SIZE(dmic_audio_map)); + if (ret) + return ret; + + snd_soc_dapm_enable_pin(dapm, "Digital Mic Legacy"); + + ret = snd_soc_dapm_sync(dapm); + + return ret; +} + /* TODO: make this a separate BT CODEC driver or DUMMY */ static struct snd_soc_dai_driver dai[] = { { @@ -551,6 +584,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { .codec_dai_name = "dmic-hifi", .codec_name = "dmic-codec.0", + .init = sdp4430_dmic_init, .ops = &sdp4430_dmic_ops, }, -- cgit v1.2.3