[alsa-devel] ASOC: codec_reg_show and variable length registers

Mark Brown broonie at opensource.wolfsonmicro.com
Sun Jul 6 01:03:31 CEST 2008

On Sat, Jul 05, 2008 at 09:37:45AM -0400, Jon Smirl wrote:

> Should the register cache really be part of the core? The core could
> still make the sysfs entries and use a callback to print them.
> reg_cache_size/reg_cache_step would then become private.

It's still useful to share as much of the code as possible to ensure
consistency between devices.  Most devices are able to use the generic
register cache formatting (which is all that uses the size and step)
as is and as a general rule it makes maintinence easier when code is
factored out of individual drivers.

> It's the sprintf that is the problem. I need to push that into my
> driver so that I can print out variable lengths. Or we need to make
> the core use an indirect table that encodes the lengths.

I'd suggest adding an optional callback that drivers can use to replace
the register value display (just the value) so that existing drivers
don't need modification to cope with larger register sizes - it's not
the common case, after all.

If there are devices that use these larger registers for operations that
are handled by snd_soc_update_bits() and friends that'd require more but
I'd be surprised to see such devices.

More information about the Alsa-devel mailing list