Browse Source

ASoC: codecs: mbhc-adc: Check if moisture duty cycle enabled during elec rem irq

With moisture_en flag being set as true for legacy moisture detection,
need to check if duty cycle is also enabled so as to report headset
insertion/removal properly when moisture detection enabled.

Change-Id: I6014e2e047d7c33b16bf9229ee1901fd8d042b47
Signed-off-by: Vatsal Bucha <[email protected]>
Vatsal Bucha 3 years ago
parent
commit
5f65bb9592
1 changed files with 4 additions and 2 deletions
  1. 4 2
      asoc/codecs/wcd-mbhc-adc.c

+ 4 - 2
asoc/codecs/wcd-mbhc-adc.c

@@ -1038,7 +1038,8 @@ static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
 		goto exit;
 	}
 
-	if (mbhc->mbhc_cfg->moisture_en) {
+	if (mbhc->mbhc_cfg->moisture_en ||
+	    mbhc->mbhc_cfg->moisture_duty_cycle_en) {
 		if (mbhc->mbhc_cb->hph_pa_on_status)
 			if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->component)) {
 				hphpa_on = true;
@@ -1053,7 +1054,8 @@ static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
 		WCD_MBHC_REG_READ(WCD_MBHC_MOISTURE_STATUS, moisture_status);
 	}
 
-	if (mbhc->mbhc_cfg->moisture_en && !moisture_status) {
+	if ((mbhc->mbhc_cfg->moisture_en ||
+	    mbhc->mbhc_cfg->moisture_duty_cycle_en) && !moisture_status) {
 		pr_debug("%s: moisture present in jack\n", __func__);
 		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_L_DET_EN, 0);
 		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MECH_DETECTION_TYPE, 1);