From 1399d398394b3334fe42c300a06a4af6cd9ccf66 Mon Sep 17 00:00:00 2001 From: Prasad Kumpatla Date: Tue, 11 Apr 2023 17:41:19 +0530 Subject: [PATCH] asoc: mbhc: enable l_det_en bit enable l_det_en bit while detecting the HS. Issue: While removing HS some additional electrical interrupts are triggered and reporting different events to userspace, which is cause issues. To avoid this electrical interrupt flow, there is a check in adc_hs_rem_irq for wcd_swch_level_remove() to check for l_det_en bit status. Depends on this it will return from the adc_hs_rem_irq() without going further. Solution: Enabling the l_det_en bit will helps to avoid serving electrical interrupt flow to further in adc_hs_rem_irq().So this will helps to stop reporting different/unwanted events to user space. Change-Id: I29d72b65ebb59969b69f3f8c7f4c7eb2debb0f1c Signed-off-by: Prasad Kumpatla --- asoc/codecs/wcd-mbhc-v2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/asoc/codecs/wcd-mbhc-v2.c b/asoc/codecs/wcd-mbhc-v2.c index b08bb229a7..7d712fd31e 100644 --- a/asoc/codecs/wcd-mbhc-v2.c +++ b/asoc/codecs/wcd-mbhc-v2.c @@ -1696,7 +1696,7 @@ static int wcd_mbhc_usbc_ana_event_handler(struct notifier_block *nb, #endif if (mbhc->mbhc_cb->clk_setup) mbhc->mbhc_cb->clk_setup(mbhc->component, true); - + WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_L_DET_EN, 1); #if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C) if (unlikely((mbhc->mbhc_cb->lock_sleep(mbhc, true)) == false)) @@ -1713,8 +1713,6 @@ static int wcd_mbhc_usbc_ana_event_handler(struct notifier_block *nb, WCD_MBHC_REG_READ(WCD_MBHC_MECH_DETECTION_TYPE, detection_type); if ((mode == TYPEC_ACCESSORY_NONE) && !detection_type) { wcd_usbss_switch_update(WCD_USBSS_AATC, WCD_USBSS_CABLE_DISCONNECT); - /* removal detected, disable L_DET_EN */ - WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_L_DET_EN, 0); if (unlikely((mbhc->mbhc_cb->lock_sleep(mbhc, true)) == false)) pr_warn("%s: failed to hold suspend\n", __func__); else {