aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/cs423x/cs4236.c
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/cs4236.c
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/cs4236.c')
-rw-r--r--sound/isa/cs423x/cs4236.c97
1 files changed, 45 insertions, 52 deletions
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 }