upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / sound / pci / intel8x0m.c
index a9b3175..e97b414 100644 (file)
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
-#include <linux/gameport.h>
 #include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
 #include <sound/info.h>
-#include <sound/mpu401.h>
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -48,22 +46,26 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
                "{Intel,82801CA-ICH3},"
                "{Intel,82801DB-ICH4},"
                "{Intel,ICH5},"
-               "{Intel,MX440}}");
-
+               "{Intel,MX440},"
+               "{SiS,7013},"
+               "{NVidia,NForce Modem},"
+               "{NVidia,NForce2 Modem},"
+               "{NVidia,NForce2s Modem},"
+               "{NVidia,NForce3 Modem},"
+               "{AMD,AMD768}}");
 
 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 ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
-static int boot_devs;
 
-module_param_array(index, int, boot_devs, 0444);
+module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard.");
-module_param_array(id, charp, boot_devs, 0444);
+module_param_array(id, charp, NULL, 0444);
 MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard.");
-module_param_array(enable, bool, boot_devs, 0444);
+module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard.");
-module_param_array(ac97_clock, int, boot_devs, 0444);
+module_param_array(ac97_clock, int, NULL, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 
 /*
@@ -233,10 +235,10 @@ struct _snd_intel8x0m {
 
        unsigned int mmio;
        unsigned long addr;
-       unsigned long remap_addr;
+       void __iomem *remap_addr;
        unsigned int bm_mmio;
        unsigned long bmaddr;
-       unsigned long remap_bmaddr;
+       void __iomem *remap_bmaddr;
 
        struct pci_dev *pci;
        snd_card_t *card;
@@ -1066,12 +1068,13 @@ static int snd_intel8x0_free(intel8x0_t *chip)
        if (chip->bdbars.area)
                snd_dma_free_pages(&chip->bdbars);
        if (chip->remap_addr)
-               iounmap((void *) chip->remap_addr);
+               iounmap(chip->remap_addr);
        if (chip->remap_bmaddr)
-               iounmap((void *) chip->remap_bmaddr);
+               iounmap(chip->remap_bmaddr);
        if (chip->irq >= 0)
                free_irq(chip->irq, (void *)chip);
        pci_release_regions(chip->pci);
+       pci_disable_device(chip->pci);
        kfree(chip);
        return 0;
 }
@@ -1089,6 +1092,7 @@ static int intel8x0m_suspend(snd_card_t *card, unsigned int state)
                snd_pcm_suspend_all(chip->pcm[i]);
        if (chip->ac97)
                snd_ac97_suspend(chip->ac97);
+       pci_disable_device(chip->pci);
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
        return 0;
 }
@@ -1170,8 +1174,10 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
                return err;
 
        chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
-       if (chip == NULL)
+       if (chip == NULL) {
+               pci_disable_device(pci);
                return -ENOMEM;
+       }
        spin_lock_init(&chip->reg_lock);
        spin_lock_init(&chip->ac97_lock);
        chip->device_type = device_type;
@@ -1181,6 +1187,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
 
        if ((err = pci_request_regions(pci, card->shortname)) < 0) {
                kfree(chip);
+               pci_disable_device(pci);
                return err;
        }
 
@@ -1193,9 +1200,9 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
        if (pci_resource_flags(pci, 2) & IORESOURCE_MEM) {      /* ICH4 and Nforce */
                chip->mmio = 1;
                chip->addr = pci_resource_start(pci, 2);
-               chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr,
-                                                                  pci_resource_len(pci, 2));
-               if (chip->remap_addr == 0) {
+               chip->remap_addr = ioremap_nocache(chip->addr,
+                                                  pci_resource_len(pci, 2));
+               if (chip->remap_addr == NULL) {
                        snd_printk("AC'97 space ioremap problem\n");
                        snd_intel8x0_free(chip);
                        return -EIO;
@@ -1206,9 +1213,9 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
        if (pci_resource_flags(pci, 3) & IORESOURCE_MEM) {      /* ICH4 */
                chip->bm_mmio = 1;
                chip->bmaddr = pci_resource_start(pci, 3);
-               chip->remap_bmaddr = (unsigned long) ioremap_nocache(chip->bmaddr,
-                                                                    pci_resource_len(pci, 3));
-               if (chip->remap_bmaddr == 0) {
+               chip->remap_bmaddr = ioremap_nocache(chip->bmaddr,
+                                                    pci_resource_len(pci, 3));
+               if (chip->remap_bmaddr == NULL) {
                        snd_printk("Controller space ioremap problem\n");
                        snd_intel8x0_free(chip);
                        return -EIO;
@@ -1332,15 +1339,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
        if (card == NULL)
                return -ENOMEM;
 
-       switch (pci_id->driver_data) {
-       case DEVICE_NFORCE:
-               strcpy(card->driver, "NFORCE-MODEM");
-               break;
-       default:
-               strcpy(card->driver, "ICH-MODEM");
-               break;
-       }
-
+       strcpy(card->driver, "ICH-MODEM");
        strcpy(card->shortname, "Intel ICH");
        for (name = shortnames; name->id; name++) {
                if (pci->device == name->id) {