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

Commit ce396617 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare Committed by Banajit Goswami
Browse files

ASoC: wcd934x: use analog mics in micbias mode for MAD



It is possible to route analog microphone data to the MAD (Microphone
Activity Detection) block in the codec. Currently, VDDIO mode is used
for analog microphones, which can cause degradation of audio data,
causing no detection from the MAD block. Change the MAD programming
to use micbias instead of VDDIO mode for analog microphones to fix
this signal degradation problem.

CRs-fixed: 2021869
Change-Id: I77e089bd9858e5179405f87982b16ddaf7b4cd5b
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 7c88288c
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -5473,7 +5473,7 @@ static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,
	u32 adc, i, mic_bias_found = 0;
	int ret = 0;
	char *mad_input;
	bool is_adc2_input = false;
	bool is_adc_input = false;

	tavil_mad_input = ucontrol->value.integer.value[0];

@@ -5521,8 +5521,7 @@ static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,
		snprintf(mad_amic_input_widget, 6, "%s%u", "AMIC", adc);

		mad_input_widget = mad_amic_input_widget;
		if (adc == 2)
			is_adc2_input = true;
		is_adc_input = true;
	} else {
		/* DMIC type input widget*/
		mad_input_widget = tavil_conn_mad_text[tavil_mad_input];
@@ -5530,7 +5529,7 @@ static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,

	dev_dbg(codec->dev,
		"%s: tavil input widget = %s, adc_input = %s\n", __func__,
		mad_input_widget, is_adc2_input ? "true" : "false");
		mad_input_widget, is_adc_input ? "true" : "false");

	for (i = 0; i < card->num_of_dapm_routes; i++) {
		if (!strcmp(card->of_dapm_routes[i].sink, mad_input_widget)) {
@@ -5575,8 +5574,8 @@ static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,
			    0x0F, tavil_mad_input);
	snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
			    0x07, mic_bias_found);
	/* for adc2 input, mad should be in micbias mode with BG enabled */
	if (is_adc2_input)
	/* for all adc inputs, mad should be in micbias mode with BG enabled */
	if (is_adc_input)
		snd_soc_update_bits(codec, WCD934X_ANA_MAD_SETUP,
				    0x88, 0x88);
	else