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

Commit 892efe8d authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

ASoC: mbhc: Call impedance detection routine before get impedance



Call impedance detection routine as part of callback to get impedance
before printing value of impedance.

Change-Id: I8b7174e4f7fd9c7715a2c12a0628c8f7849a93e6
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 4e3e8f9f
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -515,6 +515,15 @@ static void wcd_mbhc_set_and_turnoff_hph_padac(struct wcd_mbhc *mbhc)
int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
			uint32_t *zr)
			uint32_t *zr)
{
{
	int detection_type = -EINVAL;

	WCD_MBHC_REG_READ(WCD_MBHC_MECH_DETECTION_TYPE, detection_type);
	/* Call compute impedance only when accessory is inserted */
	if (!detection_type) {
		if (mbhc->mbhc_cb->compute_impedance)
			mbhc->mbhc_cb->compute_impedance(mbhc,
						&mbhc->zl, &mbhc->zr);
	}
	*zl = mbhc->zl;
	*zl = mbhc->zl;
	*zr = mbhc->zr;
	*zr = mbhc->zr;