aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:11:09 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:51 -0500
commit421a12520d4ed4a0c96640fb672ef24ad8019beb (patch)
treecdfbcad3881129cb50d4d8d5dd1ae5b17a9d7dbc
parentbf53c3b3f368cdc2aa9a59f220337ede854f507d (diff)
[ALSA] hda-intel - Fix PM support
Modules: HDA Intel driver Fix PM support on HDA-Intel driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_intel.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index abdbd96d4c06..3945c44440cf 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1326,28 +1326,33 @@ static int __devinit azx_init_stream(struct azx *chip)
1326/* 1326/*
1327 * power management 1327 * power management
1328 */ 1328 */
1329static int azx_suspend(struct snd_card *card, pm_message_t state) 1329static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1330{ 1330{
1331 struct azx *chip = card->pm_private_data; 1331 struct snd_card *card = pci_get_drvdata(pci);
1332 struct azx *chip = card->private_data;
1332 int i; 1333 int i;
1333 1334
1335 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1334 for (i = 0; i < chip->pcm_devs; i++) 1336 for (i = 0; i < chip->pcm_devs; i++)
1335 if (chip->pcm[i]) 1337 snd_pcm_suspend_all(chip->pcm[i]);
1336 snd_pcm_suspend_all(chip->pcm[i]);
1337 snd_hda_suspend(chip->bus, state); 1338 snd_hda_suspend(chip->bus, state);
1338 azx_free_cmd_io(chip); 1339 azx_free_cmd_io(chip);
1339 pci_disable_device(chip->pci); 1340 pci_disable_device(pci);
1341 pci_save_state(pci);
1340 return 0; 1342 return 0;
1341} 1343}
1342 1344
1343static int azx_resume(struct snd_card *card) 1345static int azx_resume(struct pci_dev *pci)
1344{ 1346{
1345 struct azx *chip = card->pm_private_data; 1347 struct snd_card *card = pci_get_drvdata(pci);
1348 struct azx *chip = card->private_data;
1346 1349
1347 pci_enable_device(chip->pci); 1350 pci_restore_state(pci);
1348 pci_set_master(chip->pci); 1351 pci_enable_device(pci);
1352 pci_set_master(pci);
1349 azx_init_chip(chip); 1353 azx_init_chip(chip);
1350 snd_hda_resume(chip->bus); 1354 snd_hda_resume(chip->bus);
1355 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1351 return 0; 1356 return 0;
1352} 1357}
1353#endif /* CONFIG_PM */ 1358#endif /* CONFIG_PM */
@@ -1559,6 +1564,7 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *
1559 snd_card_free(card); 1564 snd_card_free(card);
1560 return err; 1565 return err;
1561 } 1566 }
1567 card->private_data = chip;
1562 1568
1563 /* create codec instances */ 1569 /* create codec instances */
1564 if ((err = azx_codec_create(chip, model)) < 0) { 1570 if ((err = azx_codec_create(chip, model)) < 0) {
@@ -1578,7 +1584,6 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *
1578 return err; 1584 return err;
1579 } 1585 }
1580 1586
1581 snd_card_set_pm_callback(card, azx_suspend, azx_resume, chip);
1582 snd_card_set_dev(card, &pci->dev); 1587 snd_card_set_dev(card, &pci->dev);
1583 1588
1584 if ((err = snd_card_register(card)) < 0) { 1589 if ((err = snd_card_register(card)) < 0) {
@@ -1618,7 +1623,10 @@ static struct pci_driver driver = {
1618 .id_table = azx_ids, 1623 .id_table = azx_ids,
1619 .probe = azx_probe, 1624 .probe = azx_probe,
1620 .remove = __devexit_p(azx_remove), 1625 .remove = __devexit_p(azx_remove),
1621 SND_PCI_PM_CALLBACKS 1626#ifdef CONFIG_PM
1627 .suspend = azx_suspend,
1628 .resume = azx_resume,
1629#endif
1622}; 1630};
1623 1631
1624static int __init alsa_card_azx_init(void) 1632static int __init alsa_card_azx_init(void)