aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:10:19 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:47 -0500
commit0e2364a7013688c06d1a9454a2c20567027f6a6e (patch)
treec8b80e895ef3ef6b42a81c2ca79e106720a75580 /sound
parent5809c6c41ae95ce3f45ad14d31503deb1fa8268a (diff)
[ALSA] maestro3 - Fix PM support
Modules: Maestro3 driver Fix PM support on maestro3 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/maestro3.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 9878595abe34..d3ef0cc6c4f9 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2546,14 +2546,16 @@ static int snd_m3_free(struct snd_m3 *chip)
2546 * APM support 2546 * APM support
2547 */ 2547 */
2548#ifdef CONFIG_PM 2548#ifdef CONFIG_PM
2549static int m3_suspend(struct snd_card *card, pm_message_t state) 2549static int m3_suspend(struct pci_dev *pci, pm_message_t state)
2550{ 2550{
2551 struct snd_m3 *chip = card->pm_private_data; 2551 struct snd_card *card = pci_get_drvdata(pci);
2552 struct snd_m3 *chip = card->private_data;
2552 int i, index; 2553 int i, index;
2553 2554
2554 if (chip->suspend_mem == NULL) 2555 if (chip->suspend_mem == NULL)
2555 return 0; 2556 return 0;
2556 2557
2558 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2557 snd_pcm_suspend_all(chip->pcm); 2559 snd_pcm_suspend_all(chip->pcm);
2558 snd_ac97_suspend(chip->ac97); 2560 snd_ac97_suspend(chip->ac97);
2559 2561
@@ -2574,20 +2576,23 @@ static int m3_suspend(struct snd_card *card, pm_message_t state)
2574 snd_m3_outw(chip, 0xffff, 0x54); 2576 snd_m3_outw(chip, 0xffff, 0x54);
2575 snd_m3_outw(chip, 0xffff, 0x56); 2577 snd_m3_outw(chip, 0xffff, 0x56);
2576 2578
2577 pci_disable_device(chip->pci); 2579 pci_disable_device(pci);
2580 pci_save_state(pci);
2578 return 0; 2581 return 0;
2579} 2582}
2580 2583
2581static int m3_resume(struct snd_card *card) 2584static int m3_resume(struct pci_dev *pci)
2582{ 2585{
2583 struct snd_m3 *chip = card->pm_private_data; 2586 struct snd_card *card = pci_get_drvdata(pci);
2587 struct snd_m3 *chip = card->private_data;
2584 int i, index; 2588 int i, index;
2585 2589
2586 if (chip->suspend_mem == NULL) 2590 if (chip->suspend_mem == NULL)
2587 return 0; 2591 return 0;
2588 2592
2589 pci_enable_device(chip->pci); 2593 pci_restore_state(pci);
2590 pci_set_master(chip->pci); 2594 pci_enable_device(pci);
2595 pci_set_master(pci);
2591 2596
2592 /* first lets just bring everything back. .*/ 2597 /* first lets just bring everything back. .*/
2593 snd_m3_outw(chip, 0, 0x54); 2598 snd_m3_outw(chip, 0, 0x54);
@@ -2617,6 +2622,7 @@ static int m3_resume(struct snd_card *card)
2617 snd_m3_enable_ints(chip); 2622 snd_m3_enable_ints(chip);
2618 snd_m3_amp_enable(chip, 1); 2623 snd_m3_amp_enable(chip, 1);
2619 2624
2625 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
2620 return 0; 2626 return 0;
2621} 2627}
2622#endif /* CONFIG_PM */ 2628#endif /* CONFIG_PM */
@@ -2748,8 +2754,6 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2748 chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH)); 2754 chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));
2749 if (chip->suspend_mem == NULL) 2755 if (chip->suspend_mem == NULL)
2750 snd_printk(KERN_WARNING "can't allocate apm buffer\n"); 2756 snd_printk(KERN_WARNING "can't allocate apm buffer\n");
2751 else
2752 snd_card_set_pm_callback(card, m3_suspend, m3_resume, chip);
2753#endif 2757#endif
2754 2758
2755 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 2759 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
@@ -2825,6 +2829,7 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2825 snd_card_free(card); 2829 snd_card_free(card);
2826 return err; 2830 return err;
2827 } 2831 }
2832 card->private_data = chip;
2828 2833
2829 sprintf(card->shortname, "ESS %s PCI", card->driver); 2834 sprintf(card->shortname, "ESS %s PCI", card->driver);
2830 sprintf(card->longname, "%s at 0x%lx, irq %d", 2835 sprintf(card->longname, "%s at 0x%lx, irq %d",
@@ -2860,7 +2865,10 @@ static struct pci_driver driver = {
2860 .id_table = snd_m3_ids, 2865 .id_table = snd_m3_ids,
2861 .probe = snd_m3_probe, 2866 .probe = snd_m3_probe,
2862 .remove = __devexit_p(snd_m3_remove), 2867 .remove = __devexit_p(snd_m3_remove),
2863 SND_PCI_PM_CALLBACKS 2868#ifdef CONFIG_PM
2869 .suspend = m3_suspend,
2870 .resume = m3_resume,
2871#endif
2864}; 2872};
2865 2873
2866static int __init alsa_card_m3_init(void) 2874static int __init alsa_card_m3_init(void)