summaryrefslogtreecommitdiffstats
path: root/sound/pci/nm256
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 16:11:24 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:27:53 +0100
commit3fcf7d2cd8e0ebce10e4bf89da175ff9bd6aa2da (patch)
tree282784904eb8aab68bf98642e75ba2aebd503758 /sound/pci/nm256
parent421a12520d4ed4a0c96640fb672ef24ad8019beb (diff)
downloadop-kernel-dev-3fcf7d2cd8e0ebce10e4bf89da175ff9bd6aa2da.zip
op-kernel-dev-3fcf7d2cd8e0ebce10e4bf89da175ff9bd6aa2da.tar.gz
[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 99ec1c1..0d0ff54 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)
* APM event handler, so the card is properly reinitialized after a power
* event.
*/
-static int nm256_suspend(struct snd_card *card, pm_message_t state)
+static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
{
- struct nm256 *chip = card->pm_private_data;
+ struct snd_card *card = pci_get_drvdata(pci);
+ struct nm256 *chip = card->private_data;
+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm);
snd_ac97_suspend(chip->ac97);
chip->coeffs_current = 0;
- pci_disable_device(chip->pci);
+ pci_disable_device(pci);
+ pci_save_state(pci);
return 0;
}
-static int nm256_resume(struct snd_card *card)
+static int nm256_resume(struct pci_dev *pci)
{
- struct nm256 *chip = card->pm_private_data;
+ struct snd_card *card = pci_get_drvdata(pci);
+ struct nm256 *chip = card->private_data;
int i;
/* Perform a full reset on the hardware */
- pci_enable_device(chip->pci);
+ pci_restore_state(pci);
+ pci_enable_device(pci);
snd_nm256_init_chip(chip);
/* restore ac97 */
@@ -1340,6 +1345,7 @@ static int nm256_resume(struct snd_card *card)
}
}
+ snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */
@@ -1524,8 +1530,6 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
// pci_set_master(pci); /* needed? */
- snd_card_set_pm_callback(card, nm256_suspend, nm256_resume, chip);
-
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
goto __error;
@@ -1625,6 +1629,7 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
+ card->private_data = chip;
if (reset_workaround) {
snd_printdd(KERN_INFO "nm256: reset_workaround activated\n");
@@ -1668,7 +1673,10 @@ static struct pci_driver driver = {
.id_table = snd_nm256_ids,
.probe = snd_nm256_probe,
.remove = __devexit_p(snd_nm256_remove),
- SND_PCI_PM_CALLBACKS
+#ifdef CONFIG_PM
+ .suspend = nm256_suspend,
+ .resume = nm256_resume,
+#endif
};
OpenPOWER on IntegriCloud