aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ymfpci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 16:09:43 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:27:38 +0100
commitded462356886e5f80f6a20b227f7e5cf7cfc5159 (patch)
treed060b0f123a3bf844246823174bddd7dcfba0a6e /sound/pci/ymfpci
parent[ALSA] trident - Fix PM support (diff)
downloadlinux-dev-ded462356886e5f80f6a20b227f7e5cf7cfc5159.tar.xz
linux-dev-ded462356886e5f80f6a20b227f7e5cf7cfc5159.zip
[ALSA] ymfpci - Fix PM support
Modules: YMFPCI driver Fix PM support on YMFPCI driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ymfpci')
-rw-r--r--sound/pci/ymfpci/ymfpci.c7
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c23
2 files changed, 20 insertions, 10 deletions
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 42499a94df41..9e30e2c76c7f 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -271,6 +271,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
}
chip->fm_res = fm_res;
chip->mpu_res = mpu_res;
+ card->private_data = chip;
+
strcpy(card->driver, str);
sprintf(card->shortname, "Yamaha DS-XG (%s)", str);
sprintf(card->longname, "%s at 0x%lx, irq %i",
@@ -347,7 +349,10 @@ static struct pci_driver driver = {
.id_table = snd_ymfpci_ids,
.probe = snd_card_ymfpci_probe,
.remove = __devexit_p(snd_card_ymfpci_remove),
- SND_PCI_PM_CALLBACKS
+#ifdef CONFIG_PM
+ .suspend = snd_ymfpci_suspend,
+ .resume = snd_ymfpci_resume,
+#endif
};
static int __init alsa_card_ymfpci_init(void)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 62c9f25e8e71..1dfc7233c6a8 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2175,11 +2175,13 @@ static int saved_regs_index[] = {
};
#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
-static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state)
+int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
{
- struct snd_ymfpci *chip = card->pm_private_data;
+ struct snd_card *card = pci_get_drvdata(pci);
+ struct snd_ymfpci *chip = card->private_data;
unsigned int i;
+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm);
snd_pcm_suspend_all(chip->pcm2);
snd_pcm_suspend_all(chip->pcm_spdif);
@@ -2190,18 +2192,21 @@ static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state)
chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
snd_ymfpci_disable_dsp(chip);
- pci_disable_device(chip->pci);
+ pci_disable_device(pci);
+ pci_save_state(pci);
return 0;
}
-static int snd_ymfpci_resume(struct snd_card *card)
+int snd_ymfpci_resume(struct pci_dev *pci)
{
- struct snd_ymfpci *chip = card->pm_private_data;
+ struct snd_card *card = pci_get_drvdata(pci);
+ struct snd_ymfpci *chip = card->private_data;
unsigned int i;
- pci_enable_device(chip->pci);
- pci_set_master(chip->pci);
- snd_ymfpci_aclink_reset(chip->pci);
+ pci_restore_state(pci);
+ pci_enable_device(pci);
+ pci_set_master(pci);
+ snd_ymfpci_aclink_reset(pci);
snd_ymfpci_codec_ready(chip, 0);
snd_ymfpci_download_image(chip);
udelay(100);
@@ -2218,6 +2223,7 @@ static int snd_ymfpci_resume(struct snd_card *card)
chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT);
spin_unlock_irq(&chip->reg_lock);
}
+ snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif /* CONFIG_PM */
@@ -2296,7 +2302,6 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
snd_ymfpci_free(chip);
return -ENOMEM;
}
- snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
#endif
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {