[alsa-devel] [PATCH 10/19] ASoC: upd9976: add microphone bias support

Lu Guanqun guanqun.lu at intel.com
Wed May 4 15:45:44 CEST 2011


Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
---
 sound/soc/codecs/upd9976.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/upd9976.c b/sound/soc/codecs/upd9976.c
index 8b2fff7..69d83ea 100644
--- a/sound/soc/codecs/upd9976.c
+++ b/sound/soc/codecs/upd9976.c
@@ -60,6 +60,23 @@ static inline int upd9976_write(struct snd_soc_codec *codec,
 	return ret;
 }
 
+static int upd9976_mic2_bias_event(struct snd_soc_dapm_widget *widget,
+				   struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_codec *codec = widget->codec;
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		snd_soc_write(codec, UPD9976_AUXDBNC, 0xff);
+		break;
+	case SND_SOC_DAPM_POST_PMD:
+		snd_soc_write(codec, UPD9976_AUXDBNC, 0x0);
+		break;
+	}
+
+	return 0;
+}
+
 /*
  * Mixing Volume: from -25 dB to 6 dB in 1 dB steps.
  */
@@ -161,6 +178,12 @@ static const struct snd_soc_dapm_widget upd9976_dapm_widgets[] = {
 	SND_SOC_DAPM_MUX("PCM2 Mux", SND_SOC_NOPM, 0, 0,
 			 &upd9976_pcm2_mux_control),
 
+	/* Microphose Bias */
+	SND_SOC_DAPM_MICBIAS("MIC1 Bias", UPD9976_MICCTRL, 6, 0),
+	SND_SOC_DAPM_MICBIAS_E("MIC2 Bias", UPD9976_MICCTRL, 4, 0,
+			       upd9976_mic2_bias_event,
+			       SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+
 	/* PGA */
 	SND_SOC_DAPM_PGA("HP Playback Left", UPD9976_DRVPOWERCTRL,
 			 2, 0, NULL, 0),



More information about the Alsa-devel mailing list