[alsa-devel] [PATCHv4 2/7] ASoC: TWL6030: Add twl6030 codec driver

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Feb 24 11:42:57 CET 2010


On Wed, Feb 24, 2010 at 10:38:01AM +0000, Liam Girdwood wrote:
> On Tue, 2010-02-23 at 18:10 -0600, Olaya, Margarita wrote:

> > +       twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &value, reg);
> > +       twl6030_write_reg_cache(codec, reg, value);

> You probably want to read from the cache if the register is not
> volatile. This saves a slow I2C read.

...and if you don't satisfy reads from the cache you may as well not
bother with it - it's just consuming memory.

> > +               /* skip read-only registers (ASICID, ASICREV, STATUS) */
> > +               if ((reg == TWL6030_REG_ASICID) ||
> > +                   (reg == TWL6030_REG_ASICREV) ||
> > +                   (reg == TWL6030_REG_STATUS))
> > +                       continue;
> > +               twl6030_write(codec, reg, cache[reg]);

A switch statement would be nicer here.


More information about the Alsa-devel mailing list