aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/ad1848.h5
-rw-r--r--sound/isa/ad1848/ad1848_lib.c28
2 files changed, 20 insertions, 13 deletions
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index a03807088b10..1a2759f3a292 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -148,6 +148,11 @@ struct snd_ad1848 {
148 int dma_size; 148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150 150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
151 spinlock_t reg_lock; 156 spinlock_t reg_lock;
152 struct semaphore open_mutex; 157 struct semaphore open_mutex;
153}; 158};
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 55ba32d4a22e..83764c941533 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -24,7 +24,6 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/pm.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <linux/ioport.h> 28#include <linux/ioport.h>
30#include <sound/core.h> 29#include <sound/core.h>
@@ -642,29 +641,30 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) {
642} 641}
643 642
644#ifdef CONFIG_PM 643#ifdef CONFIG_PM
645static int snd_ad1848_suspend(struct snd_card *card, pm_message_t state) 644static void snd_ad1848_suspend(struct snd_ad1848 *chip)
646{ 645{
647 struct snd_ad1848 *chip = card->pm_private_data;
648
649 snd_pcm_suspend_all(chip->pcm); 646 snd_pcm_suspend_all(chip->pcm);
650 /* FIXME: save registers? */
651
652 if (chip->thinkpad_flag) 647 if (chip->thinkpad_flag)
653 snd_ad1848_thinkpad_twiddle(chip, 0); 648 snd_ad1848_thinkpad_twiddle(chip, 0);
654
655 return 0;
656} 649}
657 650
658static int snd_ad1848_resume(struct snd_card *card) 651static void snd_ad1848_resume(struct snd_ad1848 *chip)
659{ 652{
660 struct snd_ad1848 *chip = card->pm_private_data; 653 int i;
661 654
662 if (chip->thinkpad_flag) 655 if (chip->thinkpad_flag)
663 snd_ad1848_thinkpad_twiddle(chip, 1); 656 snd_ad1848_thinkpad_twiddle(chip, 1);
664 657
665 /* FIXME: restore registers? */ 658 /* clear any pendings IRQ */
659 inb(AD1848P(chip, STATUS));
660 outb(0, AD1848P(chip, STATUS));
661 mb();
666 662
667 return 0; 663 snd_ad1848_mce_down(chip);
664 for (i = 0; i < 16; i++)
665 snd_ad1848_out(chip, i, chip->image[i]);
666 snd_ad1848_mce_up(chip);
667 snd_ad1848_mce_down(chip);
668} 668}
669#endif /* CONFIG_PM */ 669#endif /* CONFIG_PM */
670 670
@@ -919,7 +919,6 @@ int snd_ad1848_create(struct snd_card *card,
919 chip->thinkpad_flag = 1; 919 chip->thinkpad_flag = 1;
920 chip->hardware = AD1848_HW_DETECT; /* reset */ 920 chip->hardware = AD1848_HW_DETECT; /* reset */
921 snd_ad1848_thinkpad_twiddle(chip, 1); 921 snd_ad1848_thinkpad_twiddle(chip, 1);
922 snd_card_set_isa_pm_callback(card, snd_ad1848_suspend, snd_ad1848_resume, chip);
923 } 922 }
924 923
925 if (snd_ad1848_probe(chip) < 0) { 924 if (snd_ad1848_probe(chip) < 0) {
@@ -933,6 +932,9 @@ int snd_ad1848_create(struct snd_card *card,
933 return err; 932 return err;
934 } 933 }
935 934
935 chip->suspend = snd_ad1848_suspend;
936 chip->resume = snd_ad1848_resume;
937
936 *rchip = chip; 938 *rchip = chip;
937 return 0; 939 return 0;
938} 940}