Skip to content

Commit b1d4ac9

Browse files
Michael-zy2000broonie
authored andcommitted
ASoC: codecs: ES8326: Adjust ANA_MICBIAS to reduce pop noise
We modify the value of ES8326_ANA_MICBIAS to reduce the pop noise Signed-off-by: Zhang Yi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 32c9c06 commit b1d4ac9

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

sound/soc/codecs/es8326.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
616616
0x0F, 0x0F);
617617
if (es8326->version > ES8326_VERSION_B) {
618618
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
619-
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x10);
619+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x30);
620620
}
621621
}
622622
} else {
@@ -631,6 +631,8 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
631631
regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
632632
es8326->calibrated = true;
633633
}
634+
regmap_update_bits(es8326->regmap, ES8326_CLK_INV, 0xc0, 0x00);
635+
regmap_update_bits(es8326->regmap, ES8326_CLK_MUX, 0x80, 0x00);
634636
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
635637
regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
636638
usleep_range(1000, 5000);
@@ -645,7 +647,7 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
645647
} else {
646648
msleep(300);
647649
if (es8326->version > ES8326_VERSION_B) {
648-
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x50);
650+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x70);
649651
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x00);
650652
}
651653
regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
@@ -676,13 +678,23 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
676678
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
677679
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20);
678680
regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x00);
681+
if (es8326->version > ES8326_VERSION_B) {
682+
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
683+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x30);
684+
}
679685
break;
680686
case SND_SOC_BIAS_PREPARE:
681687
break;
682688
case SND_SOC_BIAS_STANDBY:
683689
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
684690
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00);
685691
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT);
692+
if (es8326->version > ES8326_VERSION_B) {
693+
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
694+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x10);
695+
}
696+
regmap_update_bits(es8326->regmap, ES8326_CLK_INV, 0xc0, 0xc0);
697+
regmap_update_bits(es8326->regmap, ES8326_CLK_MUX, 0x80, 0x80);
686698
break;
687699
case SND_SOC_BIAS_OFF:
688700
clk_disable_unprepare(es8326->mclk);
@@ -773,7 +785,10 @@ static void es8326_jack_button_handler(struct work_struct *work)
773785
case 0x6f:
774786
case 0x4b:
775787
/* button volume up */
776-
cur_button = SND_JACK_BTN_1;
788+
if ((iface == 0x6f) && (es8326->version > ES8326_VERSION_B))
789+
cur_button = SND_JACK_BTN_0;
790+
else
791+
cur_button = SND_JACK_BTN_1;
777792
break;
778793
case 0x27:
779794
/* button volume down */
@@ -1082,7 +1097,7 @@ static void es8326_init(struct snd_soc_component *component)
10821097
regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66);
10831098
es8326_disable_micbias(es8326->component);
10841099
if (es8326->version > ES8326_VERSION_B) {
1085-
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x73, 0x13);
1100+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x73, 0x10);
10861101
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
10871102
}
10881103

0 commit comments

Comments
 (0)