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

Olaya, Margarita magi.olaya at ti.com
Thu Feb 25 00:57:25 CET 2010


> -----Original Message-----
> From: Mark Brown [mailto:broonie at opensource.wolfsonmicro.com]
> Sent: Wednesday, February 24, 2010 4:43 AM
> To: Liam Girdwood
> Cc: Olaya, Margarita; alsa-devel at alsa-project.org; linux-omap at vger.kernel.org
> Subject: Re: [alsa-devel] [PATCHv4 2/7] ASoC: TWL6030: Add twl6030 codec driver
> 
> 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.

We have different functions for those cases.

> 
> > > +               /* 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.

You mean something like this?

	switch (reg) {
	case TWL6030_REG_ASICID:
	case TWL6030_REG_ASICREV:
	case TWL6030_REG_STATUS:
		continue;
	default:
	break:
	}

Regards,
Margarita


More information about the Alsa-devel mailing list