diff options
Diffstat (limited to 'sound/isa/opti9xx')
-rw-r--r-- | sound/isa/opti9xx/miro.c | 2 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 121 |
2 files changed, 80 insertions, 43 deletions
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index b865e45a8f9b..5913717c1be6 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip, | |||
1558 | 1558 | ||
1559 | err = pnp_activate_dev(devmc); | 1559 | err = pnp_activate_dev(devmc); |
1560 | if (err < 0) { | 1560 | if (err < 0) { |
1561 | snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", | 1561 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", |
1562 | err); | 1562 | err); |
1563 | return err; | 1563 | return err; |
1564 | } | 1564 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index a4af53b5c1cf..4d2d0405bdc7 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -144,12 +144,8 @@ struct snd_opti9xx { | |||
144 | 144 | ||
145 | spinlock_t lock; | 145 | spinlock_t lock; |
146 | 146 | ||
147 | long wss_base; | ||
147 | int irq; | 148 | int irq; |
148 | |||
149 | #ifdef CONFIG_PNP | ||
150 | struct pnp_dev *dev; | ||
151 | struct pnp_dev *devmpu; | ||
152 | #endif /* CONFIG_PNP */ | ||
153 | }; | 149 | }; |
154 | 150 | ||
155 | static int snd_opti9xx_pnp_is_probed; | 151 | static int snd_opti9xx_pnp_is_probed; |
@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed; | |||
159 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { | 155 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { |
160 | #ifndef OPTi93X | 156 | #ifndef OPTi93X |
161 | /* OPTi 82C924 */ | 157 | /* OPTi 82C924 */ |
162 | { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, | 158 | { .id = "OPT0924", |
159 | .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } }, | ||
160 | .driver_data = 0x0924 }, | ||
163 | /* OPTi 82C925 */ | 161 | /* OPTi 82C925 */ |
164 | { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, | 162 | { .id = "OPT0925", |
163 | .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } }, | ||
164 | .driver_data = 0x0925 }, | ||
165 | #else | 165 | #else |
166 | /* OPTi 82C931/3 */ | 166 | /* OPTi 82C931/3 */ |
167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, | 167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, |
168 | .driver_data = 0x0931 }, | ||
168 | #endif /* OPTi93X */ | 169 | #endif /* OPTi93X */ |
169 | { .id = "" } | 170 | { .id = "" } |
170 | }; | 171 | }; |
@@ -207,24 +208,35 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
207 | chip->hardware = hardware; | 208 | chip->hardware = hardware; |
208 | strcpy(chip->name, snd_opti9xx_names[hardware]); | 209 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
209 | 210 | ||
210 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
211 | |||
212 | spin_lock_init(&chip->lock); | 211 | spin_lock_init(&chip->lock); |
213 | 212 | ||
214 | chip->irq = -1; | 213 | chip->irq = -1; |
215 | 214 | ||
215 | #ifndef OPTi93X | ||
216 | #ifdef CONFIG_PNP | ||
217 | if (isapnp && chip->mc_base) | ||
218 | /* PnP resource gives the least 10 bits */ | ||
219 | chip->mc_base |= 0xc00; | ||
220 | else | ||
221 | #endif /* CONFIG_PNP */ | ||
222 | { | ||
223 | chip->mc_base = 0xf8c; | ||
224 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
225 | } | ||
226 | #else | ||
227 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
228 | #endif | ||
229 | |||
216 | switch (hardware) { | 230 | switch (hardware) { |
217 | #ifndef OPTi93X | 231 | #ifndef OPTi93X |
218 | case OPTi9XX_HW_82C928: | 232 | case OPTi9XX_HW_82C928: |
219 | case OPTi9XX_HW_82C929: | 233 | case OPTi9XX_HW_82C929: |
220 | chip->mc_base = 0xf8c; | ||
221 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; | 234 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; |
222 | chip->pwd_reg = 3; | 235 | chip->pwd_reg = 3; |
223 | break; | 236 | break; |
224 | 237 | ||
225 | case OPTi9XX_HW_82C924: | 238 | case OPTi9XX_HW_82C924: |
226 | case OPTi9XX_HW_82C925: | 239 | case OPTi9XX_HW_82C925: |
227 | chip->mc_base = 0xf8c; | ||
228 | chip->password = 0xe5; | 240 | chip->password = 0xe5; |
229 | chip->pwd_reg = 3; | 241 | chip->pwd_reg = 3; |
230 | break; | 242 | break; |
@@ -292,7 +304,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, | |||
292 | spin_unlock_irqrestore(&chip->lock, flags); | 304 | spin_unlock_irqrestore(&chip->lock, flags); |
293 | return retval; | 305 | return retval; |
294 | } | 306 | } |
295 | 307 | ||
296 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | 308 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, |
297 | unsigned char value) | 309 | unsigned char value) |
298 | { | 310 | { |
@@ -341,7 +353,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
341 | 353 | ||
342 | 354 | ||
343 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | 355 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, |
344 | long wss_base, | 356 | long port, |
345 | int irq, int dma1, int dma2, | 357 | int irq, int dma1, int dma2, |
346 | long mpu_port, int mpu_irq) | 358 | long mpu_port, int mpu_irq) |
347 | { | 359 | { |
@@ -354,16 +366,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
354 | switch (chip->hardware) { | 366 | switch (chip->hardware) { |
355 | #ifndef OPTi93X | 367 | #ifndef OPTi93X |
356 | case OPTi9XX_HW_82C924: | 368 | case OPTi9XX_HW_82C924: |
369 | /* opti 929 mode (?), OPL3 clock output, audio enable */ | ||
357 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); | 370 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); |
371 | /* enable wave audio */ | ||
358 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 372 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
359 | 373 | ||
360 | case OPTi9XX_HW_82C925: | 374 | case OPTi9XX_HW_82C925: |
375 | /* enable WSS mode */ | ||
361 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | 376 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); |
377 | /* OPL3 FM synthesis */ | ||
362 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); | 378 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); |
379 | /* disable Sound Blaster IRQ and DMA */ | ||
363 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 380 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
364 | #ifdef CS4231 | 381 | #ifdef CS4231 |
382 | /* cs4231/4248 fix enabled */ | ||
365 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | 383 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); |
366 | #else | 384 | #else |
385 | /* cs4231/4248 fix disabled */ | ||
367 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); | 386 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); |
368 | #endif /* CS4231 */ | 387 | #endif /* CS4231 */ |
369 | break; | 388 | break; |
@@ -411,21 +430,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
411 | return -EINVAL; | 430 | return -EINVAL; |
412 | } | 431 | } |
413 | 432 | ||
414 | switch (wss_base) { | 433 | /* PnP resource says it decodes only 10 bits of address */ |
415 | case 0x530: | 434 | switch (port & 0x3ff) { |
435 | case 0x130: | ||
436 | chip->wss_base = 0x530; | ||
416 | wss_base_bits = 0x00; | 437 | wss_base_bits = 0x00; |
417 | break; | 438 | break; |
418 | case 0x604: | 439 | case 0x204: |
440 | chip->wss_base = 0x604; | ||
419 | wss_base_bits = 0x03; | 441 | wss_base_bits = 0x03; |
420 | break; | 442 | break; |
421 | case 0xe80: | 443 | case 0x280: |
444 | chip->wss_base = 0xe80; | ||
422 | wss_base_bits = 0x01; | 445 | wss_base_bits = 0x01; |
423 | break; | 446 | break; |
424 | case 0xf40: | 447 | case 0x340: |
448 | chip->wss_base = 0xf40; | ||
425 | wss_base_bits = 0x02; | 449 | wss_base_bits = 0x02; |
426 | break; | 450 | break; |
427 | default: | 451 | default: |
428 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); | 452 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port); |
429 | goto __skip_base; | 453 | goto __skip_base; |
430 | } | 454 | } |
431 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); | 455 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); |
@@ -487,7 +511,7 @@ __skip_base: | |||
487 | #endif /* CS4231 || OPTi93X */ | 511 | #endif /* CS4231 || OPTi93X */ |
488 | 512 | ||
489 | #ifndef OPTi93X | 513 | #ifndef OPTi93X |
490 | outb(irq_bits << 3 | dma_bits, wss_base); | 514 | outb(irq_bits << 3 | dma_bits, chip->wss_base); |
491 | #else /* OPTi93X */ | 515 | #else /* OPTi93X */ |
492 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); | 516 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); |
493 | #endif /* OPTi93X */ | 517 | #endif /* OPTi93X */ |
@@ -729,15 +753,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
729 | { | 753 | { |
730 | struct pnp_dev *pdev; | 754 | struct pnp_dev *pdev; |
731 | int err; | 755 | int err; |
756 | struct pnp_dev *devmpu; | ||
757 | #ifndef OPTi93X | ||
758 | struct pnp_dev *devmc; | ||
759 | #endif | ||
732 | 760 | ||
733 | chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); | 761 | pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); |
734 | if (chip->dev == NULL) | 762 | if (pdev == NULL) |
735 | return -EBUSY; | 763 | return -EBUSY; |
736 | 764 | ||
737 | chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); | ||
738 | |||
739 | pdev = chip->dev; | ||
740 | |||
741 | err = pnp_activate_dev(pdev); | 765 | err = pnp_activate_dev(pdev); |
742 | if (err < 0) { | 766 | if (err < 0) { |
743 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); | 767 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); |
@@ -750,9 +774,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
750 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; | 774 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; |
751 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; | 775 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; |
752 | #else | 776 | #else |
753 | if (pid->driver_data != 0x0924) | 777 | devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); |
754 | port = pnp_port_start(pdev, 1); | 778 | if (devmc == NULL) |
779 | return -EBUSY; | ||
780 | |||
781 | err = pnp_activate_dev(devmc); | ||
782 | if (err < 0) { | ||
783 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err); | ||
784 | return err; | ||
785 | } | ||
786 | |||
787 | port = pnp_port_start(pdev, 1); | ||
755 | fm_port = pnp_port_start(pdev, 2) + 8; | 788 | fm_port = pnp_port_start(pdev, 2) + 8; |
789 | /* | ||
790 | * The MC(0) is never accessed and card does not | ||
791 | * include it in the PnP resource range. OPTI93x include it. | ||
792 | */ | ||
793 | chip->mc_base = pnp_port_start(devmc, 0) - 1; | ||
794 | chip->mc_base_size = pnp_port_len(devmc, 0) + 1; | ||
756 | #endif /* OPTi93X */ | 795 | #endif /* OPTi93X */ |
757 | irq = pnp_irq(pdev, 0); | 796 | irq = pnp_irq(pdev, 0); |
758 | dma1 = pnp_dma(pdev, 0); | 797 | dma1 = pnp_dma(pdev, 0); |
@@ -760,16 +799,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
760 | dma2 = pnp_dma(pdev, 1); | 799 | dma2 = pnp_dma(pdev, 1); |
761 | #endif /* CS4231 || OPTi93X */ | 800 | #endif /* CS4231 || OPTi93X */ |
762 | 801 | ||
763 | pdev = chip->devmpu; | 802 | devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); |
764 | if (pdev && mpu_port > 0) { | 803 | |
765 | err = pnp_activate_dev(pdev); | 804 | if (devmpu && mpu_port > 0) { |
805 | err = pnp_activate_dev(devmpu); | ||
766 | if (err < 0) { | 806 | if (err < 0) { |
767 | snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); | 807 | snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); |
768 | mpu_port = -1; | 808 | mpu_port = -1; |
769 | chip->devmpu = NULL; | ||
770 | } else { | 809 | } else { |
771 | mpu_port = pnp_port_start(pdev, 0); | 810 | mpu_port = pnp_port_start(devmpu, 0); |
772 | mpu_irq = pnp_irq(pdev, 0); | 811 | mpu_irq = pnp_irq(devmpu, 0); |
773 | } | 812 | } |
774 | } | 813 | } |
775 | return pid->driver_data; | 814 | return pid->driver_data; |
@@ -824,7 +863,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
824 | if (error) | 863 | if (error) |
825 | return error; | 864 | return error; |
826 | 865 | ||
827 | error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, | 866 | error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2, |
828 | #ifdef OPTi93X | 867 | #ifdef OPTi93X |
829 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, | 868 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
830 | #else | 869 | #else |
@@ -865,10 +904,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
865 | sprintf(card->shortname, "OPTi %s", card->driver); | 904 | sprintf(card->shortname, "OPTi %s", card->driver); |
866 | #if defined(CS4231) || defined(OPTi93X) | 905 | #if defined(CS4231) || defined(OPTi93X) |
867 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", | 906 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", |
868 | card->shortname, pcm->name, port + 4, irq, dma1, xdma2); | 907 | card->shortname, pcm->name, |
908 | chip->wss_base + 4, irq, dma1, xdma2); | ||
869 | #else | 909 | #else |
870 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", | 910 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", |
871 | card->shortname, pcm->name, port + 4, irq, dma1); | 911 | card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); |
872 | #endif /* CS4231 || OPTi93X */ | 912 | #endif /* CS4231 || OPTi93X */ |
873 | 913 | ||
874 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) | 914 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
@@ -1062,9 +1102,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
1062 | snd_card_free(card); | 1102 | snd_card_free(card); |
1063 | return error; | 1103 | return error; |
1064 | } | 1104 | } |
1065 | if (hw <= OPTi9XX_HW_82C930) | ||
1066 | chip->mc_base -= 0x80; | ||
1067 | |||
1068 | error = snd_opti9xx_read_check(chip); | 1105 | error = snd_opti9xx_read_check(chip); |
1069 | if (error) { | 1106 | if (error) { |
1070 | snd_printk(KERN_ERR "OPTI chip not found\n"); | 1107 | snd_printk(KERN_ERR "OPTI chip not found\n"); |