From: Mark Brown Date: Tue, 21 Feb 2012 13:45:53 +0000 (+0000) Subject: ASoC: wm8994: Actively discharge idle MICBIAS with jack detect X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=55a27786856458a785e1ed7221aee22a06def877;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git ASoC: wm8994: Actively discharge idle MICBIAS with jack detect This minimises the chance of any external capacitors that are fitted being discharged into headphones as they insert. Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index e9a405a1fdaf..77085c1047d5 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3224,6 +3224,9 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_MECHANICAL, SND_JACK_MECHANICAL); + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_DISCH, 0); + /* * Start off measument of microphone impedence to find * out what's actually there. @@ -3235,6 +3238,9 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) } else { dev_dbg(codec->dev, "Jack not detected\n"); + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_DISCH, WM8958_MICB2_DISCH); + snd_soc_jack_report(wm8994->micdet[0].jack, 0, SND_JACK_MECHANICAL | SND_JACK_HEADSET | wm8994->btn_mask); @@ -3320,6 +3326,9 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, * otherwise jump straight to microphone detection. */ if (wm8994->jackdet) { + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_DISCH, + WM8958_MICB2_DISCH); snd_soc_update_bits(codec, WM8994_LDO_1, WM8994_LDO1_DISCH, 0); wm1811_jackdet_set_mode(codec,