From dcc84d6ff8d6752301f900796ae069c472f67b07 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Wed, 2 Sep 2020 11:08:59 +0800 Subject: [PATCH] asoc: wcd-mbhc: report headset when it's not reported During bootup and headset inserted, headset may first detect as GND_MIC swap type and not report. During three seconds polling, it's corrected as headset or headphone. When wrk_complete is false, it will not report to userspace. When current_plug is MBHC_PLUG_TYPE_NONE, report headset or headphone to userspace. Change-Id: I63394f1704c34cf355f0f4b0c33959332a69a639 Signed-off-by: Meng Wang --- asoc/codecs/wcd-mbhc-adc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/asoc/codecs/wcd-mbhc-adc.c b/asoc/codecs/wcd-mbhc-adc.c index 89f0f7ed19..19cdb6f9ea 100644 --- a/asoc/codecs/wcd-mbhc-adc.c +++ b/asoc/codecs/wcd-mbhc-adc.c @@ -885,8 +885,10 @@ correct_plug_type: */ if ((plug_type == MBHC_PLUG_TYPE_HEADSET) || (plug_type == MBHC_PLUG_TYPE_ANC_HEADPHONE)) { - pr_debug("%s: plug_type:0x%x already reported\n", - __func__, mbhc->current_plug); + pr_debug("%s: plug_type:0x%x current_plug: 0x%x already reported\n", + __func__, plug_type, mbhc->current_plug); + if (mbhc->current_plug != plug_type) + goto report; WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ADC_MODE, 0); WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ADC_EN, 0); goto enable_supply;