summaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ice1712')
-rw-r--r--sound/pci/ice1712/aureon.c130
-rw-r--r--sound/pci/ice1712/aureon.h8
-rw-r--r--sound/pci/ice1712/delta.c62
-rw-r--r--sound/pci/ice1712/hoontech.c26
-rw-r--r--sound/pci/ice1712/ice1712.c70
-rw-r--r--sound/pci/ice1712/ice1712.h11
-rw-r--r--sound/pci/ice1712/ice1724.c37
-rw-r--r--sound/pci/ice1712/phase.c10
-rw-r--r--sound/pci/ice1712/pontis.c86
9 files changed, 279 insertions, 161 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 8809812a1c2..7e6608b14ab 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -53,6 +53,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -210,14 +212,14 @@ static int aureon_ac97_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
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;
}
@@ -252,11 +254,11 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el
{
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;
}
@@ -288,11 +290,11 @@ static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ct
{
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;
}
@@ -322,36 +324,48 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned
{
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);
}
@@ -440,7 +454,9 @@ static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
*/
static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
{
- aureon_spi_write(ice, 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);
}
/*
@@ -474,11 +490,11 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
{
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;
}
@@ -543,9 +559,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
{
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;
}
@@ -768,11 +784,11 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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;
}
@@ -813,12 +829,12 @@ static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
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;
}
@@ -860,13 +876,13 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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;
}
@@ -937,11 +953,11 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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;
}
@@ -954,8 +970,8 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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);
@@ -995,7 +1011,7 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
//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;
}
@@ -1009,12 +1025,12 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
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;
}
@@ -1659,7 +1675,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *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,7 +1683,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice)
}
}
- {
+ if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT) {
unsigned char id;
snd_ice1712_save_gpio_status(ice);
id = aureon_cs8415_get(ice, CS8415_ID);
@@ -1822,7 +1838,8 @@ static int __devinit aureon_init(struct snd_ice1712 *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,11 +1847,13 @@ static int __devinit aureon_init(struct snd_ice1712 *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);
@@ -1902,6 +1921,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 +1980,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 */
};
diff --git a/sound/pci/ice1712/aureon.h b/sound/pci/ice1712/aureon.h
index 95d515f36f2..98a6752280f 100644
--- a/sound/pci/ice1712/aureon.h
+++ b/sound/pci/ice1712/aureon.h
@@ -27,12 +27,14 @@
#define AUREON_DEVICE_DESC "{Terratec,Aureon 5.1 Sky},"\
"{Terratec,Aureon 7.1 Space},"\
"{Terratec,Aureon 7.1 Universe}," \
- "{AudioTrak,Prodigy 7.1},"
+ "{AudioTrak,Prodigy 7.1}," \
+ "{AudioTrak,Prodigy 7.1 LT},"
#define VT1724_SUBDEVICE_AUREON51_SKY 0x3b154711 /* Aureon 5.1 Sky */
#define VT1724_SUBDEVICE_AUREON71_SPACE 0x3b154511 /* Aureon 7.1 Space */
#define VT1724_SUBDEVICE_AUREON71_UNIVERSE 0x3b155311 /* Aureon 7.1 Universe */
#define VT1724_SUBDEVICE_PRODIGY71 0x33495345 /* PRODIGY 7.1 */
+#define VT1724_SUBDEVICE_PRODIGY71LT 0x32315441 /* PRODIGY 7.1 LT */
extern struct snd_ice1712_card_info snd_vt1724_aureon_cards[];
@@ -53,4 +55,8 @@ extern struct snd_ice1712_card_info snd_vt1724_aureon_cards[];
#define AUREON_AC97_DATA_HIGH (1 << 8)
#define AUREON_AC97_DATA_MASK 0xFF
+#define PRODIGY_WM_CS (1 << 8)
+#define PRODIGY_SPI_MOSI (1 << 10)
+#define PRODIGY_SPI_CLK (1 << 9)
+
#endif /* __SOUND_AUREON_H */
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 9a51d34e681..af659800c9b 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -28,6 +28,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/cs8427.h>
#include <sound/asoundef.h>
@@ -130,13 +132,13 @@ static int ap_cs8427_sendbytes(struct snd_i2c_device *device, unsigned char *byt
int res = count;
unsigned char tmp;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = ap_cs8427_codec_select(ice);
ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
while (count-- > 0)
ap_cs8427_write_byte(ice, *bytes++, tmp);
ap_cs8427_codec_deassert(ice, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return res;
}
@@ -147,13 +149,13 @@ static int ap_cs8427_readbytes(struct snd_i2c_device *device, unsigned char *byt
int res = count;
unsigned char tmp;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = ap_cs8427_codec_select(ice);
ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
while (count-- > 0)
*bytes++ = ap_cs8427_read_byte(ice, tmp);
ap_cs8427_codec_deassert(ice, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return res;
}
@@ -180,7 +182,7 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
/* send byte to transmitter */
mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
for (idx = 7; idx >= 0; idx--) {
tmp &= ~(mask1 | mask2);
@@ -194,7 +196,7 @@ static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsign
}
tmp &= ~mask1;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
@@ -296,14 +298,14 @@ static void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
if (rate == 0) /* no hint - S/PDIF input is master, simply return */
return;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
tmp2 = tmp & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp2 |= ICE1712_DELTA_DFS;
if (tmp != tmp2)
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
/*
@@ -318,9 +320,9 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
return;
/* check before reset ak4524 to avoid unnecessary clicks */
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
tmp2 = tmp & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp2 |= ICE1712_DELTA_DFS;
@@ -329,12 +331,12 @@ static void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
/* do it again */
snd_akm4xxx_reset(ak, 1);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
if (rate > 48000)
tmp |= ICE1712_DELTA_DFS;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
snd_akm4xxx_reset(ak, 0);
}
@@ -391,6 +393,37 @@ static void delta_setup_spdif(struct snd_ice1712 *ice, int rate)
snd_ice1712_delta_cs8403_spdif_write(ice, tmp);
}
+static int snd_ice1712_delta1010lt_wordclock_status_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = 1;
+ return 0;
+}
+
+static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ char reg = 0x10; // cs8427 receiver error register
+ struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+
+ if (snd_i2c_sendbytes(ice->cs8427, &reg, 1) != 1)
+ snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg);
+ snd_i2c_readbytes(ice->cs8427, &reg, 1);
+ ucontrol->value.integer.value[0] = (reg ? 1 : 0);
+ return 0;
+}
+
+static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status __devinitdata =
+{
+ .access = (SNDRV_CTL_ELEM_ACCESS_READ),
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Word Clock Status",
+ .info = snd_ice1712_delta1010lt_wordclock_status_info,
+ .get = snd_ice1712_delta1010lt_wordclock_status_get,
+};
/*
* initialize the chips on M-Audio cards
@@ -620,7 +653,7 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_select __devinitdata =
ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0);
static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_select __devinitdata =
-ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 1, 0);
+ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 0, 0);
static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_status __devinitdata =
ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
static struct snd_kcontrol_new snd_ice1712_deltadio2496_spdif_in_select __devinitdata =
@@ -653,6 +686,9 @@ static int __devinit snd_ice1712_delta_add_controls(struct snd_ice1712 *ice)
err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_select, ice));
if (err < 0)
return err;
+ err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_status, ice));
+ if (err < 0)
+ return err;
break;
}
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c
index 3f2f918536f..3f27d04e7d3 100644
--- a/sound/pci/ice1712/hoontech.c
+++ b/sound/pci/ice1712/hoontech.c
@@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -48,31 +50,31 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un
static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* select box */
ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box);
@@ -115,12 +117,12 @@ static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, i
ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* select box */
ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box);
@@ -141,15 +143,15 @@ static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int
ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate);
snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index ef6f18558c9..b88eeba2f5d 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -53,8 +53,12 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/pci.h>
+#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/cs8427.h>
#include <sound/info.h>
@@ -82,10 +86,11 @@ MODULE_SUPPORTED_DEVICE("{"
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
static char *model[SNDRV_CARDS];
-static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */
+static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */
static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */
+static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard.");
@@ -99,6 +104,8 @@ module_param_array(cs8427_timeout, int, NULL, 0444);
MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution.");
module_param_array(model, charp, NULL, 0444);
MODULE_PARM_DESC(model, "Use the given board model.");
+module_param_array(dxr_enable, int, NULL, 0444);
+MODULE_PARM_DESC(dxr_enable, "Enable DXR support for Terratec DMX6FIRE.");
static struct pci_device_id snd_ice1712_ids[] = {
@@ -316,7 +323,6 @@ static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val)
inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
}
-
/*
*
* CS8427 interface
@@ -396,6 +402,20 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
return 0;
}
+static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master)
+{
+ /* change CS8427 clock source too */
+ if (ice->cs8427)
+ snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master);
+ /* notify ak4524 chip as well */
+ if (spdif_is_master) {
+ unsigned int i;
+ for (i = 0; i < ice->akm_codecs; i++) {
+ if (ice->akm[i].ops.set_rate_val)
+ ice->akm[i].ops.set_rate_val(&ice->akm[i], 0);
+ }
+ }
+}
/*
* Interrupt handler
@@ -1567,6 +1587,9 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry,
snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE)));
snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT)));
snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE)));
+ snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice));
+ snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK));
+ snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION));
}
static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice)
@@ -1856,20 +1879,8 @@ static int snd_ice1712_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
spin_unlock_irq(&ice->reg_lock);
if ((oval & ICE1712_SPDIF_MASTER) !=
- (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) {
- /* change CS8427 clock source too */
- if (ice->cs8427) {
- snd_ice1712_cs8427_set_input_clock(ice, is_spdif_master(ice));
- }
- /* notify ak4524 chip as well */
- if (is_spdif_master(ice)) {
- unsigned int i;
- for (i = 0; i < ice->akm_codecs; i++) {
- if (ice->akm[i].ops.set_rate_val)
- ice->akm[i].ops.set_rate_val(&ice->akm[i], 0);
- }
- }
- }
+ (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER))
+ snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice));
return change;
}
@@ -2388,7 +2399,13 @@ static int __devinit snd_ice1712_chip_init(struct snd_ice1712 *ice)
udelay(200);
outb(ICE1712_NATIVE, ICEREG(ice, CONTROL));
udelay(200);
- pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]);
+ if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && !ice->dxr_enable) {
+ /* Limit active ADCs and DACs to 6; */
+ /* Note: DXR extension not supported */
+ pci_write_config_byte(ice->pci, 0x60, 0x0a);
+ } else {
+ pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]);
+ }
pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]);
pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]);
pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]);
@@ -2524,6 +2541,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
const char *modelname,
int omni,
int cs8427_timeout,
+ int dxr_enable,
struct snd_ice1712 ** r_ice1712)
{
struct snd_ice1712 *ice;
@@ -2538,8 +2556,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
if ((err = pci_enable_device(pci)) < 0)
return err;
/* check, if we can restrict PCI DMA transfers to 28 bits */
- if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
- pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
+ if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
+ pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
pci_disable_device(pci);
return -ENXIO;
@@ -2556,10 +2574,11 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
else if (cs8427_timeout > 1000)
cs8427_timeout = 1000;
ice->cs8427_timeout = cs8427_timeout;
+ ice->dxr_enable = dxr_enable;
spin_lock_init(&ice->reg_lock);
- init_MUTEX(&ice->gpio_mutex);
- init_MUTEX(&ice->i2c_mutex);
- init_MUTEX(&ice->open_mutex);
+ mutex_init(&ice->gpio_mutex);
+ mutex_init(&ice->i2c_mutex);
+ mutex_init(&ice->open_mutex);
ice->gpio.set_mask = snd_ice1712_set_gpio_mask;
ice->gpio.set_dir = snd_ice1712_set_gpio_dir;
ice->gpio.set_data = snd_ice1712_set_gpio_data;
@@ -2658,7 +2677,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
strcpy(card->shortname, "ICEnsemble ICE1712");
if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev],
- cs8427_timeout[dev], &ice)) < 0) {
+ cs8427_timeout[dev], dxr_enable[dev],
+ &ice)) < 0) {
snd_card_free(card);
return err;
}
@@ -2735,6 +2755,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
}
}
+ snd_ice1712_set_input_clock_source(ice, 0);
+
sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, ice->port, ice->irq);
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index ce96b3bb653..f9b22d4a393 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -325,6 +325,7 @@ struct snd_ice1712 {
unsigned int pro_volumes[20];
unsigned int omni: 1; /* Delta Omni I/O */
+ unsigned int dxr_enable: 1; /* Terratec DXR enable for DMX6FIRE */
unsigned int vt1724: 1;
unsigned int vt1720: 1;
unsigned int has_spdif: 1; /* VT1720/4 - has SPDIF I/O */
@@ -334,7 +335,7 @@ struct snd_ice1712 {
unsigned int num_total_adcs; /* total ADCs */
unsigned int cur_rate; /* current rate */
- struct semaphore open_mutex;
+ struct mutex open_mutex;
struct snd_pcm_substream *pcm_reserved[4];
struct snd_pcm_hw_constraint_list *hw_rates; /* card-specific rate constraints */
@@ -342,7 +343,7 @@ struct snd_ice1712 {
struct snd_akm4xxx *akm;
struct snd_ice1712_spdif spdif;
- struct semaphore i2c_mutex; /* I2C mutex for ICE1724 registers */
+ struct mutex i2c_mutex; /* I2C mutex for ICE1724 registers */
struct snd_i2c_bus *i2c; /* I2C bus */
struct snd_i2c_device *cs8427; /* CS8427 I2C device */
unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */
@@ -360,7 +361,7 @@ struct snd_ice1712 {
void (*set_pro_rate)(struct snd_ice1712 *ice, unsigned int rate);
void (*i2s_mclk_changed)(struct snd_ice1712 *ice);
} gpio;
- struct semaphore gpio_mutex;
+ struct mutex gpio_mutex;
/* other board-specific data */
union {
@@ -423,7 +424,7 @@ static inline unsigned int snd_ice1712_gpio_read(struct snd_ice1712 *ice)
*/
static inline void snd_ice1712_save_gpio_status(struct snd_ice1712 *ice)
{
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ice->gpio.saved[0] = ice->gpio.direction;
ice->gpio.saved[1] = ice->gpio.write_mask;
}
@@ -434,7 +435,7 @@ static inline void snd_ice1712_restore_gpio_status(struct snd_ice1712 *ice)
ice->gpio.set_mask(ice, ice->gpio.saved[1]);
ice->gpio.direction = ice->gpio.saved[0];
ice->gpio.write_mask = ice->gpio.saved[1];
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
/* for bit controls */
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 71f08c03601..fce616c2761 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -30,6 +30,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/mpu401.h>
@@ -487,7 +488,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
int i, chs;
chs = params_channels(hw_params);
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* mark surround channels */
if (substream == ice->playback_pro_substream) {
/* PDMA0 can be multi-channel up to 8 */
@@ -495,7 +496,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
for (i = 0; i < chs; i++) {
if (ice->pcm_reserved[i] &&
ice->pcm_reserved[i] != substream) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY;
}
ice->pcm_reserved[i] = substream;
@@ -510,7 +511,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
if (ice->playback_con_substream_ds[i] == substream) {
if (ice->pcm_reserved[i] &&
ice->pcm_reserved[i] != substream) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY;
}
ice->pcm_reserved[i] = substream;
@@ -518,7 +519,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
}
}
}
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
@@ -528,12 +529,12 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
int i;
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* unmark surround channels */
for (i = 0; i < 3; i++)
if (ice->pcm_reserved[i] == substream)
ice->pcm_reserved[i] = NULL;
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return snd_pcm_lib_free_pages(substream);
}
@@ -778,7 +779,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
set_rate_constraints(ice, substream);
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* calculate the currently available channels */
for (chs = 0; chs < 3; chs++) {
if (ice->pcm_reserved[chs])
@@ -788,7 +789,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
runtime->hw.channels_max = chs;
if (chs > 2) /* channels must be even */
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
VT1724_BUFFER_ALIGN);
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
@@ -1128,13 +1129,13 @@ static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
- down(&ice->open_mutex);
+ mutex_lock(&ice->open_mutex);
/* already used by PDMA0? */
if (ice->pcm_reserved[substream->number]) {
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
return -EBUSY; /* FIXME: should handle blocking mode properly */
}
- up(&ice->open_mutex);
+ mutex_unlock(&ice->open_mutex);
runtime->private_data = &vt1724_playback_dma_regs[substream->number];
ice->playback_con_substream_ds[substream->number] = substream;
runtime->hw = snd_vt1724_2ch_stereo;
@@ -1978,12 +1979,12 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
{
unsigned char val;
- down(&ice->i2c_mutex);
+ mutex_lock(&ice->i2c_mutex);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
val = inb(ICEREG1724(ice, I2C_DATA));
- up(&ice->i2c_mutex);
+ mutex_unlock(&ice->i2c_mutex);
//printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
return val;
}
@@ -1991,14 +1992,14 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
unsigned char dev, unsigned char addr, unsigned char data)
{
- down(&ice->i2c_mutex);
+ mutex_lock(&ice->i2c_mutex);
wait_i2c_busy(ice);
//printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(data, ICEREG1724(ice, I2C_DATA));
outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
- up(&ice->i2c_mutex);
+ mutex_unlock(&ice->i2c_mutex);
}
static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
@@ -2229,9 +2230,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
}
ice->vt1724 = 1;
spin_lock_init(&ice->reg_lock);
- init_MUTEX(&ice->gpio_mutex);
- init_MUTEX(&ice->open_mutex);
- init_MUTEX(&ice->i2c_mutex);
+ mutex_init(&ice->gpio_mutex);
+ mutex_init(&ice->open_mutex);
+ mutex_init(&ice->i2c_mutex);
ice->gpio.set_mask = snd_vt1724_set_gpio_mask;
ice->gpio.set_dir = snd_vt1724_set_gpio_dir;
ice->gpio.set_data = snd_vt1724_set_gpio_data;
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index ec3757834b9..502da1c8b5f 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -39,6 +39,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include "ice1712.h"
@@ -273,9 +275,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
{
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;
}
@@ -584,11 +586,11 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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;
}
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 0dccd7707a4..d23fb3fc213 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/info.h>
@@ -124,13 +126,13 @@ static int wm_dac_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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_DAC_ATTEN_L + i) & 0xff;
val = val > DAC_MIN ? (val - DAC_MIN) : 0;
ucontrol->value.integer.value[i] = val;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -140,7 +142,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short oval, nval;
int i, idx, change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
nval = ucontrol->value.integer.value[i];
nval = (nval ? (nval + DAC_MIN) : 0) & 0xff;
@@ -152,7 +154,7 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
change = 1;
}
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -179,13 +181,13 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
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_ATTEN_L + i) & 0xff;
val = val > ADC_MIN ? (val - ADC_MIN) : 0;
ucontrol->value.integer.value[i] = val;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -195,7 +197,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short ovol, nvol;
int i, idx, change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
nvol = ucontrol->value.integer.value[i];
nvol = nvol ? (nvol + ADC_MIN) : 0;
@@ -206,7 +208,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
change = 1;
}
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -227,9 +229,9 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int bit = kcontrol->private_value;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -240,7 +242,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
unsigned short oval, nval;
int change;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
nval = oval = wm_get(ice, WM_ADC_MUX);
if (ucontrol->value.integer.value[0])
nval |= (1 << bit);
@@ -250,7 +252,7 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
if (change) {
wm_put(ice, WM_ADC_MUX, nval);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -270,9 +272,9 @@ static int wm_bypass_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
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_MUX) & 0x04) ? 1 : 0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -282,7 +284,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned short val, oval;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
val = oval = wm_get(ice, WM_OUT_MUX);
if (ucontrol->value.integer.value[0])
val |= 0x04;
@@ -292,7 +294,7 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
wm_put(ice, WM_OUT_MUX, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -312,9 +314,9 @@ static int wm_chswap_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
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_DAC_CTRL1) & 0xf0) != 0x90;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -324,7 +326,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned short val, oval;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
oval = wm_get(ice, WM_DAC_CTRL1);
val = oval & 0x0f;
if (ucontrol->value.integer.value[0])
@@ -336,7 +338,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
wm_put_nocache(ice, WM_DAC_CTRL1, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return change;
}
@@ -449,9 +451,9 @@ static int cs_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
ucontrol->value.enumerated.item[0] = ice->gpio.saved[0];
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -461,14 +463,14 @@ static int cs_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
unsigned char val;
int change = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
if (ucontrol->value.enumerated.item[0] != ice->gpio.saved[0]) {
ice->gpio.saved[0] = ucontrol->value.enumerated.item[0] & 3;
val = 0x80 | (ice->gpio.saved[0] << 3);
spi_write(ice, CS_DEV, 0x04, val);
change = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -488,10 +490,10 @@ static int pontis_gpio_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_e
static int pontis_gpio_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
ucontrol->value.integer.value[0] = (~ice->gpio.write_mask & 0xffff) | 0x00f0;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -500,22 +502,22 @@ static int pontis_gpio_mask_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val;
int changed;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
val = (~ucontrol->value.integer.value[0] & 0xffff) | 0x00f0;
changed = val != ice->gpio.write_mask;
ice->gpio.write_mask = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
static int pontis_gpio_dir_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
ucontrol->value.integer.value[0] = ice->gpio.direction & 0xff0f;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -524,23 +526,23 @@ static int pontis_gpio_dir_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val;
int changed;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
/* 4-7 reserved */
val = ucontrol->value.integer.value[0] & 0xff0f;
changed = (val != ice->gpio.direction);
ice->gpio.direction = val;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
static int pontis_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
ucontrol->value.integer.value[0] = snd_ice1712_gpio_read(ice) & 0xffff;
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return 0;
}
@@ -549,7 +551,7 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned int val, nval;
int changed = 0;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
val = snd_ice1712_gpio_read(ice) & 0xffff;
@@ -558,7 +560,7 @@ static int pontis_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
snd_ice1712_gpio_write(ice, nval);
changed = 1;
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
return changed;
}
@@ -651,14 +653,14 @@ static void wm_proc_regs_write(struct snd_info_entry *entry, struct snd_info_buf
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
char line[64];
unsigned int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
while (!snd_info_get_line(buffer, line, sizeof(line))) {
if (sscanf(line, "%x %x", &reg, &val) != 2)
continue;
if (reg <= 0x17 && val <= 0xffff)
wm_put(ice, reg, val);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
@@ -666,12 +668,12 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (reg = 0; reg <= 0x17; reg++) {
val = wm_get(ice, reg);
snd_iprintf(buffer, "%02x = %04x\n", reg, val);
}
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void wm_proc_init(struct snd_ice1712 *ice)
@@ -690,14 +692,14 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff
struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data;
int reg, val;
- down(&ice->gpio_mutex);
+ mutex_lock(&ice->gpio_mutex);
for (reg = 0; reg <= 0x26; reg++) {
val = spi_read(ice, CS_DEV, reg);
snd_iprintf(buffer, "%02x = %02x\n", reg, val);
}
val = spi_read(ice, CS_DEV, 0x7f);
snd_iprintf(buffer, "%02x = %02x\n", 0x7f, val);
- up(&ice->gpio_mutex);
+ mutex_unlock(&ice->gpio_mutex);
}
static void cs_proc_init(struct snd_ice1712 *ice)