]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/ice1712/phase.c
[ALSA] ice1712 - Reorganize existing eeprom data
[linux-2.6-omap-h63xx.git] / sound / pci / ice1712 / phase.c
index dcf1e8ca3f6601f8ae63e2ec0036ab2f5484d27f..c7f6615d60d25a581165d9aef1a751d07923825e 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/mutex.h>
+
 #include <sound/core.h>
 
 #include "ice1712.h"
 #include "envy24ht.h"
 #include "phase.h"
+#include <sound/tlv.h>
 
 /* WM8770 registers */
 #define WM_DAC_ATTEN           0x00    /* DAC1-8 analog attenuation */
@@ -86,7 +89,7 @@ static unsigned char wm_vol[256] = {
 #define WM_VOL_MAX     (sizeof(wm_vol) - 1)
 #define WM_VOL_MUTE    0x8000
 
-static akm4xxx_t akm_phase22 __devinitdata = {
+static struct snd_akm4xxx akm_phase22 __devinitdata = {
        .type = SND_AK4524,
        .num_dacs = 2,
        .num_adcs = 2,
@@ -104,9 +107,9 @@ static struct snd_ak4xxx_private akm_phase22_priv __devinitdata = {
        .mask_flags =   0,
 };
 
-static int __devinit phase22_init(ice1712_t *ice)
+static int __devinit phase22_init(struct snd_ice1712 *ice)
 {
-       akm4xxx_t *ak;
+       struct snd_akm4xxx *ak;
        int err;
 
        // Configure DAC/ADC description for generic part of ice1724
@@ -122,7 +125,7 @@ static int __devinit phase22_init(ice1712_t *ice)
        }
 
        // Initialize analog chips
-       ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
        if (! ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
@@ -136,7 +139,7 @@ static int __devinit phase22_init(ice1712_t *ice)
        return 0;
 }
 
-static int __devinit phase22_add_controls(ice1712_t *ice)
+static int __devinit phase22_add_controls(struct snd_ice1712 *ice)
 {
        int err = 0;
 
@@ -150,41 +153,41 @@ static int __devinit phase22_add_controls(ice1712_t *ice)
 }
 
 static unsigned char phase22_eeprom[] __devinitdata = {
-       0x00,   /* SYSCONF: 1xADC, 1xDACs */
-       0x80,   /* ACLINK: I2S */
-       0xf8,   /* I2S: vol, 96k, 24bit*/
-       0xc3,   /* SPDIF: out-en, out-int, spdif-in */
-       0xFF,   /* GPIO_DIR */
-       0xFF,   /* GPIO_DIR1 */
-       0xFF,   /* GPIO_DIR2 */
-       0x00,   /* GPIO_MASK */
-       0x00,   /* GPIO_MASK1 */
-       0x00,   /* GPIO_MASK2 */
-       0x00,   /* GPIO_STATE: */
-       0x00,   /* GPIO_STATE1: */
-       0x00,   /* GPIO_STATE2 */
+       [ICE_EEP2_SYSCONF]     = 0x00,  /* 1xADC, 1xDACs */
+       [ICE_EEP2_ACLINK]      = 0x80,  /* I2S */
+       [ICE_EEP2_I2S]         = 0xf8,  /* vol, 96k, 24bit */
+       [ICE_EEP2_SPDIF]       = 0xc3,  /* out-en, out-int, spdif-in */
+       [ICE_EEP2_GPIO_DIR]    = 0xff,
+       [ICE_EEP2_GPIO_DIR1]   = 0xff,
+       [ICE_EEP2_GPIO_DIR2]   = 0xff,
+       [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 phase28_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,
 };
 
 /*
  * write data in the SPI mode
  */
-static void phase28_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits)
+static void phase28_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits)
 {
        unsigned int tmp;
        int i;
@@ -225,7 +228,7 @@ static void phase28_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data
 /*
  * get the current register value of WM codec
  */
-static unsigned short wm_get(ice1712_t *ice, int reg)
+static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
 {
        reg <<= 1;
        return ((unsigned short)ice->akm[0].images[reg] << 8) |
@@ -235,7 +238,7 @@ static unsigned short wm_get(ice1712_t *ice, int reg)
 /*
  * set the register value of WM codec
  */
-static void wm_put_nocache(ice1712_t *ice, int reg, unsigned short val)
+static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
 {
        phase28_spi_write(ice, PHASE28_WM_CS, (reg << 9) | (val & 0x1ff), 16);
 }
@@ -243,7 +246,7 @@ static void wm_put_nocache(ice1712_t *ice, int reg, unsigned short val)
 /*
  * set the register value of WM codec and remember it
  */
-static void wm_put(ice1712_t *ice, int reg, unsigned short val)
+static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
 {
        wm_put_nocache(ice, reg, val);
        reg <<= 1;
@@ -251,7 +254,7 @@ static void wm_put(ice1712_t *ice, int reg, unsigned short val)
        ice->akm[0].images[reg + 1] = val;
 }
 
-static void wm_set_vol(ice1712_t *ice, unsigned int index, unsigned short vol, unsigned short master)
+static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master)
 {
        unsigned char nvol;
 
@@ -269,19 +272,19 @@ static void wm_set_vol(ice1712_t *ice, unsigned int index, unsigned short vol, u
  */
 #define wm_pcm_mute_info       phase28_mono_bool_info
 
-static int wm_pcm_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
 
-       down(&ice->gpio_mutex);
+       mutex_lock(&ice->gpio_mutex);
        ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
-       up(&ice->gpio_mutex);
+       mutex_unlock(&ice->gpio_mutex);
        return 0;
 }
 
-static int wm_pcm_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned short nval, oval;
        int change;
 
@@ -298,7 +301,7 @@ static int wm_pcm_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * uco
 /*
  * Master volume attenuation mixer control
  */
-static int wm_master_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 2;
@@ -307,18 +310,18 @@ static int wm_master_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin
        return 0;
 }
 
-static int wm_master_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int i;
        for (i=0; i<2; i++)
                ucontrol->value.integer.value[i] = ice->spec.phase28.master[i] & ~WM_VOL_MUTE;
        return 0;
 }
 
-static int wm_master_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int ch, change = 0;
 
        snd_ice1712_save_gpio_status(ice);
@@ -338,7 +341,7 @@ static int wm_master_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco
        return change;
 }
 
-static int __devinit phase28_init(ice1712_t *ice)
+static int __devinit phase28_init(struct snd_ice1712 *ice)
 {
        static unsigned short wm_inits_phase28[] = {
                /* These come first to reduce init pop noise */
@@ -378,7 +381,7 @@ static int __devinit phase28_init(ice1712_t *ice)
        };
 
        unsigned int tmp;
-       akm4xxx_t *ak;
+       struct snd_akm4xxx *ak;
        unsigned short *p;
        int i;
 
@@ -386,7 +389,7 @@ static int __devinit phase28_init(ice1712_t *ice)
        ice->num_total_adcs = 2;
 
        // Initialize analog chips
-       ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
        if (!ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
@@ -427,7 +430,7 @@ static int __devinit phase28_init(ice1712_t *ice)
 /*
  * DAC volume attenuation mixer control
  */
-static int wm_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        int voices = kcontrol->private_value >> 8;
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
@@ -437,9 +440,9 @@ static int wm_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
        return 0;
 }
 
-static int wm_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int i, ofs, voices;
 
        voices = kcontrol->private_value >> 8;
@@ -449,9 +452,9 @@ static int wm_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
        return 0;
 }
 
-static int wm_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int i, idx, ofs, voices;
        int change = 0;
 
@@ -475,7 +478,7 @@ static int wm_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
 /*
  * WM8770 mute control
  */
-static int wm_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) {
+static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = kcontrol->private_value >> 8;
        uinfo->value.integer.min = 0;
@@ -483,9 +486,9 @@ static int wm_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) {
        return 0;
 }
 
