Update of /cvsroot/alsa/alsa-kernel/ppc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22330
Modified Files: pmac.c pmac.h Log Message: fixed the suspend/resume with the new ALSA common callbacks. Index: pmac.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/ppc/pmac.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- pmac.c 17 Mar 2004 08:07:01 -0000 1.26 +++ pmac.c 15 Apr 2004 16:23:18 -0000 1.27 @@ -42,7 +42,6 @@ #if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK) static int snd_pmac_register_sleep_notifier(pmac_t *chip); static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); -static int snd_pmac_set_power_state(snd_card_t *card, unsigned int power_state); #endif @@ -1197,13 +1196,10 @@ * Save state when going to sleep, restore it afterwards. */ -static void snd_pmac_suspend(pmac_t *chip) +static int snd_pmac_suspend(snd_card_t *card, unsigned int state) { + pmac_t *chip = snd_magic_cast(pmac_t, card->pm_private_data, return -EINVAL); unsigned long flags; - snd_card_t *card = chip->card; - - if (card->power_state == SNDRV_CTL_POWER_D3hot) - return; if (chip->suspend) chip->suspend(chip); @@ -1219,14 +1215,12 @@ disable_irq(chip->rx_irq); snd_pmac_sound_feature(chip, 0); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + return 0; } -static void snd_pmac_resume(pmac_t *chip) +static int snd_pmac_resume(snd_card_t *card, unsigned int state) { - snd_card_t *card = chip->card; - - if (card->power_state == SNDRV_CTL_POWER_D0) - return; + pmac_t *chip = snd_magic_cast(pmac_t, card->pm_private_data, return -EINVAL); snd_pmac_sound_feature(chip, 1); if (chip->resume) @@ -1248,6 +1242,7 @@ enable_irq(chip->rx_irq); snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; } /* the chip is stored statically by snd_pmac_register_sleep_notifier @@ -1264,10 +1259,10 @@ switch (when) { case PBOOK_SLEEP_NOW: - snd_pmac_suspend(chip); + snd_pmac_suspend(chip->card, 0); break; case PBOOK_WAKE: - snd_pmac_resume(chip); + snd_pmac_resume(chip->card, 0); break; } return PBOOK_SLEEP_OK; @@ -1286,14 +1281,12 @@ } sleeping_pmac = chip; pmu_register_sleep_notifier(&snd_pmac_sleep_notifier); - chip->sleep_registered = 1; + snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip); return 0; } static int snd_pmac_unregister_sleep_notifier(pmac_t *chip) { - if (! chip->sleep_registered) - return 0; /* should be protected here.. */ if (sleeping_pmac != chip) return -ENODEV; @@ -1302,24 +1295,4 @@ return 0; } -/* callback */ -static int snd_pmac_set_power_state(snd_card_t *card, unsigned int power_state) -{ - pmac_t *chip = snd_magic_cast(pmac_t, card->power_state_private_data, return -ENXIO); - switch (power_state) { - case SNDRV_CTL_POWER_D0: - case SNDRV_CTL_POWER_D1: - case SNDRV_CTL_POWER_D2: - snd_pmac_resume(chip); - break; - case SNDRV_CTL_POWER_D3hot: - case SNDRV_CTL_POWER_D3cold: - snd_pmac_suspend(chip); - break; - default: - return -EINVAL; - } - return 0; -} - #endif /* CONFIG_PM && CONFIG_PMAC_PBOOK */ Index: pmac.h =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/ppc/pmac.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- pmac.h 18 Jun 2003 11:09:58 -0000 1.12 +++ pmac.h 15 Apr 2004 16:23:18 -0000 1.13 @@ -162,7 +162,6 @@ void (*update_automute)(pmac_t *chip, int do_notify); int (*detect_headphone)(pmac_t *chip); #ifdef CONFIG_PMAC_PBOOK - unsigned int sleep_registered : 1; void (*suspend)(pmac_t *chip); void (*resume)(pmac_t *chip); #endif ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog