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/intel8x0m.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/intel8x0m.c')
-rw-r--r-- | sound/pci/intel8x0m.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 6703f5cb5569..bd467c501123 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1045,10 +1045,14 @@ static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state) | |||
1045 | for (i = 0; i < chip->pcm_devs; i++) | 1045 | for (i = 0; i < chip->pcm_devs; i++) |
1046 | snd_pcm_suspend_all(chip->pcm[i]); | 1046 | snd_pcm_suspend_all(chip->pcm[i]); |
1047 | snd_ac97_suspend(chip->ac97); | 1047 | snd_ac97_suspend(chip->ac97); |
1048 | if (chip->irq >= 0) | 1048 | if (chip->irq >= 0) { |
1049 | synchronize_irq(chip->irq); | ||
1049 | free_irq(chip->irq, chip); | 1050 | free_irq(chip->irq, chip); |
1051 | chip->irq = -1; | ||
1052 | } | ||
1050 | pci_disable_device(pci); | 1053 | pci_disable_device(pci); |
1051 | pci_save_state(pci); | 1054 | pci_save_state(pci); |
1055 | pci_set_power_state(pci, pci_choose_state(pci, state)); | ||
1052 | return 0; | 1056 | return 0; |
1053 | } | 1057 | } |
1054 | 1058 | ||
@@ -1057,11 +1061,22 @@ static int intel8x0m_resume(struct pci_dev *pci) | |||
1057 | struct snd_card *card = pci_get_drvdata(pci); | 1061 | struct snd_card *card = pci_get_drvdata(pci); |
1058 | struct intel8x0m *chip = card->private_data; | 1062 | struct intel8x0m *chip = card->private_data; |
1059 | 1063 | ||
1064 | pci_set_power_state(pci, PCI_D0); | ||
1060 | pci_restore_state(pci); | 1065 | pci_restore_state(pci); |
1061 | pci_enable_device(pci); | 1066 | if (pci_enable_device(pci) < 0) { |
1067 | printk(KERN_ERR "intel8x0m: pci_enable_device failed, " | ||
1068 | "disabling device\n"); | ||
1069 | snd_card_disconnect(card); | ||
1070 | return -EIO; | ||
1071 | } | ||
1062 | pci_set_master(pci); | 1072 | pci_set_master(pci); |
1063 | request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, | 1073 | if (request_irq(pci->irq, snd_intel8x0_interrupt, |
1064 | card->shortname, chip); | 1074 | IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { |
1075 | printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " | ||
1076 | "disabling device\n", pci->irq); | ||
1077 | snd_card_disconnect(card); | ||
1078 | return -EIO; | ||
1079 | } | ||
1065 | chip->irq = pci->irq; | 1080 | chip->irq = pci->irq; |
1066 | snd_intel8x0_chip_init(chip, 0); | 1081 | snd_intel8x0_chip_init(chip, 0); |
1067 | snd_ac97_resume(chip->ac97); | 1082 | snd_ac97_resume(chip->ac97); |