X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fvx222%2Fvx222.c;h=0f1ebb010a5ed2dfa9e775497b196a09e005067c;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=4ffbb25658a57807115e641bbb0140b823f5661e;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index 4ffbb2565..0f1ebb010 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c @@ -60,7 +60,7 @@ enum { VX_PCI_VX222_NEW }; -static struct pci_device_id snd_vx222_ids[] = { +static struct pci_device_id snd_vx222_ids[] __devinitdata = { { 0x10b5, 0x9050, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_OLD, }, /* PLX */ { 0x10b5, 0x9030, 0x1369, PCI_ANY_ID, 0, 0, VX_PCI_VX222_NEW, }, /* PLX */ { 0, } @@ -108,7 +108,7 @@ static struct snd_vx_hardware vx222_mic_hw = { /* */ -static int snd_vx222_free(vx_core_t *chip) +static int snd_vx222_free(struct vx_core *chip) { struct snd_vx222 *vx = (struct snd_vx222 *)chip; @@ -121,21 +121,21 @@ static int snd_vx222_free(vx_core_t *chip) return 0; } -static int snd_vx222_dev_free(snd_device_t *device) +static int snd_vx222_dev_free(struct snd_device *device) { - vx_core_t *chip = device->device_data; + struct vx_core *chip = device->device_data; return snd_vx222_free(chip); } -static int __devinit snd_vx222_create(snd_card_t *card, struct pci_dev *pci, +static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci, struct snd_vx_hardware *hw, struct snd_vx222 **rchip) { - vx_core_t *chip; + struct vx_core *chip; struct snd_vx222 *vx; int i, err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_vx222_dev_free, }; struct snd_vx_ops *vx_ops; @@ -147,7 +147,7 @@ static int __devinit snd_vx222_create(snd_card_t *card, struct pci_dev *pci, vx_ops = hw->type == VX_TYPE_BOARD ? &vx222_old_ops : &vx222_ops; chip = snd_vx_create(card, hw, vx_ops, - sizeof(struct snd_vx222) - sizeof(vx_core_t)); + sizeof(struct snd_vx222) - sizeof(struct vx_core)); if (! chip) { pci_disable_device(pci); return -ENOMEM; @@ -186,7 +186,7 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; - snd_card_t *card; + struct snd_card *card; struct snd_vx_hardware *hw; struct snd_vx222 *vx; int err; @@ -218,6 +218,7 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci, snd_card_free(card); return err; } + card->private_data = vx; vx->core.ibl.size = ibl[dev]; sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i", @@ -250,17 +251,47 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci) pci_set_drvdata(pci, NULL); } +#ifdef CONFIG_PM +static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state) +{ + struct snd_card *card = pci_get_drvdata(pci); + struct snd_vx222 *vx = card->private_data; + int err; + + err = snd_vx_suspend(&vx->core, state); + pci_set_power_state(pci, PCI_D3hot); + pci_disable_device(pci); + pci_save_state(pci); + return err; +} + +static int snd_vx222_resume(struct pci_dev *pci) +{ + struct snd_card *card = pci_get_drvdata(pci); + struct snd_vx222 *vx = card->private_data; + + pci_restore_state(pci); + pci_enable_device(pci); + pci_set_power_state(pci, PCI_D0); + pci_set_master(pci); + return snd_vx_resume(&vx->core); +} +#endif + static struct pci_driver driver = { .name = "Digigram VX222", .id_table = snd_vx222_ids, .probe = snd_vx222_probe, .remove = __devexit_p(snd_vx222_remove), - SND_PCI_PM_CALLBACKS +#ifdef CONFIG_PM + .suspend = snd_vx222_suspend, + .resume = snd_vx222_resume, +#endif }; static int __init alsa_card_vx222_init(void) { - return pci_module_init(&driver); + return pci_register_driver(&driver); } static void __exit alsa_card_vx222_exit(void)