diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:57:48 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:28:10 -0500 |
commit | c66d7f72569e304acc134b2561b148fe7c23c0f7 (patch) | |
tree | 5404f454238c7f3546eaa1f7d892b7c5a1b5e020 /sound/isa/ad1848 | |
parent | 7a8fef1f95e563a93c7d70048b63c1ca20685a1b (diff) |
[ALSA] ad1848 - Add PM support
Modules: AD1848 driver
Add PM support to ad1848 support code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/ad1848')
-rw-r--r-- | sound/isa/ad1848/ad1848_lib.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 55ba32d4a22..83764c94153 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 |
645 | static int snd_ad1848_suspend(struct snd_card *card, pm_message_t state) | 644 | static 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 | ||
658 | static int snd_ad1848_resume(struct snd_card *card) | 651 | static 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 | } |