-static int wm_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int voices, ofs, i;
 
        voices = kcontrol->private_value >> 8;
@@ -496,9 +499,9 @@ static int wm_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
        return 0;
 }
 
-static int wm_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int change = 0, voices, ofs, i;
 
        voices = kcontrol->private_value >> 8;
@@ -524,7 +527,7 @@ static int wm_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontro
 /*
  * WM8770 master mute control
  */
-static int wm_master_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) {
+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;
@@ -532,18 +535,18 @@ static int wm_master_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui
        return 0;
 }
 
-static int wm_master_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
 
        ucontrol->value.integer.value[0] = (ice->spec.phase28.master[0] & WM_VOL_MUTE) ? 0 : 1;
        ucontrol->value.integer.value[1] = (ice->spec.phase28.master[1] & WM_VOL_MUTE) ? 0 : 1;
        return 0;
 }
 
-static int wm_master_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int change = 0, i;
 
        snd_ice1712_save_gpio_status(ice);
@@ -570,7 +573,7 @@ static int wm_master_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *
 #define PCM_0dB 0xff
 #define PCM_RES 128    /* -64dB */
 #define PCM_MIN (PCM_0dB - PCM_RES)
-static int wm_pcm_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 1;
@@ -579,22 +582,22 @@ static int wm_pcm_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
        return 0;
 }
 
