diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:09:25 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:37 -0500 |
commit | fb0700b4debbf45fb0465b40188bdc5396947bda (patch) | |
tree | 6a314571cd81b9995de254932ab7fe37038fa7b5 /sound/pci/trident | |
parent | cb28e45ba2aa42393596a364d4f947027db8a1b5 (diff) |
[ALSA] trident - Fix PM support
Modules: Trident driver
Fix PM support on Trident driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/trident')
-rw-r--r-- | sound/pci/trident/trident.c | 6 | ||||
-rw-r--r-- | sound/pci/trident/trident_main.c | 41 |
2 files changed, 22 insertions, 25 deletions
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 0999f1f83a99..2b21df16ad6a 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -100,6 +100,7 @@ static int __devinit snd_trident_probe(struct pci_dev *pci, | |||
100 | snd_card_free(card); | 100 | snd_card_free(card); |
101 | return err; | 101 | return err; |
102 | } | 102 | } |
103 | card->private_data = trident; | ||
103 | 104 | ||
104 | switch (trident->device) { | 105 | switch (trident->device) { |
105 | case TRIDENT_DEVICE_ID_DX: | 106 | case TRIDENT_DEVICE_ID_DX: |
@@ -180,7 +181,10 @@ static struct pci_driver driver = { | |||
180 | .id_table = snd_trident_ids, | 181 | .id_table = snd_trident_ids, |
181 | .probe = snd_trident_probe, | 182 | .probe = snd_trident_probe, |
182 | .remove = __devexit_p(snd_trident_remove), | 183 | .remove = __devexit_p(snd_trident_remove), |
183 | SND_PCI_PM_CALLBACKS | 184 | #ifdef CONFIG_PM |
185 | .suspend = snd_trident_suspend, | ||
186 | .resume = snd_trident_resume, | ||
187 | #endif | ||
184 | }; | 188 | }; |
185 | 189 | ||
186 | static int __init alsa_card_trident_init(void) | 190 | static int __init alsa_card_trident_init(void) |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 6277dccebf64..83b7d8aba9e6 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -52,10 +52,6 @@ static int snd_trident_pcm_mixer_free(struct snd_trident *trident, | |||
52 | struct snd_pcm_substream *substream); | 52 | struct snd_pcm_substream *substream); |
53 | static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, | 53 | static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, |
54 | struct pt_regs *regs); | 54 | struct pt_regs *regs); |
55 | #ifdef CONFIG_PM | ||
56 | static int snd_trident_suspend(struct snd_card *card, pm_message_t state); | ||
57 | static int snd_trident_resume(struct snd_card *card); | ||
58 | #endif | ||
59 | static int snd_trident_sis_reset(struct snd_trident *trident); | 55 | static int snd_trident_sis_reset(struct snd_trident *trident); |
60 | 56 | ||
61 | static void snd_trident_clear_voices(struct snd_trident * trident, | 57 | static void snd_trident_clear_voices(struct snd_trident * trident, |
@@ -3661,8 +3657,6 @@ int __devinit snd_trident_create(struct snd_card *card, | |||
3661 | 3657 | ||
3662 | snd_trident_enable_eso(trident); | 3658 | snd_trident_enable_eso(trident); |
3663 | 3659 | ||
3664 | |||
3665 | snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident); | ||
3666 | snd_trident_proc_init(trident); | 3660 | snd_trident_proc_init(trident); |
3667 | snd_card_set_dev(card, &pci->dev); | 3661 | snd_card_set_dev(card, &pci->dev); |
3668 | *rtrident = trident; | 3662 | *rtrident = trident; |
@@ -3938,20 +3932,19 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor | |||
3938 | } | 3932 | } |
3939 | 3933 | ||
3940 | #ifdef CONFIG_PM | 3934 | #ifdef CONFIG_PM |
3941 | static int snd_trident_suspend(struct snd_card *card, pm_message_t state) | 3935 | int snd_trident_suspend(struct pci_dev *pci, pm_message_t state) |
3942 | { | 3936 | { |
3943 | struct snd_trident *trident = card->pm_private_data; | 3937 | struct snd_card *card = pci_get_drvdata(pci); |
3938 | struct snd_trident *trident = card->private_data; | ||
3944 | 3939 | ||
3945 | trident->in_suspend = 1; | 3940 | trident->in_suspend = 1; |
3941 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
3946 | snd_pcm_suspend_all(trident->pcm); | 3942 | snd_pcm_suspend_all(trident->pcm); |
3947 | if (trident->foldback) | 3943 | snd_pcm_suspend_all(trident->foldback); |
3948 | snd_pcm_suspend_all(trident->foldback); | 3944 | snd_pcm_suspend_all(trident->spdif); |
3949 | if (trident->spdif) | ||
3950 | snd_pcm_suspend_all(trident->spdif); | ||
3951 | 3945 | ||
3952 | snd_ac97_suspend(trident->ac97); | 3946 | snd_ac97_suspend(trident->ac97); |
3953 | if (trident->ac97_sec) | 3947 | snd_ac97_suspend(trident->ac97_sec); |
3954 | snd_ac97_suspend(trident->ac97_sec); | ||
3955 | 3948 | ||
3956 | switch (trident->device) { | 3949 | switch (trident->device) { |
3957 | case TRIDENT_DEVICE_ID_DX: | 3950 | case TRIDENT_DEVICE_ID_DX: |
@@ -3960,19 +3953,19 @@ static int snd_trident_suspend(struct snd_card *card, pm_message_t state) | |||
3960 | case TRIDENT_DEVICE_ID_SI7018: | 3953 | case TRIDENT_DEVICE_ID_SI7018: |
3961 | break; | 3954 | break; |
3962 | } | 3955 | } |
3963 | pci_disable_device(trident->pci); | 3956 | pci_disable_device(pci); |
3957 | pci_save_state(pci); | ||
3964 | return 0; | 3958 | return 0; |
3965 | } | 3959 | } |
3966 | 3960 | ||
3967 | static int snd_trident_resume(struct snd_card *card) | 3961 | int snd_trident_resume(struct pci_dev *pci) |
3968 | { | 3962 | { |
3969 | struct snd_trident *trident = card->pm_private_data; | 3963 | struct snd_card *card = pci_get_drvdata(pci); |
3964 | struct snd_trident *trident = card->private_data; | ||
3970 | 3965 | ||
3971 | pci_enable_device(trident->pci); | 3966 | pci_restore_state(pci); |
3972 | if (pci_set_dma_mask(trident->pci, 0x3fffffff) < 0 || | 3967 | pci_enable_device(pci); |
3973 | pci_set_consistent_dma_mask(trident->pci, 0x3fffffff) < 0) | 3968 | pci_set_master(pci); /* to be sure */ |
3974 | snd_printk(KERN_WARNING "trident: can't set the proper DMA mask\n"); | ||
3975 | pci_set_master(trident->pci); /* to be sure */ | ||
3976 | 3969 | ||
3977 | switch (trident->device) { | 3970 | switch (trident->device) { |
3978 | case TRIDENT_DEVICE_ID_DX: | 3971 | case TRIDENT_DEVICE_ID_DX: |
@@ -3987,14 +3980,14 @@ static int snd_trident_resume(struct snd_card *card) | |||
3987 | } | 3980 | } |
3988 | 3981 | ||
3989 | snd_ac97_resume(trident->ac97); | 3982 | snd_ac97_resume(trident->ac97); |
3990 | if (trident->ac97_sec) | 3983 | snd_ac97_resume(trident->ac97_sec); |
3991 | snd_ac97_resume(trident->ac97_sec); | ||
3992 | 3984 | ||
3993 | /* restore some registers */ | 3985 | /* restore some registers */ |
3994 | outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); | 3986 | outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); |
3995 | 3987 | ||
3996 | snd_trident_enable_eso(trident); | 3988 | snd_trident_enable_eso(trident); |
3997 | 3989 | ||
3990 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
3998 | trident->in_suspend = 0; | 3991 | trident->in_suspend = 0; |
3999 | return 0; | 3992 | return 0; |
4000 | } | 3993 | } |