aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/atiixp.c38
-rw-r--r--sound/pci/atiixp_modem.c41
2 files changed, 45 insertions, 34 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 */
1418static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state) 1418static 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
1442static int snd_atiixp_resume(struct snd_card *card) 1444static 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
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 15be161b0a93..73f1f2b1a355 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1113,41 +1113,44 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
1113/* 1113/*
1114 * power management 1114 * power management
1115 */ 1115 */
1116static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state) 1116static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1117{ 1117{
1118 struct atiixp_modem *chip = card->pm_private_data; 1118 struct snd_card *card = pci_get_drvdata(pci);
1119 struct atiixp_modem *chip = card->private_data;
1119 int i; 1120 int i;
1120 1121
1122 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1121 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1123 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1122 if (chip->pcmdevs[i]) 1124 snd_pcm_suspend_all(chip->pcmdevs[i]);
1123 snd_pcm_suspend_all(chip->pcmdevs[i]);
1124 for (i = 0; i < NUM_ATI_CODECS; i++) 1125 for (i = 0; i < NUM_ATI_CODECS; i++)
1125 if (chip->ac97[i]) 1126 snd_ac97_suspend(chip->ac97[i]);
1126 snd_ac97_suspend(chip->ac97[i]);
1127 snd_atiixp_aclink_down(chip); 1127 snd_atiixp_aclink_down(chip);
1128 snd_atiixp_chip_stop(chip); 1128 snd_atiixp_chip_stop(chip);
1129 1129
1130 pci_set_power_state(chip->pci, PCI_D3hot); 1130 pci_set_power_state(pci, PCI_D3hot);
1131 pci_disable_device(chip->pci); 1131 pci_disable_device(pci);
1132 pci_save_state(pci);
1132 return 0; 1133 return 0;
1133} 1134}
1134 1135
1135static int snd_atiixp_resume(struct snd_card *card) 1136static int snd_atiixp_resume(struct pci_dev *pci)
1136{ 1137{
1137 struct atiixp_modem *chip = card->pm_private_data; 1138 struct snd_card *card = pci_get_drvdata(pci);
1139 struct atiixp_modem *chip = card->private_data;
1138 int i; 1140 int i;
1139 1141
1140 pci_enable_device(chip->pci); 1142 pci_restore_state(pci);
1141 pci_set_power_state(chip->pci, PCI_D0); 1143 pci_enable_device(pci);
1142 pci_set_master(chip->pci); 1144 pci_set_power_state(pci, PCI_D0);
1145 pci_set_master(pci);
1143 1146
1144 snd_atiixp_aclink_reset(chip); 1147 snd_atiixp_aclink_reset(chip);
1145 snd_atiixp_chip_start(chip); 1148 snd_atiixp_chip_start(chip);
1146 1149
1147 for (i = 0; i < NUM_ATI_CODECS; i++) 1150 for (i = 0; i < NUM_ATI_CODECS; i++)
1148 if (chip->ac97[i]) 1151 snd_ac97_resume(chip->ac97[i]);
1149 snd_ac97_resume(chip->ac97[i]);
1150 1152
1153 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1151 return 0; 1154 return 0;
1152} 1155}
1153#endif /* CONFIG_PM */ 1156#endif /* CONFIG_PM */
@@ -1284,6 +1287,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1284 strcpy(card->shortname, "ATI IXP Modem"); 1287 strcpy(card->shortname, "ATI IXP Modem");
1285 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1288 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
1286 goto __error; 1289 goto __error;
1290 card->private_data = chip;
1287 1291
1288 if ((err = snd_atiixp_aclink_reset(chip)) < 0) 1292 if ((err = snd_atiixp_aclink_reset(chip)) < 0)
1289 goto __error; 1293 goto __error;
@@ -1301,8 +1305,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1301 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i", 1305 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i",
1302 card->shortname, revision, chip->addr, chip->irq); 1306 card->shortname, revision, chip->addr, chip->irq);
1303 1307
1304 snd_card_set_pm_callback(card, snd_atiixp_suspend, snd_atiixp_resume, chip);
1305
1306 if ((err = snd_card_register(card)) < 0) 1308 if ((err = snd_card_register(card)) < 0)
1307 goto __error; 1309 goto __error;
1308 1310
@@ -1325,7 +1327,10 @@ static struct pci_driver driver = {
1325 .id_table = snd_atiixp_ids, 1327 .id_table = snd_atiixp_ids,
1326 .probe = snd_atiixp_probe, 1328 .probe = snd_atiixp_probe,
1327 .remove = __devexit_p(snd_atiixp_remove), 1329 .remove = __devexit_p(snd_atiixp_remove),
1328 SND_PCI_PM_CALLBACKS 1330#ifdef CONFIG_PM
1331 .suspend = snd_atiixp_suspend,
1332 .resume = snd_atiixp_resume,
1333#endif
1329}; 1334};
1330 1335
1331 1336