-static int wm_pcm_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned short val;
 
-       down(&ice->gpio_mutex);
+       mutex_lock(&ice->gpio_mutex);
        val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
        val = val > PCM_MIN ? (val - PCM_MIN) : 0;
        ucontrol->value.integer.value[0] = val;
-       up(&ice->gpio_mutex);
+       mutex_unlock(&ice->gpio_mutex);
        return 0;
 }
 
-static int wm_pcm_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned short ovol, nvol;
        int change = 0;
 
@@ -613,7 +616,7 @@ static int wm_pcm_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
 
 /*
  */
-static int phase28_mono_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
+static int phase28_mono_bool_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -627,16 +630,16 @@ static int phase28_mono_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
  */
 #define phase28_deemp_info     phase28_mono_bool_info
 
-static int phase28_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int phase28_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
        return 0;
 }
 
-static int phase28_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int phase28_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int temp, temp2;
        temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
        if (ucontrol->value.integer.value[0])
@@ -653,7 +656,7 @@ static int phase28_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco
 /*
  * ADC Oversampling
  */
-static int phase28_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
+static int phase28_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[2] = { "128x", "64x" };
 
@@ -668,17 +671,17 @@ static int phase28_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uin
         return 0;
 }
 
-static int phase28_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int phase28_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
        return 0;
 }
 
-static int phase28_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        int temp, temp2;
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
 
        temp2 = temp = wm_get(ice, WM_MASTER);
 
@@ -694,7 +697,10 @@ static int phase28_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value
        return 0;
 }
 
-static snd_kcontrol_new_t phase28_dac_controls[] __devinitdata = {
+static DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
+static DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
+
+static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "Master Playback Switch",
@@ -704,10 +710,13 @@ static snd_kcontrol_new_t phase28_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,
@@ -719,11 +728,14 @@ static snd_kcontrol_new_t phase28_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,
@@ -735,11 +747,14 @@ static snd_kcontrol_new_t phase28_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,
@@ -751,11 +766,14 @@ static snd_kcontrol_new_t phase28_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,
@@ -767,11 +785,14 @@ static snd_kcontrol_new_t phase28_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,
@@ -783,15 +804,18 @@ static snd_kcontrol_new_t phase28_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 }
        }
 };
 
-static snd_kcontrol_new_t wm_controls[] __devinitdata = {
+static struct snd_kcontrol_new wm_controls[] __devinitdata = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "PCM Playback Switch",
@@ -801,10 +825,13 @@ static snd_kcontrol_new_t 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,
@@ -822,7 +849,7 @@ static snd_kcontrol_new_t wm_controls[] __devinitdata = {
        }
 };
 
-static int __devinit phase28_add_controls(ice1712_t *ice)
+static int __devinit phase28_add_controls(struct snd_ice1712 *ice)
 {
        unsigned int i, counts;
        int err;