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

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

Merge "ASoC: wcd9335: Infinite loop when routing DMIC for handset ANC"

parents 7f75504d 2237e0d1
Loading
Loading
Loading
Loading
+14 −24
Original line number Diff line number Diff line
@@ -5421,26 +5421,6 @@ out:
	return ret;
}

static void tasha_set_anc_dmic_mode(struct snd_soc_codec *codec,
				u8 dmic_ctl_val)
{
	u8 anc_ctl_value;

	if (dmic_ctl_val == WCD9335_DMIC_CLK_DIV_2)
		anc_ctl_value = WCD9335_ANC_DMIC_X2_FULL_RATE;
	else
		anc_ctl_value = WCD9335_ANC_DMIC_X2_HALF_RATE;

	snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
			    0x40, anc_ctl_value << 6);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
			    0x20, anc_ctl_value << 5);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
			    0x40, anc_ctl_value << 6);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
			    0x20, anc_ctl_value << 5);
}

static u32 tasha_get_dmic_sample_rate(struct snd_soc_codec *codec,
				unsigned int dmic, struct wcd9xxx_pdata *pdata)
{
@@ -5462,6 +5442,7 @@ static u32 tasha_get_dmic_sample_rate(struct snd_soc_codec *codec,
			adc_mux_sel = ((snd_soc_read(codec, adc_mux_ctl_reg) &
						0x38) >> 3) - 1;
		} else if (adc_mux_index == 9) {
			++adc_mux_index;
			continue;
		}
		if (adc_mux_sel == dmic)
@@ -5615,9 +5596,6 @@ static int tasha_codec_enable_dmic(struct snd_soc_dapm_widget *w,
					pdata->mclk_rate,
					dmic_sample_rate);

		/* Set ANC dmic control bits to match dmic rate */
		tasha_set_anc_dmic_mode(codec, dmic_rate_val);

		(*dmic_clk_cnt)++;
		if (*dmic_clk_cnt == 1) {
			snd_soc_update_bits(codec, dmic_clk_reg,
@@ -11967,6 +11945,7 @@ static int tasha_handle_pdata(struct tasha_priv *tasha,
{
	struct snd_soc_codec *codec = tasha->codec;
	u8 dmic_ctl_val, mad_dmic_ctl_val;
	u8 anc_ctl_value;
	u32 def_dmic_rate, dmic_clk_drv;
	int vout_ctl_1, vout_ctl_2, vout_ctl_3, vout_ctl_4;
	int rc = 0;
@@ -12076,8 +12055,19 @@ static int tasha_handle_pdata(struct tasha_priv *tasha,
				pdata->mclk_rate,
				pdata->dmic_sample_rate);

	tasha_set_anc_dmic_mode(codec, dmic_ctl_val);
	if (dmic_ctl_val == WCD9335_DMIC_CLK_DIV_2)
		anc_ctl_value = WCD9335_ANC_DMIC_X2_FULL_RATE;
	else
		anc_ctl_value = WCD9335_ANC_DMIC_X2_HALF_RATE;

	snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
			    0x40, anc_ctl_value << 6);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC0_MODE_2_CTL,
			    0x20, anc_ctl_value << 5);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
			    0x40, anc_ctl_value << 6);
	snd_soc_update_bits(codec, WCD9335_CDC_ANC1_MODE_2_CTL,
			    0x20, anc_ctl_value << 5);
done:
	return rc;
}