diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-10-11 12:52:53 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-10-22 04:51:10 -0400 |
commit | 30b35399ceb2398d05837863476dcb12f12f3a82 (patch) | |
tree | 14a7cfad1c5d28d207bb1be8addb86ead33f7b63 /sound/pci/intel8x0.c | |
parent | c06134d73cdc02bb8ab1fad180f6da1f28d2e049 (diff) |
[ALSA] Various fixes for suspend/resume of ALSA PCI drivers
- Check the return value of pci_enable_device() and request_irq()
in the suspend. If any error occurs there, disable the device
using snd_card_disconnect().
- Call pci_set_power_state() properly with pci_choose_state().
- Fix the order to call pci_set_power_state().
- Removed obsolete house-made PM codes in some drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/intel8x0.c')
-rw-r--r-- | sound/pci/intel8x0.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index f4319b8d4644..7f22dab07240 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2476,10 +2476,14 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state) | |||
2476 | if (chip->device_type == DEVICE_INTEL_ICH4) | 2476 | if (chip->device_type == DEVICE_INTEL_ICH4) |
2477 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); | 2477 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); |
2478 | 2478 | ||
2479 | if (chip->irq >= 0) | 2479 | if (chip->irq >= 0) { |
2480 | synchronize_irq(chip->irq); | ||
2480 | free_irq(chip->irq, chip); | 2481 | free_irq(chip->irq, chip); |
2482 | chip->irq = -1; | ||
2483 | } | ||
2481 | pci_disable_device(pci); | 2484 | pci_disable_device(pci); |
2482 | pci_save_state(pci); | 2485 | pci_save_state(pci); |
2486 | pci_set_power_state(pci, pci_choose_state(pci, state)); | ||
2483 | return 0; | 2487 | return 0; |
2484 | } | 2488 | } |
2485 | 2489 | ||
@@ -2489,11 +2493,22 @@ static int intel8x0_resume(struct pci_dev *pci) | |||
2489 | struct intel8x0 *chip = card->private_data; | 2493 | struct intel8x0 *chip = card->private_data; |
2490 | int i; | 2494 | int i; |
2491 | 2495 | ||
2496 | pci_set_power_state(pci, PCI_D0); | ||
2492 | pci_restore_state(pci); | 2497 | pci_restore_state(pci); |
2493 | pci_enable_device(pci); | 2498 | if (pci_enable_device(pci) < 0) { |
2499 | printk(KERN_ERR "intel8x0: pci_enable_device failed, " | ||
2500 | "disabling device\n"); | ||
2501 | snd_card_disconnect(card); | ||
2502 | return -EIO; | ||
2503 | } | ||
2494 | pci_set_master(pci); | 2504 | pci_set_master(pci); |
2495 | request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, | 2505 | if (request_irq(pci->irq, snd_intel8x0_interrupt, |
2496 | card->shortname, chip); | 2506 | IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { |
2507 | printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " | ||
2508 | "disabling device\n", pci->irq); | ||
2509 | snd_card_disconnect(card); | ||
2510 | return -EIO; | ||
2511 | } | ||
2497 | chip->irq = pci->irq; | 2512 | chip->irq = pci->irq; |
2498 | synchronize_irq(chip->irq); | 2513 | synchronize_irq(chip->irq); |
2499 | snd_intel8x0_chip_init(chip, 0); | 2514 | snd_intel8x0_chip_init(chip, 0); |