aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/cs423x
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-09-05 11:19:20 -0400
committerJaroslav Kysela <perex@suse.cz>2005-09-12 04:42:01 -0400
commit43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch)
tree8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/cs423x
parent16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (diff)
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver Wavefront drivers - Added snd_card_set_generic_dev() call. - Added SND_GENERIC_DRIVER to Kconfig. - Clean up the error path in probe if necessary. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/cs423x')
-rw-r--r--sound/isa/cs423x/cs4231.c46
-rw-r--r--sound/isa/cs423x/cs4236.c97
2 files changed, 67 insertions, 76 deletions
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 7640837659ea..9be5416bcb92 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -76,15 +76,15 @@ static int __init snd_card_cs4231_probe(int dev)
76 int err; 76 int err;
77 77
78 if (port[dev] == SNDRV_AUTO_PORT) { 78 if (port[dev] == SNDRV_AUTO_PORT) {
79 snd_printk("specify port\n"); 79 snd_printk(KERN_ERR "specify port\n");
80 return -EINVAL; 80 return -EINVAL;
81 } 81 }
82 if (irq[dev] == SNDRV_AUTO_IRQ) { 82 if (irq[dev] == SNDRV_AUTO_IRQ) {
83 snd_printk("specify irq\n"); 83 snd_printk(KERN_ERR "specify irq\n");
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 if (dma1[dev] == SNDRV_AUTO_DMA) { 86 if (dma1[dev] == SNDRV_AUTO_DMA) {
87 snd_printk("specify dma1\n"); 87 snd_printk(KERN_ERR "specify dma1\n");
88 return -EINVAL; 88 return -EINVAL;
89 } 89 }
90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev)
96 dma1[dev], 96 dma1[dev],
97 dma2[dev], 97 dma2[dev],
98 CS4231_HW_DETECT, 98 CS4231_HW_DETECT,
99 0, &chip)) < 0) { 99 0, &chip)) < 0)
100 snd_card_free(card); 100 goto _err;
101 return err;
102 }
103 101
104 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 102 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
105 snd_card_free(card); 103 goto _err;
106 return err;
107 }
108 104
109 strcpy(card->driver, "CS4231"); 105 strcpy(card->driver, "CS4231");
110 strcpy(card->shortname, pcm->name); 106 strcpy(card->shortname, pcm->name);
@@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev)
113 if (dma2[dev] >= 0) 109 if (dma2[dev] >= 0)
114 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 110 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
115 111
116 if ((err = snd_cs4231_mixer(chip)) < 0) { 112 if ((err = snd_cs4231_mixer(chip)) < 0)
117 snd_card_free(card); 113 goto _err;
118 return err; 114 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
119 } 115 goto _err;
120 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
121 snd_card_free(card);
122 return err;
123 }
124 116
125 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 117 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
126 if (mpu_irq[dev] == SNDRV_AUTO_IRQ) 118 if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
@@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev)
130 mpu_irq[dev], 122 mpu_irq[dev],
131 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, 123 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0,
132 NULL) < 0) 124 NULL) < 0)
133 printk(KERN_ERR "cs4231: MPU401 not detected\n"); 125 printk(KERN_WARNING "cs4231: MPU401 not detected\n");
134 }
135 if ((err = snd_card_register(card)) < 0) {
136 snd_card_free(card);
137 return err;
138 } 126 }
127
128 if ((err = snd_card_set_generic_dev(card)) < 0)
129 goto _err;
130
131 if ((err = snd_card_register(card)) < 0)
132 goto _err;
139 snd_cs4231_cards[dev] = card; 133 snd_cs4231_cards[dev] = card;
140 return 0; 134 return 0;
135
136 _err:
137 snd_card_free(card);
138 return err;
141} 139}
142 140
143static int __init alsa_card_cs4231_init(void) 141static int __init alsa_card_cs4231_init(void)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 39f4eff44f5c..d28315dc72f7 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -387,6 +387,12 @@ static void snd_card_cs4236_free(snd_card_t *card)
387 } 387 }
388} 388}
389 389
390#ifdef CONFIG_PNP
391#define is_isapnp_selected(dev) isapnp[dev]
392#else
393#define is_isapnp_selected(dev) 0
394#endif
395
390static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, 396static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
391 const struct pnp_card_device_id *pid) 397 const struct pnp_card_device_id *pid)
392{ 398{
@@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
397 opl3_t *opl3; 403 opl3_t *opl3;
398 int err; 404 int err;
399 405
400#ifdef CONFIG_PNP 406 if (! is_isapnp_selected(dev)) {
401 if (!isapnp[dev]) {
402#endif
403 if (port[dev] == SNDRV_AUTO_PORT) { 407 if (port[dev] == SNDRV_AUTO_PORT) {
404 snd_printk("specify port\n"); 408 snd_printk(KERN_ERR "specify port\n");
405 return -EINVAL; 409 return -EINVAL;
406 } 410 }
407 if (cport[dev] == SNDRV_AUTO_PORT) { 411 if (cport[dev] == SNDRV_AUTO_PORT) {
408 snd_printk("specify cport\n"); 412 snd_printk(KERN_ERR "specify cport\n");
409 return -EINVAL; 413 return -EINVAL;
410 } 414 }
411#ifdef CONFIG_PNP
412 } 415 }
413#endif
414 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 416 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
415 sizeof(struct snd_card_cs4236)); 417 sizeof(struct snd_card_cs4236));
416 if (card == NULL) 418 if (card == NULL)
@@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
421 if (isapnp[dev]) { 423 if (isapnp[dev]) {
422 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { 424 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) {
423 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); 425 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
424 snd_card_free(card); 426 goto _err;
425 return -ENXIO;
426 } 427 }
427 snd_card_set_dev(card, &pcard->card->dev); 428 snd_card_set_dev(card, &pcard->card->dev);
428 } 429 }
@@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
430 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) 431 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT)
431 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { 432 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) {
432 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); 433 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
433 snd_card_free(card); 434 err = -EBUSY;
434 return -ENOMEM; 435 goto _err;
435 } 436 }
436 437
437#ifdef CS4232 438#ifdef CS4232
@@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
443 dma2[dev], 444 dma2[dev],
444 CS4231_HW_DETECT, 445 CS4231_HW_DETECT,
445 0, 446 0,
446 &chip)) < 0) { 447 &chip)) < 0)
447 snd_card_free(card); 448 goto _err;
448 return err; 449
449 } 450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 451 goto _err;
451 snd_card_free(card); 452
452 return err; 453 if ((err = snd_cs4231_mixer(chip)) < 0)
453 } 454 goto _err;
454 if ((err = snd_cs4231_mixer(chip)) < 0) {
455 snd_card_free(card);
456 return err;
457 }
458 455
459#else /* CS4236 */ 456#else /* CS4236 */
460 if ((err = snd_cs4236_create(card, 457 if ((err = snd_cs4236_create(card,
@@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
465 dma2[dev], 462 dma2[dev],
466 CS4231_HW_DETECT, 463 CS4231_HW_DETECT,
467 0, 464 0,
468 &chip)) < 0) { 465 &chip)) < 0)
469 snd_card_free(card); 466 goto _err;
470 return err; 467
471 } 468 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
472 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) { 469 goto _err;
473 snd_card_free(card); 470
474 return err; 471 if ((err = snd_cs4236_mixer(chip)) < 0)
475 } 472 goto _err;
476 if ((err = snd_cs4236_mixer(chip)) < 0) {
477 snd_card_free(card);
478 return err;
479 }
480#endif 473#endif
481 strcpy(card->driver, pcm->name); 474 strcpy(card->driver, pcm->name);
482 strcpy(card->shortname, pcm->name); 475 strcpy(card->shortname, pcm->name);
@@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
488 if (dma2[dev] >= 0) 481 if (dma2[dev] >= 0)
489 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 482 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
490 483
491 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { 484 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
492 snd_card_free(card); 485 goto _err;
493 return err;
494 }
495 486
496 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 487 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
497 if (snd_opl3_create(card, 488 if (snd_opl3_create(card,
498 fm_port[dev], fm_port[dev] + 2, 489 fm_port[dev], fm_port[dev] + 2,
499 OPL3_HW_OPL3_CS, 0, &opl3) < 0) { 490 OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
500 printk(KERN_ERR IDENT ": OPL3 not detected\n"); 491 printk(KERN_WARNING IDENT ": OPL3 not detected\n");
501 } else { 492 } else {
502 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 493 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
503 snd_card_free(card); 494 goto _err;
504 return err;
505 }
506 } 495 }
507 } 496 }
508 497
@@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
513 mpu_port[dev], 0, 502 mpu_port[dev], 0,
514 mpu_irq[dev], 503 mpu_irq[dev],
515 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) 504 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
516 printk(KERN_ERR IDENT ": MPU401 not detected\n"); 505 printk(KERN_WARNING IDENT ": MPU401 not detected\n");
517 }
518 if ((err = snd_card_register(card)) < 0) {
519 snd_card_free(card);
520 return err;
521 } 506 }
507
508 if ((err = snd_card_set_generic_dev(card)) < 0)
509 goto _err;
510
511 if ((err = snd_card_register(card)) < 0)
512 goto _err;
522 if (pcard) 513 if (pcard)
523 pnp_set_card_drvdata(pcard, card); 514 pnp_set_card_drvdata(pcard, card);
524 else 515 else
525 snd_cs4236_legacy[dev] = card; 516 snd_cs4236_legacy[dev] = card;
526 return 0; 517 return 0;
518
519 _err:
520 snd_card_free(card);
521 return err;
527} 522}
528 523
529#ifdef CONFIG_PNP 524#ifdef CONFIG_PNP
@@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void)
569 for (dev = 0; dev < SNDRV_CARDS; dev++) { 564 for (dev = 0; dev < SNDRV_CARDS; dev++) {
570 if (!enable[dev]) 565 if (!enable[dev])
571 continue; 566 continue;
572#ifdef CONFIG_PNP 567 if (is_isapnp_selected(dev))
573 if (isapnp[dev])
574 continue; 568 continue;
575#endif
576 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) 569 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0)
577 cards++; 570 cards++;
578 } 571 }