aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/vx_core.h6
-rw-r--r--sound/drivers/vx/vx_core.c18
-rw-r--r--sound/pci/vx222/vx222.c33
-rw-r--r--sound/pcmcia/vx/vxpocket.c9
4 files changed, 51 insertions, 15 deletions
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 0a85c37d1bc7..5fd6f3305e0d 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -347,6 +347,12 @@ int vx_change_frequency(struct vx_core *chip);
347 347
348 348
349/* 349/*
350 * PM
351 */
352int snd_vx_suspend(struct vx_core *card, pm_message_t state);
353int snd_vx_resume(struct vx_core *card);
354
355/*
350 * hardware constants 356 * hardware constants
351 */ 357 */
352 358
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index 5abf42351772..43f615d7a545 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -709,13 +709,11 @@ int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp)
709/* 709/*
710 * suspend 710 * suspend
711 */ 711 */
712static int snd_vx_suspend(struct snd_card *card, pm_message_t state) 712int snd_vx_suspend(struct vx_core *chip, pm_message_t state)
713{ 713{
714 struct vx_core *chip = card->pm_private_data;
715 unsigned int i; 714 unsigned int i;
716 715
717 snd_assert(chip, return -EINVAL); 716 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
718
719 chip->chip_status |= VX_STAT_IN_SUSPEND; 717 chip->chip_status |= VX_STAT_IN_SUSPEND;
720 for (i = 0; i < chip->hw->num_codecs; i++) 718 for (i = 0; i < chip->hw->num_codecs; i++)
721 snd_pcm_suspend_all(chip->pcm[i]); 719 snd_pcm_suspend_all(chip->pcm[i]);
@@ -726,13 +724,10 @@ static int snd_vx_suspend(struct snd_card *card, pm_message_t state)
726/* 724/*
727 * resume 725 * resume
728 */ 726 */
729static int snd_vx_resume(struct snd_card *card) 727int snd_vx_resume(struct vx_core *chip)
730{ 728{
731 struct vx_core *chip = card->pm_private_data;
732 int i, err; 729 int i, err;
733 730
734 snd_assert(chip, return -EINVAL);
735
736 chip->chip_status &= ~VX_STAT_CHIP_INIT; 731 chip->chip_status &= ~VX_STAT_CHIP_INIT;
737 732
738 for (i = 0; i < 4; i++) { 733 for (i = 0; i < 4; i++) {
@@ -748,6 +743,7 @@ static int snd_vx_resume(struct snd_card *card)
748 chip->chip_status |= VX_STAT_CHIP_INIT; 743 chip->chip_status |= VX_STAT_CHIP_INIT;
749 chip->chip_status &= ~VX_STAT_IN_SUSPEND; 744 chip->chip_status &= ~VX_STAT_IN_SUSPEND;
750 745
746 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
751 return 0; 747 return 0;
752} 748}
753 749
@@ -789,8 +785,6 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
789 strcpy(card->driver, hw->name); 785 strcpy(card->driver, hw->name);
790 sprintf(card->shortname, "Digigram %s", hw->name); 786 sprintf(card->shortname, "Digigram %s", hw->name);
791 787
792 snd_card_set_pm_callback(card, snd_vx_suspend, snd_vx_resume, chip);
793
794 vx_proc_init(chip); 788 vx_proc_init(chip);
795 789
796 return chip; 790 return chip;
@@ -822,3 +816,7 @@ EXPORT_SYMBOL(snd_vx_irq_handler);
822EXPORT_SYMBOL(snd_vx_dsp_boot); 816EXPORT_SYMBOL(snd_vx_dsp_boot);
823EXPORT_SYMBOL(snd_vx_dsp_load); 817EXPORT_SYMBOL(snd_vx_dsp_load);
824EXPORT_SYMBOL(snd_vx_load_boot_image); 818EXPORT_SYMBOL(snd_vx_load_boot_image);
819#ifdef CONFIG_PM
820EXPORT_SYMBOL(snd_vx_suspend);
821EXPORT_SYMBOL(snd_vx_resume);
822#endif
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)
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 009629714140..5bb079d17959 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -342,9 +342,9 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar
342 case CS_EVENT_PM_SUSPEND: 342 case CS_EVENT_PM_SUSPEND:
343 snd_printdd(KERN_DEBUG "SUSPEND\n"); 343 snd_printdd(KERN_DEBUG "SUSPEND\n");
344 link->state |= DEV_SUSPEND; 344 link->state |= DEV_SUSPEND;
345 if (chip && chip->card->pm_suspend) { 345 if (chip) {
346 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); 346 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
347 chip->card->pm_suspend(chip->card, PMSG_SUSPEND); 347 snd_vx_suspend(chip, PMSG_SUSPEND);
348 } 348 }
349 /* Fall through... */ 349 /* Fall through... */
350 case CS_EVENT_RESET_PHYSICAL: 350 case CS_EVENT_RESET_PHYSICAL:
@@ -362,9 +362,9 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar
362 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 362 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
363 snd_printdd(KERN_DEBUG "requestconfig...\n"); 363 snd_printdd(KERN_DEBUG "requestconfig...\n");
364 pcmcia_request_configuration(link->handle, &link->conf); 364 pcmcia_request_configuration(link->handle, &link->conf);
365 if (chip && chip->card->pm_resume) { 365 if (chip) {
366 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); 366 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
367 chip->card->pm_resume(chip->card); 367 snd_vx_resume(chip);
368 } 368 }
369 } 369 }
370 snd_printdd(KERN_DEBUG "resume done!\n"); 370 snd_printdd(KERN_DEBUG "resume done!\n");
@@ -407,6 +407,7 @@ static dev_link_t *vxpocket_attach(void)
407 snd_card_free(card); 407 snd_card_free(card);
408 return NULL; 408 return NULL;
409 } 409 }
410 card->private_data = vxp;
410 411
411 vxp->index = i; 412 vxp->index = i;
412 card_alloc |= 1 << i; 413 card_alloc |= 1 << i;