From 48003fde1ab2f3bdf6276b02a3d78823ff073f4a Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Wed, 17 Jul 2019 16:25:08 +0530 Subject: [PATCH] ASoC: wcd-mbhc: Fix high impedance lineout detected as headphone issue During playback if lineout is inserted it is detected as lineout then changed to headphone. This is because we do not compute impedance again as pa is on. Force jack to be detected as lineout based on initial detection to resolve the issue. Change-Id: I243c324dcd251596db97aeef07b8535986550650 Signed-off-by: Vatsal Bucha --- asoc/codecs/wcd-mbhc-v2.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/asoc/codecs/wcd-mbhc-v2.c b/asoc/codecs/wcd-mbhc-v2.c index 6a85c8232770..624b59af069e 100644 --- a/asoc/codecs/wcd-mbhc-v2.c +++ b/asoc/codecs/wcd-mbhc-v2.c @@ -655,7 +655,6 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, SND_JACK_LINEOUT | SND_JACK_ANC_HEADPHONE | SND_JACK_UNSUPPORTED); - mbhc->force_linein = false; } if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADSET && @@ -714,6 +713,25 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, } } + /* Do not calculate impedance again for lineout + * as during playback pa is on and impedance values + * will not be correct resulting in lineout detected + * as headphone. + */ + if ((is_pa_on) && mbhc->force_linein == true) { + jack_type = SND_JACK_LINEOUT; + mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH; + if (mbhc->hph_status) { + mbhc->hph_status &= ~(SND_JACK_HEADSET | + SND_JACK_LINEOUT | + SND_JACK_UNSUPPORTED); + wcd_mbhc_jack_report(mbhc, + &mbhc->headset_jack, + mbhc->hph_status, + WCD_MBHC_JACK_MASK); + } + } + mbhc->hph_status |= jack_type; pr_debug("%s: Reporting insertion %d(%x)\n", __func__,