aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/intel8x0m.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:10:01 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:42 -0500
commit5809c6c41ae95ce3f45ad14d31503deb1fa8268a (patch)
treec1029ae1b55bb67414459d47820dd39dfd277ef7 /sound/pci/intel8x0m.c
parentded462356886e5f80f6a20b227f7e5cf7cfc5159 (diff)
[ALSA] intel8x0 - Fix PM support
Modules: Intel8x0 driver,Intel8x0-modem driver Fix PM support on Intel8x0 and modem drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/intel8x0m.c')
-rw-r--r--sound/pci/intel8x0m.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 3b6724e02e4e..466170e12167 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1035,28 +1035,33 @@ static int snd_intel8x0_free(struct intel8x0m *chip)
1035/* 1035/*
1036 * power management 1036 * power management
1037 */ 1037 */
1038static int intel8x0m_suspend(struct snd_card *card, pm_message_t state) 1038static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
1039{ 1039{
1040 struct intel8x0m *chip = card->pm_private_data; 1040 struct snd_card *card = pci_get_drvdata(pci);
1041 struct intel8x0m *chip = card->private_data;
1041 int i; 1042 int i;
1042 1043
1044 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1043 for (i = 0; i < chip->pcm_devs; i++) 1045 for (i = 0; i < chip->pcm_devs; i++)
1044 snd_pcm_suspend_all(chip->pcm[i]); 1046 snd_pcm_suspend_all(chip->pcm[i]);
1045 if (chip->ac97) 1047 snd_ac97_suspend(chip->ac97);
1046 snd_ac97_suspend(chip->ac97); 1048 pci_disable_device(pci);
1047 pci_disable_device(chip->pci); 1049 pci_save_state(pci);
1048 return 0; 1050 return 0;
1049} 1051}
1050 1052
1051static int intel8x0m_resume(struct snd_card *card) 1053static int intel8x0m_resume(struct pci_dev *pci)
1052{ 1054{
1053 struct intel8x0m *chip = card->pm_private_data; 1055 struct snd_card *card = pci_get_drvdata(pci);
1054 pci_enable_device(chip->pci); 1056 struct intel8x0m *chip = card->private_data;
1055 pci_set_master(chip->pci); 1057
1058 pci_restore_state(pci);
1059 pci_enable_device(pci);
1060 pci_set_master(pci);
1056 snd_intel8x0_chip_init(chip, 0); 1061 snd_intel8x0_chip_init(chip, 0);
1057 if (chip->ac97) 1062 snd_ac97_resume(chip->ac97);
1058 snd_ac97_resume(chip->ac97);
1059 1063
1064 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1060 return 0; 1065 return 0;
1061} 1066}
1062#endif /* CONFIG_PM */ 1067#endif /* CONFIG_PM */
@@ -1233,8 +1238,6 @@ static int __devinit snd_intel8x0m_create(struct snd_card *card,
1233 return err; 1238 return err;
1234 } 1239 }
1235 1240
1236 snd_card_set_pm_callback(card, intel8x0m_suspend, intel8x0m_resume, chip);
1237
1238 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 1241 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
1239 snd_intel8x0_free(chip); 1242 snd_intel8x0_free(chip);
1240 return err; 1243 return err;
@@ -1298,6 +1301,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
1298 snd_card_free(card); 1301 snd_card_free(card);
1299 return err; 1302 return err;
1300 } 1303 }
1304 card->private_data = chip;
1301 1305
1302 if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) { 1306 if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) {
1303 snd_card_free(card); 1307 snd_card_free(card);
@@ -1332,7 +1336,10 @@ static struct pci_driver driver = {
1332 .id_table = snd_intel8x0m_ids, 1336 .id_table = snd_intel8x0m_ids,
1333 .probe = snd_intel8x0m_probe, 1337 .probe = snd_intel8x0m_probe,
1334 .remove = __devexit_p(snd_intel8x0m_remove), 1338 .remove = __devexit_p(snd_intel8x0m_remove),
1335 SND_PCI_PM_CALLBACKS 1339#ifdef CONFIG_PM
1340 .suspend = intel8x0m_suspend,
1341 .resume = intel8x0m_resume,
1342#endif
1336}; 1343};
1337 1344
1338 1345