[alsa-devel] [PATCH 4/6] ASoC: Tegra: Harmony: Implement mic detection
Stephen Warren
swarren at nvidia.com
Thu Feb 3 21:56:16 CET 2011
* Add jack definition for mic jack
* Request wm8903 to enable mic detection
* Remove Mic Bias from DAPM route map, so that Mic Bias isn't disable
when capture is stopped, thus preventing further mic detection from
operating.
Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
sound/soc/tegra/harmony.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
index e87395c..799b1ef 100644
--- a/sound/soc/tegra/harmony.c
+++ b/sound/soc/tegra/harmony.c
@@ -43,6 +43,8 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
+#include "../codecs/wm8903.h"
+
#include "tegra_das.h"
#include "tegra_i2s.h"
#include "tegra_pcm.h"
@@ -142,6 +144,15 @@ static struct snd_soc_jack_gpio harmony_hp_jack_gpios[] = {
}
};
+static struct snd_soc_jack harmony_mic_jack;
+
+static struct snd_soc_jack_pin harmony_mic_jack_pins[] = {
+ {
+ .pin = "Mic Jack",
+ .mask = SND_JACK_MICROPHONE,
+ },
+};
+
static int harmony_event_int_spk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
@@ -169,8 +180,7 @@ static const struct snd_soc_dapm_route harmony_audio_map[] = {
{"Int Spk", NULL, "RON"},
{"Int Spk", NULL, "LOP"},
{"Int Spk", NULL, "LON"},
- {"Mic Bias", NULL, "Mic Jack"},
- {"IN1L", NULL, "Mic Bias"},
+ {"IN1L", NULL, "Mic Jack"},
};
static const struct snd_kcontrol_new harmony_controls[] = {
@@ -206,9 +216,6 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_add_routes(dapm, harmony_audio_map,
ARRAY_SIZE(harmony_audio_map));
- snd_soc_dapm_enable_pin(dapm, "Mic Jack");
- snd_soc_dapm_sync(dapm);
-
harmony_hp_jack_gpios[0].gpio = pdata->gpio_hp_det;
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
&harmony_hp_jack);
@@ -219,6 +226,13 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
ARRAY_SIZE(harmony_hp_jack_gpios),
harmony_hp_jack_gpios);
+ snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
+ &harmony_mic_jack);
+ snd_soc_jack_add_pins(&harmony_mic_jack,
+ ARRAY_SIZE(harmony_mic_jack_pins),
+ harmony_mic_jack_pins);
+ wm8903_mic_detect(codec, &harmony_mic_jack, SND_JACK_MICROPHONE, 0);
+
return 0;
}
--
1.7.1
More information about the Alsa-devel
mailing list