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

Commit 9ae5d053 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare
Browse files

ASoC: wcd9330: Set audio MAD IIR coefficients from calibration



MAD block on the codec requires the audio IIR filter coefficients
to be configured. Without this configuration, the MAD block on codec
might not be as efficient. Fix the MAD enablement to configure the
MAD IIR coefficients from the calibration data.

Change-Id: I3c7b7e61be4b53d7027ea24db32080eed4a975d1
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 3311f658
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -3221,6 +3221,7 @@ static int tomtom_codec_config_mad(struct snd_soc_codec *codec)
	const char *filename = TOMTOM_MAD_AUDIO_FIRMWARE_PATH;
	struct tomtom_priv *tomtom = snd_soc_codec_get_drvdata(codec);
	size_t cal_size;
	int idx;

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

@@ -3287,6 +3288,16 @@ static int tomtom_codec_config_mad(struct snd_soc_codec *codec)
	snd_soc_write(codec, TOMTOM_A_CDC_MAD_AUDIO_CTL_6,
		      mad_cal->audio_info.rms_threshold_msb);

	for (idx = 0; idx < ARRAY_SIZE(mad_cal->audio_info.iir_coefficients);
	     idx++) {
		snd_soc_update_bits(codec, TOMTOM_A_CDC_MAD_AUDIO_IIR_CTL_PTR,
				    0x3F, idx);
		snd_soc_write(codec, TOMTOM_A_CDC_MAD_AUDIO_IIR_CTL_VAL,
			      mad_cal->audio_info.iir_coefficients[idx]);
		dev_dbg(codec->dev, "%s:MAD Audio IIR Coef[%d] = 0X%x",
			__func__, idx,
			mad_cal->audio_info.iir_coefficients[idx]);
	}

	/* Beacon */
	snd_soc_write(codec, TOMTOM_A_CDC_MAD_BEACON_CTL_8,