Skip to content

Commit bc48c55

Browse files
Michael-zy2000broonie
authored andcommitted
ASoC: codecs: ES8326: Modify the configuration of and micbias
Because we designed a new version of ES8326, the configuration of micbias needed to be modified.We tested the new driver, on both the new version and the old one. It works well. Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> Link: https://patch.msgid.link/20241028060529.3359-1-zhangyi@everest-semi.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent dea15b2 commit bc48c55

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

sound/soc/codecs/es8326.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
614614
} else {
615615
regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
616616
0x0F, 0x0F);
617+
if (es8326->version > ES8326_VERSION_B) {
618+
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
619+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x00);
620+
}
617621
}
618622
} else {
619623
if (!es8326->calibrated) {
@@ -640,6 +644,10 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
640644
ES8326_MUTE_MASK, ~(ES8326_MUTE));
641645
} else {
642646
msleep(300);
647+
if (es8326->version > ES8326_VERSION_B) {
648+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x70, 0x50);
649+
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x00);
650+
}
643651
regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
644652
0x0F, 0x00);
645653
}
@@ -821,7 +829,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
821829
iface = snd_soc_component_read(comp, ES8326_HPDET_STA);
822830
dev_dbg(comp->dev, "gpio flag %#04x", iface);
823831

824-
if ((es8326->jack_remove_retry == 1) && (es8326->version != ES8326_VERSION_B)) {
832+
if ((es8326->jack_remove_retry == 1) && (es8326->version < ES8326_VERSION_B)) {
825833
if (iface & ES8326_HPINSERT_FLAG)
826834
es8326->jack_remove_retry = 2;
827835
else
@@ -859,7 +867,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
859867
/*
860868
* Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
861869
*/
862-
if ((es8326->jack_remove_retry == 0) && (es8326->version != ES8326_VERSION_B)) {
870+
if ((es8326->jack_remove_retry == 0) && (es8326->version < ES8326_VERSION_B)) {
863871
es8326->jack_remove_retry = 1;
864872
dev_dbg(comp->dev, "remove event check, invert HPJACK_POL, cnt = %d\n",
865873
es8326->jack_remove_retry);
@@ -954,7 +962,7 @@ static int es8326_calibrate(struct snd_soc_component *component)
954962
regmap_read(es8326->regmap, ES8326_CHIP_VERSION, &reg);
955963
es8326->version = reg;
956964

957-
if ((es8326->version == ES8326_VERSION_B) && (es8326->calibrated == false)) {
965+
if ((es8326->version >= ES8326_VERSION_B) && (es8326->calibrated == false)) {
958966
dev_dbg(component->dev, "ES8326_VERSION_B, calibrating\n");
959967
regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0);
960968
regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x03);
@@ -1047,7 +1055,7 @@ static void es8326_init(struct snd_soc_component *component)
10471055
regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15);
10481056

10491057
regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
1050-
((es8326->version == ES8326_VERSION_B) ?
1058+
((es8326->version >= ES8326_VERSION_B) ?
10511059
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
10521060
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
10531061
usleep_range(5000, 10000);
@@ -1073,6 +1081,10 @@ static void es8326_init(struct snd_soc_component *component)
10731081
regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44);
10741082
regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66);
10751083
es8326_disable_micbias(es8326->component);
1084+
if (es8326->version > ES8326_VERSION_B) {
1085+
regmap_update_bits(es8326->regmap, ES8326_ANA_MICBIAS, 0x73, 0x03);
1086+
regmap_update_bits(es8326->regmap, ES8326_VMIDSEL, 0x40, 0x40);
1087+
}
10761088

10771089
msleep(200);
10781090
regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);

0 commit comments

Comments
 (0)