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

Commit f9274c37 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9335: Configure MBHC ground detection registers



Configure wcd9335 codec registers to enable mbhc ground
detection used for accessory insertion/removal.

Change-Id: Ifd1ba80f915615806dbad03386d496fa8d0796cb
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 1d7be653
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1222,6 +1222,21 @@ complete_zdet:
		tasha->zdet_gpio_cb(codec, false);
}

static void tasha_mbhc_gnd_det_ctrl(struct snd_soc_codec *codec, bool enable)
{
	if (enable) {
		snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
				    0x02, 0x02);
		snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
				    0x40, 0x40);
	} else {
		snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
				    0x40, 0x00);
		snd_soc_update_bits(codec, WCD9335_ANA_MBHC_MECH,
				    0x02, 0x00);
	}
}

static const struct wcd_mbhc_cb mbhc_cb = {
	.request_irq = tasha_mbhc_request_irq,
	.irq_control = tasha_mbhc_irq_control,
@@ -1240,6 +1255,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
	.get_hwdep_fw_cal = tasha_get_hwdep_fw_cal,
	.mbhc_micb_ctrl_thr_mic = tasha_mbhc_micb_ctrl_threshold_mic,
	.compute_impedance = tasha_wcd_mbhc_calc_impedance,
	.mbhc_gnd_det_ctrl = tasha_mbhc_gnd_det_ctrl,
};

static int tasha_get_anc_slot(struct snd_kcontrol *kcontrol,