Loading sound/pci/ali5451/ali5451.c +24 −22 Original line number Original line Diff line number Diff line Loading @@ -1991,9 +1991,10 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec) } } #ifdef CONFIG_PM #ifdef CONFIG_PM static int ali_suspend(struct snd_card *card, pm_message_t state) static int ali_suspend(struct pci_dev *pci, pm_message_t state) { { struct snd_ali *chip = card->pm_private_data; struct snd_card *card = pci_get_drvdata(pci); struct snd_ali *chip = card->private_data; struct snd_ali_image *im; struct snd_ali_image *im; int i, j; int i, j; Loading @@ -2001,10 +2002,9 @@ static int ali_suspend(struct snd_card *card, pm_message_t state) if (! im) if (! im) return 0; return 0; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); for(i = 0 ; i < chip->num_of_codecs ; i++) { for(i = 0 ; i < chip->num_of_codecs ; i++) { if (chip->pcm[i]) snd_pcm_suspend_all(chip->pcm[i]); snd_pcm_suspend_all(chip->pcm[i]); if(chip->ac97[i]) snd_ac97_suspend(chip->ac97[i]); snd_ac97_suspend(chip->ac97[i]); } } Loading Loading @@ -2033,13 +2033,15 @@ static int ali_suspend(struct snd_card *card, pm_message_t state) outl(0xffffffff, ALI_REG(chip, ALI_STOP)); outl(0xffffffff, ALI_REG(chip, ALI_STOP)); spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock); pci_disable_device(chip->pci); pci_disable_device(pci); pci_save_state(pci); return 0; return 0; } } static int ali_resume(struct snd_card *card) static int ali_resume(struct pci_dev *pci) { { struct snd_ali *chip = card->pm_private_data; struct snd_card *card = pci_get_drvdata(pci); struct snd_ali *chip = card->private_data; struct snd_ali_image *im; struct snd_ali_image *im; int i, j; int i, j; Loading @@ -2047,7 +2049,8 @@ static int ali_resume(struct snd_card *card) if (! im) if (! im) return 0; return 0; pci_enable_device(chip->pci); pci_restore_state(pci); pci_enable_device(pci); spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock); Loading @@ -2071,9 +2074,9 @@ static int ali_resume(struct snd_card *card) spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock); for(i = 0 ; i < chip->num_of_codecs ; i++) for(i = 0 ; i < chip->num_of_codecs ; i++) if(chip->ac97[i]) snd_ac97_resume(chip->ac97[i]); snd_ac97_resume(chip->ac97[i]); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; return 0; } } #endif /* CONFIG_PM */ #endif /* CONFIG_PM */ Loading Loading @@ -2204,8 +2207,7 @@ static int __devinit snd_ali_create(struct snd_card *card, { { struct snd_ali *codec; struct snd_ali *codec; int i, err; int i, err; unsigned short cmdw = 0; unsigned short cmdw; struct pci_dev *pci_dev = NULL; static struct snd_device_ops ops = { static struct snd_device_ops ops = { .dev_free = snd_ali_dev_free, .dev_free = snd_ali_dev_free, }; }; Loading Loading @@ -2281,16 +2283,14 @@ static int __devinit snd_ali_create(struct snd_card *card, codec->chregs.data.ainten = 0x00; codec->chregs.data.ainten = 0x00; /* M1533: southbridge */ /* M1533: southbridge */ pci_dev = pci_get_device(0x10b9, 0x1533, NULL); codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL); codec->pci_m1533 = pci_dev; if (! codec->pci_m1533) { if (! codec->pci_m1533) { snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); snd_ali_free(codec); snd_ali_free(codec); return -ENODEV; return -ENODEV; } } /* M7101: power management */ /* M7101: power management */ pci_dev = pci_get_device(0x10b9, 0x7101, NULL); codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL); codec->pci_m7101 = pci_dev; if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); snd_ali_free(codec); snd_ali_free(codec); Loading @@ -2317,8 +2317,6 @@ static int __devinit snd_ali_create(struct snd_card *card, codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); if (! codec->image) if (! codec->image) snd_printk(KERN_WARNING "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 #endif snd_ali_enable_address_interrupt(codec); snd_ali_enable_address_interrupt(codec); Loading Loading @@ -2346,6 +2344,7 @@ static int __devinit snd_ali_probe(struct pci_dev *pci, snd_card_free(card); snd_card_free(card); return err; return err; } } card->private_data = codec; snd_ali_printk("mixer building ...\n"); snd_ali_printk("mixer building ...\n"); if ((err = snd_ali_mixer(codec)) < 0) { if ((err = snd_ali_mixer(codec)) < 0) { Loading Loading @@ -2387,7 +2386,10 @@ static struct pci_driver driver = { .id_table = snd_ali_ids, .id_table = snd_ali_ids, .probe = snd_ali_probe, .probe = snd_ali_probe, .remove = __devexit_p(snd_ali_remove), .remove = __devexit_p(snd_ali_remove), SND_PCI_PM_CALLBACKS #ifdef CONFIG_PM .suspend = ali_suspend, .resume = ali_resume, #endif }; }; static int __init alsa_card_ali_init(void) static int __init alsa_card_ali_init(void) Loading Loading
sound/pci/ali5451/ali5451.c +24 −22 Original line number Original line Diff line number Diff line Loading @@ -1991,9 +1991,10 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec) } } #ifdef CONFIG_PM #ifdef CONFIG_PM static int ali_suspend(struct snd_card *card, pm_message_t state) static int ali_suspend(struct pci_dev *pci, pm_message_t state) { { struct snd_ali *chip = card->pm_private_data; struct snd_card *card = pci_get_drvdata(pci); struct snd_ali *chip = card->private_data; struct snd_ali_image *im; struct snd_ali_image *im; int i, j; int i, j; Loading @@ -2001,10 +2002,9 @@ static int ali_suspend(struct snd_card *card, pm_message_t state) if (! im) if (! im) return 0; return 0; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); for(i = 0 ; i < chip->num_of_codecs ; i++) { for(i = 0 ; i < chip->num_of_codecs ; i++) { if (chip->pcm[i]) snd_pcm_suspend_all(chip->pcm[i]); snd_pcm_suspend_all(chip->pcm[i]); if(chip->ac97[i]) snd_ac97_suspend(chip->ac97[i]); snd_ac97_suspend(chip->ac97[i]); } } Loading Loading @@ -2033,13 +2033,15 @@ static int ali_suspend(struct snd_card *card, pm_message_t state) outl(0xffffffff, ALI_REG(chip, ALI_STOP)); outl(0xffffffff, ALI_REG(chip, ALI_STOP)); spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock); pci_disable_device(chip->pci); pci_disable_device(pci); pci_save_state(pci); return 0; return 0; } } static int ali_resume(struct snd_card *card) static int ali_resume(struct pci_dev *pci) { { struct snd_ali *chip = card->pm_private_data; struct snd_card *card = pci_get_drvdata(pci); struct snd_ali *chip = card->private_data; struct snd_ali_image *im; struct snd_ali_image *im; int i, j; int i, j; Loading @@ -2047,7 +2049,8 @@ static int ali_resume(struct snd_card *card) if (! im) if (! im) return 0; return 0; pci_enable_device(chip->pci); pci_restore_state(pci); pci_enable_device(pci); spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock); Loading @@ -2071,9 +2074,9 @@ static int ali_resume(struct snd_card *card) spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock); for(i = 0 ; i < chip->num_of_codecs ; i++) for(i = 0 ; i < chip->num_of_codecs ; i++) if(chip->ac97[i]) snd_ac97_resume(chip->ac97[i]); snd_ac97_resume(chip->ac97[i]); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; return 0; } } #endif /* CONFIG_PM */ #endif /* CONFIG_PM */ Loading Loading @@ -2204,8 +2207,7 @@ static int __devinit snd_ali_create(struct snd_card *card, { { struct snd_ali *codec; struct snd_ali *codec; int i, err; int i, err; unsigned short cmdw = 0; unsigned short cmdw; struct pci_dev *pci_dev = NULL; static struct snd_device_ops ops = { static struct snd_device_ops ops = { .dev_free = snd_ali_dev_free, .dev_free = snd_ali_dev_free, }; }; Loading Loading @@ -2281,16 +2283,14 @@ static int __devinit snd_ali_create(struct snd_card *card, codec->chregs.data.ainten = 0x00; codec->chregs.data.ainten = 0x00; /* M1533: southbridge */ /* M1533: southbridge */ pci_dev = pci_get_device(0x10b9, 0x1533, NULL); codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL); codec->pci_m1533 = pci_dev; if (! codec->pci_m1533) { if (! codec->pci_m1533) { snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); snd_ali_free(codec); snd_ali_free(codec); return -ENODEV; return -ENODEV; } } /* M7101: power management */ /* M7101: power management */ pci_dev = pci_get_device(0x10b9, 0x7101, NULL); codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL); codec->pci_m7101 = pci_dev; if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); snd_ali_free(codec); snd_ali_free(codec); Loading @@ -2317,8 +2317,6 @@ static int __devinit snd_ali_create(struct snd_card *card, codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); if (! codec->image) if (! codec->image) snd_printk(KERN_WARNING "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 #endif snd_ali_enable_address_interrupt(codec); snd_ali_enable_address_interrupt(codec); Loading Loading @@ -2346,6 +2344,7 @@ static int __devinit snd_ali_probe(struct pci_dev *pci, snd_card_free(card); snd_card_free(card); return err; return err; } } card->private_data = codec; snd_ali_printk("mixer building ...\n"); snd_ali_printk("mixer building ...\n"); if ((err = snd_ali_mixer(codec)) < 0) { if ((err = snd_ali_mixer(codec)) < 0) { Loading Loading @@ -2387,7 +2386,10 @@ static struct pci_driver driver = { .id_table = snd_ali_ids, .id_table = snd_ali_ids, .probe = snd_ali_probe, .probe = snd_ali_probe, .remove = __devexit_p(snd_ali_remove), .remove = __devexit_p(snd_ali_remove), SND_PCI_PM_CALLBACKS #ifdef CONFIG_PM .suspend = ali_suspend, .resume = ali_resume, #endif }; }; static int __init alsa_card_ali_init(void) static int __init alsa_card_ali_init(void) Loading