diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:10:35 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:48 -0500 |
commit | 57feb83507d598de04e986cfa463acda9f2a67a8 (patch) | |
tree | 3a9b9fef2fed7b8306674724685270c012d096b9 /sound/pci/via82xx_modem.c | |
parent | 0e2364a7013688c06d1a9454a2c20567027f6a6e (diff) |
[ALSA] via82xx - Fix PM support
Modules: VIA82xx driver,VIA82xx-modem driver
Fix PM support on VIA82xx and modem drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/via82xx_modem.c')
-rw-r--r-- | sound/pci/via82xx_modem.c | 35 |
1 files changed, 21 insertions, 14 deletions
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 | */ |
1022 | static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) | 1022 | static 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 | ||
1039 | static int snd_via82xx_resume(struct snd_card *card) | 1041 | static 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 | ||
1222 | static int __init alsa_card_via82xx_init(void) | 1229 | static int __init alsa_card_via82xx_init(void) |