Skip to content

Commit 472a630

Browse files
eghidolibroonie
authored andcommitted
ASoC: wm8904: fix wrong outputs volume after power reactivation
Restore volume after charge pump and PGA activation to ensure that volume settings are correctly applied when re-enabling codec from SND_SOC_BIAS_OFF state. CLASS_W, CHARGE_PUMP and POWER_MANAGEMENT_2 register configuration affect how the volume register are applied and must be configured first. Fixes: a91eb19 ("ASoC: Initial WM8904 CODEC driver") Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Emanuele Ghidoli <[email protected]> Signed-off-by: Francesco Dolcini <[email protected]> Acked-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 810948f commit 472a630

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sound/soc/codecs/wm8904.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
697697
int dcs_mask;
698698
int dcs_l, dcs_r;
699699
int dcs_l_reg, dcs_r_reg;
700+
int an_out_reg;
700701
int timeout;
701702
int pwr_reg;
702703

@@ -712,6 +713,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
712713
dcs_mask = WM8904_DCS_ENA_CHAN_0 | WM8904_DCS_ENA_CHAN_1;
713714
dcs_r_reg = WM8904_DC_SERVO_8;
714715
dcs_l_reg = WM8904_DC_SERVO_9;
716+
an_out_reg = WM8904_ANALOGUE_OUT1_LEFT;
715717
dcs_l = 0;
716718
dcs_r = 1;
717719
break;
@@ -720,6 +722,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
720722
dcs_mask = WM8904_DCS_ENA_CHAN_2 | WM8904_DCS_ENA_CHAN_3;
721723
dcs_r_reg = WM8904_DC_SERVO_6;
722724
dcs_l_reg = WM8904_DC_SERVO_7;
725+
an_out_reg = WM8904_ANALOGUE_OUT2_LEFT;
723726
dcs_l = 2;
724727
dcs_r = 3;
725728
break;
@@ -792,6 +795,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
792795
snd_soc_component_update_bits(component, reg,
793796
WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP,
794797
WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP);
798+
799+
/* Update volume, requires PGA to be powered */
800+
val = snd_soc_component_read(component, an_out_reg);
801+
snd_soc_component_write(component, an_out_reg, val);
795802
break;
796803

797804
case SND_SOC_DAPM_POST_PMU:

0 commit comments

Comments
 (0)