Commit b34a580e authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] es1938 - Fix PM support

Modules: ES1938 driver

Fix PM support on ES1938 driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 38c0a158
...@@ -1398,11 +1398,13 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = { ...@@ -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; unsigned char *s, *d;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm); snd_pcm_suspend_all(chip->pcm);
/* save mixer-related registers */ /* save mixer-related registers */
...@@ -1412,19 +1414,22 @@ static int es1938_suspend(struct snd_card *card, pm_message_t state) ...@@ -1412,19 +1414,22 @@ static int es1938_suspend(struct snd_card *card, pm_message_t state)
outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
if (chip->irq >= 0) if (chip->irq >= 0)
free_irq(chip->irq, chip); free_irq(chip->irq, chip);
pci_disable_device(chip->pci); pci_disable_device(pci);
pci_save_state(pci);
return 0; 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; unsigned char *s, *d;
pci_enable_device(chip->pci); pci_restore_state(pci);
request_irq(chip->pci->irq, snd_es1938_interrupt, pci_enable_device(pci);
request_irq(pci->irq, snd_es1938_interrupt,
SA_INTERRUPT|SA_SHIRQ, "ES1938", chip); SA_INTERRUPT|SA_SHIRQ, "ES1938", chip);
chip->irq = chip->pci->irq; chip->irq = pci->irq;
snd_es1938_chip_init(chip); snd_es1938_chip_init(chip);
/* restore mixer-related registers */ /* restore mixer-related registers */
...@@ -1435,6 +1440,7 @@ static int es1938_resume(struct snd_card *card) ...@@ -1435,6 +1440,7 @@ static int es1938_resume(struct snd_card *card)
snd_es1938_write(chip, *s, *d); snd_es1938_write(chip, *s, *d);
} }
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0; return 0;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
...@@ -1553,8 +1559,6 @@ static int __devinit snd_es1938_create(struct snd_card *card, ...@@ -1553,8 +1559,6 @@ static int __devinit snd_es1938_create(struct snd_card *card,
snd_es1938_chip_init(chip); 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) { if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_es1938_free(chip); snd_es1938_free(chip);
return err; return err;
...@@ -1717,6 +1721,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, ...@@ -1717,6 +1721,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
card->private_data = chip;
strcpy(card->driver, "ES1938"); strcpy(card->driver, "ES1938");
strcpy(card->shortname, "ESS ES1938 (Solo-1)"); strcpy(card->shortname, "ESS ES1938 (Solo-1)");
...@@ -1781,7 +1786,10 @@ static struct pci_driver driver = { ...@@ -1781,7 +1786,10 @@ static struct pci_driver driver = {
.id_table = snd_es1938_ids, .id_table = snd_es1938_ids,
.probe = snd_es1938_probe, .probe = snd_es1938_probe,
.remove = __devexit_p(snd_es1938_remove), .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) static int __init alsa_card_es1938_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment