aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:09:43 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:38 -0500
commitded462356886e5f80f6a20b227f7e5cf7cfc5159 (patch)
treed060b0f123a3bf844246823174bddd7dcfba0a6e
parentfb0700b4debbf45fb0465b40188bdc5396947bda (diff)
[ALSA] ymfpci - Fix PM support
Modules: YMFPCI driver Fix PM support on YMFPCI driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/ymfpci.h3
-rw-r--r--sound/pci/ymfpci/ymfpci.c7
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c23
3 files changed, 23 insertions, 10 deletions
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index ec790a9c496f..d567bfdbf513 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -369,6 +369,9 @@ int snd_ymfpci_create(struct snd_card *card,
369 struct snd_ymfpci ** rcodec); 369 struct snd_ymfpci ** rcodec);
370void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); 370void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);
371 371
372int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
373int snd_ymfpci_resume(struct pci_dev *pci);
374
372int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 375int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
373int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 376int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
374int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 377int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
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,
271 } 271 }
272 chip->fm_res = fm_res; 272 chip->fm_res = fm_res;
273 chip->mpu_res = mpu_res; 273 chip->mpu_res = mpu_res;
274 card->private_data = chip;
275
274 strcpy(card->driver, str); 276 strcpy(card->driver, str);
275 sprintf(card->shortname, "Yamaha DS-XG (%s)", str); 277 sprintf(card->shortname, "Yamaha DS-XG (%s)", str);
276 sprintf(card->longname, "%s at 0x%lx, irq %i", 278 sprintf(card->longname, "%s at 0x%lx, irq %i",
@@ -347,7 +349,10 @@ static struct pci_driver driver = {
347 .id_table = snd_ymfpci_ids, 349 .id_table = snd_ymfpci_ids,
348 .probe = snd_card_ymfpci_probe, 350 .probe = snd_card_ymfpci_probe,
349 .remove = __devexit_p(snd_card_ymfpci_remove), 351 .remove = __devexit_p(snd_card_ymfpci_remove),
350 SND_PCI_PM_CALLBACKS 352#ifdef CONFIG_PM
353 .suspend = snd_ymfpci_suspend,
354 .resume = snd_ymfpci_resume,
355#endif
351}; 356};
352 357
353static int __init alsa_card_ymfpci_init(void) 358static 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[] = {
2175}; 2175};
2176#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) 2176#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
2177 2177
2178static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state) 2178int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
2179{ 2179{
2180 struct snd_ymfpci *chip = card->pm_private_data; 2180 struct snd_card *card = pci_get_drvdata(pci);
2181 struct snd_ymfpci *chip = card->private_data;
2181 unsigned int i; 2182 unsigned int i;
2182 2183
2184 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2183 snd_pcm_suspend_all(chip->pcm); 2185 snd_pcm_suspend_all(chip->pcm);
2184 snd_pcm_suspend_all(chip->pcm2); 2186 snd_pcm_suspend_all(chip->pcm2);
2185 snd_pcm_suspend_all(chip->pcm_spdif); 2187 snd_pcm_suspend_all(chip->pcm_spdif);
@@ -2190,18 +2192,21 @@ static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state)
2190 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE); 2192 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
2191 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); 2193 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
2192 snd_ymfpci_disable_dsp(chip); 2194 snd_ymfpci_disable_dsp(chip);
2193 pci_disable_device(chip->pci); 2195 pci_disable_device(pci);
2196 pci_save_state(pci);
2194 return 0; 2197 return 0;
2195} 2198}
2196 2199
2197static int snd_ymfpci_resume(struct snd_card *card) 2200int snd_ymfpci_resume(struct pci_dev *pci)
2198{ 2201{
2199 struct snd_ymfpci *chip = card->pm_private_data; 2202 struct snd_card *card = pci_get_drvdata(pci);
2203 struct snd_ymfpci *chip = card->private_data;
2200 unsigned int i; 2204 unsigned int i;
2201 2205
2202 pci_enable_device(chip->pci); 2206 pci_restore_state(pci);
2203 pci_set_master(chip->pci); 2207 pci_enable_device(pci);
2204 snd_ymfpci_aclink_reset(chip->pci); 2208 pci_set_master(pci);
2209 snd_ymfpci_aclink_reset(pci);
2205 snd_ymfpci_codec_ready(chip, 0); 2210 snd_ymfpci_codec_ready(chip, 0);
2206 snd_ymfpci_download_image(chip); 2211 snd_ymfpci_download_image(chip);
2207 udelay(100); 2212 udelay(100);
@@ -2218,6 +2223,7 @@ static int snd_ymfpci_resume(struct snd_card *card)
2218 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT); 2223 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT);
2219 spin_unlock_irq(&chip->reg_lock); 2224 spin_unlock_irq(&chip->reg_lock);
2220 } 2225 }
2226 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
2221 return 0; 2227 return 0;
2222} 2228}
2223#endif /* CONFIG_PM */ 2229#endif /* CONFIG_PM */
@@ -2296,7 +2302,6 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2296 snd_ymfpci_free(chip); 2302 snd_ymfpci_free(chip);
2297 return -ENOMEM; 2303 return -ENOMEM;
2298 } 2304 }
2299 snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
2300#endif 2305#endif
2301 2306
2302 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 2307 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {