Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ce1bcb4 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9xxx: Fix detection issue for headsets with threshold on MIC



Add additional check to see whether micbias is enabled
during DCE measurements and if it is enabled update the
condition so that plug type cannot be wrongly classified
as invalid plug type.

Change-Id: Id758e1bc553e1e6dbc81721f00f9c147b11cf390
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 3e2b941d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1409,7 +1409,7 @@ wcd9xxx_cs_find_plug_type(struct wcd9xxx_mbhc *mbhc,
		    (dgnd->_vdces + WCD9XXX_CS_GM_SWAP_THRES_MAX_MV >
		     maxv))
			type = PLUG_TYPE_GND_MIC_SWAP;
		else if (dgnd->_type != PLUG_TYPE_HEADSET) {
		else if (dgnd->_type != PLUG_TYPE_HEADSET && !dmicbias) {
			pr_debug("%s: Invalid, inconsistent types\n", __func__);
			type = PLUG_TYPE_INVALID;
		}
@@ -2260,8 +2260,11 @@ static void wcd9xxx_hs_remove_irq_noswch(struct wcd9xxx_mbhc *mbhc)
	usleep_range(generic->t_shutdown_plug_rem,
		     generic->t_shutdown_plug_rem);

	cs_enable = ((mbhc->mbhc_cfg->cs_enable_flags &
		      (1 << MBHC_CS_ENABLE_REMOVAL)) != 0);
	/* If micbias is enabled, don't enable current source */
	cs_enable = (((mbhc->mbhc_cfg->cs_enable_flags &
		      (1 << MBHC_CS_ENABLE_REMOVAL)) != 0) &&
		     (!(snd_soc_read(codec,
				     mbhc->mbhc_bias_regs.ctl_reg) & 0x80)));
	if (cs_enable)
		wcd9xxx_turn_onoff_current_source(mbhc, true, false);