diff options
| -rw-r--r-- | include/sound/es1688.h | 1 | ||||
| -rw-r--r-- | sound/isa/es1688/es1688_lib.c | 34 |
2 files changed, 24 insertions, 11 deletions
diff --git a/include/sound/es1688.h b/include/sound/es1688.h index 3ec7ecbe2502..f752dd33dfaf 100644 --- a/include/sound/es1688.h +++ b/include/sound/es1688.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #define ES1688_HW_AUTO 0x0000 | 29 | #define ES1688_HW_AUTO 0x0000 |
| 30 | #define ES1688_HW_688 0x0001 | 30 | #define ES1688_HW_688 0x0001 |
| 31 | #define ES1688_HW_1688 0x0002 | 31 | #define ES1688_HW_1688 0x0002 |
| 32 | #define ES1688_HW_UNDEF 0x0003 | ||
| 32 | 33 | ||
| 33 | struct snd_es1688 { | 34 | struct snd_es1688 { |
| 34 | unsigned long port; /* port of ESS chip */ | 35 | unsigned long port; /* port of ESS chip */ |
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 1d47be8170b5..b3b4f15e45ba 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c | |||
| @@ -612,10 +612,10 @@ static int snd_es1688_capture_close(struct snd_pcm_substream *substream) | |||
| 612 | 612 | ||
| 613 | static int snd_es1688_free(struct snd_es1688 *chip) | 613 | static int snd_es1688_free(struct snd_es1688 *chip) |
| 614 | { | 614 | { |
| 615 | if (chip->res_port) { | 615 | if (chip->hardware != ES1688_HW_UNDEF) |
| 616 | snd_es1688_init(chip, 0); | 616 | snd_es1688_init(chip, 0); |
| 617 | if (chip->res_port) | ||
| 617 | release_and_free_resource(chip->res_port); | 618 | release_and_free_resource(chip->res_port); |
| 618 | } | ||
| 619 | if (chip->irq >= 0) | 619 | if (chip->irq >= 0) |
| 620 | free_irq(chip->irq, (void *) chip); | 620 | free_irq(chip->irq, (void *) chip); |
| 621 | if (chip->dma8 >= 0) { | 621 | if (chip->dma8 >= 0) { |
| @@ -657,19 +657,27 @@ int snd_es1688_create(struct snd_card *card, | |||
| 657 | return -ENOMEM; | 657 | return -ENOMEM; |
| 658 | chip->irq = -1; | 658 | chip->irq = -1; |
| 659 | chip->dma8 = -1; | 659 | chip->dma8 = -1; |
| 660 | chip->hardware = ES1688_HW_UNDEF; | ||
| 660 | 661 | ||
| 661 | if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { | 662 | chip->res_port = request_region(port + 4, 12, "ES1688"); |
| 663 | if (chip->res_port == NULL) { | ||
| 662 | snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); | 664 | snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); |
| 663 | return -EBUSY; | 665 | err = -EBUSY; |
| 666 | goto exit; | ||
| 664 | } | 667 | } |
| 665 | if (request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip)) { | 668 | |
| 669 | err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip); | ||
| 670 | if (err < 0) { | ||
| 666 | snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); | 671 | snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); |
| 667 | return -EBUSY; | 672 | goto exit; |
| 668 | } | 673 | } |
| 674 | |||
| 669 | chip->irq = irq; | 675 | chip->irq = irq; |
| 670 | if (request_dma(dma8, "ES1688")) { | 676 | err = request_dma(dma8, "ES1688"); |
| 677 | |||
| 678 | if (err < 0) { | ||
| 671 | snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); | 679 | snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); |
| 672 | return -EBUSY; | 680 | goto exit; |
| 673 | } | 681 | } |
| 674 | chip->dma8 = dma8; | 682 | chip->dma8 = dma8; |
| 675 | 683 | ||
| @@ -685,14 +693,18 @@ int snd_es1688_create(struct snd_card *card, | |||
| 685 | 693 | ||
| 686 | err = snd_es1688_probe(chip); | 694 | err = snd_es1688_probe(chip); |
| 687 | if (err < 0) | 695 | if (err < 0) |
| 688 | return err; | 696 | goto exit; |
| 689 | 697 | ||
| 690 | err = snd_es1688_init(chip, 1); | 698 | err = snd_es1688_init(chip, 1); |
| 691 | if (err < 0) | 699 | if (err < 0) |
| 692 | return err; | 700 | goto exit; |
| 693 | 701 | ||
| 694 | /* Register device */ | 702 | /* Register device */ |
| 695 | return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | 703 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
| 704 | exit: | ||
| 705 | if (err) | ||
| 706 | snd_es1688_free(chip); | ||
| 707 | return err; | ||
| 696 | } | 708 | } |
| 697 | 709 | ||
| 698 | static struct snd_pcm_ops snd_es1688_playback_ops = { | 710 | static struct snd_pcm_ops snd_es1688_playback_ops = { |
