diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:10:01 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:42 -0500 |
commit | 5809c6c41ae95ce3f45ad14d31503deb1fa8268a (patch) | |
tree | c1029ae1b55bb67414459d47820dd39dfd277ef7 /sound | |
parent | ded462356886e5f80f6a20b227f7e5cf7cfc5159 (diff) |
[ALSA] intel8x0 - Fix PM support
Modules: Intel8x0 driver,Intel8x0-modem driver
Fix PM support on Intel8x0 and modem drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/intel8x0.c | 37 | ||||
-rw-r--r-- | sound/pci/intel8x0m.c | 35 |
2 files changed, 43 insertions, 29 deletions
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 3ea90f1e22e5..c5c4ec64a156 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2396,11 +2396,13 @@ static int snd_intel8x0_free(struct intel8x0 *chip) | |||
2396 | /* | 2396 | /* |
2397 | * power management | 2397 | * power management |
2398 | */ | 2398 | */ |
2399 | static int intel8x0_suspend(struct snd_card *card, pm_message_t state) | 2399 | static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state) |
2400 | { | 2400 | { |
2401 | struct intel8x0 *chip = card->pm_private_data; | 2401 | struct snd_card *card = pci_get_drvdata(pci); |
2402 | struct intel8x0 *chip = card->private_data; | ||
2402 | int i; | 2403 | int i; |
2403 | 2404 | ||
2405 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
2404 | for (i = 0; i < chip->pcm_devs; i++) | 2406 | for (i = 0; i < chip->pcm_devs; i++) |
2405 | snd_pcm_suspend_all(chip->pcm[i]); | 2407 | snd_pcm_suspend_all(chip->pcm[i]); |
2406 | /* clear nocache */ | 2408 | /* clear nocache */ |
@@ -2415,26 +2417,29 @@ static int intel8x0_suspend(struct snd_card *card, pm_message_t state) | |||
2415 | } | 2417 | } |
2416 | } | 2418 | } |
2417 | for (i = 0; i < 3; i++) | 2419 | for (i = 0; i < 3; i++) |
2418 | if (chip->ac97[i]) | 2420 | snd_ac97_suspend(chip->ac97[i]); |
2419 | snd_ac97_suspend(chip->ac97[i]); | ||
2420 | if (chip->device_type == DEVICE_INTEL_ICH4) | 2421 | if (chip->device_type == DEVICE_INTEL_ICH4) |
2421 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); | 2422 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); |
2422 | 2423 | ||
2423 | if (chip->irq >= 0) | 2424 | if (chip->irq >= 0) |
2424 | free_irq(chip->irq, chip); | 2425 | free_irq(chip->irq, chip); |
2425 | pci_disable_device(chip->pci); | 2426 | pci_disable_device(pci); |
2427 | pci_save_state(pci); | ||
2426 | return 0; | 2428 | return 0; |
2427 | } | 2429 | } |
2428 | 2430 | ||
2429 | static int intel8x0_resume(struct snd_card *card) | 2431 | static int intel8x0_resume(struct pci_dev *pci) |
2430 | { | 2432 | { |
2431 | struct intel8x0 *chip = card->pm_private_data; | 2433 | struct snd_card *card = pci_get_drvdata(pci); |
2434 | struct intel8x0 *chip = card->private_data; | ||
2432 | int i; | 2435 | int i; |
2433 | 2436 | ||
2434 | pci_enable_device(chip->pci); | 2437 | pci_restore_state(pci); |
2435 | pci_set_master(chip->pci); | 2438 | pci_enable_device(pci); |
2436 | request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, | 2439 | pci_set_master(pci); |
2440 | request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, | ||
2437 | card->shortname, chip); | 2441 | card->shortname, chip); |
2442 | chip->irq = pci->irq; | ||
2438 | synchronize_irq(chip->irq); | 2443 | synchronize_irq(chip->irq); |
2439 | snd_intel8x0_chip_init(chip, 1); | 2444 | snd_intel8x0_chip_init(chip, 1); |
2440 | 2445 | ||
@@ -2453,8 +2458,7 @@ static int intel8x0_resume(struct snd_card *card) | |||
2453 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); | 2458 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); |
2454 | 2459 | ||
2455 | for (i = 0; i < 3; i++) | 2460 | for (i = 0; i < 3; i++) |
2456 | if (chip->ac97[i]) | 2461 | snd_ac97_resume(chip->ac97[i]); |
2457 | snd_ac97_resume(chip->ac97[i]); | ||
2458 | 2462 | ||
2459 | /* refill nocache */ | 2463 | /* refill nocache */ |
2460 | if (chip->fix_nocache) { | 2464 | if (chip->fix_nocache) { |
@@ -2482,6 +2486,7 @@ static int intel8x0_resume(struct snd_card *card) | |||
2482 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); | 2486 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); |
2483 | } | 2487 | } |
2484 | 2488 | ||
2489 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
2485 | return 0; | 2490 | return 0; |
2486 | } | 2491 | } |
2487 | #endif /* CONFIG_PM */ | 2492 | #endif /* CONFIG_PM */ |
@@ -2800,8 +2805,6 @@ static int __devinit snd_intel8x0_create(struct snd_card *card, | |||
2800 | return err; | 2805 | return err; |
2801 | } | 2806 | } |
2802 | 2807 | ||
2803 | snd_card_set_pm_callback(card, intel8x0_suspend, intel8x0_resume, chip); | ||
2804 | |||
2805 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 2808 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
2806 | snd_intel8x0_free(chip); | 2809 | snd_intel8x0_free(chip); |
2807 | return err; | 2810 | return err; |
@@ -2889,6 +2892,7 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2889 | snd_card_free(card); | 2892 | snd_card_free(card); |
2890 | return err; | 2893 | return err; |
2891 | } | 2894 | } |
2895 | card->private_data = chip; | ||
2892 | 2896 | ||
2893 | if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) { | 2897 | if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) { |
2894 | snd_card_free(card); | 2898 | snd_card_free(card); |
@@ -2927,7 +2931,10 @@ static struct pci_driver driver = { | |||
2927 | .id_table = snd_intel8x0_ids, | 2931 | .id_table = snd_intel8x0_ids, |
2928 | .probe = snd_intel8x0_probe, | 2932 | .probe = snd_intel8x0_probe, |
2929 | .remove = __devexit_p(snd_intel8x0_remove), | 2933 | .remove = __devexit_p(snd_intel8x0_remove), |
2930 | SND_PCI_PM_CALLBACKS | 2934 | #ifdef CONFIG_PM |
2935 | .suspend = intel8x0_suspend, | ||
2936 | .resume = intel8x0_resume, | ||
2937 | #endif | ||
2931 | }; | 2938 | }; |
2932 | 2939 | ||
2933 | 2940 | ||
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 3b6724e02e4e..466170e12167 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1035,28 +1035,33 @@ static int snd_intel8x0_free(struct intel8x0m *chip) | |||
1035 | /* | 1035 | /* |
1036 | * power management | 1036 | * power management |
1037 | */ | 1037 | */ |
1038 | static int intel8x0m_suspend(struct snd_card *card, pm_message_t state) | 1038 | static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state) |
1039 | { | 1039 | { |
1040 | struct intel8x0m *chip = card->pm_private_data; | 1040 | struct snd_card *card = pci_get_drvdata(pci); |
1041 | struct intel8x0m *chip = card->private_data; | ||
1041 | int i; | 1042 | int i; |
1042 | 1043 | ||
1044 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
1043 | for (i = 0; i < chip->pcm_devs; i++) | 1045 | for (i = 0; i < chip->pcm_devs; i++) |
1044 | snd_pcm_suspend_all(chip->pcm[i]); | 1046 | snd_pcm_suspend_all(chip->pcm[i]); |
1045 | if (chip->ac97) | 1047 | snd_ac97_suspend(chip->ac97); |
1046 | snd_ac97_suspend(chip->ac97); | 1048 | pci_disable_device(pci); |
1047 | pci_disable_device(chip->pci); | 1049 | pci_save_state(pci); |
1048 | return 0; | 1050 | return 0; |
1049 | } | 1051 | } |
1050 | 1052 | ||
1051 | static int intel8x0m_resume(struct snd_card *card) | 1053 | static int intel8x0m_resume(struct pci_dev *pci) |
1052 | { | 1054 | { |
1053 | struct intel8x0m *chip = card->pm_private_data; | 1055 | struct snd_card *card = pci_get_drvdata(pci); |
1054 | pci_enable_device(chip->pci); | 1056 | struct intel8x0m *chip = card->private_data; |
1055 | pci_set_master(chip->pci); | 1057 | |
1058 | pci_restore_state(pci); | ||
1059 | pci_enable_device(pci); | ||
1060 | pci_set_master(pci); | ||
1056 | snd_intel8x0_chip_init(chip, 0); | 1061 | snd_intel8x0_chip_init(chip, 0); |
1057 | if (chip->ac97) | 1062 | snd_ac97_resume(chip->ac97); |
1058 | snd_ac97_resume(chip->ac97); | ||
1059 | 1063 | ||
1064 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
1060 | return 0; | 1065 | return 0; |
1061 | } | 1066 | } |
1062 | #endif /* CONFIG_PM */ | 1067 | #endif /* CONFIG_PM */ |
@@ -1233,8 +1238,6 @@ static int __devinit snd_intel8x0m_create(struct snd_card *card, | |||
1233 | return err; | 1238 | return err; |
1234 | } | 1239 | } |
1235 | 1240 | ||
1236 | snd_card_set_pm_callback(card, intel8x0m_suspend, intel8x0m_resume, chip); | ||
1237 | |||
1238 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1241 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
1239 | snd_intel8x0_free(chip); | 1242 | snd_intel8x0_free(chip); |
1240 | return err; | 1243 | return err; |
@@ -1298,6 +1301,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1298 | snd_card_free(card); | 1301 | snd_card_free(card); |
1299 | return err; | 1302 | return err; |
1300 | } | 1303 | } |
1304 | card->private_data = chip; | ||
1301 | 1305 | ||
1302 | if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) { | 1306 | if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) { |
1303 | snd_card_free(card); | 1307 | snd_card_free(card); |
@@ -1332,7 +1336,10 @@ static struct pci_driver driver = { | |||
1332 | .id_table = snd_intel8x0m_ids, | 1336 | .id_table = snd_intel8x0m_ids, |
1333 | .probe = snd_intel8x0m_probe, | 1337 | .probe = snd_intel8x0m_probe, |
1334 | .remove = __devexit_p(snd_intel8x0m_remove), | 1338 | .remove = __devexit_p(snd_intel8x0m_remove), |
1335 | SND_PCI_PM_CALLBACKS | 1339 | #ifdef CONFIG_PM |
1340 | .suspend = intel8x0m_suspend, | ||
1341 | .resume = intel8x0m_resume, | ||
1342 | #endif | ||
1336 | }; | 1343 | }; |
1337 | 1344 | ||
1338 | 1345 | ||