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

Commit 10b913fa authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9xxx: Update valid delta threshold when plug type is HIGH_HPH



Whenever plug type is classified as HIGH_HPH during successive DCE
measurements, it is observed that the difference min and max measured
mic voltage will be above 10mv for a current source. Update this valid
threshold limit to 80mv so that plug type cannot be classified as invalid.

CRs-fixed: 566579
Change-Id: I0a87ad58161646f4c94da601a8ec6ffc3f1b06c8
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 6badacdb
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1308,6 +1308,7 @@ wcd9xxx_cs_find_plug_type(struct wcd9xxx_mbhc *mbhc,
	const struct wcd9xxx_mbhc_plug_type_cfg *plug_type =
	    WCD9XXX_MBHC_CAL_PLUG_TYPE_PTR(mbhc->mbhc_cfg->calibration);
	s16 hs_max, no_mic, dce_z;
	int highhph_cnt = 0;

	pr_debug("%s: enter\n", __func__);
	pr_debug("%s: event_state 0x%lx\n", __func__, event_state);
@@ -1332,9 +1333,10 @@ wcd9xxx_cs_find_plug_type(struct wcd9xxx_mbhc *mbhc,
		d->_vdces = vdce;
		if (d->_vdces < no_mic)
			d->_type = PLUG_TYPE_HEADPHONE;
		else if (d->_vdces >= hs_max)
		else if (d->_vdces >= hs_max) {
			d->_type = PLUG_TYPE_HIGH_HPH;
		else
			highhph_cnt++;
		} else
			d->_type = PLUG_TYPE_HEADSET;

		pr_debug("%s: DCE #%d, %04x, V %04d(%04d), HPHL %d TYPE %d\n",
@@ -1369,7 +1371,8 @@ wcd9xxx_cs_find_plug_type(struct wcd9xxx_mbhc *mbhc,
		goto exit;
	}

	delta_thr = highhph ? WCD9XXX_MB_MEAS_DELTA_MAX_MV :
	delta_thr = ((highhph_cnt == sz) || highhph) ?
			      WCD9XXX_MB_MEAS_DELTA_MAX_MV :
			      WCD9XXX_CS_MEAS_DELTA_MAX_MV;

	for (i = 0, d = dt; i < sz; i++, d++) {