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

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

ASoC: wcd: keep micbias enabled for headset



If micbias is disabled after recording is stopped,
buttons won't work. Dont disable micbias, instead
keep it on till headset is inserted and disable
when headset is removed.

CRs-Fixed: 653668
Change-Id: Id601355921abf91d24d3890bf280a961bb4f3479
Signed-off-by: default avatarSimmi Pateriya <simmip@codeaurora.org>
parent 0805dd59
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1751,6 +1751,8 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w,
	struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = w->codec;
	struct msm8x16_wcd_priv *msm8x16_wcd = snd_soc_codec_get_drvdata(codec);

	u16 micb_int_reg;
	char *internal1_text = "Internal1";
	char *internal2_text = "Internal2";
@@ -1789,7 +1791,8 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w,
	case SND_SOC_DAPM_POST_PMD:
		if (strnstr(w->name, internal1_text, 30)) {
			snd_soc_update_bits(codec, micb_int_reg, 0xC0, 0x40);
		} else if (strnstr(w->name, internal2_text, 30)) {
		} else if (strnstr(w->name, internal2_text, 30) &&
			   (!msm8x16_wcd->mbhc.is_hs_inserted)) {
			snd_soc_update_bits(codec, micb_int_reg, 0x18, 0x08);
			snd_soc_update_bits(codec, w->reg, 0x20, 0x20);
		} else if (strnstr(w->name, internal3_text, 30)) {
+11 −1
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ exit:
static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
				enum snd_jack_types jack_type)
{
	struct snd_soc_codec *codec = mbhc->codec;
	WCD_MBHC_RSC_ASSERT_LOCKED(mbhc);

	pr_debug("%s: enter insertion %d hph_status %x\n",
@@ -357,10 +358,18 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
		}

		mbhc->zl = mbhc->zr = 0;
		mbhc->is_hs_inserted = false;
		pr_debug("%s: Reporting removal %d(%x)\n", __func__,
			 jack_type, mbhc->hph_status);
		wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
				mbhc->hph_status, WCD_MBHC_JACK_MASK);
		/* make sure to turn off micbias */
		snd_soc_update_bits(codec,
				    MSM8X16_WCD_A_ANALOG_MICB_1_INT_RBIAS,
				    0x18, 0x08);
		snd_soc_update_bits(codec, MSM8X16_WCD_A_ANALOG_MICB_2_EN,
				    0x20, 0x20);

		wcd_mbhc_set_and_turnoff_hph_padac(mbhc);
		hphrocp_off_report(mbhc, SND_JACK_OC_HPHR);
		hphlocp_off_report(mbhc, SND_JACK_OC_HPHL);
@@ -375,6 +384,7 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
		    (mbhc->hph_status && mbhc->hph_status != jack_type)) {

			mbhc->zl = mbhc->zr = 0;
			mbhc->is_hs_inserted = false;
			pr_debug("%s: Reporting removal (%x)\n",
				 __func__, mbhc->hph_status);
			wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
@@ -397,7 +407,7 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
		if (mbhc->impedance_detect)
			wcd_mbhc_calc_impedance(mbhc,
					&mbhc->zl, &mbhc->zr);

		mbhc->is_hs_inserted = true;
		pr_debug("%s: Reporting insertion %d(%x)\n", __func__,
			 jack_type, mbhc->hph_status);
		wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ struct wcd_mbhc {

	wait_queue_head_t wait_btn_press;
	bool is_btn_press;
	bool is_hs_inserted;
	u8 current_plug;
	bool in_swch_irq_handler;
	bool hphl_swh; /*track HPHL switch NC / NO */