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

Commit 59996159 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

ASoC: codecs: Fix pop noise in HPH plus LO4 concurrent usecase



Pop sound happens after start playback on HPH when
ultrasound playback on LO4 is enabled.
This is because CnP is sequence dependent and enabling
design blocks in specified order is causing minimum CnP.

CRs-Fixed: 2100346
Change-Id: If10f9013cc1a2aa61fe9c719d3190f2df0b00950
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 1cbd1cdf
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -4073,6 +4073,8 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0xC0, 0xC0);
		}
		set_bit(HPH_PA_DELAY, &tasha->status_mask);
		if (!(strcmp(w->name, "HPHR PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x40, 0x40);
		break;
	case SND_SOC_DAPM_POST_PMU:
		if (!(strcmp(w->name, "ANC HPHR PA"))) {
@@ -4127,6 +4129,8 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
		tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
		if (!(strcmp(w->name, "ANC HPHR PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x40, 0x00);
		if (!(strcmp(w->name, "HPHR PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x40, 0x00);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 5ms sleep is required after PA is disabled as per
@@ -4166,6 +4170,8 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		    (test_bit(HPH_PA_DELAY, &tasha->status_mask))) {
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0xC0, 0xC0);
		}
		if (!(strcmp(w->name, "HPHL PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x80, 0x80);
		set_bit(HPH_PA_DELAY, &tasha->status_mask);
		break;
	case SND_SOC_DAPM_POST_PMU:
@@ -4222,6 +4228,8 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		tasha_codec_hph_post_pa_config(tasha, hph_mode, event);
		if (!(strcmp(w->name, "ANC HPHL PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x80, 0x00);
		if (!(strcmp(w->name, "HPHL PA")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x80, 0x00);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 5ms sleep is required after PA is disabled as per
@@ -4544,6 +4552,10 @@ static int tasha_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		if (!(strcmp(w->name, "RX INT2 DAC"))) {
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x20, 0x20);
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x10, 0x10);
		}
		if (tasha->anc_func) {
			ret = tasha_codec_enable_anc(w, kcontrol, event);
			/* 40 msec delay is needed to avoid click and pop */
@@ -4582,6 +4594,8 @@ static int tasha_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
		}
		break;
	case SND_SOC_DAPM_PRE_PMD:
		if (!(strcmp(w->name, "RX INT2 DAC")))
			snd_soc_update_bits(codec, WCD9335_ANA_HPH, 0x30, 0x00);
		if ((hph_mode == CLS_H_LP) &&
		   (TASHA_IS_1_1(wcd9xxx))) {
			snd_soc_update_bits(codec, WCD9335_HPH_L_DAC_CTL,
@@ -11094,12 +11108,12 @@ static const struct snd_soc_dapm_widget tasha_dapm_widgets[] = {
		0, 0, tasha_codec_ear_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT1 DAC", NULL, WCD9335_ANA_HPH,
		5, 0, tasha_codec_hphl_dac_event,
	SND_SOC_DAPM_DAC_E("RX INT1 DAC", NULL, SND_SOC_NOPM,
		0, 0, tasha_codec_hphl_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT2 DAC", NULL, WCD9335_ANA_HPH,
		4, 0, tasha_codec_hphr_dac_event,
	SND_SOC_DAPM_DAC_E("RX INT2 DAC", NULL, SND_SOC_NOPM,
		0, 0, tasha_codec_hphr_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT3 DAC", NULL, SND_SOC_NOPM,
@@ -11114,11 +11128,11 @@ static const struct snd_soc_dapm_widget tasha_dapm_widgets[] = {
	SND_SOC_DAPM_DAC_E("RX INT6 DAC", NULL, SND_SOC_NOPM,
		0, 0, tasha_codec_lineout_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("HPHL PA", WCD9335_ANA_HPH, 7, 0, NULL, 0,
	SND_SOC_DAPM_PGA_E("HPHL PA", SND_SOC_NOPM, 0, 0, NULL, 0,
			   tasha_codec_enable_hphl_pa,
			   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
			   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("HPHR PA", WCD9335_ANA_HPH, 6, 0, NULL, 0,
	SND_SOC_DAPM_PGA_E("HPHR PA", SND_SOC_NOPM, 0, 0, NULL, 0,
			   tasha_codec_enable_hphr_pa,
			   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
			   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
+22 −6
Original line number Diff line number Diff line
@@ -2014,6 +2014,8 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec, WCD934X_ANA_RX_SUPPLIES,
					    0x02, 0x02);
		}
		if (!(strcmp(w->name, "HPHR PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x40, 0x40);
		break;
	case SND_SOC_DAPM_POST_PMU:
		if ((!(strcmp(w->name, "ANC HPHR PA")))) {
@@ -2112,6 +2114,8 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
				    0x10, 0x10);
		if (!(strcmp(w->name, "ANC HPHR PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x40, 0x00);
		if (!(strcmp(w->name, "HPHR PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x40, 0x00);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/*
@@ -2161,6 +2165,8 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		    (test_bit(HPH_PA_DELAY, &tavil->status_mask)))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH,
					    0xC0, 0xC0);
		if (!(strcmp(w->name, "HPHL PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x80, 0x80);
		set_bit(HPH_PA_DELAY, &tavil->status_mask);
		if (dsd_conf &&
		    (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01)) {
@@ -2266,6 +2272,8 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		if (!(strcmp(w->name, "ANC HPHL PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH,
					    0x80, 0x00);
		if (!(strcmp(w->name, "HPHL PA")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x80, 0x00);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/*
@@ -2418,6 +2426,10 @@ static int tavil_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		if (!(strcmp(w->name, "RX INT2 DAC"))) {
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x20, 0x20);
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x10, 0x10);
		}
		if (tavil->anc_func) {
			ret = tavil_codec_enable_anc(w, kcontrol, event);
			/* 40 msec delay is needed to avoid click and pop */
@@ -2458,6 +2470,10 @@ static int tavil_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
					    WCD934X_CDC_RX2_RX_PATH_CFG0,
					    0x10, 0x10);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		if (!(strcmp(w->name, "RX INT2 DAC")))
			snd_soc_update_bits(codec, WCD934X_ANA_HPH, 0x30, 0x00);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 1000us required as per HW requirement */
		usleep_range(1000, 1100);
@@ -7365,12 +7381,12 @@ static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = {
		0, 0, tavil_codec_ear_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT1 DAC", NULL, WCD934X_ANA_HPH,
		5, 0, tavil_codec_hphl_dac_event,
	SND_SOC_DAPM_DAC_E("RX INT1 DAC", NULL, SND_SOC_NOPM,
		0, 0, tavil_codec_hphl_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT2 DAC", NULL, WCD934X_ANA_HPH,
		4, 0, tavil_codec_hphr_dac_event,
	SND_SOC_DAPM_DAC_E("RX INT2 DAC", NULL, SND_SOC_NOPM,
		0, 0, tavil_codec_hphr_dac_event,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_DAC_E("RX INT3 DAC", NULL, SND_SOC_NOPM,
@@ -7383,11 +7399,11 @@ static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = {
	SND_SOC_DAPM_PGA_E("EAR PA", WCD934X_ANA_EAR, 7, 0, NULL, 0,
		tavil_codec_enable_ear_pa,
		SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("HPHL PA", WCD934X_ANA_HPH, 7, 0, NULL, 0,
	SND_SOC_DAPM_PGA_E("HPHL PA", SND_SOC_NOPM, 0, 0, NULL, 0,
		tavil_codec_enable_hphl_pa,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("HPHR PA", WCD934X_ANA_HPH, 6, 0, NULL, 0,
	SND_SOC_DAPM_PGA_E("HPHR PA", SND_SOC_NOPM, 0, 0, NULL, 0,
		tavil_codec_enable_hphr_pa,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),