diff options
Diffstat (limited to 'sound/pci/cs46xx/cs46xx_lib.c')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 11d91d08a14c..0ec0592a6e6f 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -3654,18 +3654,19 @@ static struct cs_card_type __devinitdata cards[] = { | |||
3654 | * APM support | 3654 | * APM support |
3655 | */ | 3655 | */ |
3656 | #ifdef CONFIG_PM | 3656 | #ifdef CONFIG_PM |
3657 | static int snd_cs46xx_suspend(struct snd_card *card, pm_message_t state) | 3657 | int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state) |
3658 | { | 3658 | { |
3659 | struct snd_cs46xx *chip = card->pm_private_data; | 3659 | struct snd_card *card = pci_get_drvdata(pci); |
3660 | struct snd_cs46xx *chip = card->private_data; | ||
3660 | int amp_saved; | 3661 | int amp_saved; |
3661 | 3662 | ||
3663 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
3662 | snd_pcm_suspend_all(chip->pcm); | 3664 | snd_pcm_suspend_all(chip->pcm); |
3663 | // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); | 3665 | // chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL); |
3664 | // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); | 3666 | // chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE); |
3665 | 3667 | ||
3666 | snd_ac97_suspend(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); | 3668 | snd_ac97_suspend(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); |
3667 | if (chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]) | 3669 | snd_ac97_suspend(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); |
3668 | snd_ac97_suspend(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); | ||
3669 | 3670 | ||
3670 | amp_saved = chip->amplifier; | 3671 | amp_saved = chip->amplifier; |
3671 | /* turn off amp */ | 3672 | /* turn off amp */ |
@@ -3674,17 +3675,20 @@ static int snd_cs46xx_suspend(struct snd_card *card, pm_message_t state) | |||
3674 | /* disable CLKRUN */ | 3675 | /* disable CLKRUN */ |
3675 | chip->active_ctrl(chip, -chip->amplifier); | 3676 | chip->active_ctrl(chip, -chip->amplifier); |
3676 | chip->amplifier = amp_saved; /* restore the status */ | 3677 | chip->amplifier = amp_saved; /* restore the status */ |
3677 | pci_disable_device(chip->pci); | 3678 | pci_disable_device(pci); |
3679 | pci_save_state(pci); | ||
3678 | return 0; | 3680 | return 0; |
3679 | } | 3681 | } |
3680 | 3682 | ||
3681 | static int snd_cs46xx_resume(struct snd_card *card) | 3683 | int snd_cs46xx_resume(struct pci_dev *pci) |
3682 | { | 3684 | { |
3683 | struct snd_cs46xx *chip = card->pm_private_data; | 3685 | struct snd_card *card = pci_get_drvdata(pci); |
3686 | struct snd_cs46xx *chip = card->private_data; | ||
3684 | int amp_saved; | 3687 | int amp_saved; |
3685 | 3688 | ||
3686 | pci_enable_device(chip->pci); | 3689 | pci_restore_state(pci); |
3687 | pci_set_master(chip->pci); | 3690 | pci_enable_device(pci); |
3691 | pci_set_master(pci); | ||
3688 | amp_saved = chip->amplifier; | 3692 | amp_saved = chip->amplifier; |
3689 | chip->amplifier = 0; | 3693 | chip->amplifier = 0; |
3690 | chip->active_ctrl(chip, 1); /* force to on */ | 3694 | chip->active_ctrl(chip, 1); /* force to on */ |
@@ -3703,14 +3707,14 @@ static int snd_cs46xx_resume(struct snd_card *card) | |||
3703 | #endif | 3707 | #endif |
3704 | 3708 | ||
3705 | snd_ac97_resume(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); | 3709 | snd_ac97_resume(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]); |
3706 | if (chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]) | 3710 | snd_ac97_resume(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); |
3707 | snd_ac97_resume(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]); | ||
3708 | 3711 | ||
3709 | if (amp_saved) | 3712 | if (amp_saved) |
3710 | chip->amplifier_ctrl(chip, 1); /* turn amp on */ | 3713 | chip->amplifier_ctrl(chip, 1); /* turn amp on */ |
3711 | else | 3714 | else |
3712 | chip->active_ctrl(chip, -1); /* disable CLKRUN */ | 3715 | chip->active_ctrl(chip, -1); /* disable CLKRUN */ |
3713 | chip->amplifier = amp_saved; | 3716 | chip->amplifier = amp_saved; |
3717 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
3714 | return 0; | 3718 | return 0; |
3715 | } | 3719 | } |
3716 | #endif /* CONFIG_PM */ | 3720 | #endif /* CONFIG_PM */ |
@@ -3870,8 +3874,6 @@ int __devinit snd_cs46xx_create(struct snd_card *card, | |||
3870 | 3874 | ||
3871 | snd_cs46xx_proc_init(card, chip); | 3875 | snd_cs46xx_proc_init(card, chip); |
3872 | 3876 | ||
3873 | snd_card_set_pm_callback(card, snd_cs46xx_suspend, snd_cs46xx_resume, chip); | ||
3874 | |||
3875 | chip->active_ctrl(chip, -1); /* disable CLKRUN */ | 3877 | chip->active_ctrl(chip, -1); /* disable CLKRUN */ |
3876 | 3878 | ||
3877 | snd_card_set_dev(card, &pci->dev); | 3879 | snd_card_set_dev(card, &pci->dev); |