aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-21 23:51:13 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-22 13:42:33 -0500
commit864c4bd2487619564acd75fdcf1a4349992e9090 (patch)
tree1fa2ec8b34711ad4de61cc16c896462751a31151 /sound
parent48e028eccabc9c246bfad175262582a1ce34a316 (diff)
ASoC: Simplify default WM8958 jack detection code
The default WM8958 jack detection handler implements a full set of buttons and also support for video detection. Support for multi-button jacks is fairly system specific and will usually require some tuning for headsets so simplify the implementation to only report a simple short to ground button, leaving multi-button headsets to be handled by system specific code. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8994.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 9b9c15ffb7d2..0dc14115f109 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -102,8 +102,6 @@ struct wm8994_priv {
102 102
103 wm8958_micdet_cb jack_cb; 103 wm8958_micdet_cb jack_cb;
104 void *jack_cb_data; 104 void *jack_cb_data;
105 bool jack_is_mic;
106 bool jack_is_video;
107 int micdet_irq; 105 int micdet_irq;
108 106
109 int revision; 107 int revision;
@@ -2972,46 +2970,18 @@ static void wm8958_default_micdet(u16 status, void *data)
2972 int report = 0; 2970 int report = 0;
2973 2971
2974 /* If nothing present then clear our statuses */ 2972 /* If nothing present then clear our statuses */
2975 if (!(status & WM8958_MICD_STS)) { 2973 if (!(status & WM8958_MICD_STS))
2976 wm8994->jack_is_video = false;
2977 wm8994->jack_is_mic = false;
2978 goto done; 2974 goto done;
2979 }
2980
2981 /* Assume anything over 475 ohms is a microphone and remember
2982 * that we've seen one (since buttons override it) */
2983 if (status & 0x600)
2984 wm8994->jack_is_mic = true;
2985 if (wm8994->jack_is_mic)
2986 report |= SND_JACK_MICROPHONE;
2987 2975
2988 /* Video has an impedence of approximately 75 ohms; assume 2976 report = SND_JACK_MICROPHONE;
2989 * this isn't used as a button and remember it since buttons
2990 * override it. */
2991 if (status & 0x40)
2992 wm8994->jack_is_video = true;
2993 if (wm8994->jack_is_video)
2994 report |= SND_JACK_VIDEOOUT;
2995 2977
2996 /* Everything else is buttons; just assign slots */ 2978 /* Everything else is buttons; just assign slots */
2997 if (status & 0x4) 2979 if (status & 0x1c0)
2998 report |= SND_JACK_BTN_0; 2980 report |= SND_JACK_BTN_0;
2999 if (status & 0x8)
3000 report |= SND_JACK_BTN_1;
3001 if (status & 0x10)
3002 report |= SND_JACK_BTN_2;
3003 if (status & 0x20)
3004 report |= SND_JACK_BTN_3;
3005 if (status & 0x80)
3006 report |= SND_JACK_BTN_4;
3007 if (status & 0x100)
3008 report |= SND_JACK_BTN_5;
3009 2981
3010done: 2982done:
3011 snd_soc_jack_report(wm8994->micdet[0].jack, report, 2983 snd_soc_jack_report(wm8994->micdet[0].jack, report,
3012 SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | 2984 SND_JACK_BTN_0 | SND_JACK_MICROPHONE);
3013 SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 |
3014 SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT);
3015} 2985}
3016 2986
3017/** 2987/**