From 2ccb20dc4cebd281153e1c8f5872637ed8c81a95 Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Tue, 7 Jan 2020 18:21:31 +0530 Subject: [PATCH] ASoC: wcd-mbhc: Disable micbias internal pull-up after headphone detected Micbias2 internal pull-up remains enabled even after headphone is detected. This results in power issues. Disable pull up after insertion detection. Change-Id: I335dbb498192738fc282421d92510400a661cf0c Signed-off-by: Vatsal Bucha --- asoc/codecs/wcd-mbhc-v2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/asoc/codecs/wcd-mbhc-v2.c b/asoc/codecs/wcd-mbhc-v2.c index 48f0c6e425..f173f3e314 100644 --- a/asoc/codecs/wcd-mbhc-v2.c +++ b/asoc/codecs/wcd-mbhc-v2.c @@ -758,6 +758,10 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, mbhc->hph_status |= jack_type; + if (jack_type == SND_JACK_HEADPHONE && + mbhc->mbhc_cb->mbhc_micb_ramp_control) + mbhc->mbhc_cb->mbhc_micb_ramp_control(component, false); + pr_debug("%s: Reporting insertion %d(%x)\n", __func__, jack_type, mbhc->hph_status); wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack, @@ -952,6 +956,10 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc) else pr_info("%s: hs_detect_plug work not cancelled\n", __func__); + /* Enable micbias ramp */ + if (mbhc->mbhc_cb->mbhc_micb_ramp_control) + mbhc->mbhc_cb->mbhc_micb_ramp_control(component, true); + if (mbhc->mbhc_cb->micbias_enable_status) micbias1 = mbhc->mbhc_cb->micbias_enable_status(mbhc, MIC_BIAS_1); @@ -1459,9 +1467,6 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) /* Button Debounce set to 16ms */ WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_DBNC, 2); - /* Enable micbias ramp */ - if (mbhc->mbhc_cb->mbhc_micb_ramp_control) - mbhc->mbhc_cb->mbhc_micb_ramp_control(component, true); /* enable bias */ mbhc->mbhc_cb->mbhc_bias(component, true); /* enable MBHC clock */