fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / ice1712 / ice1724.c
index 71f08c0..3e3a102 100644 (file)
@@ -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>
@@ -217,7 +218,7 @@ static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice)
  *  Interrupt handler
  */
 
-static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
 {
        struct snd_ice1712 *ice = dev_id;
        unsigned char status;
@@ -235,7 +236,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id, struct pt_regs *r
                 */
                if ((status & VT1724_IRQ_MPU_RX)||(status & VT1724_IRQ_MPU_TX)) {
                        if (ice->rmidi[0])
-                               snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data, regs);
+                               snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data);
                        outb(status & (VT1724_IRQ_MPU_RX|VT1724_IRQ_MPU_TX), ICEREG1724(ice, IRQSTAT));
                        status &= ~(VT1724_IRQ_MPU_RX|VT1724_IRQ_MPU_TX);
                }
@@ -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;
@@ -1292,7 +1293,7 @@ static void __devinit snd_vt1724_proc_init(struct snd_ice1712 * ice)
        struct snd_info_entry *entry;
 
        if (! snd_card_proc_new(ice->card, "ice1724", &entry))
-               snd_info_set_text_ops(entry, ice, 1024, snd_vt1724_proc_read);
+               snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read);
 }
 
 /*
@@ -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;
@@ -2252,7 +2253,7 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
        ice->profi_port = pci_resource_start(pci, 1);
 
        if (request_irq(pci->irq, snd_vt1724_interrupt,
-                       SA_INTERRUPT|SA_SHIRQ, "ICE1724", ice)) {
+                       IRQF_SHARED, "ICE1724", ice)) {
                snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_vt1724_free(ice);
                return -EIO;
@@ -2387,7 +2388,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
        if (! c->no_mpu401) {
                if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) {
                        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
-                                                      ICEREG1724(ice, MPU_CTRL), 1,
+                                                      ICEREG1724(ice, MPU_CTRL),
+                                                      MPU401_INFO_INTEGRATED,
                                                       ice->irq, 0,
                                                       &ice->rmidi[0])) < 0) {
                                snd_card_free(card);