diff options
Diffstat (limited to 'sound/isa/ad1816a/ad1816a_lib.c')
-rw-r--r-- | sound/isa/ad1816a/ad1816a_lib.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 177eed3271bc..db64df6023e0 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c | |||
@@ -491,7 +491,7 @@ static int snd_ad1816a_capture_close(struct snd_pcm_substream *substream) | |||
491 | } | 491 | } |
492 | 492 | ||
493 | 493 | ||
494 | static void __devinit snd_ad1816a_init(struct snd_ad1816a *chip) | 494 | static void snd_ad1816a_init(struct snd_ad1816a *chip) |
495 | { | 495 | { |
496 | unsigned long flags; | 496 | unsigned long flags; |
497 | 497 | ||
@@ -511,6 +511,32 @@ static void __devinit snd_ad1816a_init(struct snd_ad1816a *chip) | |||
511 | spin_unlock_irqrestore(&chip->lock, flags); | 511 | spin_unlock_irqrestore(&chip->lock, flags); |
512 | } | 512 | } |
513 | 513 | ||
514 | #ifdef CONFIG_PM | ||
515 | void snd_ad1816a_suspend(struct snd_ad1816a *chip) | ||
516 | { | ||
517 | int reg; | ||
518 | unsigned long flags; | ||
519 | |||
520 | snd_pcm_suspend_all(chip->pcm); | ||
521 | spin_lock_irqsave(&chip->lock, flags); | ||
522 | for (reg = 0; reg < 48; reg++) | ||
523 | chip->image[reg] = snd_ad1816a_read(chip, reg); | ||
524 | spin_unlock_irqrestore(&chip->lock, flags); | ||
525 | } | ||
526 | |||
527 | void snd_ad1816a_resume(struct snd_ad1816a *chip) | ||
528 | { | ||
529 | int reg; | ||
530 | unsigned long flags; | ||
531 | |||
532 | snd_ad1816a_init(chip); | ||
533 | spin_lock_irqsave(&chip->lock, flags); | ||
534 | for (reg = 0; reg < 48; reg++) | ||
535 | snd_ad1816a_write(chip, reg, chip->image[reg]); | ||
536 | spin_unlock_irqrestore(&chip->lock, flags); | ||
537 | } | ||
538 | #endif | ||
539 | |||
514 | static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) | 540 | static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) |
515 | { | 541 | { |
516 | unsigned long flags; | 542 | unsigned long flags; |
@@ -548,7 +574,6 @@ static int snd_ad1816a_free(struct snd_ad1816a *chip) | |||
548 | snd_dma_disable(chip->dma2); | 574 | snd_dma_disable(chip->dma2); |
549 | free_dma(chip->dma2); | 575 | free_dma(chip->dma2); |
550 | } | 576 | } |
551 | kfree(chip); | ||
552 | return 0; | 577 | return 0; |
553 | } | 578 | } |
554 | 579 | ||
@@ -573,19 +598,13 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip) | |||
573 | 598 | ||
574 | int __devinit snd_ad1816a_create(struct snd_card *card, | 599 | int __devinit snd_ad1816a_create(struct snd_card *card, |
575 | unsigned long port, int irq, int dma1, int dma2, | 600 | unsigned long port, int irq, int dma1, int dma2, |
576 | struct snd_ad1816a **rchip) | 601 | struct snd_ad1816a *chip) |
577 | { | 602 | { |
578 | static struct snd_device_ops ops = { | 603 | static struct snd_device_ops ops = { |
579 | .dev_free = snd_ad1816a_dev_free, | 604 | .dev_free = snd_ad1816a_dev_free, |
580 | }; | 605 | }; |
581 | int error; | 606 | int error; |
582 | struct snd_ad1816a *chip; | ||
583 | |||
584 | *rchip = NULL; | ||
585 | 607 | ||
586 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
587 | if (chip == NULL) | ||
588 | return -ENOMEM; | ||
589 | chip->irq = -1; | 608 | chip->irq = -1; |
590 | chip->dma1 = -1; | 609 | chip->dma1 = -1; |
591 | chip->dma2 = -1; | 610 | chip->dma2 = -1; |
@@ -631,7 +650,6 @@ int __devinit snd_ad1816a_create(struct snd_card *card, | |||
631 | return error; | 650 | return error; |
632 | } | 651 | } |
633 | 652 | ||
634 | *rchip = chip; | ||
635 | return 0; | 653 | return 0; |
636 | } | 654 | } |
637 | 655 | ||