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

Commit 8c1c5ab5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd-mbhc: fix inconsistent detection of euro headset" into msm-4.9

parents 5f258a91 a2f82ed6
Loading
Loading
Loading
Loading
+18 −24
Original line number Diff line number Diff line
@@ -1165,6 +1165,8 @@ static void wcd_correct_swch_plug(struct work_struct *work)
	bool micbias1 = false;
	int ret = 0;
	int rc, spl_hs_count = 0;
	int cross_conn;
	int try = 0;

	pr_debug("%s: enter\n", __func__);

@@ -1182,11 +1184,6 @@ static void wcd_correct_swch_plug(struct work_struct *work)
	wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);


	if (mbhc->current_plug == MBHC_PLUG_TYPE_GND_MIC_SWAP) {
		mbhc->current_plug = MBHC_PLUG_TYPE_NONE;
		goto correct_plug_type;
	}

	/* Enable HW FSM */
	WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 1);
	/*
@@ -1214,8 +1211,23 @@ static void wcd_correct_swch_plug(struct work_struct *work)
			plug_type = MBHC_PLUG_TYPE_INVALID;
	}

	pr_debug("%s: Valid plug found, plug type is %d\n",
	do {
		cross_conn = wcd_check_cross_conn(mbhc);
		try++;
	} while (try < GND_MIC_SWAP_THRESHOLD);
	/*
	 * check for cross coneection 4 times.
	 * conisder the result of the fourth iteration.
	 */
	if (cross_conn > 0) {
		pr_debug("%s: cross con found, start polling\n",
			 __func__);
		plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP;
		pr_debug("%s: Plug found, plug type is %d\n",
			 __func__, plug_type);
		goto correct_plug_type;
	}

	if ((plug_type == MBHC_PLUG_TYPE_HEADSET ||
	     plug_type == MBHC_PLUG_TYPE_HEADPHONE) &&
	    (!wcd_swch_level_remove(mbhc))) {
@@ -1457,10 +1469,7 @@ static void wcd_correct_swch_plug(struct work_struct *work)
static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
{
	struct snd_soc_codec *codec = mbhc->codec;
	enum wcd_mbhc_plug_type plug_type;
	bool micbias1 = false;
	int cross_conn;
	int try = 0;

	pr_debug("%s: enter\n", __func__);
	WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);
@@ -1481,21 +1490,6 @@ static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
	else
		wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_MB);

	do {
		cross_conn = wcd_check_cross_conn(mbhc);
		try++;
	} while (try < GND_MIC_SWAP_THRESHOLD);

	if (cross_conn > 0) {
		pr_debug("%s: cross con found, start polling\n",
			 __func__);
		plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP;
		if (!mbhc->current_plug)
			mbhc->current_plug = plug_type;
		pr_debug("%s: Plug found, plug type is %d\n",
			 __func__, plug_type);
	}

	/* Re-initialize button press completion object */
	reinit_completion(&mbhc->btn_press_compl);
	wcd_schedule_hs_detect_plug(mbhc, &mbhc->correct_plug_swch);