Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-18 Thread Grant Likely
On Fri, Jul 18, 2008 at 10:58:25AM +0100, Mark Brown wrote:
> Sparse (or sparsely used) register maps are pretty common - in practice
> it's not been a problem to just have a cache that covers everything and
> only gets read, the amount of data involved is rarely that large in the
> context of what you need to store the audio you're working with.

okay.

g.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-18 Thread Mark Brown
On Thu, Jul 17, 2008 at 05:31:53PM -0600, Grant Likely wrote:
> On Sat, Jul 12, 2008 at 06:36:10PM +0100, Mark Brown wrote:

> > /sys/bus/platform/devices/soc-audio/codec_reg

> Yikes.  The AIC26 has registers all over the place and most of them are
> empty.  The codec_reg attribute handling means I need to maintain a
> cache of the entire register file; not just the part that is actually
> used.  Oh well; I can work around it.

Sparse (or sparsely used) register maps are pretty common - in practice
it's not been a problem to just have a cache that covers everything and
only gets read, the amount of data involved is rarely that large in the
context of what you need to store the audio you're working with.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-17 Thread Grant Likely
On Sat, Jul 12, 2008 at 06:36:10PM +0100, Mark Brown wrote:
> On Sat, Jul 12, 2008 at 12:00:18AM -0600, Grant Likely wrote:

> It wouldn't be the only driver not to implement PLL configuration in
> this way so that's probably be OK for an initial merge.  What's expected
> for PLL configuration is that you implement the DAI set_pll() operation
> in the codec driver, allowing machine drivers to configure the PLL when
> they wish.

okay

> The power configuration should be fixed, though.  Normally drivers
> either fully implement DAPM (including set_bias_level()) or power
> everything in the codec up when the driver is loaded.  At the minute
> what the driver is doing appears to be powering the codec up in both
> _hw_params() and _probe() but never powering anything down - if that is
> the case then probably all you need to do is remove the extra power up
> from hw_params(), giving you the simple option.

done

> > Hmmm, I haven't been able to find this; either in the code or on a live
> > running system.  Where is the common reg dump implemented.
> 
> /sys/bus/platform/devices/soc-audio/codec_reg

Yikes.  The AIC26 has registers all over the place and most of them are
empty.  The codec_reg attribute handling means I need to maintain a
cache of the entire register file; not just the part that is actually
used.  Oh well; I can work around it.

Thanks,
g.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-12 Thread Grant Likely
On Sat, Jul 12, 2008 at 11:36 AM, Mark Brown
<[EMAIL PROTECTED]> wrote:
> The power configuration should be fixed, though.  Normally drivers
> either fully implement DAPM (including set_bias_level()) or power
> everything in the codec up when the driver is loaded.  At the minute
> what the driver is doing appears to be powering the codec up in both
> _hw_params() and _probe() but never powering anything down - if that is
> the case then probably all you need to do is remove the extra power up
> from hw_params(), giving you the simple option.

Okay, cool.  I'll do this for the time being then.

Thanks,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-12 Thread Mark Brown
On Sat, Jul 12, 2008 at 12:00:18AM -0600, Grant Likely wrote:
> On Wed, Jul 02, 2008 at 11:48:33AM +0100, Liam Girdwood wrote:

> > PLL/FLL/clock config is usually done in a separate function
> > (codec_set_pll(), callable by machine driver) so that we can change
> > clocks depending on the available machine clocks and srate. 

...

> > Codec domain (i.e Bias power) PM stuff should be done in
> > codec_dapm_event(). This allows us to power the codec on when we do
> > things like sidetone (with no active playback or capture stream).

> Ugh, I'm going to have to leave these two for now.  I don't understand
> enough about the ASoC structure yet to understand what it should look
> like.  I'll probably need help, but I don't think I can get it sorted
> out before the merge window.

> Do these two comments need to be addressed before the driver is merged?

It wouldn't be the only driver not to implement PLL configuration in
this way so that's probably be OK for an initial merge.  What's expected
for PLL configuration is that you implement the DAI set_pll() operation
in the codec driver, allowing machine drivers to configure the PLL when
they wish.

