aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/via82xx.c33
-rw-r--r--sound/pci/via82xx_modem.c35
2 files changed, 41 insertions, 27 deletions
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index c87000130dd2..ce4985f8078e 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2126,14 +2126,15 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
2126/* 2126/*
2127 * power management 2127 * power management
2128 */ 2128 */
2129static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) 2129static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
2130{ 2130{
2131 struct via82xx *chip = card->pm_private_data; 2131 struct snd_card *card = pci_get_drvdata(pci);
2132 struct via82xx *chip = card->private_data;
2132 int i; 2133 int i;
2133 2134
2135 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2134 for (i = 0; i < 2; i++) 2136 for (i = 0; i < 2; i++)
2135 if (chip->pcms[i]) 2137 snd_pcm_suspend_all(chip->pcms[i]);
2136 snd_pcm_suspend_all(chip->pcms[i]);
2137 for (i = 0; i < chip->num_devs; i++) 2138 for (i = 0; i < chip->num_devs; i++)
2138 snd_via82xx_channel_reset(chip, &chip->devs[i]); 2139 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2139 synchronize_irq(chip->irq); 2140 synchronize_irq(chip->irq);
@@ -2146,18 +2147,21 @@ static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state)
2146 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); 2147 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
2147 } 2148 }
2148 2149
2149 pci_set_power_state(chip->pci, 3); 2150 pci_set_power_state(pci, PCI_D3hot);
2150 pci_disable_device(chip->pci); 2151 pci_disable_device(pci);
2152 pci_save_state(pci);
2151 return 0; 2153 return 0;
2152} 2154}
2153 2155
2154static int snd_via82xx_resume(struct snd_card *card) 2156static int snd_via82xx_resume(struct pci_dev *pci)
2155{ 2157{
2156 struct via82xx *chip = card->pm_private_data; 2158 struct snd_card *card = pci_get_drvdata(pci);
2159 struct via82xx *chip = card->private_data;
2157 int i; 2160 int i;
2158 2161
2159 pci_enable_device(chip->pci); 2162 pci_restore_state(pci);
2160 pci_set_power_state(chip->pci, 0); 2163 pci_enable_device(pci);
2164 pci_set_power_state(pci, PCI_D0);
2161 2165
2162 snd_via82xx_chip_init(chip); 2166 snd_via82xx_chip_init(chip);
2163 2167
@@ -2177,6 +2181,7 @@ static int snd_via82xx_resume(struct snd_card *card)
2177 for (i = 0; i < chip->num_devs; i++) 2181 for (i = 0; i < chip->num_devs; i++)
2178 snd_via82xx_channel_reset(chip, &chip->devs[i]); 2182 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2179 2183
2184 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
2180 return 0; 2185 return 0;
2181} 2186}
2182#endif /* CONFIG_PM */ 2187#endif /* CONFIG_PM */
@@ -2453,6 +2458,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2453 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 2458 if ((err = snd_via82xx_create(card, pci, chip_type, revision,
2454 ac97_clock, &chip)) < 0) 2459 ac97_clock, &chip)) < 0)
2455 goto __error; 2460 goto __error;
2461 card->private_data = chip;
2456 if ((err = snd_via82xx_mixer_new(chip, ac97_quirk)) < 0) 2462 if ((err = snd_via82xx_mixer_new(chip, ac97_quirk)) < 0)
2457 goto __error; 2463 goto __error;
2458 2464
@@ -2481,8 +2487,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2481 goto __error; 2487 goto __error;
2482 } 2488 }
2483 2489
2484 snd_card_set_pm_callback(card, snd_via82xx_suspend, snd_via82xx_resume, chip);
2485
2486 /* disable interrupts */ 2490 /* disable interrupts */
2487 for (i = 0; i < chip->num_devs; i++) 2491 for (i = 0; i < chip->num_devs; i++)
2488 snd_via82xx_channel_reset(chip, &chip->devs[i]); 2492 snd_via82xx_channel_reset(chip, &chip->devs[i]);
@@ -2516,7 +2520,10 @@ static struct pci_driver driver = {
2516 .id_table = snd_via82xx_ids, 2520 .id_table = snd_via82xx_ids,
2517 .probe = snd_via82xx_probe, 2521 .probe = snd_via82xx_probe,
2518 .remove = __devexit_p(snd_via82xx_remove), 2522 .remove = __devexit_p(snd_via82xx_remove),
2519 SND_PCI_PM_CALLBACKS 2523#ifdef CONFIG_PM
2524 .suspend = snd_via82xx_suspend,
2525 .resume = snd_via82xx_resume,
2526#endif
2520}; 2527};
2521 2528
2522static int __init alsa_card_via82xx_init(void) 2529static int __init alsa_card_via82xx_init(void)
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 55ef69a8d2de..22ce4d309929 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1019,31 +1019,35 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip)
1019/* 1019/*
1020 * power management 1020 * power management
1021 */ 1021 */
1022static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) 1022static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
1023{ 1023{
1024 struct via82xx_modem *chip = card->pm_private_data; 1024 struct snd_card *card = pci_get_drvdata(pci);
1025 struct via82xx_modem *chip = card->private_data;
1025 int i; 1026 int i;
1026 1027
1028 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1027 for (i = 0; i < 2; i++) 1029 for (i = 0; i < 2; i++)
1028 if (chip->pcms[i]) 1030 snd_pcm_suspend_all(chip->pcms[i]);
1029 snd_pcm_suspend_all(chip->pcms[i]);
1030 for (i = 0; i < chip->num_devs; i++) 1031 for (i = 0; i < chip->num_devs; i++)
1031 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1032 snd_via82xx_channel_reset(chip, &chip->devs[i]);
1032 synchronize_irq(chip->irq); 1033 synchronize_irq(chip->irq);
1033 snd_ac97_suspend(chip->ac97); 1034 snd_ac97_suspend(chip->ac97);
1034 pci_set_power_state(chip->pci, 3); 1035 pci_set_power_state(pci, PCI_D3hot);
1035 pci_disable_device(chip->pci); 1036 pci_disable_device(pci);
1037 pci_save_state(pci);
1036 return 0; 1038 return 0;
1037} 1039}
1038 1040
1039static int snd_via82xx_resume(struct snd_card *card) 1041static int snd_via82xx_resume(struct pci_dev *pci)
1040{ 1042{
1041 struct via82xx_modem *chip = card->pm_private_data; 1043 struct snd_card *card = pci_get_drvdata(pci);
1044 struct via82xx_modem *chip = card->private_data;
1042 int i; 1045 int i;
1043 1046
1044 pci_enable_device(chip->pci); 1047 pci_restore_state(pci);
1045 pci_set_power_state(chip->pci, 0); 1048 pci_enable_device(pci);
1046 pci_set_master(chip->pci); 1049 pci_set_power_state(pci, PCI_D0);
1050 pci_set_master(pci);
1047 1051
1048 snd_via82xx_chip_init(chip); 1052 snd_via82xx_chip_init(chip);
1049 1053
@@ -1052,6 +1056,7 @@ static int snd_via82xx_resume(struct snd_card *card)
1052 for (i = 0; i < chip->num_devs; i++) 1056 for (i = 0; i < chip->num_devs; i++)
1053 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1057 snd_via82xx_channel_reset(chip, &chip->devs[i]);
1054 1058
1059 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1055 return 0; 1060 return 0;
1056} 1061}
1057#endif /* CONFIG_PM */ 1062#endif /* CONFIG_PM */
@@ -1176,14 +1181,13 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1176 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 1181 if ((err = snd_via82xx_create(card, pci, chip_type, revision,
1177 ac97_clock, &chip)) < 0) 1182 ac97_clock, &chip)) < 0)
1178 goto __error; 1183 goto __error;
1184 card->private_data = chip;
1179 if ((err = snd_via82xx_mixer_new(chip)) < 0) 1185 if ((err = snd_via82xx_mixer_new(chip)) < 0)
1180 goto __error; 1186 goto __error;
1181 1187
1182 if ((err = snd_via686_pcm_new(chip)) < 0 ) 1188 if ((err = snd_via686_pcm_new(chip)) < 0 )
1183 goto __error; 1189 goto __error;
1184 1190
1185 snd_card_set_pm_callback(card, snd_via82xx_suspend, snd_via82xx_resume, chip);
1186
1187 /* disable interrupts */ 1191 /* disable interrupts */
1188 for (i = 0; i < chip->num_devs; i++) 1192 for (i = 0; i < chip->num_devs; i++)
1189 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1193 snd_via82xx_channel_reset(chip, &chip->devs[i]);
@@ -1216,7 +1220,10 @@ static struct pci_driver driver = {
1216 .id_table = snd_via82xx_modem_ids, 1220 .id_table = snd_via82xx_modem_ids,
1217 .probe = snd_via82xx_probe, 1221 .probe = snd_via82xx_probe,
1218 .remove = __devexit_p(snd_via82xx_remove), 1222 .remove = __devexit_p(snd_via82xx_remove),
1219 SND_PCI_PM_CALLBACKS 1223#ifdef CONFIG_PM
1224 .suspend = snd_via82xx_suspend,
1225 .resume = snd_via82xx_resume,
1226#endif
1220}; 1227};
1221 1228
1222static int __init alsa_card_via82xx_init(void) 1229static int __init alsa_card_via82xx_init(void)