Merge "ASoC: wcd9335: Realign the ANC coefficients index"

This commit is contained in:
Linux Build Service Account 2015-09-07 04:24:11 -07:00 committed by Gerrit - the friendly Code Review server
commit d575b5ec8d

View file

@ -2580,6 +2580,44 @@ static int tasha_codec_enable_rx_bias(struct snd_soc_dapm_widget *w,
return 0;
}
static void tasha_realign_anc_coeff(struct snd_soc_codec *codec,
u16 reg1, u16 reg2)
{
u8 val1, val2, tmpval1, tmpval2;
snd_soc_write(codec, reg1, 0x00);
tmpval1 = snd_soc_read(codec, reg2);
tmpval2 = snd_soc_read(codec, reg2);
snd_soc_write(codec, reg1, 0x00);
snd_soc_write(codec, reg2, 0xFF);
snd_soc_write(codec, reg1, 0x01);
snd_soc_write(codec, reg2, 0xFF);
snd_soc_write(codec, reg1, 0x00);
val1 = snd_soc_read(codec, reg2);
val2 = snd_soc_read(codec, reg2);
if (val1 == 0x0F && val2 == 0xFF) {
dev_dbg(codec->dev, "%s: ANC0 co-eff index re-aligned\n",
__func__);
snd_soc_read(codec, reg2);
snd_soc_write(codec, reg1, 0x00);
snd_soc_write(codec, reg2, tmpval2);
snd_soc_write(codec, reg1, 0x01);
snd_soc_write(codec, reg2, tmpval1);
} else if (val1 == 0xFF && val2 == 0x0F) {
dev_dbg(codec->dev, "%s: ANC0 co-eff index already aligned\n",
__func__);
snd_soc_write(codec, reg1, 0x00);
snd_soc_write(codec, reg2, tmpval1);
snd_soc_write(codec, reg1, 0x01);
snd_soc_write(codec, reg2, tmpval2);
} else {
dev_err(codec->dev, "%s: ANC0 co-eff index not aligned\n",
__func__);
}
}
static int tasha_codec_enable_anc(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
@ -2679,6 +2717,12 @@ static int tasha_codec_enable_anc(struct snd_soc_dapm_widget *w,
goto err;
}
tasha_realign_anc_coeff(codec,
WCD9335_CDC_ANC0_IIR_COEFF_1_CTL,
WCD9335_CDC_ANC0_IIR_COEFF_2_CTL);
tasha_realign_anc_coeff(codec,
WCD9335_CDC_ANC1_IIR_COEFF_1_CTL,
WCD9335_CDC_ANC1_IIR_COEFF_2_CTL);
i = 0;
anc_cal_size = anc_writes_size;