linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / pci / cs4281.c
index 9631456..4f65ec5 100644 (file)
@@ -1046,7 +1046,7 @@ static int snd_cs4281_put_volume(struct snd_kcontrol *kcontrol,
                snd_cs4281_pokeBA0(chip, regL, volL);
                change = 1;
        }
-       if (ucontrol->value.integer.value[1] != volR) {
+       if (ucontrol->value.integer.value[0] != volL) {
                volR = CS_VOL_MASK - (ucontrol->value.integer.value[1] & CS_VOL_MASK);
                snd_cs4281_pokeBA0(chip, regR, volR);
                change = 1;
@@ -1184,7 +1184,7 @@ static void __devinit snd_cs4281_proc_init(struct cs4281 * chip)
        struct snd_info_entry *entry;
 
        if (! snd_card_proc_new(chip->card, "cs4281", &entry))
-               snd_info_set_text_ops(entry, chip, snd_cs4281_proc_read);
+               snd_info_set_text_ops(entry, chip, 1024, snd_cs4281_proc_read);
        if (! snd_card_proc_new(chip->card, "cs4281_BA0", &entry)) {
                entry->content = SNDRV_INFO_CONTENT_DATA;
                entry->private_data = chip;
@@ -1379,14 +1379,7 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
        chip->ba0_addr = pci_resource_start(pci, 0);
        chip->ba1_addr = pci_resource_start(pci, 1);
 
-       chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
-       chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
-       if (!chip->ba0 || !chip->ba1) {
-               snd_cs4281_free(chip);
-               return -ENOMEM;
-       }
-       
-       if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_DISABLED|IRQF_SHARED,
+       if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ,
                        "CS4281", chip)) {
                snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_cs4281_free(chip);
@@ -1394,6 +1387,13 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
        }
        chip->irq = pci->irq;
 
+       chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
+       chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
+       if (!chip->ba0 || !chip->ba1) {
+               snd_cs4281_free(chip);
+               return -ENOMEM;
+       }
+       
        tmp = snd_cs4281_chip_init(chip);
        if (tmp) {
                snd_cs4281_free(chip);
@@ -1416,7 +1416,7 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
 static int snd_cs4281_chip_init(struct cs4281 *chip)
 {
        unsigned int tmp;
-       unsigned long end_time;
+       int timeout;
        int retry_count = 2;
 
        /* Having EPPMC.FPDN=1 prevent proper chip initialisation */
@@ -1496,7 +1496,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
        /*
         * Wait for the DLL ready signal from the clock logic.
         */
-       end_time = jiffies + HZ;
+       timeout = 100;
        do {
                /*
                 *  Read the AC97 status register to see if we've seen a CODEC
@@ -1504,8 +1504,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
                 */
                if (snd_cs4281_peekBA0(chip, BA0_CLKCR1) & BA0_CLKCR1_DLLRDY)
                        goto __ok0;
-               schedule_timeout_uninterruptible(1);
-       } while (time_after_eq(end_time, jiffies));
+               msleep(1);
+       } while (timeout-- > 0);
 
        snd_printk(KERN_ERR "DLLRDY not seen\n");
        return -EIO;
@@ -1522,7 +1522,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
        /*
         * Wait for the codec ready signal from the AC97 codec.
         */
-       end_time = jiffies + HZ;
+       timeout = 100;
        do {
                /*
                 *  Read the AC97 status register to see if we've seen a CODEC
@@ -1530,20 +1530,20 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
                 */
                if (snd_cs4281_peekBA0(chip, BA0_ACSTS) & BA0_ACSTS_CRDY)
                        goto __ok1;
-               schedule_timeout_uninterruptible(1);
-       } while (time_after_eq(end_time, jiffies));
+               msleep(1);
+       } while (timeout-- > 0);
 
        snd_printk(KERN_ERR "never read codec ready from AC'97 (0x%x)\n", snd_cs4281_peekBA0(chip, BA0_ACSTS));
        return -EIO;
 
       __ok1:
        if (chip->dual_codec) {
-               end_time = jiffies + HZ;
+               timeout = 100;
                do {
                        if (snd_cs4281_peekBA0(chip, BA0_ACSTS2) & BA0_ACSTS_CRDY)
                                goto __codec2_ok;
-                       schedule_timeout_uninterruptible(1);
-               } while (time_after_eq(end_time, jiffies));
+                       msleep(1);
+               } while (timeout-- > 0);
                snd_printk(KERN_INFO "secondary codec doesn't respond. disable it...\n");
                chip->dual_codec = 0;
        __codec2_ok: ;
@@ -1561,7 +1561,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
         *  the codec is pumping ADC data across the AC-link.
         */
 
-       end_time = jiffies + HZ;
+       timeout = 100;
        do {
                /*
                 *  Read the input slot valid register and see if input slots 3
@@ -1569,8 +1569,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
                 */
                 if ((snd_cs4281_peekBA0(chip, BA0_ACISV) & (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4))) == (BA0_ACISV_SLV(3) | BA0_ACISV_SLV(4)))
                         goto __ok2;
-               schedule_timeout_uninterruptible(1);
-       } while (time_after_eq(end_time, jiffies));
+               msleep(1);
+       } while (timeout-- > 0);
 
        if (--retry_count > 0)
                goto __retry;