[alsa-devel] [PATCH] ASoC: cs4270: fix dynamic initialization of register cache

Timur Tabi timur at freescale.com
Thu Jan 6 21:24:11 CET 2011


Mark Brown wrote:
>> > +	u8 reg_cache[CS4270_NUMREGS];
>> > +	struct snd_soc_codec_driver codec_drv;
> Having a driver per device is pretty icky and off the top of my head I'd
> expect it to cause problems if there are two cs4270 in the system.  It
> would be much nicer and more maintainable to avoid bodging around the
> API like this.

The problem is that I need a distinct default register cache for each CS4270 in
the system, so I don't know how to reconcile the idea that there is supposed to
be only one snd_soc_codec_driver for all devices.

What do I do if there are two CS4270s in a system, and they each have different
power-on default values for the registers?  Granted, it's a contrived example,
but this could happen if the first CS4270 is a rev1 chip, and the second is a
rev2 chip.

And even if this example is contrived, it's conceivable that there can be codecs
where the power-on defaults are set by pin configuration.  Perhaps codec #1 is
muted by default and codec #2 isn't.

-- 
Timur Tabi
Linux kernel developer at Freescale



More information about the Alsa-devel mailing list