diff options
Diffstat (limited to 'sound/pci/intel8x0.c')
-rw-r--r-- | sound/pci/intel8x0.c | 160 |
1 files changed, 86 insertions, 74 deletions
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 1a96198a17ae..0801083f32dd 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -64,36 +64,35 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | |||
64 | "{AMD,AMD8111}," | 64 | "{AMD,AMD8111}," |
65 | "{ALI,M5455}}"); | 65 | "{ALI,M5455}}"); |
66 | 66 | ||
67 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 67 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
68 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 68 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
69 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 69 | static int ac97_clock = 0; |
70 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | 70 | static char *ac97_quirk; |
71 | static char *ac97_quirk[SNDRV_CARDS]; | 71 | static int buggy_semaphore; |
72 | static int buggy_semaphore[SNDRV_CARDS]; | 72 | static int buggy_irq = -1; /* auto-check */ |
73 | static int buggy_irq[SNDRV_CARDS]; | 73 | static int xbox; |
74 | static int xbox[SNDRV_CARDS]; | 74 | |
75 | 75 | module_param(index, int, 0444); | |
76 | #ifdef SUPPORT_MIDI | ||
77 | static int mpu_port[SNDRV_CARDS]; /* disabled */ | ||
78 | #endif | ||
79 | |||
80 | module_param_array(index, int, NULL, 0444); | ||
81 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard."); | 76 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard."); |
82 | module_param_array(id, charp, NULL, 0444); | 77 | module_param(id, charp, 0444); |
83 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard."); | 78 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard."); |
84 | module_param_array(enable, bool, NULL, 0444); | 79 | module_param(ac97_clock, int, 0444); |
85 | MODULE_PARM_DESC(enable, "Enable Intel i8x0 soundcard."); | ||
86 | module_param_array(ac97_clock, int, NULL, 0444); | ||
87 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | 80 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); |
88 | module_param_array(ac97_quirk, charp, NULL, 0444); | 81 | module_param(ac97_quirk, charp, 0444); |
89 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | 82 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); |
90 | module_param_array(buggy_semaphore, bool, NULL, 0444); | 83 | module_param(buggy_semaphore, bool, 0444); |
91 | MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); | 84 | MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); |
92 | module_param_array(buggy_irq, bool, NULL, 0444); | 85 | module_param(buggy_irq, bool, 0444); |
93 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); | 86 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); |
94 | module_param_array(xbox, bool, NULL, 0444); | 87 | module_param(xbox, bool, 0444); |
95 | MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); | 88 | MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); |
96 | 89 | ||
90 | /* just for backward compatibility */ | ||
91 | static int enable; | ||
92 | module_param(enable, bool, 0444); | ||
93 | static int joystick; | ||
94 | module_param(joystick, int, 0444); | ||
95 | |||
97 | /* | 96 | /* |
98 | * Direct registers | 97 | * Direct registers |
99 | */ | 98 | */ |
@@ -539,7 +538,7 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec) | |||
539 | /* access to some forbidden (non existant) ac97 registers will not | 538 | /* access to some forbidden (non existant) ac97 registers will not |
540 | * reset the semaphore. So even if you don't get the semaphore, still | 539 | * reset the semaphore. So even if you don't get the semaphore, still |
541 | * continue the access. We don't need the semaphore anyway. */ | 540 | * continue the access. We don't need the semaphore anyway. */ |
542 | snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", | 541 | snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", |
543 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); | 542 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); |
544 | iagetword(chip, 0); /* clear semaphore flag */ | 543 | iagetword(chip, 0); /* clear semaphore flag */ |
545 | /* I don't care about the semaphore */ | 544 | /* I don't care about the semaphore */ |
@@ -554,7 +553,7 @@ static void snd_intel8x0_codec_write(ac97_t *ac97, | |||
554 | 553 | ||
555 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { | 554 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { |
556 | if (! chip->in_ac97_init) | 555 | if (! chip->in_ac97_init) |
557 | snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 556 | snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
558 | } | 557 | } |
559 | iaputword(chip, reg + ac97->num * 0x80, val); | 558 | iaputword(chip, reg + ac97->num * 0x80, val); |
560 | } | 559 | } |
@@ -568,7 +567,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
568 | 567 | ||
569 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { | 568 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { |
570 | if (! chip->in_ac97_init) | 569 | if (! chip->in_ac97_init) |
571 | snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 570 | snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
572 | res = 0xffff; | 571 | res = 0xffff; |
573 | } else { | 572 | } else { |
574 | res = iagetword(chip, reg + ac97->num * 0x80); | 573 | res = iagetword(chip, reg + ac97->num * 0x80); |
@@ -576,7 +575,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
576 | /* reset RCS and preserve other R/WC bits */ | 575 | /* reset RCS and preserve other R/WC bits */ |
577 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); | 576 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); |
578 | if (! chip->in_ac97_init) | 577 | if (! chip->in_ac97_init) |
579 | snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); | 578 | snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); |
580 | res = 0xffff; | 579 | res = 0xffff; |
581 | } | 580 | } |
582 | } | 581 | } |
@@ -607,16 +606,19 @@ static int snd_intel8x0_ali_codec_ready(intel8x0_t *chip, int mask) | |||
607 | if (val & mask) | 606 | if (val & mask) |
608 | return 0; | 607 | return 0; |
609 | } | 608 | } |
610 | snd_printd(KERN_WARNING "intel8x0: AC97 codec ready timeout.\n"); | 609 | if (! chip->in_ac97_init) |
610 | snd_printd(KERN_WARNING "intel8x0: AC97 codec ready timeout.\n"); | ||
611 | return -EBUSY; | 611 | return -EBUSY; |
612 | } | 612 | } |
613 | 613 | ||
614 | static int snd_intel8x0_ali_codec_semaphore(intel8x0_t *chip) | 614 | static int snd_intel8x0_ali_codec_semaphore(intel8x0_t *chip) |
615 | { | 615 | { |
616 | int time = 100; | 616 | int time = 100; |
617 | if (chip->buggy_semaphore) | ||
618 | return 0; /* just ignore ... */ | ||
617 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) | 619 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) |
618 | udelay(1); | 620 | udelay(1); |
619 | if (! time) | 621 | if (! time && ! chip->in_ac97_init) |
620 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); | 622 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); |
621 | return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY); | 623 | return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY); |
622 | } | 624 | } |
@@ -1716,6 +1718,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1716 | .type = AC97_TUNE_HP_ONLY | 1718 | .type = AC97_TUNE_HP_ONLY |
1717 | }, | 1719 | }, |
1718 | { | 1720 | { |
1721 | .subvendor = 0x1025, | ||
1722 | .subdevice = 0x0083, | ||
1723 | .name = "Acer Aspire 3003LCi", | ||
1724 | .type = AC97_TUNE_HP_ONLY | ||
1725 | }, | ||
1726 | { | ||
1719 | .subvendor = 0x1028, | 1727 | .subvendor = 0x1028, |
1720 | .subdevice = 0x00d8, | 1728 | .subdevice = 0x00d8, |
1721 | .name = "Dell Precision 530", /* AD1885 */ | 1729 | .name = "Dell Precision 530", /* AD1885 */ |
@@ -1758,6 +1766,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1758 | .type = AC97_TUNE_HP_ONLY | 1766 | .type = AC97_TUNE_HP_ONLY |
1759 | }, | 1767 | }, |
1760 | { | 1768 | { |
1769 | .subvendor = 0x1028, | ||
1770 | .subdevice = 0x0191, | ||
1771 | .name = "Dell Inspiron 8600", | ||
1772 | .type = AC97_TUNE_HP_ONLY | ||
1773 | }, | ||
1774 | { | ||
1761 | .subvendor = 0x103c, | 1775 | .subvendor = 0x103c, |
1762 | .subdevice = 0x006d, | 1776 | .subdevice = 0x006d, |
1763 | .name = "HP zv5000", | 1777 | .name = "HP zv5000", |
@@ -2022,7 +2036,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock, const | |||
2022 | if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) | 2036 | if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) |
2023 | goto __err; | 2037 | goto __err; |
2024 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; | 2038 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; |
2025 | pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with modem driver */ | ||
2026 | if (ac97_clock >= 8000 && ac97_clock <= 48000) | 2039 | if (ac97_clock >= 8000 && ac97_clock <= 48000) |
2027 | pbus->clock = ac97_clock; | 2040 | pbus->clock = ac97_clock; |
2028 | /* FIXME: my test board doesn't work well with VRA... */ | 2041 | /* FIXME: my test board doesn't work well with VRA... */ |
@@ -2131,14 +2144,13 @@ static void do_ali_reset(intel8x0_t *chip) | |||
2131 | iputdword(chip, ICHREG(ALI_FIFOCR2), 0x83838383); | 2144 | iputdword(chip, ICHREG(ALI_FIFOCR2), 0x83838383); |
2132 | iputdword(chip, ICHREG(ALI_FIFOCR3), 0x83838383); | 2145 | iputdword(chip, ICHREG(ALI_FIFOCR3), 0x83838383); |
2133 | iputdword(chip, ICHREG(ALI_INTERFACECR), | 2146 | iputdword(chip, ICHREG(ALI_INTERFACECR), |
2134 | ICH_ALI_IF_MC|ICH_ALI_IF_PI|ICH_ALI_IF_PO); | 2147 | ICH_ALI_IF_PI|ICH_ALI_IF_PO); |
2135 | iputdword(chip, ICHREG(ALI_INTERRUPTCR), 0x00000000); | 2148 | iputdword(chip, ICHREG(ALI_INTERRUPTCR), 0x00000000); |
2136 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); | 2149 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); |
2137 | } | 2150 | } |
2138 | 2151 | ||
2139 | #define do_delay(chip) do {\ | 2152 | #define do_delay(chip) do {\ |
2140 | set_current_state(TASK_UNINTERRUPTIBLE);\ | 2153 | schedule_timeout_uninterruptible(1);\ |
2141 | schedule_timeout(1);\ | ||
2142 | } while (0) | 2154 | } while (0) |
2143 | 2155 | ||
2144 | static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) | 2156 | static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) |
@@ -2166,7 +2178,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) | |||
2166 | goto __ok; | 2178 | goto __ok; |
2167 | do_delay(chip); | 2179 | do_delay(chip); |
2168 | } while (time_after_eq(end_time, jiffies)); | 2180 | } while (time_after_eq(end_time, jiffies)); |
2169 | snd_printk("AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); | 2181 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); |
2170 | return -EIO; | 2182 | return -EIO; |
2171 | 2183 | ||
2172 | __ok: | 2184 | __ok: |
@@ -2441,7 +2453,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
2441 | 2453 | ||
2442 | subs = chip->pcm[0]->streams[0].substream; | 2454 | subs = chip->pcm[0]->streams[0].substream; |
2443 | if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { | 2455 | if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { |
2444 | snd_printk("no playback buffer allocated - aborting measure ac97 clock\n"); | 2456 | snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); |
2445 | return; | 2457 | return; |
2446 | } | 2458 | } |
2447 | ichdev = &chip->ichd[ICHD_PCMOUT]; | 2459 | ichdev = &chip->ichd[ICHD_PCMOUT]; |
@@ -2477,7 +2489,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
2477 | do_gettimeofday(&stop_time); | 2489 | do_gettimeofday(&stop_time); |
2478 | /* stop */ | 2490 | /* stop */ |
2479 | if (chip->device_type == DEVICE_ALI) { | 2491 | if (chip->device_type == DEVICE_ALI) { |
2480 | iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 8)); | 2492 | iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); |
2481 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); | 2493 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); |
2482 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) | 2494 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) |
2483 | ; | 2495 | ; |
@@ -2556,7 +2568,6 @@ struct ich_reg_info { | |||
2556 | static int __devinit snd_intel8x0_create(snd_card_t * card, | 2568 | static int __devinit snd_intel8x0_create(snd_card_t * card, |
2557 | struct pci_dev *pci, | 2569 | struct pci_dev *pci, |
2558 | unsigned long device_type, | 2570 | unsigned long device_type, |
2559 | int buggy_sem, | ||
2560 | intel8x0_t ** r_intel8x0) | 2571 | intel8x0_t ** r_intel8x0) |
2561 | { | 2572 | { |
2562 | intel8x0_t *chip; | 2573 | intel8x0_t *chip; |
@@ -2614,18 +2625,17 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2614 | chip->card = card; | 2625 | chip->card = card; |
2615 | chip->pci = pci; | 2626 | chip->pci = pci; |
2616 | chip->irq = -1; | 2627 | chip->irq = -1; |
2617 | chip->buggy_semaphore = buggy_sem; | 2628 | |
2629 | /* module parameters */ | ||
2630 | chip->buggy_irq = buggy_irq; | ||
2631 | chip->buggy_semaphore = buggy_semaphore; | ||
2632 | if (xbox) | ||
2633 | chip->xbox = 1; | ||
2618 | 2634 | ||
2619 | if (pci->vendor == PCI_VENDOR_ID_INTEL && | 2635 | if (pci->vendor == PCI_VENDOR_ID_INTEL && |
2620 | pci->device == PCI_DEVICE_ID_INTEL_440MX) | 2636 | pci->device == PCI_DEVICE_ID_INTEL_440MX) |
2621 | chip->fix_nocache = 1; /* enable workaround */ | 2637 | chip->fix_nocache = 1; /* enable workaround */ |
2622 | 2638 | ||
2623 | /* some Nforce[2] and ICH boards have problems with IRQ handling. | ||
2624 | * Needs to return IRQ_HANDLED for unknown irqs. | ||
2625 | */ | ||
2626 | if (device_type == DEVICE_NFORCE) | ||
2627 | chip->buggy_irq = 1; | ||
2628 | |||
2629 | if ((err = pci_request_regions(pci, card->shortname)) < 0) { | 2639 | if ((err = pci_request_regions(pci, card->shortname)) < 0) { |
2630 | kfree(chip); | 2640 | kfree(chip); |
2631 | pci_disable_device(pci); | 2641 | pci_disable_device(pci); |
@@ -2644,7 +2654,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2644 | chip->remap_addr = ioremap_nocache(chip->addr, | 2654 | chip->remap_addr = ioremap_nocache(chip->addr, |
2645 | pci_resource_len(pci, 2)); | 2655 | pci_resource_len(pci, 2)); |
2646 | if (chip->remap_addr == NULL) { | 2656 | if (chip->remap_addr == NULL) { |
2647 | snd_printk("AC'97 space ioremap problem\n"); | 2657 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
2648 | snd_intel8x0_free(chip); | 2658 | snd_intel8x0_free(chip); |
2649 | return -EIO; | 2659 | return -EIO; |
2650 | } | 2660 | } |
@@ -2657,7 +2667,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2657 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, | 2667 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, |
2658 | pci_resource_len(pci, 3)); | 2668 | pci_resource_len(pci, 3)); |
2659 | if (chip->remap_bmaddr == NULL) { | 2669 | if (chip->remap_bmaddr == NULL) { |
2660 | snd_printk("Controller space ioremap problem\n"); | 2670 | snd_printk(KERN_ERR "Controller space ioremap problem\n"); |
2661 | snd_intel8x0_free(chip); | 2671 | snd_intel8x0_free(chip); |
2662 | return -EIO; | 2672 | return -EIO; |
2663 | } | 2673 | } |
@@ -2666,15 +2676,6 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2666 | } | 2676 | } |
2667 | 2677 | ||
2668 | port_inited: | 2678 | port_inited: |
2669 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | ||
2670 | snd_printk("unable to grab IRQ %d\n", pci->irq); | ||
2671 | snd_intel8x0_free(chip); | ||
2672 | return -EBUSY; | ||
2673 | } | ||
2674 | chip->irq = pci->irq; | ||
2675 | pci_set_master(pci); | ||
2676 | synchronize_irq(chip->irq); | ||
2677 | |||
2678 | chip->bdbars_count = bdbars[device_type]; | 2679 | chip->bdbars_count = bdbars[device_type]; |
2679 | 2680 | ||
2680 | /* initialize offsets */ | 2681 | /* initialize offsets */ |
@@ -2725,13 +2726,27 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2725 | int_sta_masks = 0; | 2726 | int_sta_masks = 0; |
2726 | for (i = 0; i < chip->bdbars_count; i++) { | 2727 | for (i = 0; i < chip->bdbars_count; i++) { |
2727 | ichdev = &chip->ichd[i]; | 2728 | ichdev = &chip->ichd[i]; |
2728 | ichdev->bdbar = ((u32 *)chip->bdbars.area) + (i * ICH_MAX_FRAGS * 2); | 2729 | ichdev->bdbar = ((u32 *)chip->bdbars.area) + |
2729 | ichdev->bdbar_addr = chip->bdbars.addr + (i * sizeof(u32) * ICH_MAX_FRAGS * 2); | 2730 | (i * ICH_MAX_FRAGS * 2); |
2731 | ichdev->bdbar_addr = chip->bdbars.addr + | ||
2732 | (i * sizeof(u32) * ICH_MAX_FRAGS * 2); | ||
2730 | int_sta_masks |= ichdev->int_sta_mask; | 2733 | int_sta_masks |= ichdev->int_sta_mask; |
2731 | } | 2734 | } |
2732 | chip->int_sta_reg = device_type == DEVICE_ALI ? ICH_REG_ALI_INTERRUPTSR : ICH_REG_GLOB_STA; | 2735 | chip->int_sta_reg = device_type == DEVICE_ALI ? |
2736 | ICH_REG_ALI_INTERRUPTSR : ICH_REG_GLOB_STA; | ||
2733 | chip->int_sta_mask = int_sta_masks; | 2737 | chip->int_sta_mask = int_sta_masks; |
2734 | 2738 | ||
2739 | /* request irq after initializaing int_sta_mask, etc */ | ||
2740 | if (request_irq(pci->irq, snd_intel8x0_interrupt, | ||
2741 | SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | ||
2742 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | ||
2743 | snd_intel8x0_free(chip); | ||
2744 | return -EBUSY; | ||
2745 | } | ||
2746 | chip->irq = pci->irq; | ||
2747 | pci_set_master(pci); | ||
2748 | synchronize_irq(chip->irq); | ||
2749 | |||
2735 | if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) { | 2750 | if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) { |
2736 | snd_intel8x0_free(chip); | 2751 | snd_intel8x0_free(chip); |
2737 | return err; | 2752 | return err; |
@@ -2782,20 +2797,12 @@ static struct shortname_table { | |||
2782 | static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | 2797 | static int __devinit snd_intel8x0_probe(struct pci_dev *pci, |
2783 | const struct pci_device_id *pci_id) | 2798 | const struct pci_device_id *pci_id) |
2784 | { | 2799 | { |
2785 | static int dev; | ||
2786 | snd_card_t *card; | 2800 | snd_card_t *card; |
2787 | intel8x0_t *chip; | 2801 | intel8x0_t *chip; |
2788 | int err; | 2802 | int err; |
2789 | struct shortname_table *name; | 2803 | struct shortname_table *name; |
2790 | 2804 | ||
2791 | if (dev >= SNDRV_CARDS) | 2805 | card = snd_card_new(index, id, THIS_MODULE, 0); |
2792 | return -ENODEV; | ||
2793 | if (!enable[dev]) { | ||
2794 | dev++; | ||
2795 | return -ENOENT; | ||
2796 | } | ||
2797 | |||
2798 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
2799 | if (card == NULL) | 2806 | if (card == NULL) |
2800 | return -ENOMEM; | 2807 | return -ENOMEM; |
2801 | 2808 | ||
@@ -2819,17 +2826,23 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2819 | } | 2826 | } |
2820 | } | 2827 | } |
2821 | 2828 | ||
2829 | if (buggy_irq < 0) { | ||
2830 | /* some Nforce[2] and ICH boards have problems with IRQ handling. | ||
2831 | * Needs to return IRQ_HANDLED for unknown irqs. | ||
2832 | */ | ||
2833 | if (pci_id->driver_data == DEVICE_NFORCE) | ||
2834 | buggy_irq = 1; | ||
2835 | else | ||
2836 | buggy_irq = 0; | ||
2837 | } | ||
2838 | |||
2822 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, | 2839 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, |
2823 | buggy_semaphore[dev], &chip)) < 0) { | 2840 | &chip)) < 0) { |
2824 | snd_card_free(card); | 2841 | snd_card_free(card); |
2825 | return err; | 2842 | return err; |
2826 | } | 2843 | } |
2827 | if (buggy_irq[dev]) | ||
2828 | chip->buggy_irq = 1; | ||
2829 | if (xbox[dev]) | ||
2830 | chip->xbox = 1; | ||
2831 | 2844 | ||
2832 | if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev], ac97_quirk[dev])) < 0) { | 2845 | if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) { |
2833 | snd_card_free(card); | 2846 | snd_card_free(card); |
2834 | return err; | 2847 | return err; |
2835 | } | 2848 | } |
@@ -2844,7 +2857,7 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2844 | "%s with %s at %#lx, irq %i", card->shortname, | 2857 | "%s with %s at %#lx, irq %i", card->shortname, |
2845 | snd_ac97_get_short_name(chip->ac97[0]), chip->addr, chip->irq); | 2858 | snd_ac97_get_short_name(chip->ac97[0]), chip->addr, chip->irq); |
2846 | 2859 | ||
2847 | if (! ac97_clock[dev]) | 2860 | if (! ac97_clock) |
2848 | intel8x0_measure_ac97_clock(chip); | 2861 | intel8x0_measure_ac97_clock(chip); |
2849 | 2862 | ||
2850 | if ((err = snd_card_register(card)) < 0) { | 2863 | if ((err = snd_card_register(card)) < 0) { |
@@ -2852,7 +2865,6 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2852 | return err; | 2865 | return err; |
2853 | } | 2866 | } |
2854 | pci_set_drvdata(pci, card); | 2867 | pci_set_drvdata(pci, card); |
2855 | dev++; | ||
2856 | return 0; | 2868 | return 0; |
2857 | } | 2869 | } |
2858 | 2870 | ||