[alsa-devel] [PATCH] ASoC: Add initial WM8995 driver

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Dec 22 12:07:52 CET 2010


On Wed, Dec 22, 2010 at 10:54:39AM +0000, Liam Girdwood wrote:
> On Wed, 2010-12-22 at 10:26 +0000, Dimitris Papastamos wrote:
> > On Tue, 2010-12-21 at 20:38 +0000, Liam Girdwood wrote:
> > > On Tue, 2010-12-21 at 17:16 +0000, Dimitris Papastamos wrote:

> > > > +static int wm8995_volatile(unsigned int reg)
> > > > +{
> > > > +	if (reg >= WM8995_MAX_REGISTER + 1)
> > > > +		return 1;
> > > > +

> > > return -EINVAL here.

> > The logic behind this is that out of bounds registers are considered
> > volatile. 

> It does look a little odd since out of bounds generally means invalid. 

Most of the drivers that use this idiom use a constant like
MAX_CACHED_REGISTER or similar which makes it clearer that there are
more registers beyond the end of the register map.  The normal use is to
allow access to partially documented diagnostic registers or to support
register banks that are partially owned by something else (devices with
an embedded DSP being the most obvious example).

> > I've found one call to dc_servo_cmd() using a magic number.  The dapm
> > widgets and the kcontrols don't generally use the macros since the lines
> > become very long.

> There are also some magic numbers in configure_aif_clock,
> wm8995_set_dai_fmt, wm8995_hw_params. It's possible there are no macros
> defined for these numbers though...

Those are all bitfield values IIRC - our register map generation tool is
only smart enough to generate register and full field wide constants, it
can't manage to generate constants for the values that go in bitfields
(yet!).


More information about the Alsa-devel mailing list