[ALSA] CS5535: shorter delays when accessing AC'97 codec registers
[safe/jmp/linux-2.6] / sound / pci / cs5535audio / cs5535audio.c
index 1899356..9fc7f38 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -28,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
 #include <asm/io.h>
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -46,8 +46,10 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 
 static struct pci_device_id snd_cs5535audio_ids[] = {
-       { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO, PCI_ANY_ID,
-               PCI_ANY_ID, 0, 0, 0, },
+       { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO,
+         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
+       { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO,
+         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
        {}
 };
 
@@ -60,7 +62,7 @@ static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long time
                tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
                if (!(tmp & CMD_NEW))
                        break;
-               msleep(10);
+               udelay(1);
        } while (--timeout);
        if (!timeout)
                snd_printk(KERN_ERR "Failure writing to cs5535 codec\n");
@@ -78,14 +80,14 @@ static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
        regdata |= CMD_NEW;
 
        cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
-       wait_till_cmd_acked(cs5535au, 500);
+       wait_till_cmd_acked(cs5535au, 50);
 
        timeout = 50;
        do {
                val = cs_readl(cs5535au, ACC_CODEC_STATUS);
                if ((val & STS_NEW) && reg == (val >> 24))
                        break;
-               msleep(10);
+               udelay(1);
        } while (--timeout);
        if (!timeout)
                snd_printk(KERN_ERR "Failure reading cs5535 codec\n");
@@ -385,7 +387,7 @@ static struct pci_driver driver = {
 
 static int __init alsa_card_cs5535audio_init(void)
 {
-       return pci_module_init(&driver);
+       return pci_register_driver(&driver);
 }
 
 static void __exit alsa_card_cs5535audio_exit(void)