]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/ice1712/aureon.c
dsp56k: BKL pushdown
[linux-2.6-omap-h63xx.git] / sound / pci / ice1712 / aureon.c
index 7e6608b14abce345187fee04495d1550ef995cba..868ae291b960fd32f6054b322cdca8cd3bfad326 100644 (file)
@@ -47,7 +47,6 @@
  *
  */      
 
-#include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "ice1712.h"
 #include "envy24ht.h"
 #include "aureon.h"
+#include <sound/tlv.h>
+
+/* AC97 register cache for Aureon */
+struct aureon_spec {
+       unsigned short stac9744[64];
+       unsigned int cs8415_mux;
+       unsigned short master[2];
+       unsigned short vol[8];
+       unsigned char pca9554_out;
+};
 
 /* WM8770 registers */
 #define WM_DAC_ATTEN           0x00    /* DAC1-8 analog attenuation */
 #define CS8415_C_BUFFER        0x20
 #define CS8415_ID              0x7F
 
-static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, unsigned short val) {
+/* PCA9554 registers */
+#define PCA9554_DEV     0x40            /* I2C device address */
+#define PCA9554_IN      0x00            /* input port */
+#define PCA9554_OUT     0x01            /* output port */
+#define PCA9554_INVERT  0x02            /* input invert */
+#define PCA9554_DIR     0x03            /* port directions */
+
+/*
+ * Aureon Universe additional controls using PCA9554
+ */
+
+/*
+ * Send data to pca9554
+ */
+static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
+                                unsigned char data)
+{
+       unsigned int tmp;
+       int i, j;
+       unsigned char dev = PCA9554_DEV;  /* ID 0100000, write */
+       unsigned char val = 0;
+
+       tmp = snd_ice1712_gpio_read(ice);
+
+       snd_ice1712_gpio_set_mask(ice, ~(AUREON_SPI_MOSI|AUREON_SPI_CLK|
+                                        AUREON_WM_RW|AUREON_WM_CS|
+                                        AUREON_CS8415_CS));
+       tmp |= AUREON_WM_RW;
+       tmp |= AUREON_CS8415_CS | AUREON_WM_CS; /* disable SPI devices */
+
+       tmp &= ~AUREON_SPI_MOSI;
+       tmp &= ~AUREON_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(50);
+
+       /* 
+        * send i2c stop condition and start condition
+        * to obtain sane state
+        */
+       tmp |= AUREON_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(50);
+       tmp |= AUREON_SPI_MOSI;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(100);
+       tmp &= ~AUREON_SPI_MOSI;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(50);
+       tmp &= ~AUREON_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(100);
+       /*
+        * send device address, command and value,
+        * skipping ack cycles inbetween
+        */
+       for (j = 0; j < 3; j++) {
+               switch(j) {
+               case 0: val = dev; break;
+               case 1: val = reg; break;
+               case 2: val = data; break;
+               }
+               for (i = 7; i >= 0; i--) {
+                       tmp &= ~AUREON_SPI_CLK;
+                       snd_ice1712_gpio_write(ice, tmp);
+                       udelay(40);
+                       if (val & (1 << i))
+                               tmp |= AUREON_SPI_MOSI;
+                       else
+                               tmp &= ~AUREON_SPI_MOSI;
+                       snd_ice1712_gpio_write(ice, tmp);
+                       udelay(40);
+                       tmp |= AUREON_SPI_CLK;
+                       snd_ice1712_gpio_write(ice, tmp);
+                       udelay(40);
+               }
+                tmp &= ~AUREON_SPI_CLK;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(40);
+               tmp |= AUREON_SPI_CLK;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(40);
+               tmp &= ~AUREON_SPI_CLK;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(40);
+       }
+       tmp &= ~AUREON_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(40);
+       tmp &= ~AUREON_SPI_MOSI;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(40);
+       tmp |= AUREON_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(50);
+       tmp |= AUREON_SPI_MOSI;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(100);
+}
+
+static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_info *uinfo)
+{
+       char *texts[3] = {"Internal Aux", "Wavetable", "Rear Line-In"};
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 3;
+       if(uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+               uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       return 0;
+}
+
+static int aureon_universe_inmux_get(struct snd_kcontrol *kcontrol,
+                                    struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
+       ucontrol->value.enumerated.item[0] = spec->pca9554_out;
+       return 0;
+}
+
+static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol,
+                                    struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
+       unsigned char oval, nval;
+       int change;
+
+       nval = ucontrol->value.enumerated.item[0];
+       if (nval >= 3)
+               return -EINVAL;
+       snd_ice1712_save_gpio_status(ice);
+       oval = spec->pca9554_out;
+       if ((change = (oval != nval))) {
+               aureon_pca9554_write(ice, PCA9554_OUT, nval);
+               spec->pca9554_out = nval;
+       }
+       snd_ice1712_restore_gpio_status(ice);
+       
+       return change;
+}
+
+
+static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg,
+                             unsigned short val)
+{
+       struct aureon_spec *spec = ice->spec;
        unsigned int tmp;
 
        /* Send address to XILINX chip */
@@ -135,20 +292,23 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, unsig
        udelay(10);
        
        /* Store the data in out private buffer */
-       ice->spec.aureon.stac9744[(reg & 0x7F) >> 1] = val;
+       spec->stac9744[(reg & 0x7F) >> 1] = val;
 }
 
 static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg)
 {
-       return ice->spec.aureon.stac9744[(reg & 0x7F) >> 1];
+       struct aureon_spec *spec = ice->spec;
+       return spec->stac9744[(reg & 0x7F) >> 1];
 }
 
 /*
  * Initialize STAC9744 chip
  */
