diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-04-24 19:49:19 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-04-24 19:49:19 +0200 |
commit | f290e603b0a5182edc1548ae481187ca4f55dc20 (patch) | |
tree | 9fbccbb90080dfc84fd3edfc4aee66281c52ed69 /sound | |
parent | 870dd09e04dc14da816526701e54390066baac5b (diff) | |
download | history-f290e603b0a5182edc1548ae481187ca4f55dc20.tar.gz |
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
ALI5451 driver
Clean up of power-management codes.
- moved commonly used codes to the core layer.
- using the unified suspend/resume callbacks for PCI and ISA
- added snd_card_set_pm_callbacks() and snd_card_set_isa_pm_callbacks()
as the registration functions.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ali5451/ali5451.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 415905be771bc2..7b47e3cc0905f0 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -1905,14 +1905,15 @@ static int __devinit snd_ali_mixer(ali_t * codec) } #ifdef CONFIG_PM -static void ali_suspend(ali_t *chip) +static int ali_suspend(snd_card_t *card, unsigned int state) { + ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL); ali_image_t *im; int i, j; im = chip->image; if (! im) - return; + return 0; spin_lock_irq(&chip->reg_lock); @@ -1939,16 +1940,18 @@ static void ali_suspend(ali_t *chip) outl(0xffffffff, ALI_REG(chip, ALI_STOP)); spin_unlock_irq(&chip->reg_lock); + return 0; } -static void ali_resume(ali_t *chip) +static int ali_resume(snd_card_t *card, unsigned int state) { + ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL); ali_image_t *im; int i, j; im = chip->image; if (! im) - return; + return 0; pci_enable_device(chip->pci); @@ -1974,19 +1977,6 @@ static void ali_resume(ali_t *chip) outl(im->regs[ALI_MISCINT >> 2], ALI_REG(chip, ALI_MISCINT)); spin_unlock_irq(&chip->reg_lock); - return; -} - -static int snd_ali_suspend(struct pci_dev *dev, u32 state) -{ - ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO); - ali_suspend(chip); - return 0; -} -static int snd_ali_resume(struct pci_dev *dev) -{ - ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO); - ali_resume(chip); return 0; } #endif /* CONFIG_PM */ @@ -2202,7 +2192,9 @@ static int __devinit snd_ali_create(snd_card_t * card, #ifdef CONFIG_PM codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); if (! codec->image) - snd_printk("can't allocate apm buffer\n"); + snd_printk(KERN_WARNING "can't allocate apm buffer\n"); + else + snd_card_set_pm_callback(card, ali_suspend, ali_resume, codec); #endif snd_ali_enable_address_interrupt(codec); @@ -2278,10 +2270,7 @@ static struct pci_driver driver = { .id_table = snd_ali_ids, .probe = snd_ali_probe, .remove = __devexit_p(snd_ali_remove), -#ifdef CONFIG_PM - .suspend = snd_ali_suspend, - .resume = snd_ali_resume, -#endif + SND_PCI_PM_CALLBACKS }; static int __init alsa_card_ali_init(void) |