Commit 1ce211a9 authored by Alexander Beregalov's avatar Alexander Beregalov Committed by Jaroslav Kysela

ALSA: ice1712/aureon.c: fix coding style

before:
total: 304 errors, 137 warnings, 2259 lines checked

after:
total: 0 errors, 121 warnings, 2284 lines checked

Compile tested, size is different because of include was changed,
but without that change md5sum is different because of cmp cx,dx/cmp
dx,cx swap and __LINE__ was changed in printk function.
Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 59fcbb63
...@@ -44,10 +44,9 @@ ...@@ -44,10 +44,9 @@
* not working: prety much everything else, at least i could verify that * not working: prety much everything else, at least i could verify that
* we have no digital output, no capture, pretty bad clicks and poops * we have no digital output, no capture, pretty bad clicks and poops
* on mixer switch and other coll stuff. * on mixer switch and other coll stuff.
*
*/ */
#include <asm/io.h> #include <linux/io.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -152,10 +151,16 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg, ...@@ -152,10 +151,16 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
* skipping ack cycles inbetween * skipping ack cycles inbetween
*/ */
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
switch(j) { switch (j) {
case 0: val = dev; break; case 0:
case 1: val = reg; break; val = dev;
case 2: val = data; break; break;
case 1:
val = reg;
break;
case 2:
val = data;
break;
} }
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
tmp &= ~AUREON_SPI_CLK; tmp &= ~AUREON_SPI_CLK;
...@@ -203,7 +208,7 @@ static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol, ...@@ -203,7 +208,7 @@ static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1; uinfo->count = 1;
uinfo->value.enumerated.items = 3; uinfo->value.enumerated.items = 3;
if(uinfo->value.enumerated.item >= uinfo->value.enumerated.items) if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0; return 0;
...@@ -231,12 +236,12 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol, ...@@ -231,12 +236,12 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol,
return -EINVAL; return -EINVAL;
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
oval = spec->pca9554_out; oval = spec->pca9554_out;
if ((change = (oval != nval))) { change = (oval != nval);
if (change) {
aureon_pca9554_write(ice, PCA9554_OUT, nval); aureon_pca9554_write(ice, PCA9554_OUT, nval);
spec->pca9554_out = nval; spec->pca9554_out = nval;
} }
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
return change; return change;
} }
...@@ -304,7 +309,7 @@ static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short r ...@@ -304,7 +309,7 @@ static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short r
/* /*
* Initialize STAC9744 chip * 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; struct aureon_spec *spec = ice->spec;
int i; int i;
...@@ -345,10 +350,11 @@ static int aureon_ac97_init (struct snd_ice1712 *ice) ...@@ -345,10 +350,11 @@ static int aureon_ac97_init (struct snd_ice1712 *ice)
udelay(3); udelay(3);
memset(&spec->stac9744, 0, sizeof(spec->stac9744)); memset(&spec->stac9744, 0, sizeof(spec->stac9744));
for (i=0; ac97_defaults[i] != (unsigned short)-1; i+=2) for (i = 0; ac97_defaults[i] != (unsigned short)-1; i += 2)
spec->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 /* Unmute AC'97 master volume permanently - muting is done by WM8770 */
aureon_ac97_write(ice, AC97_MASTER, 0x0000);
return 0; return 0;
} }
...@@ -397,7 +403,8 @@ static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele ...@@ -397,7 +403,8 @@ static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
nvol |= ((0x1F - ucontrol->value.integer.value[1]) << 8) & 0x1F00; nvol |= ((0x1F - ucontrol->value.integer.value[1]) << 8) & 0x1F00;
nvol |= ovol & ~0x1F1F; nvol |= ovol & ~0x1F1F;
if ((change = (ovol != nvol))) change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
...@@ -416,7 +423,8 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el ...@@ -416,7 +423,8 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el
mutex_lock(&ice->gpio_mutex); mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; ucontrol->value.integer.value[0] = aureon_ac97_read(ice,
kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1;
mutex_unlock(&ice->gpio_mutex); mutex_unlock(&ice->gpio_mutex);
return 0; return 0;
...@@ -431,9 +439,10 @@ static int aureon_ac97_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el ...@@ -431,9 +439,10 @@ static int aureon_ac97_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x8000) | (ovol & ~ 0x8000); nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x8000) | (ovol & ~0x8000);
if ((change = (ovol != nvol))) change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
...@@ -469,7 +478,8 @@ static int aureon_ac97_micboost_put(struct snd_kcontrol *kcontrol, struct snd_ct ...@@ -469,7 +478,8 @@ static int aureon_ac97_micboost_put(struct snd_kcontrol *kcontrol, struct snd_ct
ovol = aureon_ac97_read(ice, AC97_MIC); ovol = aureon_ac97_read(ice, AC97_MIC);
nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x0020) | (ovol & ~0x0020); nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x0020) | (ovol & ~0x0020);
if ((change = (ovol != nvol))) change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, AC97_MIC, nvol); aureon_ac97_write(ice, AC97_MIC, nvol);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
...@@ -493,8 +503,7 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned ...@@ -493,8 +503,7 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned
snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS)); snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS));
mosi = PRODIGY_SPI_MOSI; mosi = PRODIGY_SPI_MOSI;
clk = PRODIGY_SPI_CLK; clk = PRODIGY_SPI_CLK;
} } else {
else {
snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK| snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK|
AUREON_WM_CS|AUREON_CS8415_CS)); AUREON_WM_CS|AUREON_CS8415_CS));
mosi = AUREON_SPI_MOSI; mosi = AUREON_SPI_MOSI;
...@@ -534,7 +543,9 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned ...@@ -534,7 +543,9 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned
/* /*
* Read data in SPI mode * Read data in SPI mode
*/ */
static void aureon_spi_read(struct snd_ice1712 *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; int i, j;
unsigned int tmp; unsigned int tmp;
...@@ -544,7 +555,7 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i ...@@ -544,7 +555,7 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i
snd_ice1712_gpio_write(ice, tmp); snd_ice1712_gpio_write(ice, tmp);
udelay(1); udelay(1);
for (i=bits-1; i>=0; i--) { for (i = bits-1; i >= 0; i--) {
if (data & (1 << i)) if (data & (1 << i))
tmp |= AUREON_SPI_MOSI; tmp |= AUREON_SPI_MOSI;
else else
...@@ -561,9 +572,9 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i ...@@ -561,9 +572,9 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i
udelay(1); udelay(1);
} }
for (j=0; j<size; j++) { for (j = 0; j < size; j++) {
unsigned char outdata = 0; unsigned char outdata = 0;
for (i=7; i>=0; i--) { for (i = 7; i >= 0; i--) {
tmp = snd_ice1712_gpio_read(ice); tmp = snd_ice1712_gpio_read(ice);
outdata <<= 1; outdata <<= 1;
outdata |= (tmp & AUREON_SPI_MISO) ? 1 : 0; outdata |= (tmp & AUREON_SPI_MISO) ? 1 : 0;
...@@ -584,19 +595,24 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i ...@@ -584,19 +595,24 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i
snd_ice1712_gpio_write(ice, tmp); snd_ice1712_gpio_write(ice, tmp);
} }
static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg) { static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg)
{
unsigned char val; unsigned char val;
aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1); aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1);
return val; return val;
} }
static void aureon_cs8415_read(struct snd_ice1712 *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_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size); aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size);
} }
static void aureon_cs8415_put(struct snd_ice1712 *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); aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24);
} }
...@@ -654,7 +670,8 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -654,7 +670,8 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
return 0; return 0;
} }
static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol; unsigned short ovol, nvol;
int change; int change;
...@@ -663,7 +680,8 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -663,7 +680,8 @@ static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
ovol = wm_get(ice, WM_OUT_MUX1); ovol = wm_get(ice, WM_OUT_MUX1);
nvol = (ovol & ~0x02) | (ucontrol->value.integer.value[0] ? 0x02 : 0x00); nvol = (ovol & ~0x02) | (ucontrol->value.integer.value[0] ? 0x02 : 0x00);
if ((change = (ovol != nvol))) change = (ovol != nvol);
if (change)
wm_put(ice, WM_OUT_MUX1, nvol); wm_put(ice, WM_OUT_MUX1, nvol);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
...@@ -736,7 +754,8 @@ static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va ...@@ -736,7 +754,8 @@ static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
oval = wm_get(ice, WM_MUTE); oval = wm_get(ice, WM_MUTE);
nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10); nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10);
if ((change = (nval != oval))) change = (oval != nval);
if (change)
wm_put(ice, WM_MUTE, nval); wm_put(ice, WM_MUTE, nval);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
...@@ -760,7 +779,7 @@ static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ ...@@ -760,7 +779,7 @@ static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec; struct aureon_spec *spec = ice->spec;
int i; int i;
for (i=0; i<2; i++) for (i = 0; i < 2; i++)
ucontrol->value.integer.value[i] = ucontrol->value.integer.value[i] =
spec->master[i] & ~WM_VOL_MUTE; spec->master[i] & ~WM_VOL_MUTE;
return 0; return 0;
...@@ -849,7 +868,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * ...@@ -849,7 +868,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
/* /*
* WM8770 mute control * WM8770 mute control
*/ */
static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = kcontrol->private_value >> 8; uinfo->count = kcontrol->private_value >> 8;
uinfo->value.integer.min = 0; uinfo->value.integer.min = 0;
...@@ -1083,21 +1103,21 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val ...@@ -1083,21 +1103,21 @@ 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 int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
static const char * const texts[] = { static const char * const texts[] = {
"CD", //AIN1 "CD", /* AIN1 */
"Aux", //AIN2 "Aux", /* AIN2 */
"Line", //AIN3 "Line", /* AIN3 */
"Mic", //AIN4 "Mic", /* AIN4 */
"AC97" //AIN5 "AC97" /* AIN5 */
}; };
static const char * const universe_texts[] = { static const char * const universe_texts[] = {
"Aux1", //AIN1 "Aux1", /* AIN1 */
"CD", //AIN2 "CD", /* AIN2 */
"Phono", //AIN3 "Phono", /* AIN3 */
"Line", //AIN4 "Line", /* AIN4 */
"Aux2", //AIN5 "Aux2", /* AIN5 */
"Mic", //AIN6 "Mic", /* AIN6 */
"Aux3", //AIN7 "Aux3", /* AIN7 */
"AC97" //AIN8 "AC97" /* AIN8 */
}; };
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
...@@ -1108,8 +1128,7 @@ static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in ...@@ -1108,8 +1128,7 @@ static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
strcpy(uinfo->value.enumerated.name, universe_texts[uinfo->value.enumerated.item]); strcpy(uinfo->value.enumerated.name, universe_texts[uinfo->value.enumerated.item]);
} } else {
else {
uinfo->value.enumerated.items = 5; uinfo->value.enumerated.items = 5;
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
...@@ -1156,8 +1175,8 @@ static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ ...@@ -1156,8 +1175,8 @@ static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
{ {
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
static const char * const aureon_texts[] = { static const char * const aureon_texts[] = {
"CD", //RXP0 "CD", /* RXP0 */
"Optical" //RXP1 "Optical" /* RXP1 */
}; };
static const char * const prodigy_texts[] = { static const char * const prodigy_texts[] = {
"CD", "CD",
...@@ -1180,10 +1199,10 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -1180,10 +1199,10 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec; struct aureon_spec *spec = ice->spec;
//snd_ice1712_save_gpio_status(ice); /* snd_ice1712_save_gpio_status(ice); */
//val = aureon_cs8415_get(ice, CS8415_CTRL2); /* val = aureon_cs8415_get(ice, CS8415_CTRL2); */
ucontrol->value.enumerated.item[0] = spec->cs8415_mux; ucontrol->value.enumerated.item[0] = spec->cs8415_mux;
//snd_ice1712_restore_gpio_status(ice); /* snd_ice1712_restore_gpio_status(ice); */
return 0; return 0;
} }
...@@ -1206,7 +1225,7 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e ...@@ -1206,7 +1225,7 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
return change; return change;
} }
static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *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->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -1215,7 +1234,7 @@ static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ct ...@@ -1215,7 +1234,7 @@ static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ct
return 0; return 0;
} }
static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int aureon_cs8415_rate_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned char ratio; unsigned char ratio;
...@@ -1229,7 +1248,7 @@ static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -1229,7 +1248,7 @@ static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl
*/ */
#define aureon_cs8415_mute_info snd_ctl_boolean_mono_info #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) static int aureon_cs8415_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
...@@ -1238,7 +1257,7 @@ static int aureon_cs8415_mute_get (struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -1238,7 +1257,7 @@ static int aureon_cs8415_mute_get (struct snd_kcontrol *kcontrol, struct snd_ctl
return 0; return 0;
} }
static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) static int aureon_cs8415_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned char oval, nval; unsigned char oval, nval;
...@@ -1249,7 +1268,8 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -1249,7 +1268,8 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl
nval = oval & ~0x20; nval = oval & ~0x20;
else else
nval = oval | 0x20; nval = oval | 0x20;
if ((change = (oval != nval))) change = (oval != nval);
if (change)
aureon_cs8415_put(ice, CS8415_CTRL1, nval); aureon_cs8415_put(ice, CS8415_CTRL1, nval);
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
return change; return change;
...@@ -1258,13 +1278,15 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -1258,13 +1278,15 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl
/* /*
* CS8415A Q-Sub info * CS8415A Q-Sub info
*/ */
static int aureon_cs8415_qsub_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *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->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = 10; uinfo->count = 10;
return 0; return 0;
} }
static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int aureon_cs8415_qsub_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
...@@ -1274,18 +1296,21 @@ static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl ...@@ -1274,18 +1296,21 @@ static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl
return 0; return 0;
} }
static int aureon_cs8415_spdif_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *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->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int aureon_cs8415_mask_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int aureon_cs8415_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
memset(ucontrol->value.iec958.status, 0xFF, 24); memset(ucontrol->value.iec958.status, 0xFF, 24);
return 0; return 0;
} }
static int aureon_cs8415_spdif_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int aureon_cs8415_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice); snd_ice1712_save_gpio_status(ice);
...@@ -1311,9 +1336,9 @@ static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable) ...@@ -1311,9 +1336,9 @@ static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable)
else else
if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT && if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
tmp &= ~ AUREON_HP_SEL; tmp &= ~AUREON_HP_SEL;
else else
tmp &= ~ PRODIGY_HP_SEL; tmp &= ~PRODIGY_HP_SEL;
if (tmp != tmp2) { if (tmp != tmp2) {
snd_ice1712_gpio_write(ice, tmp); snd_ice1712_gpio_write(ice, tmp);
return 1; return 1;
...@@ -1325,7 +1350,7 @@ static int aureon_get_headphone_amp(struct snd_ice1712 *ice) ...@@ -1325,7 +1350,7 @@ static int aureon_get_headphone_amp(struct snd_ice1712 *ice)
{ {
unsigned int tmp = snd_ice1712_gpio_read(ice); unsigned int tmp = snd_ice1712_gpio_read(ice);
return ( tmp & AUREON_HP_SEL )!= 0; return (tmp & AUREON_HP_SEL) != 0;
} }
#define aureon_hpamp_info snd_ctl_boolean_mono_info #define aureon_hpamp_info snd_ctl_boolean_mono_info
...@@ -1343,7 +1368,7 @@ static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v ...@@ -1343,7 +1368,7 @@ static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
{ {
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]); return aureon_set_headphone_amp(ice, ucontrol->value.integer.value[0]);
} }
/* /*
...@@ -1844,43 +1869,43 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { ...@@ -1844,43 +1869,43 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
static struct snd_kcontrol_new cs8415_controls[] __devinitdata = { static struct snd_kcontrol_new cs8415_controls[] __devinitdata = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH),
.info = aureon_cs8415_mute_info, .info = aureon_cs8415_mute_info,
.get = aureon_cs8415_mute_get, .get = aureon_cs8415_mute_get,
.put = aureon_cs8415_mute_put .put = aureon_cs8415_mute_put
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Source", .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Source",
.info = aureon_cs8415_mux_info, .info = aureon_cs8415_mux_info,
.get = aureon_cs8415_mux_get, .get = aureon_cs8415_mux_get,
.put = aureon_cs8415_mux_put, .put = aureon_cs8415_mux_put,
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("Q-subcode ",CAPTURE,DEFAULT), .name = SNDRV_CTL_NAME_IEC958("Q-subcode ", CAPTURE, DEFAULT),
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_qsub_info, .info = aureon_cs8415_qsub_info,
.get = aureon_cs8415_qsub_get, .get = aureon_cs8415_qsub_get,
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,MASK), .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, MASK),
.access = SNDRV_CTL_ELEM_ACCESS_READ, .access = SNDRV_CTL_ELEM_ACCESS_READ,
.info = aureon_cs8415_spdif_info, .info = aureon_cs8415_spdif_info,
.get = aureon_cs8415_mask_get .get = aureon_cs8415_mask_get
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT),
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_spdif_info, .info = aureon_cs8415_spdif_info,
.get = aureon_cs8415_spdif_get .get = aureon_cs8415_spdif_get
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Rate", .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Rate",
.access =SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_rate_info, .info = aureon_cs8415_rate_info,
.get = aureon_cs8415_rate_get .get = aureon_cs8415_rate_get
} }
...@@ -1912,8 +1937,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice) ...@@ -1912,8 +1937,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
if (err < 0) if (err < 0)
return err; return err;
} }
} } else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) { ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) { for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) {
err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice)); err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice));
...@@ -1932,7 +1956,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice) ...@@ -1932,7 +1956,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
else if ((id & 0x0F) != 0x01) else if ((id & 0x0F) != 0x01)
snd_printk(KERN_INFO "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 { else {
for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice))); err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice)));
if (err < 0) if (err < 0)
...@@ -2059,11 +2083,12 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) ...@@ -2059,11 +2083,12 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
/* to remeber the register values of CS8415 */ /* to remeber the register values of CS8415 */
ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
if (! ice->akm) if (!ice->akm)
return -ENOMEM; return -ENOMEM;
ice->akm_codecs = 1; ice->akm_codecs = 1;
if ((err = aureon_ac97_init(ice)) != 0) err = aureon_ac97_init(ice);
if (err != 0)
return err; return err;
snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */ snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */
...@@ -2105,7 +2130,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) ...@@ -2105,7 +2130,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
snd_ice1712_restore_gpio_status(ice); snd_ice1712_restore_gpio_status(ice);
/* initialize PCA9554 pin directions & set default input*/ /* initialize PCA9554 pin directions & set default input */
aureon_pca9554_write(ice, PCA9554_DIR, 0x00); aureon_pca9554_write(ice, PCA9554_DIR, 0x00);
aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */ aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment