wm8904 and output volume control

Emanuele Ghidoli ghidoliemanuele at gmail.com
Sat Dec 17 00:47:14 CET 2022


Hello,
I have found that output volume is set to the default value after a 
limited time (~4 seconds) after play stop.
I have analyzed what is happening:
- at first play the volume is the expected one
- After stopping playing + ~4 seconds wm8904_set_bias_level (..., 
SND_SOC_BIAS_OFF) is called
- Chip is reset and regulator is switched off if "possible" (not in our 
case, it is important to note)
- at second play wm8904_set_bias_level (..., SND_SOC_BIAS_STANDBY) is 
called. wm8904_hw_params is also called just before.

I see that all I2C transactions are good, registers are written as 
expected, especially volume control register (even the silly HPOUT_VU 
bit, to do a volume update is correctly written).
Reading out this register, using i2cget (bypassing regcache), report the 
"expected" value. But the real output volume correspond to the default 
value (hw default, that it is the same value in wm8904_reg_defaults 
structure).

I checked that SYSCLK_ENA is 0 during register writing (needed if 
MCLK/SYSCLK is not present). I do not know if there is some other 
constrain on these registers.

If I rewrite the volume control register, a second time, the volume is 
set (tested with i2cset, from user space. And from kernel space, 
bypassing regcache).

I resolve also by reverting e9149b8c00d2 ("ASoC: wm8904: fix regcache 
handling").
I'm not here to say that the commit is wrong. I analyzed it and seem 
perfect (in few words it align the hw with the regcache avoiding 
potential incoherence).

I'm trying to compare first play and second play register programming 
sequence. They are similar but not the same. But on the first play the 
volume output is good.

Do someone remember something similar fixed on another codec?
Any idea is appreciated.
Thank you.
Best regards,


Emanuele Ghidoli


More information about the Alsa-devel mailing list