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/cs46xx/cs46xx_lib.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/cs46xx/cs46xx_lib.c')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 16d4ebf2a33f..2807b9756ef0 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -3687,8 +3687,10 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state) | |||
3687 | /* disable CLKRUN */ | 3687 | /* disable CLKRUN */ |
3688 | chip->active_ctrl(chip, -chip->amplifier); | 3688 | chip->active_ctrl(chip, -chip->amplifier); |
3689 | chip->amplifier = amp_saved; /* restore the status */ | 3689 | chip->amplifier = amp_saved; /* restore the status */ |
3690 | |||
3690 | pci_disable_device(pci); | 3691 | pci_disable_device(pci); |
3691 | pci_save_state(pci); | 3692 | pci_save_state(pci); |
3693 | pci_set_power_state(pci, pci_choose_state(pci, state)); | ||
3692 | return 0; | 3694 | return 0; |
3693 | } | 3695 | } |
3694 | 3696 | ||
@@ -3698,9 +3700,16 @@ int snd_cs46xx_resume(struct pci_dev *pci) | |||
3698 | struct snd_cs46xx *chip = card->private_data; | 3700 | struct snd_cs46xx *chip = card->private_data; |
3699 | int amp_saved; | 3701 | int amp_saved; |
3700 | 3702 | ||
3703 | pci_set_power_state(pci, PCI_D0); | ||
3701 | pci_restore_state(pci); | 3704 | pci_restore_state(pci); |
3702 | pci_enable_device(pci); | 3705 | if (pci_enable_device(pci) < 0) { |
3706 | printk(KERN_ERR "cs46xx: pci_enable_device failed, " | ||
3707 | "disabling device\n"); | ||
3708 | snd_card_disconnect(card); | ||
3709 | return -EIO; | ||
3710 | } | ||
3703 | pci_set_master(pci); | 3711 | pci_set_master(pci); |
3712 | |||
3704 | amp_saved = chip->amplifier; | 3713 | amp_saved = chip->amplifier; |
3705 | chip->amplifier = 0; | 3714 | chip->amplifier = 0; |
3706 | chip->active_ctrl(chip, 1); /* force to on */ | 3715 | chip->active_ctrl(chip, 1); /* force to on */ |