[alsa-devel] ADAU1761 default register value problem

Ricard Wanderlof ricard.wanderlof at axis.com
Tue Mar 29 15:58:19 CEST 2016


I have a problem with the ADAU1761 (although the problem I would think 
would manifest itself with a veriety of codecs).

The register values are cached to minimize the number of writes needed, 
and there is a set of default values specified. However, this assumes that 
when the software boots the chip is always in the default state. This is 
not necessarily the case, because the chip has no external reset line and 
resets its internal state using an internal power-on-reset circuit, so if 
the system is rebooted without a power cycle, the regcache will contain 
the default values of the registers, whereas the actual registers in the 
chip will retain their previous values. Hence, if attempting to set a 
value in a register which is in fact identical to the default value, it 
will not be written, and the value that is currently in the register will 
remain. This can lead to all sorts of misconfigurations, depending on the 
previous state of the chip.

One way to fix this is simply to avoid setting up a set of default 
registers (looking at regcache.c, one way seems to be to omit setting the 
reg_defaults and num_reg_defaults members of the struct regmap_config 
during initialization, and instead setting num_reg_defaults_raw to the 
number of registers the chip has, but not setting reg_defaults_raw; I 
don't know if this is how it is intended to be used however). The regcache 
framework will then read all the register values from the chip and use 
them as the new defaults.

While this would seem to be technically correct, the question is if this 
is acceptable? A drawback is that there will be a lot of I2C or SPI 
accesses just to get the default values. Or should the caching behavior at 
startup be configured in some way, for instance via devicetree?

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30


More information about the Alsa-devel mailing list