-static int aureon_ac97_init (struct snd_ice1712 *ice) {
+static int aureon_ac97_init (struct snd_ice1712 *ice)
+{
+       struct aureon_spec *spec = ice->spec;
        int i;
-       static unsigned short ac97_defaults[] = {
+       static const unsigned short ac97_defaults[] = {
                0x00, 0x9640,
                0x02, 0x8000,
                0x04, 0x8000,
@@ -184,9 +344,9 @@ static int aureon_ac97_init (struct snd_ice1712 *ice) {
        snd_ice1712_gpio_write(ice, tmp);
        udelay(3);
        
-       memset(&ice->spec.aureon.stac9744, 0, sizeof(ice->spec.aureon.stac9744));
+       memset(&spec->stac9744, 0, sizeof(spec->stac9744));
        for (i=0; ac97_defaults[i] != (unsigned short)-1; i+=2)
-               ice->spec.aureon.stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1];
+               spec->stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1];
                
        aureon_ac97_write(ice, AC97_MASTER, 0x0000); // Unmute AC'97 master volume permanently - muting is done by WM8770
 
@@ -248,7 +408,7 @@ static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
 /*
  * AC'97 mute controls
  */
-#define aureon_ac97_mute_info  aureon_mono_bool_info
+#define aureon_ac97_mute_info  snd_ctl_boolean_mono_info
 
 static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -284,7 +444,7 @@ static int aureon_ac97_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
 /*
  * AC'97 mute controls
  */
-#define aureon_ac97_micboost_info      aureon_mono_bool_info
+#define aureon_ac97_micboost_info      snd_ctl_boolean_mono_info
 
 static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -328,7 +488,8 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned
 
        tmp = snd_ice1712_gpio_read(ice);
 
-       if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT) {
+       if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
+           ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) {
                snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS));
                mosi = PRODIGY_SPI_MOSI;
                clk = PRODIGY_SPI_CLK;
@@ -455,7 +616,9 @@ static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
 static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
 {
        aureon_spi_write(ice,
-                       (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ? PRODIGY_WM_CS : AUREON_WM_CS),
+                        ((ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
+                          ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) ?
+                        PRODIGY_WM_CS : AUREON_WM_CS),
                        (reg << 9) | (val & 0x1ff), 16);
 }
 
@@ -472,19 +635,12 @@ static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
 
 /*
  */
-static int aureon_mono_bool_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
+#define aureon_mono_bool_info          snd_ctl_boolean_mono_info
 
 /*
  * AC'97 master playback mute controls (Mute on WM8770 chip)
  */
-#define aureon_ac97_mmute_info aureon_mono_bool_info
+#define aureon_ac97_mmute_info         snd_ctl_boolean_mono_info
 
 static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -515,11 +671,17 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        return change;
 }
 
+static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
+static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
+static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0);
+
 /*
  * Logarithmic volume values for WM8770
  * Computed as 20 * Log10(255 / x)
  */
