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/pci/intel8x0.c | |
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/pci/intel8x0.c')
-rw-r--r-- | sound/pci/intel8x0.c | 37 |
1 files changed, 22 insertions, 15 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 | ||