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

Commit 7e00a355 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: mbhc-adc: Fix fake electrical removal interrupts on rouleur aatc"

parents ab1f4738 53d316ac
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -138,7 +138,20 @@ static int wcd_measure_adc_once(struct wcd_mbhc *mbhc, int mux_ctl)
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
	/* Set the appropriate MUX selection */
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MUX_CTL, mux_ctl);
	/*
	 * Current source mode requires Auto zeroing to be enabled
	 * automatically. If HW doesn't do it, SW has to take care of this
	 * for button interrupts to work fine and to avoid
	 * fake electrical removal interrupts by enabling autozero before FSM
	 * enable and disable it after FSM enable
	 */
	if (mbhc->mbhc_cb->mbhc_comp_autozero_control)
		mbhc->mbhc_cb->mbhc_comp_autozero_control(mbhc,
							true);
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
	if (mbhc->mbhc_cb->mbhc_comp_autozero_control)
		mbhc->mbhc_cb->mbhc_comp_autozero_control(mbhc,
							false);
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ADC_EN, 1);

	while (retry--) {
@@ -351,8 +364,20 @@ static int wcd_check_cross_conn(struct wcd_mbhc *mbhc)
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
	/* Set the MUX selection to Auto */
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_MUX_CTL, MUX_CTL_AUTO);
	/*
	 * Current source mode requires Auto zeroing to be enabled
	 * automatically. If HW doesn't do it, SW has to take care of this
	 * for button interrupts to work fine and to avoid
	 * fake electrical removal interrupts by enabling autozero before FSM
	 * enable and disable it after FSM enable
	 */
	if (mbhc->mbhc_cb->mbhc_comp_autozero_control)
		mbhc->mbhc_cb->mbhc_comp_autozero_control(mbhc,
							true);
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);

	if (mbhc->mbhc_cb->mbhc_comp_autozero_control)
		mbhc->mbhc_cb->mbhc_comp_autozero_control(mbhc,
							false);
	/* Restore ADC Enable */
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ADC_EN, adc_en);