diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 15:08:27 (GMT) |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 11:27:31 (GMT) |
commit | b34a580ec5b2eb7d3a7645552821e9dadb42bdab (patch) | |
tree | eafcecac59f5d297294e319991b83eab9bd4f465 /sound/pci | |
parent | 38c0a158ee23027e6a4fe47311e05d9c34c94da4 (diff) | |
download | linux-fsl-qoriq-b34a580ec5b2eb7d3a7645552821e9dadb42bdab.tar.xz |
[ALSA] es1938 - Fix PM support
Modules: ES1938 driver
Fix PM support on ES1938 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/es1938.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 577877d..0d556b0 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1398,11 +1398,13 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = { }; -static int es1938_suspend(struct snd_card *card, pm_message_t state) +static int es1938_suspend(struct pci_dev *pci, pm_message_t state) { - struct es1938 *chip = card->pm_private_data; + struct snd_card *card = pci_get_drvdata(pci); + struct es1938 *chip = card->private_data; unsigned char *s, *d; + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_pcm_suspend_all(chip->pcm); /* save mixer-related registers */ @@ -1411,20 +1413,23 @@ static int es1938_suspend(struct snd_card *card, pm_message_t state) outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ if (chip->irq >= 0) - free_irq(chip->irq, chip); - pci_disable_device(chip->pci); + free_irq(chip->irq, chip); + pci_disable_device(pci); + pci_save_state(pci); return 0; } -static int es1938_resume(struct snd_card *card) +static int es1938_resume(struct pci_dev *pci) { - struct es1938 *chip = card->pm_private_data; + struct snd_card *card = pci_get_drvdata(pci); + struct es1938 *chip = card->private_data; unsigned char *s, *d; - pci_enable_device(chip->pci); - request_irq(chip->pci->irq, snd_es1938_interrupt, + pci_restore_state(pci); + pci_enable_device(pci); + request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", chip); - chip->irq = chip->pci->irq; + chip->irq = pci->irq; snd_es1938_chip_init(chip); /* restore mixer-related registers */ @@ -1435,6 +1440,7 @@ static int es1938_resume(struct snd_card *card) snd_es1938_write(chip, *s, *d); } + snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; } #endif /* CONFIG_PM */ @@ -1553,8 +1559,6 @@ static int __devinit snd_es1938_create(struct snd_card *card, snd_es1938_chip_init(chip); - snd_card_set_pm_callback(card, es1938_suspend, es1938_resume, chip); - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { snd_es1938_free(chip); return err; @@ -1717,6 +1721,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, snd_card_free(card); return err; } + card->private_data = chip; strcpy(card->driver, "ES1938"); strcpy(card->shortname, "ESS ES1938 (Solo-1)"); @@ -1781,7 +1786,10 @@ static struct pci_driver driver = { .id_table = snd_es1938_ids, .probe = snd_es1938_probe, .remove = __devexit_p(snd_es1938_remove), - SND_PCI_PM_CALLBACKS +#ifdef CONFIG_PM + .suspend = es1938_suspend, + .resume = es1938_resume, +#endif }; static int __init alsa_card_es1938_init(void) |