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 <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha
2021-09-28 13:25:40 +05:30
committed by Gerrit - the friendly Code Review server
parent 1b69ddf3c3
commit 5f65bb9592

View File

@@ -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);