From c66d7f72569e304acc134b2561b148fe7c23c0f7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 16:57:48 +0100 Subject: [ALSA] ad1848 - Add PM support Modules: AD1848 driver Add PM support to ad1848 support code. Signed-off-by: Takashi Iwai --- sound/isa/ad1848/ad1848_lib.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'sound/isa') 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 @@ #include #include #include -#include #include #include #include @@ -642,29 +641,30 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) { } #ifdef CONFIG_PM -static int snd_ad1848_suspend(struct snd_card *card, pm_message_t state) +static void snd_ad1848_suspend(struct snd_ad1848 *chip) { - struct snd_ad1848 *chip = card->pm_private_data; - snd_pcm_suspend_all(chip->pcm); - /* FIXME: save registers? */ - if (chip->thinkpad_flag) snd_ad1848_thinkpad_twiddle(chip, 0); - - return 0; } -static int snd_ad1848_resume(struct snd_card *card) +static void snd_ad1848_resume(struct snd_ad1848 *chip) { - struct snd_ad1848 *chip = card->pm_private_data; + int i; if (chip->thinkpad_flag) snd_ad1848_thinkpad_twiddle(chip, 1); - /* FIXME: restore registers? */ + /* clear any pendings IRQ */ + inb(AD1848P(chip, STATUS)); + outb(0, AD1848P(chip, STATUS)); + mb(); - return 0; + snd_ad1848_mce_down(chip); + for (i = 0; i < 16; i++) + snd_ad1848_out(chip, i, chip->image[i]); + snd_ad1848_mce_up(chip); + snd_ad1848_mce_down(chip); } #endif /* CONFIG_PM */ @@ -919,7 +919,6 @@ int snd_ad1848_create(struct snd_card *card, chip->thinkpad_flag = 1; chip->hardware = AD1848_HW_DETECT; /* reset */ snd_ad1848_thinkpad_twiddle(chip, 1); - snd_card_set_isa_pm_callback(card, snd_ad1848_suspend, snd_ad1848_resume, chip); } if (snd_ad1848_probe(chip) < 0) { @@ -933,6 +932,9 @@ int snd_ad1848_create(struct snd_card *card, return err; } + chip->suspend = snd_ad1848_suspend; + chip->resume = snd_ad1848_resume; + *rchip = chip; return 0; } -- cgit v1.2.3