aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-02-10 17:37:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-13 14:50:09 -0500
commit41b5f9b349617a42696b6783a86cfa8226044c6f (patch)
tree055472d2530bae193d24a746abe59db8685eb723 /sound/soc/tegra
parent535787b6ae081171a5e7dbf0158ef9fa56d59dc8 (diff)
ASoC: Tegra: Harmony: Implement mic detection
* Add jack definition for mic jack * Request wm8903 to enable mic detection * Force mic bias on, since it's required for mic detection Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r--sound/soc/tegra/harmony.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
index 61befcc281a8..cb95e5344853 100644
--- a/sound/soc/tegra/harmony.c
+++ b/sound/soc/tegra/harmony.c
@@ -43,6 +43,8 @@
43#include <sound/pcm_params.h> 43#include <sound/pcm_params.h>
44#include <sound/soc.h> 44#include <sound/soc.h>
45 45
46#include "../codecs/wm8903.h"
47
46#include "tegra_das.h" 48#include "tegra_das.h"
47#include "tegra_i2s.h" 49#include "tegra_i2s.h"
48#include "tegra_pcm.h" 50#include "tegra_pcm.h"
@@ -142,6 +144,15 @@ static struct snd_soc_jack_gpio harmony_hp_jack_gpios[] = {
142 } 144 }
143}; 145};
144 146
147static struct snd_soc_jack harmony_mic_jack;
148
149static struct snd_soc_jack_pin harmony_mic_jack_pins[] = {
150 {
151 .pin = "Mic Jack",
152 .mask = SND_JACK_MICROPHONE,
153 },
154};
155
145static int harmony_event_int_spk(struct snd_soc_dapm_widget *w, 156static int harmony_event_int_spk(struct snd_soc_dapm_widget *w,
146 struct snd_kcontrol *k, int event) 157 struct snd_kcontrol *k, int event)
147{ 158{
@@ -206,9 +217,6 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
206 snd_soc_dapm_add_routes(dapm, harmony_audio_map, 217 snd_soc_dapm_add_routes(dapm, harmony_audio_map,
207 ARRAY_SIZE(harmony_audio_map)); 218 ARRAY_SIZE(harmony_audio_map));
208 219
209 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
210 snd_soc_dapm_sync(dapm);
211
212 harmony_hp_jack_gpios[0].gpio = pdata->gpio_hp_det; 220 harmony_hp_jack_gpios[0].gpio = pdata->gpio_hp_det;
213 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, 221 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
214 &harmony_hp_jack); 222 &harmony_hp_jack);
@@ -219,6 +227,17 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
219 ARRAY_SIZE(harmony_hp_jack_gpios), 227 ARRAY_SIZE(harmony_hp_jack_gpios),
220 harmony_hp_jack_gpios); 228 harmony_hp_jack_gpios);
221 229
230 snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
231 &harmony_mic_jack);
232 snd_soc_jack_add_pins(&harmony_mic_jack,
233 ARRAY_SIZE(harmony_mic_jack_pins),
234 harmony_mic_jack_pins);
235 wm8903_mic_detect(codec, &harmony_mic_jack, SND_JACK_MICROPHONE, 0);
236
237 snd_soc_dapm_force_enable_pin(dapm, "Mic Bias");
238
239 snd_soc_dapm_sync(dapm);
240
222 return 0; 241 return 0;
223} 242}
224 243