-static unsigned char wm_vol[256] = {
+static const unsigned char wm_vol[256] = {
        127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23,
        23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17,
        17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13,
@@ -553,7 +715,7 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
 /*
  * DAC mute control
  */
-#define wm_pcm_mute_info       aureon_mono_bool_info
+#define wm_pcm_mute_info       snd_ctl_boolean_mono_info
 
 static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -596,27 +758,33 @@ static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
 static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int i;
        for (i=0; i<2; i++)
-               ucontrol->value.integer.value[i] = ice->spec.aureon.master[i] & ~WM_VOL_MUTE;
+               ucontrol->value.integer.value[i] =
+                       spec->master[i] & ~WM_VOL_MUTE;
        return 0;
 }
 
 static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int ch, change = 0;
 
        snd_ice1712_save_gpio_status(ice);
        for (ch = 0; ch < 2; ch++) {
-               if (ucontrol->value.integer.value[ch] != ice->spec.aureon.master[ch]) {
+               unsigned int vol = ucontrol->value.integer.value[ch];
+               if (vol > WM_VOL_MAX)
+                       continue;
+               vol |= spec->master[ch] & WM_VOL_MUTE;
+               if (vol != spec->master[ch]) {
                        int dac;
-                       ice->spec.aureon.master[ch] &= WM_VOL_MUTE;
-                       ice->spec.aureon.master[ch] |= ucontrol->value.integer.value[ch];
+                       spec->master[ch] = vol;
                        for (dac = 0; dac < ice->num_total_dacs; dac += 2)
                                wm_set_vol(ice, WM_DAC_ATTEN + dac + ch,
-                                          ice->spec.aureon.vol[dac + ch],
-                                          ice->spec.aureon.master[ch]);
+                                          spec->vol[dac + ch],
+                                          spec->master[ch]);
                        change = 1;
                }
        }
@@ -640,18 +808,21 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *
 static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int i, ofs, voices;
 
        voices = kcontrol->private_value >> 8;
        ofs = kcontrol->private_value & 0xff;
        for (i = 0; i < voices; i++)
-               ucontrol->value.integer.value[i] = ice->spec.aureon.vol[ofs+i] & ~WM_VOL_MUTE;
+               ucontrol->value.integer.value[i] =
+                       spec->vol[ofs+i] & ~WM_VOL_MUTE;
        return 0;
 }
 
 static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int i, idx, ofs, voices;
        int change = 0;
 
@@ -659,12 +830,15 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
        ofs = kcontrol->private_value & 0xff;
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < voices; i++) {
-               idx  = WM_DAC_ATTEN + ofs + i;
-               if (ucontrol->value.integer.value[i] != ice->spec.aureon.vol[ofs+i]) {
-                       ice->spec.aureon.vol[ofs+i] &= WM_VOL_MUTE;
-                       ice->spec.aureon.vol[ofs+i] |= ucontrol->value.integer.value[i];
-                       wm_set_vol(ice, idx, ice->spec.aureon.vol[ofs+i],
-                                  ice->spec.aureon.master[i]);
+               unsigned int vol = ucontrol->value.integer.value[i];
+               if (vol > 0x7f)
+                       continue;
+               vol |= spec->vol[ofs+i];
+               if (vol != spec->vol[ofs+i]) {
+                       spec->vol[ofs+i] = vol;
+                       idx  = WM_DAC_ATTEN + ofs + i;
+                       wm_set_vol(ice, idx, spec->vol[ofs + i],
+                                  spec->master[i]);
                        change = 1;
                }
        }
@@ -686,19 +860,22 @@ static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info
 static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int voices, ofs, i;
        
        voices = kcontrol->private_value >> 8;
        ofs = kcontrol->private_value & 0xFF;
 
        for (i = 0; i < voices; i++)
-               ucontrol->value.integer.value[i] = (ice->spec.aureon.vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1;
+               ucontrol->value.integer.value[i] =
+                       (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
        return 0;
 }
 
 static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int change = 0, voices, ofs, i;
 
        voices = kcontrol->private_value >> 8;
@@ -706,13 +883,13 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value
 
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < voices; i++) {
-               int val = (ice->spec.aureon.vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
+               int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
                if (ucontrol->value.integer.value[i] != val) {
-                       ice->spec.aureon.vol[ofs + i] &= ~WM_VOL_MUTE;
-                       ice->spec.aureon.vol[ofs + i] |=
+                       spec->vol[ofs + i] &= ~WM_VOL_MUTE;
+                       spec->vol[ofs + i] |=
                                ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
-                       wm_set_vol(ice, ofs + i, ice->spec.aureon.vol[ofs + i],
-                                  ice->spec.aureon.master[i]);
+                       wm_set_vol(ice, ofs + i, spec->vol[ofs + i],
+                                  spec->master[i]);
                        change = 1;
                }
        }
@@ -724,40 +901,38 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value
 /*
  * WM8770 master mute control
  */
-static int wm_master_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 2;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
+#define wm_master_mute_info            snd_ctl_boolean_stereo_info
 
 static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        
-       ucontrol->value.integer.value[0] = (ice->spec.aureon.master[0] & WM_VOL_MUTE) ? 0 : 1;
-       ucontrol->value.integer.value[1] = (ice->spec.aureon.master[1] & WM_VOL_MUTE) ? 0 : 1;
+       ucontrol->value.integer.value[0] =
+               (spec->master[0] & WM_VOL_MUTE) ? 0 : 1;
+       ucontrol->value.integer.value[1] =
+               (spec->master[1] & WM_VOL_MUTE) ? 0 : 1;
        return 0;
 }
 
 static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        int change = 0, i;
 
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < 2; i++) {
-               int val = (ice->spec.aureon.master[i] & WM_VOL_MUTE) ? 0 : 1;
+               int val = (spec->master[i] & WM_VOL_MUTE) ? 0 : 1;
                if (ucontrol->value.integer.value[i] != val) {
                        int dac;
-                       ice->spec.aureon.master[i] &= ~WM_VOL_MUTE;
-                       ice->spec.aureon.master[i] |=
+                       spec->master[i] &= ~WM_VOL_MUTE;
+                       spec->master[i] |=
                                ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
                        for (dac = 0; dac < ice->num_total_dacs; dac += 2)
                                wm_set_vol(ice, WM_DAC_ATTEN + dac + i,
-                                          ice->spec.aureon.vol[dac + i],
-                                          ice->spec.aureon.master[i]);
+                                          spec->vol[dac + i],
+                                          spec->master[i]);
                        change = 1;
                }
        }
@@ -798,8 +973,10 @@ static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
        unsigned short ovol, nvol;
        int change = 0;
 
-       snd_ice1712_save_gpio_status(ice);
        nvol = ucontrol->value.integer.value[0];
+       if (nvol > PCM_RES)
+               return -EINVAL;
+       snd_ice1712_save_gpio_status(ice);
        nvol = (nvol ? (nvol + PCM_MIN) : 0) & 0xff;
        ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
        if (ovol != nvol) {
@@ -814,14 +991,7 @@ static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
 /*
  * ADC mute control
  */
-static int wm_adc_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 2;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
+#define wm_adc_mute_info               snd_ctl_boolean_stereo_info
 
 static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -896,7 +1066,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < 2; i++) {
                idx  = WM_ADC_GAIN + i;
-               nvol = ucontrol->value.integer.value[i];
+               nvol = ucontrol->value.integer.value[i] & 0x1f;
                ovol = wm_get(ice, idx);
                if ((ovol & 0x1f) != nvol) {
                        wm_put(ice, idx, nvol | (ovol & ~0x1f));
@@ -912,14 +1082,14 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
  */
 static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[] = {
+       static const char * const texts[] = {
                "CD",           //AIN1
                "Aux",          //AIN2
                "Line",         //AIN3
                "Mic",          //AIN4
                "AC97"          //AIN5
        };
-       static char *universe_texts[] = {
+       static const char * const universe_texts[] = {
                "Aux1",         //AIN1
                "CD",           //AIN2
                "Phono",        //AIN3
@@ -985,11 +1155,11 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
 static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
-       static char *aureon_texts[] = {
+       static const char * const aureon_texts[] = {
                "CD",           //RXP0
                "Optical"       //RXP1
        };
-       static char *prodigy_texts[] = {
+       static const char * const prodigy_texts[] = {
                "CD",
                "Coax"
        };
@@ -1008,10 +1178,11 @@ static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
 static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
 
        //snd_ice1712_save_gpio_status(ice);
        //val = aureon_cs8415_get(ice, CS8415_CTRL2);
-       ucontrol->value.enumerated.item[0] = ice->spec.aureon.cs8415_mux;
+       ucontrol->value.enumerated.item[0] = spec->cs8415_mux;
        //snd_ice1712_restore_gpio_status(ice);
        return 0;
 }
@@ -1019,6 +1190,7 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       struct aureon_spec *spec = ice->spec;
        unsigned short oval, nval;
        int change;
 
@@ -1030,7 +1202,7 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        if (change)
                aureon_cs8415_put(ice, CS8415_CTRL2, nval);
        snd_ice1712_restore_gpio_status(ice);
-       ice->spec.aureon.cs8415_mux = ucontrol->value.enumerated.item[0];
+       spec->cs8415_mux = ucontrol->value.enumerated.item[0];
        return change;
 }
 
@@ -1055,12 +1227,7 @@ static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl
 /*
  * CS8415A Mute
  */
-static int aureon_cs8415_mute_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-       return 0;
-}
+#define aureon_cs8415_mute_info                snd_ctl_boolean_mono_info
 
 static int aureon_cs8415_mute_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -1136,9 +1303,17 @@ static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable)
 
        tmp2 = tmp = snd_ice1712_gpio_read(ice);
        if (enable)
-               tmp |= AUREON_HP_SEL;
+               if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
+                   ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
+                       tmp |= AUREON_HP_SEL;
+               else
+                       tmp |= PRODIGY_HP_SEL;
        else
-               tmp &= ~ AUREON_HP_SEL;
+               if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
+                   ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
+                       tmp &= ~ AUREON_HP_SEL;
+               else
+                       tmp &= ~ PRODIGY_HP_SEL;
        if (tmp != tmp2) {
                snd_ice1712_gpio_write(ice, tmp);
                return 1;
@@ -1153,7 +1328,7 @@ static int aureon_get_headphone_amp(struct snd_ice1712 *ice)
        return ( tmp & AUREON_HP_SEL )!= 0;
 }
 
-#define aureon_hpamp_info      aureon_mono_bool_info
+#define aureon_hpamp_info      snd_ctl_boolean_mono_info
 
 static int aureon_hpamp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -1175,7 +1350,7 @@ static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
  * Deemphasis
  */
 
-#define aureon_deemp_info      aureon_mono_bool_info
+#define aureon_deemp_info      snd_ctl_boolean_mono_info
 
 static int aureon_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
@@ -1205,7 +1380,7 @@ static int aureon_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
  */
 static int aureon_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[2] = { "128x", "64x" };
+       static const char * const texts[2] = { "128x", "64x"    };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
@@ -1258,10 +1433,13 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Master Playback Volume",
                .info = wm_master_vol_info,
                .get = wm_master_vol_get,
-               .put = wm_master_vol_put
+               .put = wm_master_vol_put,
+               .tlv = { .p = db_scale_wm_dac }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1273,11 +1451,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Front Playback Volume",
                .info = wm_vol_info,
                .get = wm_vol_get,
                .put = wm_vol_put,
-               .private_value = (2 << 8) | 0
+               .private_value = (2 << 8) | 0,
+               .tlv = { .p = db_scale_wm_dac }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1289,11 +1470,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Rear Playback Volume",
                .info = wm_vol_info,
                .get = wm_vol_get,
                .put = wm_vol_put,
-               .private_value = (2 << 8) | 2
+               .private_value = (2 << 8) | 2,
+               .tlv = { .p = db_scale_wm_dac }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1305,11 +1489,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Center Playback Volume",
                .info = wm_vol_info,
                .get = wm_vol_get,
                .put = wm_vol_put,
-               .private_value = (1 << 8) | 4
+               .private_value = (1 << 8) | 4,
+               .tlv = { .p = db_scale_wm_dac }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1321,11 +1508,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "LFE Playback Volume",
                .info = wm_vol_info,
                .get = wm_vol_get,
                .put = wm_vol_put,
-               .private_value = (1 << 8) | 5
+               .private_value = (1 << 8) | 5,
+               .tlv = { .p = db_scale_wm_dac }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1337,11 +1527,14 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Side Playback Volume",
                .info = wm_vol_info,
                .get = wm_vol_get,
                .put = wm_vol_put,
-               .private_value = (2 << 8) | 6
+               .private_value = (2 << 8) | 6,
+               .tlv = { .p = db_scale_wm_dac }
        }
 };
 
@@ -1355,10 +1548,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "PCM Playback Volume",
                .info = wm_pcm_vol_info,
                .get = wm_pcm_vol_get,
-               .put = wm_pcm_vol_put
+               .put = wm_pcm_vol_put,
+               .tlv = { .p = db_scale_wm_pcm }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1369,10 +1565,13 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Capture Volume",
                .info = wm_adc_vol_info,
                .get = wm_adc_vol_get,
-               .put = wm_adc_vol_put
+               .put = wm_adc_vol_put,
+               .tlv = { .p = db_scale_wm_adc }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1416,11 +1615,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "AC97 Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_MASTER|AUREON_AC97_STEREO
+               .private_value = AC97_MASTER|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_master }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1432,11 +1634,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "CD Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_CD|AUREON_AC97_STEREO
+               .private_value = AC97_CD|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1448,11 +1653,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Aux Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_AUX|AUREON_AC97_STEREO
+               .private_value = AC97_AUX|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1464,11 +1672,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Line Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_LINE|AUREON_AC97_STEREO
+               .private_value = AC97_LINE|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1480,11 +1691,14 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Mic Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_MIC
+               .private_value = AC97_MIC,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1506,11 +1720,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "AC97 Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_MASTER|AUREON_AC97_STEREO
+               .private_value = AC97_MASTER|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_master }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1522,11 +1739,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "CD Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_AUX|AUREON_AC97_STEREO
+               .private_value = AC97_AUX|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1534,15 +1754,18 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
                .info = aureon_ac97_mute_info,
                .get = aureon_ac97_mute_get,
                .put = aureon_ac97_mute_put,
-               .private_value = AC97_CD,
+               .private_value = AC97_CD
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Phono Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_CD|AUREON_AC97_STEREO
+               .private_value = AC97_CD|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1554,11 +1777,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Line Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_LINE|AUREON_AC97_STEREO
+               .private_value = AC97_LINE|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1570,11 +1796,14 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Mic Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_MIC
+               .private_value = AC97_MIC,
+               .tlv = { .p = db_scale_ac97_gain }
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1593,15 +1822,25 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
        },
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                          SNDRV_CTL_ELEM_ACCESS_TLV_READ),
                .name = "Aux Playback Volume",
                .info = aureon_ac97_vol_info,
                .get = aureon_ac97_vol_get,
                .put = aureon_ac97_vol_put,
-               .private_value = AC97_VIDEO|AUREON_AC97_STEREO
-       }
+               .private_value = AC97_VIDEO|AUREON_AC97_STEREO,
+               .tlv = { .p = db_scale_ac97_gain }
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Aux Source",
+               .info = aureon_universe_inmux_info,
+               .get = aureon_universe_inmux_get,
+               .put = aureon_universe_inmux_put
+       }
+
 };
 
-       
 static struct snd_kcontrol_new cs8415_controls[] __devinitdata = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1647,7 +1886,6 @@ static struct snd_kcontrol_new cs8415_controls[] __devinitdata = {
        }
 };
 
 static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
 {
        unsigned int i, counts;
@@ -1675,7 +1913,8 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
                                return err;
                }
        }
