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

Commit 44e45af8 authored by Simmi Pateriya's avatar Simmi Pateriya Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd: correct the cross connection check condition



When there is cross connection present, schmitt
HPHL/HPHR triggers bits are set to 0. While reading
this register modify the check condition to be same
as the hardware generated result.

CRs-Fixed: 642944
Change-Id: I82225cf9a820eeace0c45696c167732b3d0e4a86
Signed-off-by: default avatarSimmi Pateriya <simmip@codeaurora.org>
parent de5acd14
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
	long timeout = msecs_to_jiffies(50);   /* 50ms */
	enum wcd_mbhc_plug_type plug_type;
	int timeout_result;
	u16 result1, result2;
	u16 result1, result2, swap_res;

	pr_debug("%s: enter\n", __func__);
	WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
@@ -435,10 +435,10 @@ static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
		snd_soc_update_bits(codec,
				MSM8X16_WCD_A_ANALOG_MBHC_DET_CTL_2,
				0x6, 0x2);
		/* Update result2 read value with cross connection bit */
		result2 = snd_soc_read(codec,
		/* read reg MBHC_RESULT_2 value with cross connection bit */
		swap_res = snd_soc_read(codec,
				MSM8X16_WCD_A_ANALOG_MBHC_ZDET_ELECT_RESULT);
		if (!result1 && (result2 & 0x04)) {
		if (!result1 && !(swap_res & 0x04)) {
			plug_type = PLUG_TYPE_GND_MIC_SWAP;
			pr_debug("%s: Cross connection identified", __func__);
		} else {