aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/nm256
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:11:24 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:53 -0500
commit3fcf7d2cd8e0ebce10e4bf89da175ff9bd6aa2da (patch)
tree282784904eb8aab68bf98642e75ba2aebd503758 /sound/pci/nm256
parent421a12520d4ed4a0c96640fb672ef24ad8019beb (diff)
[ALSA] nm256-intel - Fix PM support
Modules: NM256 driver Fix PM support on NM256 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/nm256')
-rw-r--r--sound/pci/nm256/nm256.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 99ec1c17049b..0d0ff54f0fc6 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1308,24 +1308,29 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
1308 * APM event handler, so the card is properly reinitialized after a power 1308 * APM event handler, so the card is properly reinitialized after a power
1309 * event. 1309 * event.
1310 */ 1310 */
1311static int nm256_suspend(struct snd_card *card, pm_message_t state) 1311static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
1312{ 1312{
1313 struct nm256 *chip = card->pm_private_data; 1313 struct snd_card *card = pci_get_drvdata(pci);
1314 struct nm256 *chip = card->private_data;
1314 1315
1316 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1315 snd_pcm_suspend_all(chip->pcm); 1317 snd_pcm_suspend_all(chip->pcm);
1316 snd_ac97_suspend(chip->ac97); 1318 snd_ac97_suspend(chip->ac97);
1317 chip->coeffs_current = 0; 1319 chip->coeffs_current = 0;
1318 pci_disable_device(chip->pci); 1320 pci_disable_device(pci);
1321 pci_save_state(pci);
1319 return 0; 1322 return 0;
1320} 1323}
1321 1324
1322static int nm256_resume(struct snd_card *card) 1325static int nm256_resume(struct pci_dev *pci)
1323{ 1326{
1324 struct nm256 *chip = card->pm_private_data; 1327 struct snd_card *card = pci_get_drvdata(pci);
1328 struct nm256 *chip = card->private_data;
1325 int i; 1329 int i;
1326 1330
1327 /* Perform a full reset on the hardware */ 1331 /* Perform a full reset on the hardware */
1328 pci_enable_device(chip->pci); 1332 pci_restore_state(pci);
1333 pci_enable_device(pci);
1329 snd_nm256_init_chip(chip); 1334 snd_nm256_init_chip(chip);
1330 1335
1331 /* restore ac97 */ 1336 /* restore ac97 */
@@ -1340,6 +1345,7 @@ static int nm256_resume(struct snd_card *card)
1340 } 1345 }
1341 } 1346 }
1342 1347
1348 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1343 return 0; 1349 return 0;
1344} 1350}
1345#endif /* CONFIG_PM */ 1351#endif /* CONFIG_PM */
@@ -1524,8 +1530,6 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1524 1530
1525 // pci_set_master(pci); /* needed? */ 1531 // pci_set_master(pci); /* needed? */
1526 1532
1527 snd_card_set_pm_callback(card, nm256_suspend, nm256_resume, chip);
1528
1529 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) 1533 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
1530 goto __error; 1534 goto __error;
1531 1535
@@ -1625,6 +1629,7 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1625 snd_card_free(card); 1629 snd_card_free(card);
1626 return err; 1630 return err;
1627 } 1631 }
1632 card->private_data = chip;
1628 1633
1629 if (reset_workaround) { 1634 if (reset_workaround) {
1630 snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); 1635 snd_printdd(KERN_INFO "nm256: reset_workaround activated\n");
@@ -1668,7 +1673,10 @@ static struct pci_driver driver = {
1668 .id_table = snd_nm256_ids, 1673 .id_table = snd_nm256_ids,
1669 .probe = snd_nm256_probe, 1674 .probe = snd_nm256_probe,
1670 .remove = __devexit_p(snd_nm256_remove), 1675 .remove = __devexit_p(snd_nm256_remove),
1671 SND_PCI_PM_CALLBACKS 1676#ifdef CONFIG_PM
1677 .suspend = nm256_suspend,
1678 .resume = nm256_resume,
1679#endif
1672}; 1680};
1673 1681
1674 1682