aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-21 11:23:35 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-21 11:49:53 -0500
commit07fb9d9e935a07aaed557c58d795c18fcd99aab4 (patch)
tree16607052a8dae5d85d54d5d3fdd1193ed30c1f75
parent55a27786856458a785e1ed7221aee22a06def877 (diff)
ASoC: wm8994: Support external capacitors on MICBIAS2 with jack detection
When an external capacitor is connected to MICBIAS2 on devices with jack detection (which is not required but may be done in some systems) then the loading may mean that better performance is obtained when the microphone bias is enabled normally rather than using the low power mode. Provide platform data allowing systems to indicate if they require this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--include/linux/mfd/wm8994/pdata.h3
-rw-r--r--sound/soc/codecs/wm8994.c24
2 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 3fb1f407d5e6..dc3e05011689 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -185,6 +185,9 @@ struct wm8994_pdata {
185 unsigned int jd_scthr:2; 185 unsigned int jd_scthr:2;
186 unsigned int jd_thr:2; 186 unsigned int jd_thr:2;
187 187
188 /* Configure WM1811 jack detection for use with external capacitor */
189 unsigned int jd_ext_cap:1;
190
188 /* WM8958 microphone bias configuration */ 191 /* WM8958 microphone bias configuration */
189 int micbias[2]; 192 int micbias[2];
190 193
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 77085c1047d5..0b1c271468af 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3172,6 +3172,14 @@ static void wm8958_default_micdet(u16 status, void *data)
3172 3172
3173 wm1811_jackdet_set_mode(codec, 3173 wm1811_jackdet_set_mode(codec,
3174 WM1811_JACKDET_MODE_JACK); 3174 WM1811_JACKDET_MODE_JACK);
3175
3176 if (wm8994->pdata->jd_ext_cap) {
3177 mutex_lock(&codec->mutex);
3178 snd_soc_dapm_disable_pin(&codec->dapm,
3179 "MICBIAS2");
3180 snd_soc_dapm_sync(&codec->dapm);
3181 mutex_unlock(&codec->mutex);
3182 }
3175 } 3183 }
3176 } 3184 }
3177 3185
@@ -3227,6 +3235,15 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3227 snd_soc_update_bits(codec, WM8958_MICBIAS2, 3235 snd_soc_update_bits(codec, WM8958_MICBIAS2,
3228 WM8958_MICB2_DISCH, 0); 3236 WM8958_MICB2_DISCH, 0);
3229 3237
3238 /* If required for an external cap force MICBIAS on */
3239 if (wm8994->pdata->jd_ext_cap) {
3240 mutex_lock(&codec->mutex);
3241 snd_soc_dapm_force_enable_pin(&codec->dapm,
3242 "MICBIAS2");
3243 snd_soc_dapm_sync(&codec->dapm);
3244 mutex_unlock(&codec->mutex);
3245 }
3246
3230 /* 3247 /*
3231 * Start off measument of microphone impedence to find 3248 * Start off measument of microphone impedence to find
3232 * out what's actually there. 3249 * out what's actually there.
@@ -3241,6 +3258,13 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3241 snd_soc_update_bits(codec, WM8958_MICBIAS2, 3258 snd_soc_update_bits(codec, WM8958_MICBIAS2,
3242 WM8958_MICB2_DISCH, WM8958_MICB2_DISCH); 3259 WM8958_MICB2_DISCH, WM8958_MICB2_DISCH);
3243 3260
3261 if (wm8994->pdata->jd_ext_cap) {
3262 mutex_lock(&codec->mutex);
3263 snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2");
3264 snd_soc_dapm_sync(&codec->dapm);
3265 mutex_unlock(&codec->mutex);
3266 }
3267
3244 snd_soc_jack_report(wm8994->micdet[0].jack, 0, 3268 snd_soc_jack_report(wm8994->micdet[0].jack, 0,
3245 SND_JACK_MECHANICAL | SND_JACK_HEADSET | 3269 SND_JACK_MECHANICAL | SND_JACK_HEADSET |
3246 wm8994->btn_mask); 3270 wm8994->btn_mask);