X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fice1712%2Faureon.c;h=336dc489aee1f23ec648a7e816bc60c90674eb87;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=4405d96cbedf925d7fe9a4e928a7079694fc2e52;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 4405d96cb..336dc489a 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -22,7 +22,7 @@ * * NOTES: * - * - we reuse the akm4xxx_t record for storing the wm8770 codec data. + * - we reuse the struct snd_akm4xxx record for storing the wm8770 codec data. * both wm and akm codecs are pretty similar, so we can integrate * both controls in the future, once if wm codecs are reused in * many boards. @@ -53,6 +53,8 @@ #include #include #include +#include + #include #include "ice1712.h" @@ -85,7 +87,151 @@ #define CS8415_C_BUFFER 0x20 #define CS8415_ID 0x7F -static void aureon_ac97_write(ice1712_t *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); + ucontrol->value.integer.value[0] = ice->spec.aureon.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); + unsigned char oval, nval; + int change; + + snd_ice1712_save_gpio_status(ice); + + oval = ice->spec.aureon.pca9554_out; + nval = ucontrol->value.integer.value[0]; + if ((change = (oval != nval))) { + aureon_pca9554_write(ice, PCA9554_OUT, nval); + ice->spec.aureon.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) +{ unsigned int tmp; /* Send address to XILINX chip */ @@ -136,7 +282,7 @@ static void aureon_ac97_write(ice1712_t *ice, unsigned short reg, unsigned short ice->spec.aureon.stac9744[(reg & 0x7F) >> 1] = val; } -static unsigned short aureon_ac97_read(ice1712_t *ice, unsigned short reg) +static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg) { return ice->spec.aureon.stac9744[(reg & 0x7F) >> 1]; } @@ -144,7 +290,8 @@ static unsigned short aureon_ac97_read(ice1712_t *ice, unsigned short reg) /* * Initialize STAC9744 chip */ -static int aureon_ac97_init (ice1712_t *ice) { +static int aureon_ac97_init (struct snd_ice1712 *ice) +{ int i; static unsigned short ac97_defaults[] = { 0x00, 0x9640, @@ -196,7 +343,7 @@ static int aureon_ac97_init (ice1712_t *ice) { /* * AC'97 volume controls */ -static int aureon_ac97_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int aureon_ac97_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = kcontrol->private_value & AUREON_AC97_STEREO ? 2 : 1; @@ -205,25 +352,25 @@ static int aureon_ac97_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u return 0; } -static int aureon_ac97_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_ac97_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 vol; - down(&ice->gpio_mutex); + mutex_lock(&ice->gpio_mutex); vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F); if (kcontrol->private_value & AUREON_AC97_STEREO) ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F); - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int aureon_ac97_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_ac97_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; @@ -248,21 +395,21 @@ static int aureon_ac97_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u */ #define aureon_ac97_mute_info aureon_mono_bool_info -static int aureon_ac97_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_ac97_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] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int aureon_ac97_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int aureon_ac97_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 ovol, nvol; int change; @@ -284,21 +431,21 @@ static int aureon_ac97_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t */ #define aureon_ac97_micboost_info aureon_mono_bool_info -static int aureon_ac97_micboost_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_ac97_micboost_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] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1; - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int aureon_ac97_micboost_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int aureon_ac97_micboost_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; @@ -318,40 +465,52 @@ static int aureon_ac97_micboost_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu /* * write data in the SPI mode */ -static void aureon_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits) +static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits) { unsigned int tmp; int i; + unsigned int mosi, clk; tmp = snd_ice1712_gpio_read(ice); - snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK| - AUREON_WM_CS|AUREON_CS8415_CS)); - tmp |= AUREON_WM_RW; + if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT) { + snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS)); + mosi = PRODIGY_SPI_MOSI; + clk = PRODIGY_SPI_CLK; + } + else { + snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK| + AUREON_WM_CS|AUREON_CS8415_CS)); + mosi = AUREON_SPI_MOSI; + clk = AUREON_SPI_CLK; + + tmp |= AUREON_WM_RW; + } + tmp &= ~cs; snd_ice1712_gpio_write(ice, tmp); udelay(1); for (i = bits - 1; i >= 0; i--) { - tmp &= ~AUREON_SPI_CLK; + tmp &= ~clk; snd_ice1712_gpio_write(ice, tmp); udelay(1); if (data & (1 << i)) - tmp |= AUREON_SPI_MOSI; + tmp |= mosi; else - tmp &= ~AUREON_SPI_MOSI; + tmp &= ~mosi; snd_ice1712_gpio_write(ice, tmp); udelay(1); - tmp |= AUREON_SPI_CLK; + tmp |= clk; snd_ice1712_gpio_write(ice, tmp); udelay(1); } - tmp &= ~AUREON_SPI_CLK; + tmp &= ~clk; tmp |= cs; snd_ice1712_gpio_write(ice, tmp); udelay(1); - tmp |= AUREON_SPI_CLK; + tmp |= clk; snd_ice1712_gpio_write(ice, tmp); udelay(1); } @@ -359,7 +518,7 @@ static void aureon_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, /* * Read data in SPI mode */ -static void aureon_spi_read(ice1712_t *ice, unsigned int cs, unsigned int data, int bits, unsigned char *buffer, int size) { +static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits, unsigned char *buffer, int size) { int i, j; unsigned int tmp; @@ -409,26 +568,26 @@ static void aureon_spi_read(ice1712_t *ice, unsigned int cs, unsigned int data, snd_ice1712_gpio_write(ice, tmp); } -static unsigned char aureon_cs8415_get(ice1712_t *ice, int reg) { +static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg) { unsigned char val; aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1); return val; } -static void aureon_cs8415_read(ice1712_t *ice, int reg, unsigned char *buffer, int size) { +static void aureon_cs8415_read(struct snd_ice1712 *ice, int reg, unsigned char *buffer, int size) { aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size); } -static void aureon_cs8415_put(ice1712_t *ice, int reg, unsigned char val) { +static void aureon_cs8415_put(struct snd_ice1712 *ice, int reg, unsigned char val) { aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24); } /* * 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) | @@ -438,15 +597,17 @@ 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) { - aureon_spi_write(ice, AUREON_WM_CS, (reg << 9) | (val & 0x1ff), 16); + aureon_spi_write(ice, + (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ? PRODIGY_WM_CS : AUREON_WM_CS), + (reg << 9) | (val & 0x1ff), 16); } /* * 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; @@ -456,7 +617,7 @@ static void wm_put(ice1712_t *ice, int reg, unsigned short val) /* */ -static int aureon_mono_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo) +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; @@ -470,20 +631,20 @@ static int aureon_mono_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo) */ #define aureon_ac97_mmute_info aureon_mono_bool_info -static int aureon_ac97_mmute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_ac97_mmute_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_OUT_MUX1) >> 1) & 0x01; - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int aureon_ac97_mmute_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { - ice1712_t *ice = snd_kcontrol_chip(kcontrol); +static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); unsigned short ovol, nvol; int change; @@ -521,7 +682,7 @@ static unsigned char wm_vol[256] = { #define WM_VOL_MAX (sizeof(wm_vol) - 1) #define WM_VOL_MUTE 0x8000 -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; @@ -539,19 +700,19 @@ static void wm_set_vol(ice1712_t *ice, unsigned int index, unsigned short vol, u */ #define wm_pcm_mute_info aureon_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; @@ -568,7 +729,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; @@ -577,18 +738,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.aureon.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); @@ -611,7 +772,7 @@ static int wm_master_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco /* * 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; @@ -621,9 +782,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; @@ -633,9 +794,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; @@ -659,7 +820,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; @@ -667,9 +828,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; @@ -680,9 +841,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; @@ -708,7 +869,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; @@ -716,18 +877,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.aureon.master[0] & WM_VOL_MUTE) ? 0 : 1; ucontrol->value.integer.value[1] = (ice->spec.aureon.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); @@ -754,7 +915,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; @@ -763,22 +924,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; @@ -798,7 +959,7 @@ static int wm_pcm_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr /* * ADC mute control */ -static int wm_adc_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +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; @@ -807,24 +968,24 @@ static int wm_adc_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo return 0; } -static int wm_adc_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int wm_adc_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); unsigned short val; int i; - down(&ice->gpio_mutex); + mutex_lock(&ice->gpio_mutex); for (i = 0; i < 2; i++) { val = wm_get(ice, WM_ADC_GAIN + i); ucontrol->value.integer.value[i] = ~val>>5 & 0x1; } - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int wm_adc_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int wm_adc_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 new, old; int i, change = 0; @@ -845,7 +1006,7 @@ static int wm_adc_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * uco /* * ADC gain mixer control */ -static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int wm_adc_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -854,25 +1015,25 @@ static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) return 0; } -static int wm_adc_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int wm_adc_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, idx; unsigned short vol; - down(&ice->gpio_mutex); + mutex_lock(&ice->gpio_mutex); for (i = 0; i < 2; i++) { idx = WM_ADC_GAIN + i; vol = wm_get(ice, idx) & 0x1f; ucontrol->value.integer.value[i] = vol; } - up(&ice->gpio_mutex); + mutex_unlock(&ice->gpio_mutex); return 0; } -static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int wm_adc_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; unsigned short ovol, nvol; int change = 0; @@ -894,7 +1055,7 @@ static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr /* * ADC input mux mixer control */ -static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[] = { "CD", //AIN1 @@ -913,7 +1074,7 @@ static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) "Aux3", //AIN7 "AC97" //AIN8 }; - ice1712_t *ice = snd_kcontrol_chip(kcontrol); + struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 2; @@ -932,43 +1093,43 @@ static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) return 0; } -static int wm_adc_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int wm_adc_mux_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_ADC_MUX); - ucontrol->value.integer.value[0] = val & 7; - ucontrol->value.integer.value[1] = (val >> 4) & 7; - up(&ice->gpio_mutex); + ucontrol->value.enumerated.item[0] = val & 7; + ucontrol->value.enumerated.item[1] = (val >> 4) & 7; + mutex_unlock(&ice->gpio_mutex); return 0; } -static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int wm_adc_mux_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 oval, nval; int change; snd_ice1712_save_gpio_status(ice); oval = wm_get(ice, WM_ADC_MUX); nval = oval & ~0x77; - nval |= ucontrol->value.integer.value[0] & 7; - nval |= (ucontrol->value.integer.value[1] & 7) << 4; + nval |= ucontrol->value.enumerated.item[0] & 7; + nval |= (ucontrol->value.enumerated.item[1] & 7) << 4; change = (oval != nval); if (change) wm_put(ice, WM_ADC_MUX, nval); snd_ice1712_restore_gpio_status(ice); - return 0; + return change; } /* * CS8415 Input mux */ -static int aureon_cs8415_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - ice1712_t *ice = snd_kcontrol_chip(kcontrol); + struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); static char *aureon_texts[] = { "CD", //RXP0 "Optical" //RXP1 @@ -989,36 +1150,36 @@ static int aureon_cs8415_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int aureon_cs8415_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_cs8415_mux_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); //snd_ice1712_save_gpio_status(ice); //val = aureon_cs8415_get(ice, CS8415_CTRL2); - ucontrol->value.integer.value[0] = ice->spec.aureon.cs8415_mux; + ucontrol->value.enumerated.item[0] = ice->spec.aureon.cs8415_mux; //snd_ice1712_restore_gpio_status(ice); return 0; } -static int aureon_cs8415_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_cs8415_mux_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 oval, nval; int change; snd_ice1712_save_gpio_status(ice); oval = aureon_cs8415_get(ice, CS8415_CTRL2); nval = oval & ~0x07; - nval |= ucontrol->value.integer.value[0] & 7; + nval |= ucontrol->value.enumerated.item[0] & 7; change = (oval != nval); if (change) aureon_cs8415_put(ice, CS8415_CTRL2, nval); snd_ice1712_restore_gpio_status(ice); - ice->spec.aureon.cs8415_mux = ucontrol->value.integer.value[0]; + ice->spec.aureon.cs8415_mux = ucontrol->value.enumerated.item[0]; return change; } -static int aureon_cs8415_rate_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -1027,9 +1188,9 @@ static int aureon_cs8415_rate_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_ return 0; } -static int aureon_cs8415_rate_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_cs8415_rate_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 char ratio; ratio = aureon_cs8415_get(ice, CS8415_RATIO); ucontrol->value.integer.value[0] = (int)((unsigned int)ratio * 750); @@ -1039,25 +1200,25 @@ static int aureon_cs8415_rate_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ /* * CS8415A Mute */ -static int aureon_cs8415_mute_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +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; } -static int aureon_cs8415_mute_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_cs8415_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); snd_ice1712_save_gpio_status(ice); ucontrol->value.integer.value[0] = (aureon_cs8415_get(ice, CS8415_CTRL1) & 0x20) ? 0 : 1; snd_ice1712_restore_gpio_status(ice); return 0; } -static int aureon_cs8415_mute_put (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_cs8415_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 char oval, nval; int change; snd_ice1712_save_gpio_status(ice); @@ -1075,14 +1236,14 @@ static int aureon_cs8415_mute_put (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ /* * CS8415A Q-Sub info */ -static int aureon_cs8415_qsub_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { +static int aureon_cs8415_qsub_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; uinfo->count = 10; return 0; } -static int aureon_cs8415_qsub_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { - ice1712_t *ice = snd_kcontrol_chip(kcontrol); +static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); snd_ice1712_save_gpio_status(ice); aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10); @@ -1091,19 +1252,19 @@ static int aureon_cs8415_qsub_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ return 0; } -static int aureon_cs8415_spdif_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) { +static int aureon_cs8415_spdif_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->count = 1; return 0; } -static int aureon_cs8415_mask_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { +static int aureon_cs8415_mask_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { memset(ucontrol->value.iec958.status, 0xFF, 24); return 0; } -static int aureon_cs8415_spdif_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { - ice1712_t *ice = snd_kcontrol_chip(kcontrol); +static int aureon_cs8415_spdif_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); snd_ice1712_save_gpio_status(ice); aureon_cs8415_read(ice, CS8415_C_BUFFER, ucontrol->value.iec958.status, 24); @@ -1114,7 +1275,7 @@ static int aureon_cs8415_spdif_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value /* * Headphone Amplifier */ -static int aureon_set_headphone_amp(ice1712_t *ice, int enable) +static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable) { unsigned int tmp, tmp2; @@ -1130,7 +1291,7 @@ static int aureon_set_headphone_amp(ice1712_t *ice, int enable) return 0; } -static int aureon_get_headphone_amp(ice1712_t *ice) +static int aureon_get_headphone_amp(struct snd_ice1712 *ice) { unsigned int tmp = snd_ice1712_gpio_read(ice); @@ -1139,18 +1300,18 @@ static int aureon_get_headphone_amp(ice1712_t *ice) #define aureon_hpamp_info aureon_mono_bool_info -static int aureon_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_hpamp_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] = aureon_get_headphone_amp(ice); return 0; } -static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_hpamp_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); return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]); } @@ -1161,16 +1322,16 @@ static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon #define aureon_deemp_info aureon_mono_bool_info -static int aureon_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_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 aureon_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_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]) @@ -1187,7 +1348,7 @@ static int aureon_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon /* * ADC Oversampling */ -static int aureon_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo) +static int aureon_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo) { static char *texts[2] = { "128x", "64x" }; @@ -1202,17 +1363,17 @@ static int aureon_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinf return 0; } -static int aureon_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_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 aureon_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int aureon_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); @@ -1232,7 +1393,7 @@ static int aureon_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ * mixers */ -static snd_kcontrol_new_t aureon_dac_controls[] __devinitdata = { +static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Switch", @@ -1329,7 +1490,7 @@ static snd_kcontrol_new_t aureon_dac_controls[] __devinitdata = { } }; -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", @@ -1389,7 +1550,7 @@ static snd_kcontrol_new_t wm_controls[] __devinitdata = { } }; -static snd_kcontrol_new_t ac97_controls[] __devinitdata = { +static struct snd_kcontrol_new ac97_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "AC97 Playback Switch", @@ -1479,7 +1640,7 @@ static snd_kcontrol_new_t ac97_controls[] __devinitdata = { } }; -static snd_kcontrol_new_t universe_ac97_controls[] __devinitdata = { +static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "AC97 Playback Switch", @@ -1582,11 +1743,19 @@ static snd_kcontrol_new_t universe_ac97_controls[] __devinitdata = { .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_VIDEO|AUREON_AC97_STEREO - } + }, + { + .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 snd_kcontrol_new_t cs8415_controls[] __devinitdata = { +static struct snd_kcontrol_new cs8415_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), @@ -1632,7 +1801,7 @@ static snd_kcontrol_new_t cs8415_controls[] __devinitdata = { }; -static int __devinit aureon_add_controls(ice1712_t *ice) +static int __devinit aureon_add_controls(struct snd_ice1712 *ice) { unsigned int i, counts; int err; @@ -1659,7 +1828,7 @@ static int __devinit aureon_add_controls(ice1712_t *ice) return err; } } - else { + else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) { 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) @@ -1667,17 +1836,17 @@ static int __devinit aureon_add_controls(ice1712_t *ice) } } - { + if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) { unsigned char id; snd_ice1712_save_gpio_status(ice); id = aureon_cs8415_get(ice, CS8415_ID); if (id != 0x41) - snd_printk("No CS8415 chip. Skipping CS8415 controls.\n"); + snd_printk(KERN_INFO "No CS8415 chip. Skipping CS8415 controls.\n"); else if ((id & 0x0F) != 0x01) - snd_printk("Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); + snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); else { for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { - snd_kcontrol_t *kctl; + struct snd_kcontrol *kctl; err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice))); if (err < 0) return err; @@ -1695,7 +1864,7 @@ static int __devinit aureon_add_controls(ice1712_t *ice) /* * initialize the chip */ -static int __devinit aureon_init(ice1712_t *ice) +static int __devinit aureon_init(struct snd_ice1712 *ice) { static unsigned short wm_inits_aureon[] = { /* These come first to reduce init pop noise */ @@ -1796,7 +1965,7 @@ static int __devinit aureon_init(ice1712_t *ice) } /* to remeber the register values of CS8415 */ - ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); + ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); if (! ice->akm) return -ENOMEM; ice->akm_codecs = 1; @@ -1822,7 +1991,8 @@ static int __devinit aureon_init(ice1712_t *ice) udelay(1); /* initialize WM8770 codec */ - if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71) + if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 || + ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT) p = wm_inits_prodigy; else p = wm_inits_aureon; @@ -1830,13 +2000,19 @@ static int __devinit aureon_init(ice1712_t *ice) wm_put(ice, p[0], p[1]); /* initialize CS8415A codec */ - 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; + if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) { + 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; - aureon_set_headphone_amp(ice, 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; @@ -1902,6 +2078,23 @@ static unsigned char prodigy71_eeprom[] __devinitdata = { 0x00, /* GPIO_STATE2 */ }; +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 */ +}; + + /* entry point */ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { { @@ -1944,5 +2137,15 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { .eeprom_data = prodigy71_eeprom, .driver = "Prodigy71", /* should be identical with Aureon71 */ }, + { + .subvendor = VT1724_SUBDEVICE_PRODIGY71LT, + .name = "Audiotrak Prodigy 7.1 LT", + .model = "prodigy71lt", + .chip_init = aureon_init, + .build_controls = aureon_add_controls, + .eeprom_size = sizeof(prodigy71lt_eeprom), + .eeprom_data = prodigy71lt_eeprom, + .driver = "Prodigy71LT", + }, { } /* terminator */ };