diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:08:27 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:31 -0500 |
commit | b34a580ec5b2eb7d3a7645552821e9dadb42bdab (patch) | |
tree | eafcecac59f5d297294e319991b83eab9bd4f465 | |
parent | 38c0a158ee23027e6a4fe47311e05d9c34c94da4 (diff) |
[ALSA] es1938 - Fix PM support
Modules: ES1938 driver
Fix PM support on ES1938 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-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 577877dad2eb..0d556b09ad04 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1398,11 +1398,13 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = { | |||
1398 | }; | 1398 | }; |
1399 | 1399 | ||
1400 | 1400 | ||
1401 | static int es1938_suspend(struct snd_card *card, pm_message_t state) | 1401 | static int es1938_suspend(struct pci_dev *pci, pm_message_t state) |
1402 | { | 1402 | { |
1403 | struct es1938 *chip = card->pm_private_data; | 1403 | struct snd_card *card = pci_get_drvdata(pci); |
1404 | struct es1938 *chip = card->private_data; | ||
1404 | unsigned char *s, *d; | 1405 | unsigned char *s, *d; |
1405 | 1406 | ||
1407 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
1406 | snd_pcm_suspend_all(chip->pcm); | 1408 | snd_pcm_suspend_all(chip->pcm); |
1407 | 1409 | ||
1408 | /* save mixer-related registers */ | 1410 | /* save mixer-related registers */ |
@@ -1411,20 +1413,23 @@ static int es1938_suspend(struct snd_card *card, pm_message_t state) | |||
1411 | 1413 | ||
1412 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ | 1414 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ |
1413 | if (chip->irq >= 0) | 1415 | if (chip->irq >= 0) |
1414 | free_irq(chip->irq, chip); | 1416 | free_irq(chip->irq, chip); |
1415 | pci_disable_device(chip->pci); | 1417 | pci_disable_device(pci); |
1418 | pci_save_state(pci); | ||
1416 | return 0; | 1419 | return 0; |
1417 | } | 1420 | } |
1418 | 1421 | ||
1419 | static int es1938_resume(struct snd_card *card) | 1422 | static int es1938_resume(struct pci_dev *pci) |
1420 | { | 1423 | { |
1421 | struct es1938 *chip = card->pm_private_data; | 1424 | struct snd_card *card = pci_get_drvdata(pci); |
1425 | struct es1938 *chip = card->private_data; | ||
1422 | unsigned char *s, *d; | 1426 | unsigned char *s, *d; |
1423 | 1427 | ||
1424 | pci_enable_device(chip->pci); | 1428 | pci_restore_state(pci); |
1425 | request_irq(chip->pci->irq, snd_es1938_interrupt, | 1429 | pci_enable_device(pci); |
1430 | request_irq(pci->irq, snd_es1938_interrupt, | ||
1426 | SA_INTERRUPT|SA_SHIRQ, "ES1938", chip); | 1431 | SA_INTERRUPT|SA_SHIRQ, "ES1938", chip); |
1427 | chip->irq = chip->pci->irq; | 1432 | chip->irq = pci->irq; |
1428 | snd_es1938_chip_init(chip); | 1433 | snd_es1938_chip_init(chip); |
1429 | 1434 | ||
1430 | /* restore mixer-related registers */ | 1435 | /* restore mixer-related registers */ |
@@ -1435,6 +1440,7 @@ static int es1938_resume(struct snd_card *card) | |||
1435 | snd_es1938_write(chip, *s, *d); | 1440 | snd_es1938_write(chip, *s, *d); |
1436 | } | 1441 | } |
1437 | 1442 | ||
1443 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
1438 | return 0; | 1444 | return 0; |
1439 | } | 1445 | } |
1440 | #endif /* CONFIG_PM */ | 1446 | #endif /* CONFIG_PM */ |
@@ -1553,8 +1559,6 @@ static int __devinit snd_es1938_create(struct snd_card *card, | |||
1553 | 1559 | ||
1554 | snd_es1938_chip_init(chip); | 1560 | snd_es1938_chip_init(chip); |
1555 | 1561 | ||
1556 | snd_card_set_pm_callback(card, es1938_suspend, es1938_resume, chip); | ||
1557 | |||
1558 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1562 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
1559 | snd_es1938_free(chip); | 1563 | snd_es1938_free(chip); |
1560 | return err; | 1564 | return err; |
@@ -1717,6 +1721,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, | |||
1717 | snd_card_free(card); | 1721 | snd_card_free(card); |
1718 | return err; | 1722 | return err; |
1719 | } | 1723 | } |
1724 | card->private_data = chip; | ||
1720 | 1725 | ||
1721 | strcpy(card->driver, "ES1938"); | 1726 | strcpy(card->driver, "ES1938"); |
1722 | strcpy(card->shortname, "ESS ES1938 (Solo-1)"); | 1727 | strcpy(card->shortname, "ESS ES1938 (Solo-1)"); |
@@ -1781,7 +1786,10 @@ static struct pci_driver driver = { | |||
1781 | .id_table = snd_es1938_ids, | 1786 | .id_table = snd_es1938_ids, |
1782 | .probe = snd_es1938_probe, | 1787 | .probe = snd_es1938_probe, |
1783 | .remove = __devexit_p(snd_es1938_remove), | 1788 | .remove = __devexit_p(snd_es1938_remove), |
1784 | SND_PCI_PM_CALLBACKS | 1789 | #ifdef CONFIG_PM |
1790 | .suspend = es1938_suspend, | ||
1791 | .resume = es1938_resume, | ||
1792 | #endif | ||
1785 | }; | 1793 | }; |
1786 | 1794 | ||
1787 | static int __init alsa_card_es1938_init(void) | 1795 | static int __init alsa_card_es1938_init(void) |