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

Commit 32c02c3c authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9xxx: Update button release thresholds based on current micbias



During short button press, the button release threshold
registers are updated based on the determined button number
so that when mic voltage goes above the programmed value,
release interrupt will be triggered. This reduces delay in
reporting button release. However, the release thresholds
should be programmed based on the current micbias voltage
instead of programming based on 2.7V micbias. Otherwise,
it is possible that during playback where micbias is switched
to VDDIO (1.8V), the mic voltage would never go beyond the
voltage programmed in release threshold registers there by
not generating release interrupt at all.

CRs-Fixed: 641486
Change-Id: Ied9891f88b89d6f972db5e197200886c6aab3ab2
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 27a70795
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -3469,7 +3469,8 @@ void wcd9xxx_update_z(struct wcd9xxx_mbhc *mbhc)
 * wcd9xxx_update_rel_threshold : update mbhc release upper bound threshold
 *				  to ceilmv + buffer
 */
static int wcd9xxx_update_rel_threshold(struct wcd9xxx_mbhc *mbhc, int ceilmv)
static int wcd9xxx_update_rel_threshold(struct wcd9xxx_mbhc *mbhc, int ceilmv,
					bool vddio)
{
	u16 v_brh, v_b1_hu;
	int mv;
@@ -3479,6 +3480,8 @@ static int wcd9xxx_update_rel_threshold(struct wcd9xxx_mbhc *mbhc, int ceilmv)

	btn_det = WCD9XXX_MBHC_CAL_BTN_DET_PTR(calibration);
	mv = ceilmv + btn_det->v_btn_press_delta_cic;
	if (vddio)
		mv = scale_v_micb_vddio(mbhc, mv, true);
	pr_debug("%s: reprogram vb1hu/vbrh to %dmv\n", __func__, mv);

	if (mbhc->mbhc_state != MBHC_STATE_POTENTIAL_RECOVERY) {
@@ -3679,7 +3682,7 @@ irqreturn_t wcd9xxx_dce_handler(int irq, void *data)
						       MBHC_BTN_DET_V_BTN_HIGH);
		WARN_ON(btn >= btn_det->num_btn);
		/* reprogram release threshold to catch voltage ramp up early */
		wcd9xxx_update_rel_threshold(mbhc, v_btn_high[btn]);
		wcd9xxx_update_rel_threshold(mbhc, v_btn_high[btn], vddio);

		mask = wcd9xxx_get_button_mask(btn);
		mbhc->buttons_pressed |= mask;