aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/vx222
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:06:05 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:22 -0500
commit0ed1cad172176a4595f82e8cd9055938ad54bd4b (patch)
treeb00296e5a061c90debfc4fa8c5303f75042456bc /sound/pci/vx222
parent597c3c96691c861e837f9024084b4943fa5fc0fd (diff)
[ALSA] vx-driver - Fix PM support
Fix PM support on VX drivers (vxpocket and vx222). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/vx222')
-rw-r--r--sound/pci/vx222/vx222.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index 4ebbabedb3c3..c816ddf1b215 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -218,6 +218,7 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci,
218 snd_card_free(card); 218 snd_card_free(card);
219 return err; 219 return err;
220 } 220 }
221 card->private_data = vx;
221 vx->core.ibl.size = ibl[dev]; 222 vx->core.ibl.size = ibl[dev];
222 223
223 sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i", 224 sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i",
@@ -250,12 +251,42 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci)
250 pci_set_drvdata(pci, NULL); 251 pci_set_drvdata(pci, NULL);
251} 252}
252 253
254#ifdef CONFIG_PM
255static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state)
256{
257 struct snd_card *card = pci_get_drvdata(pci);
258 struct snd_vx222 *vx = card->private_data;
259 int err;
260
261 err = snd_vx_suspend(&vx->core, state);
262 pci_set_power_state(pci, PCI_D3hot);
263 pci_disable_device(pci);
264 pci_save_state(pci);
265 return err;
266}
267
268static int snd_vx222_resume(struct pci_dev *pci)
269{
270 struct snd_card *card = pci_get_drvdata(pci);
271 struct snd_vx222 *vx = card->private_data;
272
273 pci_restore_state(pci);
274 pci_enable_device(pci);
275 pci_set_power_state(pci, PCI_D0);
276 pci_set_master(pci);
277 return snd_vx_resume(&vx->core);
278}
279#endif
280
253static struct pci_driver driver = { 281static struct pci_driver driver = {
254 .name = "Digigram VX222", 282 .name = "Digigram VX222",
255 .id_table = snd_vx222_ids, 283 .id_table = snd_vx222_ids,
256 .probe = snd_vx222_probe, 284 .probe = snd_vx222_probe,
257 .remove = __devexit_p(snd_vx222_remove), 285 .remove = __devexit_p(snd_vx222_remove),
258 SND_PCI_PM_CALLBACKS 286#ifdef CONFIG_PM
287 .suspend = snd_vx222_suspend,
288 .resume = snd_vx222_resume,
289#endif
259}; 290};
260 291
261static int __init alsa_card_vx222_init(void) 292static int __init alsa_card_vx222_init(void)