The power configuration should be fixed, though.  Normally drivers
either fully implement DAPM (including set_bias_level()) or power
everything in the codec up when the driver is loaded.  At the minute
what the driver is doing appears to be powering the codec up in both
_hw_params() and _probe() but never powering anything down - if that is
the case then probably all you need to do is remove the extra power up
from hw_params(), giving you the simple option.

> Hmmm, I haven't been able to find this; either in the code or on a live
> running system.  Where is the common reg dump implemented.

/sys/bus/platform/devices/soc-audio/codec_reg
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-11 Thread Grant Likely
On Wed, Jul 02, 2008 at 11:48:33AM +0100, Liam Girdwood wrote:
> On Tue, 2008-07-01 at 17:53 -0600, Grant Likely wrote:
> > From: Grant Likely <[EMAIL PROTECTED]>
> > 
> > ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
> > v1 API, so I don't expect it to get merged as-is, but I want to get it
> > out there for review.
> > ---
> 
> Fwiw, I usually put all the codec registers defs in a separate header
> just in case we need to do any codec stuff in the machine driver.

okay, done

> > +   switch (params_rate(params)) {
> > +case 8000: fsref = 48000; divisor = AIC26_DIV_6; break;
> > +case 11025: fsref = 44100; divisor = AIC26_DIV_4; break;
> > +case 12000: fsref = 48000; divisor = AIC26_DIV_4; break;
> > +case 16000: fsref = 48000; divisor = AIC26_DIV_3; break;
> > +case 22050: fsref = 44100; divisor = AIC26_DIV_2; break;
> > +case 24000: fsref = 48000; divisor = AIC26_DIV_2; break;
> > +case 32000: fsref = 48000; divisor = AIC26_DIV_1_5; break;
> > +case 44100: fsref = 44100; divisor = AIC26_DIV_1; break;
> > +case 48000: fsref = 48000; divisor = AIC26_DIV_1; break;
> > +default: dev_dbg(&aic26->spi->dev, "bad rate\n"); return -EINVAL;
> > +   }
> > +
> 
> Indentation.

done.

> > +   /* Configure PLL */
> > +   pval = 1;
> > +   jval = (fsref == 44100) ? 7 : 8;
> > +   dval = (fsref == 44100) ? 5264 : 1920;
> > +   qval = 0;
> > +   reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
> > +   aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);
> > +   reg = dval << 2;
> > +   aic26_reg_write(codec, AIC26_REG_PLL_PROG2, reg);
> > +
> 
> PLL/FLL/clock config is usually done in a separate function
> (codec_set_pll(), callable by machine driver) so that we can change
> clocks depending on the available machine clocks and srate. 
> 
> > +   /* Power up CODEC */
> > +   aic26_reg_write(codec, AIC26_REG_POWER_CTRL, 0);
> > +
> 
> Codec domain (i.e Bias power) PM stuff should be done in
> codec_dapm_event(). This allows us to power the codec on when we do
> things like sidetone (with no active playback or capture stream).
> 

Ugh, I'm going to have to leave these two for now.  I don't understand
enough about the ASoC structure yet to understand what it should look
like.  I'll probably need help, but I don't think I can get it sorted
out before the merge window.

Do these two comments need to be addressed before the driver is merged?

> > +static ssize_t aic26_regs_show(struct device *dev,
> > +   struct device_attribute *attr, char *buf)
> > +{
> > +   struct aic26 *aic26 = dev_get_drvdata(dev);
> > +   char *idx = buf;
> > +   int cache_flag, addr, page, i, reg;
> > +
> > +   cache_flag = (strcmp(attr->attr.name, "regs_cache") == 0);
> > +
> > +   for (page = 0; page < 3; page++) {
> > +   for (i = 0; i < 0x20; i++) {
> > +   addr = AIC26_PAGE_ADDR(page, i);
> > +   if (i % 8 == 0)
> > +   idx += sprintf(idx, "%i:%.2i:", page,i);
> > +   if (cache_flag)
> > +   reg = aic26_reg_read_cache(&aic26->codec, addr);
> > +   else
> > +   reg = aic26_reg_read(&aic26->codec, addr);
> > +   idx += sprintf(idx, " %.4x", reg);
> > +   if (i % 8 == 7)
> > +   idx += sprintf(idx, "\n");
> > +   }
> > +   }
> > +   return idx - buf;
> > +}
> > +
> 
> The soc_core already has a codec reg dump sysfs file, so we don't need
> this.

Hmmm, I haven't been able to find this; either in the code or on a live
running system.  Where is the common reg dump implemented.

Thanks for the comments.
g.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-04 Thread Grant Likely
On Fri, Jul 4, 2008 at 2:49 PM, Mark Brown
<[EMAIL PROTECTED]> wrote:
> On Tue, Jul 01, 2008 at 05:53:40PM -0600, Grant Likely wrote:
>> + /* Tell the of_soc helper about this codec */
>> + of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
>> +   spi->dev.archdata.of_node);
>
> Does this need to be ifdefed out if of_snd_soc_register_codec() is not
> in use or is the function stubbed out if it's not in use?  Stubbing it
> out would be cleaner.

yeah, probably.  This is a stop-gap measure anyway until ASoC v2 is merged.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-04 Thread Mark Brown
On Tue, Jul 01, 2008 at 05:53:40PM -0600, Grant Likely wrote:

> +static ssize_t aic26_keyclick_show(struct device *dev,
> +struct device_attribute *attr, char *buf)
> +{
> + struct aic26 *aic26 = dev_get_drvdata(dev);
> + int val, amp, freq, len;
> +
> + val = aic26_reg_read_cache(&aic26->codec, AIC26_REG_AUDIO_CTRL2);
> + amp = (val >> 12) & 0x7;
> + freq = (125 << ((val >> 8) & 0x7)) >> 1;
> + len = 2 * (1 +((val >> 8) & 0xf));
> +
> + return sprintf(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len);
> +}

It might be nice if these parameters were exposed as controls if they
can be configured, though obviously that's not essential.

> + /* Tell the of_soc helper about this codec */
> + of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
> +   spi->dev.archdata.of_node);

Does this need to be ifdefed out if of_snd_soc_register_codec() is not
in use or is the function stubbed out if it's not in use?  Stubbing it
out would be cleaner.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Liam Girdwood
On Wed, 2008-07-02 at 09:52 -0400, Jon Smirl wrote:
> 
> I've been using asoc-v2 so it may not be possible to make this arch
> independent in asoc-v1.  Maybe try porting this to asoc-v2 and see if
> a bunch of the registration complexity disappears. Most of soc-of.c
> should be unnecessary.
> 
> Liam, when is asoc-v2 going into mainline?

Hopefully over the next 2 merge windows. I'm about to start queueing
patches

This also assumes Mark and I remain at our current work load levels.

Liam


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Jon Smirl
On 7/1/08, Grant Likely <[EMAIL PROTECTED]> wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
>
>  ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
>  v1 API, so I don't expect it to get merged as-is, but I want to get it
>  out there for review.
>  ---
>
>   sound/soc/codecs/Kconfig   |4
>   sound/soc/codecs/Makefile  |2
>   sound/soc/codecs/tlv320aic26.c |  630 
> 
>   3 files changed, 636 insertions(+), 0 deletions(-)
>
>  diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
>  index 3903ab7..96c7bfe 100644
>  --- a/sound/soc/codecs/Kconfig
>  +++ b/sound/soc/codecs/Kconfig
>  @@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
> bool
> depends on SND_SOC_CS4270
>
>  +config SND_SOC_TLV320AIC26
>  +   tristate "TI TLB320AIC26 Codec support"
>  +   depends on SND_SOC && SPI
>  +
>   config SND_SOC_TLV320AIC3X
> tristate
> depends on SND_SOC && I2C
>  diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
>  index 4e1314c..ec0cd93 100644
>  --- a/sound/soc/codecs/Makefile
>  +++ b/sound/soc/codecs/Makefile
>  @@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
>   snd-soc-wm9712-objs := wm9712.o
>   snd-soc-wm9713-objs := wm9713.o
>   snd-soc-cs4270-objs := cs4270.o
>  +snd-soc-tlv320aic26-objs := tlv320aic26.o
>   snd-soc-tlv320aic3x-objs := tlv320aic3x.o
>
>   obj-$(CONFIG_SND_SOC_AC97_CODEC)   += snd-soc-ac97.o
>  @@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)  += snd-soc-wm8753.o
>   obj-$(CONFIG_SND_SOC_WM9712)   += snd-soc-wm9712.o
>   obj-$(CONFIG_SND_SOC_WM9713)   += snd-soc-wm9713.o
>   obj-$(CONFIG_SND_SOC_CS4270)   += snd-soc-cs4270.o
>  +obj-$(CONFIG_SND_SOC_TLV320AIC26)  += snd-soc-tlv320aic26.o
>   obj-$(CONFIG_SND_SOC_TLV320AIC3X)  += snd-soc-tlv320aic3x.o
>  diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
>  new file mode 100644
>  index 000..aee1dbc
>  --- /dev/null
>  +++ b/sound/soc/codecs/tlv320aic26.c
>  @@ -0,0 +1,630 @@
>  +/*
>  + * Texas Instruments TLV320AIC26 low power audio CODEC
>  + * ALSA SoC CODEC driver
>  + *
>  + * Copyright (C) 2008 Secret Lab Technologies Ltd.
>  + */
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +
>  +MODULE_DESCRIPTION("ASoC TLV320AIC26 codec driver");
>  +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
>  +MODULE_LICENSE("GPL");
>  +
>  +/* AIC26 Registers */
>  +#define AIC26_READ_COMMAND_WORD(addr)  ((1 << 15) | (addr << 5))
>  +#define AIC26_WRITE_COMMAND_WORD(addr) ((0 << 15) | (addr << 5))
>  +#define AIC26_PAGE_ADDR(page, offset)  ((page << 6) | offset)
>  +#define AIC26_NUM_REGS AIC26_PAGE_ADDR(3, 0)
>  +#define AIC26_REG_CACHE_SIZE   (0x20) /* only page 2 cached */
>  +#define AIC26_REG_IS_CACHED(addr)  ((addr & ~0x1f) == (2 << 6))
>  +#define AIC26_REG_CACHE_ADDR(addr) (addr & 0x1f)
>  +
>  +/* Page 0: Auxillary data registers */
>  +#define AIC26_REG_BAT1 AIC26_PAGE_ADDR(0, 0x05)
>  +#define AIC26_REG_BAT2 AIC26_PAGE_ADDR(0, 0x06)
>  +#define AIC26_REG_AUX  AIC26_PAGE_ADDR(0, 0x07)
>  +#define AIC26_REG_TEMP1AIC26_PAGE_ADDR(0, 0x09)
>  +#define AIC26_REG_TEMP2AIC26_PAGE_ADDR(0, 0x0A)
>  +
>  +/* Page 1: Auxillary control registers */
>  +#define AIC26_REG_AUX_ADC  AIC26_PAGE_ADDR(1, 0x00)
>  +#define AIC26_REG_STATUS   AIC26_PAGE_ADDR(1, 0x01)
>  +#define AIC26_REG_REFERENCEAIC26_PAGE_ADDR(1, 0x03)
>  +#define AIC26_REG_RESETAIC26_PAGE_ADDR(1, 0x04)
>  +
>  +/* Page 2: Audio control registers */
>  +#define AIC26_REG_AUDIO_CTRL1  AIC26_PAGE_ADDR(2, 0x00)
>  +#define AIC26_REG_ADC_GAIN AIC26_PAGE_ADDR(2, 0x01)
>  +#define AIC26_REG_DAC_GAIN AIC26_PAGE_ADDR(2, 0x02)
>  +#define AIC26_REG_SIDETONE AIC26_PAGE_ADDR(2, 0x03)
>  +#define AIC26_REG_AUDIO_CTRL2  AIC26_PAGE_ADDR(2, 0x04)
>  +#define AIC26_REG_POWER_CTRL   AIC26_PAGE_ADDR(2, 0x05)
>  +#define AIC26_REG_AUDIO_CTRL3  AIC26_PAGE_ADDR(2, 0x06)
>  +
>  +#define AIC26_REG_FILTER_COEFF_L_N0AIC26_PAGE_ADDR(2, 0x07)
>  +#define AIC26_REG_FILTER_COEFF_L_N1AIC26_PAGE_ADDR(2, 0x08)
>  +#define AIC26_REG_FILTER_COEFF_L_N2AIC26_PAGE_ADDR(2, 0x09)
>  +#define AIC26_REG_FILTER_COEFF_L_N3AIC26_PAGE_ADDR(2, 0x0A)
>  +#define AIC26_REG_FILTER_COEFF_L_N4AIC26_PAGE_ADDR(2, 0x0B)
>  +#define AIC26_REG_FILTER_COEFF_L_N5AIC26_PAGE_ADDR(2, 0x0C)
>  +#define AIC26_REG_FILTER_COEFF_L_D1AIC26_PAGE_ADDR(2, 0x0D)
>  +#define AIC26_REG_FILTER_COEFF_L_D2AIC26_PAGE_ADDR(2, 0x0E)
>  +#define AIC26_REG_FILTER_COEFF_L_D4AIC26_PAGE_ADDR(2, 0x0F)
>  +#define AIC26_REG_FILTER_COEFF_L

Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