-       else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) {
+       else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
+                ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
                for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) {
                        err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice));
                        if (err < 0)
@@ -1683,7 +1922,8 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
                }
        }
 
-       if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) {
+       if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
+           ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
                unsigned char id;
                snd_ice1712_save_gpio_status(ice);
                id = aureon_cs8415_get(ice, CS8415_ID);
@@ -1713,7 +1953,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
  */
 static int __devinit aureon_init(struct snd_ice1712 *ice)
 {
-       static unsigned short wm_inits_aureon[] = {
+       static const unsigned short wm_inits_aureon[] = {
                /* These come first to reduce init pop noise */
                0x1b, 0x044,            /* ADC Mux (AC'97 source) */
                0x1c, 0x00B,            /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */
@@ -1749,7 +1989,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
                0x1a, 0x000,            /* -12dB ADC/R */
                (unsigned short)-1
        };
-       static unsigned short wm_inits_prodigy[] = {
+       static const unsigned short wm_inits_prodigy[] = {
 
                /* These come first to reduce init pop noise */
                0x1b, 0x000,            /* ADC Mux */
@@ -1791,17 +2031,23 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
                (unsigned short)-1
 
        };
-       static unsigned short cs_inits[] = {
+       static const unsigned short cs_inits[] = {
                0x0441, /* RUN */
                0x0180, /* no mute, OMCK output on RMCK pin */
                0x0201, /* S/PDIF source on RXP1 */
                0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */
                (unsigned short)-1
        };
+       struct aureon_spec *spec;
        unsigned int tmp;
-       unsigned short *p;
+       const unsigned short *p;
        int err, i;
 
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+       if (!spec)
+               return -ENOMEM;
+       ice->spec = spec;
+
        if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
                ice->num_total_dacs = 6;
                ice->num_total_adcs = 2;
@@ -1839,7 +2085,8 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
 
        /* initialize WM8770 codec */
        if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 ||
-               ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT)
+               ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
+               ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT)
                p = wm_inits_prodigy;
        else
                p = wm_inits_aureon;
@@ -1847,21 +2094,26 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
                wm_put(ice, p[0], p[1]);
 
        /* initialize CS8415A codec */
-       if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) {
+       if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
+           ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
                for (p = cs_inits; *p != (unsigned short)-1; p++)
                        aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24);
-               ice->spec.aureon.cs8415_mux = 1;
+               spec->cs8415_mux = 1;
 
                aureon_set_headphone_amp(ice, 1);
        }
 
        snd_ice1712_restore_gpio_status(ice);
+
+        /* initialize PCA9554 pin directions & set default input*/
+       aureon_pca9554_write(ice, PCA9554_DIR, 0x00);
+       aureon_pca9554_write(ice, PCA9554_OUT, 0x00);   /* internal AUX */
        
-       ice->spec.aureon.master[0] = WM_VOL_MUTE;
-       ice->spec.aureon.master[1] = WM_VOL_MUTE;
+       spec->master[0] = WM_VOL_MUTE;
+       spec->master[1] = WM_VOL_MUTE;
        for (i = 0; i < ice->num_total_dacs; i++) {
-               ice->spec.aureon.vol[i] = WM_VOL_MUTE;
-               wm_set_vol(ice, i, ice->spec.aureon.vol[i], ice->spec.aureon.master[i % 2]);
+               spec->vol[i] = WM_VOL_MUTE;
+               wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
        }
 
        return 0;
@@ -1874,69 +2126,54 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
  */
 
 static unsigned char aureon51_eeprom[] __devinitdata = {
-       0x0a,   /* SYSCONF: clock 512, spdif-in/ADC, 3DACs */
-       0x80,   /* ACLINK: I2S */
-       0xfc,   /* I2S: vol, 96k, 24bit, 192k */
-       0xc3,   /* SPDIF: out-en, out-int, spdif-in */
-       0xff,   /* GPIO_DIR */
-       0xff,   /* GPIO_DIR1 */
-       0x5f,   /* GPIO_DIR2 */
-       0x00,   /* GPIO_MASK */
-       0x00,   /* GPIO_MASK1 */
-       0x00,   /* GPIO_MASK2 */
-       0x00,   /* GPIO_STATE */
-       0x00,   /* GPIO_STATE1 */
-       0x00,   /* GPIO_STATE2 */
+       [ICE_EEP2_SYSCONF]     = 0x0a,  /* clock 512, spdif-in/ADC, 3DACs */
+       [ICE_EEP2_ACLINK]      = 0x80,  /* I2S */
+       [ICE_EEP2_I2S]         = 0xfc,  /* vol, 96k, 24bit, 192k */
+       [ICE_EEP2_SPDIF]       = 0xc3,  /* out-en, out-int, spdif-in */
+       [ICE_EEP2_GPIO_DIR]    = 0xff,
+       [ICE_EEP2_GPIO_DIR1]   = 0xff,
+       [ICE_EEP2_GPIO_DIR2]   = 0x5f,
+       [ICE_EEP2_GPIO_MASK]   = 0x00,
+       [ICE_EEP2_GPIO_MASK1]  = 0x00,
+       [ICE_EEP2_GPIO_MASK2]  = 0x00,
+       [ICE_EEP2_GPIO_STATE]  = 0x00,
+       [ICE_EEP2_GPIO_STATE1] = 0x00,
+       [ICE_EEP2_GPIO_STATE2] = 0x00,
 };
 
 static unsigned char aureon71_eeprom[] __devinitdata = {
-       0x0b,   /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */
-       0x80,   /* ACLINK: I2S */
-       0xfc,   /* I2S: vol, 96k, 24bit, 192k */
-       0xc3,   /* SPDIF: out-en, out-int, spdif-in */
-       0xff,   /* GPIO_DIR */
-       0xff,   /* GPIO_DIR1 */
-       0x5f,   /* GPIO_DIR2 */
-       0x00,   /* GPIO_MASK */
-       0x00,   /* GPIO_MASK1 */
-       0x00,   /* GPIO_MASK2 */
-       0x00,   /* GPIO_STATE */
-       0x00,   /* GPIO_STATE1 */
-       0x00,   /* GPIO_STATE2 */
-};
-
-static unsigned char prodigy71_eeprom[] __devinitdata = {
-       0x0b,   /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */
-       0x80,   /* ACLINK: I2S */
-       0xfc,   /* I2S: vol, 96k, 24bit, 192k */
-       0xc3,   /* SPDIF: out-en, out-int, spdif-in */
-       0xff,   /* GPIO_DIR */
-       0xff,   /* GPIO_DIR1 */
-       0x5f,   /* GPIO_DIR2 */
-       0x00,   /* GPIO_MASK */
-       0x00,   /* GPIO_MASK1 */
-       0x00,   /* GPIO_MASK2 */
-       0x00,   /* GPIO_STATE */
-       0x00,   /* GPIO_STATE1 */
-       0x00,   /* GPIO_STATE2 */
+       [ICE_EEP2_SYSCONF]     = 0x0b,  /* clock 512, spdif-in/ADC, 4DACs */
+       [ICE_EEP2_ACLINK]      = 0x80,  /* I2S */
+       [ICE_EEP2_I2S]         = 0xfc,  /* vol, 96k, 24bit, 192k */
+       [ICE_EEP2_SPDIF]       = 0xc3,  /* out-en, out-int, spdif-in */
+       [ICE_EEP2_GPIO_DIR]    = 0xff,
+       [ICE_EEP2_GPIO_DIR1]   = 0xff,
+       [ICE_EEP2_GPIO_DIR2]   = 0x5f,
+       [ICE_EEP2_GPIO_MASK]   = 0x00,
+       [ICE_EEP2_GPIO_MASK1]  = 0x00,
+       [ICE_EEP2_GPIO_MASK2]  = 0x00,
+       [ICE_EEP2_GPIO_STATE]  = 0x00,
+       [ICE_EEP2_GPIO_STATE1] = 0x00,
+       [ICE_EEP2_GPIO_STATE2] = 0x00,
 };
+#define prodigy71_eeprom aureon71_eeprom
 
 static unsigned char prodigy71lt_eeprom[] __devinitdata = {
-       0x0b,   /* SYSCINF: clock 512, spdif-in/ADC, 4DACs */
-       0x80,   /* ACLINK: I2S */
-       0xfc,   /* I2S: vol, 96k, 24bit, 192k */
-       0xc3,   /* SPDUF: out-en, out-int */
-       0x00,   /* GPIO_DIR */
-       0x07,   /* GPIO_DIR1 */
-       0x00,   /* GPIO_DIR2 */
-       0xff,   /* GPIO_MASK */
-       0xf8,   /* GPIO_MASK1 */
-       0xff,   /* GPIO_MASK2 */
-       0x00,   /* GPIO_STATE */
-       0x00,   /* GPIO_STATE1 */
-       0x00,   /* GPIO_STATE2 */
+       [ICE_EEP2_SYSCONF]     = 0x4b,  /* clock 384, spdif-in/ADC, 4DACs */
+       [ICE_EEP2_ACLINK]      = 0x80,  /* I2S */
+       [ICE_EEP2_I2S]         = 0xfc,  /* vol, 96k, 24bit, 192k */
+       [ICE_EEP2_SPDIF]       = 0xc3,  /* out-en, out-int, spdif-in */
+       [ICE_EEP2_GPIO_DIR]    = 0xff,
+       [ICE_EEP2_GPIO_DIR1]   = 0xff,
+       [ICE_EEP2_GPIO_DIR2]   = 0x5f,
+       [ICE_EEP2_GPIO_MASK]   = 0x00,
+       [ICE_EEP2_GPIO_MASK1]  = 0x00,
+       [ICE_EEP2_GPIO_MASK2]  = 0x00,
+       [ICE_EEP2_GPIO_STATE]  = 0x00,
+       [ICE_EEP2_GPIO_STATE1] = 0x00,
+       [ICE_EEP2_GPIO_STATE2] = 0x00,
 };
-       
+#define prodigy71xt_eeprom prodigy71lt_eeprom
 
 /* entry point */
 struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = {
@@ -1968,7 +2205,7 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = {
                .build_controls = aureon_add_controls,
                .eeprom_size = sizeof(aureon71_eeprom),
                .eeprom_data = aureon71_eeprom,
-               .driver = "Aureon71Universe",
+               .driver = "Aureon71Univ", /* keep in 15 letters */
        },
        {
                .subvendor = VT1724_SUBDEVICE_PRODIGY71,
@@ -1990,5 +2227,15 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = {
                .eeprom_data = prodigy71lt_eeprom,
                .driver = "Prodigy71LT",
        },
+       {
+               .subvendor = VT1724_SUBDEVICE_PRODIGY71XT,
+               .name = "Audiotrak Prodigy 7.1 XT",
+               .model = "prodigy71xt",
+               .chip_init = aureon_init,
+               .build_controls = aureon_add_controls,
+               .eeprom_size = sizeof(prodigy71xt_eeprom),
+               .eeprom_data = prodigy71xt_eeprom,
+               .driver = "Prodigy71LT",
+       },
        { } /* terminator */
 };