aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/atiixp_modem.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:07:46 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:24 -0500
commit92304cc7ecfc87d8336696ab5fe6a1c0eec2ff00 (patch)
tree979c7147e3234bc4c92eaf97aff08853c5bb7264 /sound/pci/atiixp_modem.c
parent0ed1cad172176a4595f82e8cd9055938ad54bd4b (diff)
[ALSA] atiixp - Fix PM support
Modules: ATIIXP driver,ATIIXP-modem driver Fix PM support on ATIIXP and modem drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/atiixp_modem.c')
-rw-r--r--sound/pci/atiixp_modem.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 15be161b0a93..73f1f2b1a355 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1113,41 +1113,44 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
1113/* 1113/*
1114 * power management 1114 * power management
1115 */ 1115 */
1116static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state) 1116static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1117{ 1117{
1118 struct atiixp_modem *chip = card->pm_private_data; 1118 struct snd_card *card = pci_get_drvdata(pci);
1119 struct atiixp_modem *chip = card->private_data;
1119 int i; 1120 int i;
1120 1121
1122 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1121 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1123 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1122 if (chip->pcmdevs[i]) 1124 snd_pcm_suspend_all(chip->pcmdevs[i]);
1123 snd_pcm_suspend_all(chip->pcmdevs[i]);
1124 for (i = 0; i < NUM_ATI_CODECS; i++) 1125 for (i = 0; i < NUM_ATI_CODECS; i++)
1125 if (chip->ac97[i]) 1126 snd_ac97_suspend(chip->ac97[i]);
1126 snd_ac97_suspend(chip->ac97[i]);
1127 snd_atiixp_aclink_down(chip); 1127 snd_atiixp_aclink_down(chip);
1128 snd_atiixp_chip_stop(chip); 1128 snd_atiixp_chip_stop(chip);
1129 1129
1130 pci_set_power_state(chip->pci, PCI_D3hot); 1130 pci_set_power_state(pci, PCI_D3hot);
1131 pci_disable_device(chip->pci); 1131 pci_disable_device(pci);
1132 pci_save_state(pci);
1132 return 0; 1133 return 0;
1133} 1134}
1134 1135
1135static int snd_atiixp_resume(struct snd_card *card) 1136static int snd_atiixp_resume(struct pci_dev *pci)
1136{ 1137{
1137 struct atiixp_modem *chip = card->pm_private_data; 1138 struct snd_card *card = pci_get_drvdata(pci);
1139 struct atiixp_modem *chip = card->private_data;
1138 int i; 1140 int i;
1139 1141
1140 pci_enable_device(chip->pci); 1142 pci_restore_state(pci);
1141 pci_set_power_state(chip->pci, PCI_D0); 1143 pci_enable_device(pci);
1142 pci_set_master(chip->pci); 1144 pci_set_power_state(pci, PCI_D0);
1145 pci_set_master(pci);
1143 1146
1144 snd_atiixp_aclink_reset(chip); 1147 snd_atiixp_aclink_reset(chip);
1145 snd_atiixp_chip_start(chip); 1148 snd_atiixp_chip_start(chip);
1146 1149
1147 for (i = 0; i < NUM_ATI_CODECS; i++) 1150 for (i = 0; i < NUM_ATI_CODECS; i++)
1148 if (chip->ac97[i]) 1151 snd_ac97_resume(chip->ac97[i]);
1149 snd_ac97_resume(chip->ac97[i]);
1150 1152
1153 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1151 return 0; 1154 return 0;
1152} 1155}
1153#endif /* CONFIG_PM */ 1156#endif /* CONFIG_PM */
@@ -1284,6 +1287,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1284 strcpy(card->shortname, "ATI IXP Modem"); 1287 strcpy(card->shortname, "ATI IXP Modem");
1285 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1288 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
1286 goto __error; 1289 goto __error;
1290 card->private_data = chip;
1287 1291
1288 if ((err = snd_atiixp_aclink_reset(chip)) < 0) 1292 if ((err = snd_atiixp_aclink_reset(chip)) < 0)
1289 goto __error; 1293 goto __error;
@@ -1301,8 +1305,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1301 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i", 1305 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i",
1302 card->shortname, revision, chip->addr, chip->irq); 1306 card->shortname, revision, chip->addr, chip->irq);
1303 1307
1304 snd_card_set_pm_callback(card, snd_atiixp_suspend, snd_atiixp_resume, chip);
1305
1306 if ((err = snd_card_register(card)) < 0) 1308 if ((err = snd_card_register(card)) < 0)
1307 goto __error; 1309 goto __error;
1308 1310
@@ -1325,7 +1327,10 @@ static struct pci_driver driver = {
1325 .id_table = snd_atiixp_ids, 1327 .id_table = snd_atiixp_ids,
1326 .probe = snd_atiixp_probe, 1328 .probe = snd_atiixp_probe,
1327 .remove = __devexit_p(snd_atiixp_remove), 1329 .remove = __devexit_p(snd_atiixp_remove),
1328 SND_PCI_PM_CALLBACKS 1330#ifdef CONFIG_PM
1331 .suspend = snd_atiixp_suspend,
1332 .resume = snd_atiixp_resume,
1333#endif
1329}; 1334};
1330 1335
1331 1336