2008-07-02 Thread Liam Girdwood
On Tue, 2008-07-01 at 17:53 -0600, Grant Likely wrote:
> From: Grant Likely <[EMAIL PROTECTED]>
> 
> ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
> v1 API, so I don't expect it to get merged as-is, but I want to get it
> out there for review.
> ---
> 
>  sound/soc/codecs/Kconfig   |4 
>  sound/soc/codecs/Makefile  |2 
>  sound/soc/codecs/tlv320aic26.c |  630 
> 
>  3 files changed, 636 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 3903ab7..96c7bfe 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
>   bool
>   depends on SND_SOC_CS4270
>  
> +config SND_SOC_TLV320AIC26
> + tristate "TI TLB320AIC26 Codec support"
> + depends on SND_SOC && SPI
> +
>  config SND_SOC_TLV320AIC3X
>   tristate
>   depends on SND_SOC && I2C
> diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
> index 4e1314c..ec0cd93 100644
> --- a/sound/soc/codecs/Makefile
> +++ b/sound/soc/codecs/Makefile
> @@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
>  snd-soc-wm9712-objs := wm9712.o
>  snd-soc-wm9713-objs := wm9713.o
>  snd-soc-cs4270-objs := cs4270.o
> +snd-soc-tlv320aic26-objs := tlv320aic26.o
>  snd-soc-tlv320aic3x-objs := tlv320aic3x.o
>  
>  obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
> @@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)+= snd-soc-wm8753.o
>  obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
>  obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
>  obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o
> +obj-$(CONFIG_SND_SOC_TLV320AIC26)+= snd-soc-tlv320aic26.o
>  obj-$(CONFIG_SND_SOC_TLV320AIC3X)+= snd-soc-tlv320aic3x.o
> diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
> new file mode 100644
> index 000..aee1dbc
> --- /dev/null
> +++ b/sound/soc/codecs/tlv320aic26.c
> @@ -0,0 +1,630 @@
> +/*
> + * Texas Instruments TLV320AIC26 low power audio CODEC
> + * ALSA SoC CODEC driver
> + *
> + * Copyright (C) 2008 Secret Lab Technologies Ltd.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +MODULE_DESCRIPTION("ASoC TLV320AIC26 codec driver");
> +MODULE_AUTHOR("Grant Likely <[EMAIL PROTECTED]>");
> +MODULE_LICENSE("GPL");
> +
> +/* AIC26 Registers */
> +#define AIC26_READ_COMMAND_WORD(addr)((1 << 15) | (addr << 5))
> +#define AIC26_WRITE_COMMAND_WORD(addr)   ((0 << 15) | (addr << 5))
> +#define AIC26_PAGE_ADDR(page, offset)((page << 6) | offset)
> +#define AIC26_NUM_REGS   AIC26_PAGE_ADDR(3, 0)
> +#define AIC26_REG_CACHE_SIZE (0x20) /* only page 2 cached */
> +#define AIC26_REG_IS_CACHED(addr)((addr & ~0x1f) == (2 << 6))
> +#define AIC26_REG_CACHE_ADDR(addr)   (addr & 0x1f)
> +
> +/* Page 0: Auxillary data registers */
> +#define AIC26_REG_BAT1   AIC26_PAGE_ADDR(0, 0x05)
> +#define AIC26_REG_BAT2   AIC26_PAGE_ADDR(0, 0x06)
> +#define AIC26_REG_AUXAIC26_PAGE_ADDR(0, 0x07)
> +#define AIC26_REG_TEMP1  AIC26_PAGE_ADDR(0, 0x09)
> +#define AIC26_REG_TEMP2  AIC26_PAGE_ADDR(0, 0x0A)
> +
> +/* Page 1: Auxillary control registers */
> +#define AIC26_REG_AUX_ADCAIC26_PAGE_ADDR(1, 0x00)
> +#define AIC26_REG_STATUS AIC26_PAGE_ADDR(1, 0x01)
> +#define AIC26_REG_REFERENCE  AIC26_PAGE_ADDR(1, 0x03)
> +#define AIC26_REG_RESET  AIC26_PAGE_ADDR(1, 0x04)
> +
> +/* Page 2: Audio control registers */
> +#define AIC26_REG_AUDIO_CTRL1AIC26_PAGE_ADDR(2, 0x00)
> +#define AIC26_REG_ADC_GAIN   AIC26_PAGE_ADDR(2, 0x01)
> +#define AIC26_REG_DAC_GAIN   AIC26_PAGE_ADDR(2, 0x02)
> +#define AIC26_REG_SIDETONE   AIC26_PAGE_ADDR(2, 0x03)
> +#define AIC26_REG_AUDIO_CTRL2AIC26_PAGE_ADDR(2, 0x04)
> +#define AIC26_REG_POWER_CTRL AIC26_PAGE_ADDR(2, 0x05)
> +#define AIC26_REG_AUDIO_CTRL3AIC26_PAGE_ADDR(2, 0x06)
> +
> +#define AIC26_REG_FILTER_COEFF_L_N0  AIC26_PAGE_ADDR(2, 0x07)
> +#define AIC26_REG_FILTER_COEFF_L_N1  AIC26_PAGE_ADDR(2, 0x08)
> +#define AIC26_REG_FILTER_COEFF_L_N2  AIC26_PAGE_ADDR(2, 0x09)
> +#define AIC26_REG_FILTER_COEFF_L_N3  AIC26_PAGE_ADDR(2, 0x0A)
> +#define AIC26_REG_FILTER_COEFF_L_N4  AIC26_PAGE_ADDR(2, 0x0B)
> +#define AIC26_REG_FILTER_COEFF_L_N5  AIC26_PAGE_ADDR(2, 0x0C)
> +#define AIC26_REG_FILTER_COEFF_L_D1  AIC26_PAGE_ADDR(2, 0x0D)
> +#define AIC26_REG_FILTER_COEFF_L_D2  AIC26_PAGE_ADDR(2, 0x0E)
> +#define AIC26_REG_FILTER_COEFF_L_D4  AIC26_PAGE_ADDR(2, 0x0F)
> +#define AIC26_REG_FILTER_COEFF_L_D5  AIC26_PAGE_ADDR(2, 0x10)
> +#define AIC26_REG_FILTER_COEFF_R_N0  AIC26_PAGE_ADDR(2, 0x11)
> +