diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:07:46 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:24 -0500 |
commit | 92304cc7ecfc87d8336696ab5fe6a1c0eec2ff00 (patch) | |
tree | 979c7147e3234bc4c92eaf97aff08853c5bb7264 /sound/pci/atiixp.c | |
parent | 0ed1cad172176a4595f82e8cd9055938ad54bd4b (diff) |
[ALSA] atiixp - Fix PM support
Modules: ATIIXP driver,ATIIXP-modem driver
Fix PM support on ATIIXP and modem drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/atiixp.c')
-rw-r--r-- | sound/pci/atiixp.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 5ead66610ed7..a039284c7c54 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1415,11 +1415,13 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock, | |||
1415 | /* | 1415 | /* |
1416 | * power management | 1416 | * power management |
1417 | */ | 1417 | */ |
1418 | static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state) | 1418 | static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state) |
1419 | { | 1419 | { |
1420 | struct atiixp *chip = card->pm_private_data; | 1420 | struct snd_card *card = pci_get_drvdata(pci); |
1421 | struct atiixp *chip = card->private_data; | ||
1421 | int i; | 1422 | int i; |
1422 | 1423 | ||
1424 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
1423 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) | 1425 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) |
1424 | if (chip->pcmdevs[i]) { | 1426 | if (chip->pcmdevs[i]) { |
1425 | struct atiixp_dma *dma = &chip->dmas[i]; | 1427 | struct atiixp_dma *dma = &chip->dmas[i]; |
@@ -1429,31 +1431,32 @@ static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state) | |||
1429 | snd_pcm_suspend_all(chip->pcmdevs[i]); | 1431 | snd_pcm_suspend_all(chip->pcmdevs[i]); |
1430 | } | 1432 | } |
1431 | for (i = 0; i < NUM_ATI_CODECS; i++) | 1433 | for (i = 0; i < NUM_ATI_CODECS; i++) |
1432 | if (chip->ac97[i]) | 1434 | snd_ac97_suspend(chip->ac97[i]); |
1433 | snd_ac97_suspend(chip->ac97[i]); | ||
1434 | snd_atiixp_aclink_down(chip); | 1435 | snd_atiixp_aclink_down(chip); |
1435 | snd_atiixp_chip_stop(chip); | 1436 | snd_atiixp_chip_stop(chip); |
1436 | 1437 | ||
1437 | pci_set_power_state(chip->pci, PCI_D3hot); | 1438 | pci_set_power_state(pci, PCI_D3hot); |
1438 | pci_disable_device(chip->pci); | 1439 | pci_disable_device(pci); |
1440 | pci_save_state(pci); | ||
1439 | return 0; | 1441 | return 0; |
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | static int snd_atiixp_resume(struct snd_card *card) | 1444 | static int snd_atiixp_resume(struct pci_dev *pci) |
1443 | { | 1445 | { |
1444 | struct atiixp *chip = card->pm_private_data; | 1446 | struct snd_card *card = pci_get_drvdata(pci); |
1447 | struct atiixp *chip = card->private_data; | ||
1445 | int i; | 1448 | int i; |
1446 | 1449 | ||
1447 | pci_enable_device(chip->pci); | 1450 | pci_restore_state(pci); |
1448 | pci_set_power_state(chip->pci, PCI_D0); | 1451 | pci_enable_device(pci); |
1449 | pci_set_master(chip->pci); | 1452 | pci_set_power_state(pci, PCI_D0); |
1453 | pci_set_master(pci); | ||
1450 | 1454 | ||
1451 | snd_atiixp_aclink_reset(chip); | 1455 | snd_atiixp_aclink_reset(chip); |
1452 | snd_atiixp_chip_start(chip); | 1456 | snd_atiixp_chip_start(chip); |
1453 | 1457 | ||
1454 | for (i = 0; i < NUM_ATI_CODECS; i++) | 1458 | for (i = 0; i < NUM_ATI_CODECS; i++) |
1455 | if (chip->ac97[i]) | 1459 | snd_ac97_resume(chip->ac97[i]); |
1456 | snd_ac97_resume(chip->ac97[i]); | ||
1457 | 1460 | ||
1458 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) | 1461 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) |
1459 | if (chip->pcmdevs[i]) { | 1462 | if (chip->pcmdevs[i]) { |
@@ -1468,6 +1471,7 @@ static int snd_atiixp_resume(struct snd_card *card) | |||
1468 | } | 1471 | } |
1469 | } | 1472 | } |
1470 | 1473 | ||
1474 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
1471 | return 0; | 1475 | return 0; |
1472 | } | 1476 | } |
1473 | #endif /* CONFIG_PM */ | 1477 | #endif /* CONFIG_PM */ |
@@ -1604,6 +1608,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1604 | strcpy(card->shortname, "ATI IXP"); | 1608 | strcpy(card->shortname, "ATI IXP"); |
1605 | if ((err = snd_atiixp_create(card, pci, &chip)) < 0) | 1609 | if ((err = snd_atiixp_create(card, pci, &chip)) < 0) |
1606 | goto __error; | 1610 | goto __error; |
1611 | card->private_data = chip; | ||
1607 | 1612 | ||
1608 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) | 1613 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) |
1609 | goto __error; | 1614 | goto __error; |
@@ -1625,8 +1630,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1625 | chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?", | 1630 | chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?", |
1626 | chip->addr, chip->irq); | 1631 | chip->addr, chip->irq); |
1627 | 1632 | ||
1628 | snd_card_set_pm_callback(card, snd_atiixp_suspend, snd_atiixp_resume, chip); | ||
1629 | |||
1630 | if ((err = snd_card_register(card)) < 0) | 1633 | if ((err = snd_card_register(card)) < 0) |
1631 | goto __error; | 1634 | goto __error; |
1632 | 1635 | ||
@@ -1649,7 +1652,10 @@ static struct pci_driver driver = { | |||
1649 | .id_table = snd_atiixp_ids, | 1652 | .id_table = snd_atiixp_ids, |
1650 | .probe = snd_atiixp_probe, | 1653 | .probe = snd_atiixp_probe, |
1651 | .remove = __devexit_p(snd_atiixp_remove), | 1654 | .remove = __devexit_p(snd_atiixp_remove), |
1652 | SND_PCI_PM_CALLBACKS | 1655 | #ifdef CONFIG_PM |
1656 | .suspend = snd_atiixp_suspend, | ||
1657 | .resume = snd_atiixp_resume, | ||
1658 | #endif | ||
1653 | }; | 1659 | }; |
1654 | 1660 | ||
1655 | 1661 | ||