aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/cmi8330.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/cmi8330.c')
-rw-r--r--sound/isa/cmi8330.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 1fce8b9f37cf..5252206ea388 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip)
438/* 438/*
439 */ 439 */
440 440
441#ifdef CONFIG_PNP
442#define is_isapnp_selected(dev) isapnp[dev]
443#else
444#define is_isapnp_selected(dev) 0
445#endif
446
447#define PFX "cmi8330: "
448
441static int __devinit snd_cmi8330_probe(int dev, 449static int __devinit snd_cmi8330_probe(int dev,
442 struct pnp_card_link *pcard, 450 struct pnp_card_link *pcard,
443 const struct pnp_card_device_id *pid) 451 const struct pnp_card_device_id *pid)
444{ 452{
445 snd_card_t *card; 453 snd_card_t *card;
446 struct snd_cmi8330 *acard; 454 struct snd_cmi8330 *acard;
447 unsigned long flags;
448 int i, err; 455 int i, err;
449 456
450#ifdef CONFIG_PNP 457 if (! is_isapnp_selected(dev)) {
451 if (!isapnp[dev]) {
452#endif
453 if (wssport[dev] == SNDRV_AUTO_PORT) { 458 if (wssport[dev] == SNDRV_AUTO_PORT) {
454 snd_printk("specify wssport\n"); 459 snd_printk(KERN_ERR PFX "specify wssport\n");
455 return -EINVAL; 460 return -EINVAL;
456 } 461 }
457 if (sbport[dev] == SNDRV_AUTO_PORT) { 462 if (sbport[dev] == SNDRV_AUTO_PORT) {
458 snd_printk("specify sbport\n"); 463 snd_printk(KERN_ERR PFX "specify sbport\n");
459 return -EINVAL; 464 return -EINVAL;
460 } 465 }
461#ifdef CONFIG_PNP
462 } 466 }
463#endif 467
464 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 468 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
465 sizeof(struct snd_cmi8330)); 469 sizeof(struct snd_cmi8330));
466 if (card == NULL) { 470 if (card == NULL) {
467 snd_printk("could not get a new card\n"); 471 snd_printk(KERN_ERR PFX "could not get a new card\n");
468 return -ENOMEM; 472 return -ENOMEM;
469 } 473 }
470 acard = (struct snd_cmi8330 *)card->private_data; 474 acard = (struct snd_cmi8330 *)card->private_data;
@@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev,
473#ifdef CONFIG_PNP 477#ifdef CONFIG_PNP
474 if (isapnp[dev]) { 478 if (isapnp[dev]) {
475 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { 479 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
476 snd_printk("PnP detection failed\n"); 480 snd_printk(KERN_ERR PFX "PnP detection failed\n");
477 snd_card_free(card); 481 goto _err;
478 return err;
479 } 482 }
480 snd_card_set_dev(card, &pcard->card->dev); 483 snd_card_set_dev(card, &pcard->card->dev);
481 } 484 }
@@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev,
487 wssdma[dev], 490 wssdma[dev],
488 AD1848_HW_DETECT, 491 AD1848_HW_DETECT,
489 &acard->wss)) < 0) { 492 &acard->wss)) < 0) {
490 snd_printk("(AD1848) device busy??\n"); 493 snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
491 snd_card_free(card); 494 goto _err;
492 return err;
493 } 495 }
494 if (acard->wss->hardware != AD1848_HW_CMI8330) { 496 if (acard->wss->hardware != AD1848_HW_CMI8330) {
495 snd_printk("(AD1848) not found during probe\n"); 497 snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
496 snd_card_free(card); 498 err = -ENODEV;
497 return -ENODEV; 499 goto _err;
498 } 500 }
499 501
500 if ((err = snd_sbdsp_create(card, sbport[dev], 502 if ((err = snd_sbdsp_create(card, sbport[dev],
@@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev,
503 sbdma8[dev], 505 sbdma8[dev],
504 sbdma16[dev], 506 sbdma16[dev],
505 SB_HW_AUTO, &acard->sb)) < 0) { 507 SB_HW_AUTO, &acard->sb)) < 0) {
506 snd_printk("(SB16) device busy??\n"); 508 snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
507 snd_card_free(card); 509 goto _err;
508 return err;
509 } 510 }
510 if (acard->sb->hardware != SB_HW_16) { 511 if (acard->sb->hardware != SB_HW_16) {
511 snd_printk("(SB16) not found during probe\n"); 512 snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
512 snd_card_free(card); 513 goto _err;
513 return -ENODEV;
514 } 514 }
515 515
516 spin_lock_irqsave(&acard->wss->reg_lock, flags);
517 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ 516 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
518 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) 517 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
519 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); 518 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
520 spin_unlock_irqrestore(&acard->wss->reg_lock, flags);
521 519
522 if ((err = snd_cmi8330_mixer(card, acard)) < 0) { 520 if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
523 snd_printk("failed to create mixers\n"); 521 snd_printk(KERN_ERR PFX "failed to create mixers\n");
524 snd_card_free(card); 522 goto _err;
525 return err;
526 } 523 }
527 524
528 if ((err = snd_cmi8330_pcm(card, acard)) < 0) { 525 if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
529 snd_printk("failed to create pcms\n"); 526 snd_printk(KERN_ERR PFX "failed to create pcms\n");
530 snd_card_free(card); 527 goto _err;
531 return err;
532 } 528 }
533 529
534 strcpy(card->driver, "CMI8330/C3D"); 530 strcpy(card->driver, "CMI8330/C3D");
@@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev,
539 wssirq[dev], 535 wssirq[dev],
540 wssdma[dev]); 536 wssdma[dev]);
541 537
542 if ((err = snd_card_register(card)) < 0) { 538 if ((err = snd_card_set_generic_dev(card)) < 0)
543 snd_card_free(card); 539 goto _err;
544 return err; 540
545 } 541 if ((err = snd_card_register(card)) < 0)
542 goto _err;
546 543
547 if (pcard) 544 if (pcard)
548 pnp_set_card_drvdata(pcard, card); 545 pnp_set_card_drvdata(pcard, card);
549 else 546 else
550 snd_cmi8330_legacy[dev] = card; 547 snd_cmi8330_legacy[dev] = card;
551 return 0; 548 return 0;
549
550 _err:
551 snd_card_free(card);
552 return err;
552} 553}
553 554
554#ifdef CONFIG_PNP 555#ifdef CONFIG_PNP
@@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void)
594 for (dev = 0; dev < SNDRV_CARDS; dev++) { 595 for (dev = 0; dev < SNDRV_CARDS; dev++) {
595 if (!enable[dev]) 596 if (!enable[dev])
596 continue; 597 continue;
597#ifdef CONFIG_PNP 598 if (is_isapnp_selected(dev))
598 if (isapnp[dev])
599 continue; 599 continue;
600#endif
601 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) 600 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
602 cards++; 601 cards++;
603 } 602 }