Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] trident - Fix PM support

Modules: Trident driver

Fix PM support on Trident driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
fb0700b4 cb28e45b

+24 -25
+2
include/sound/trident.h
··· 452 452 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice); 453 453 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice); 454 454 void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice); 455 + int snd_trident_suspend(struct pci_dev *pci, pm_message_t state); 456 + int snd_trident_resume(struct pci_dev *pci); 455 457 456 458 /* TLB memory allocation */ 457 459 struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
+5 -1
sound/pci/trident/trident.c
··· 100 100 snd_card_free(card); 101 101 return err; 102 102 } 103 + card->private_data = trident; 103 104 104 105 switch (trident->device) { 105 106 case TRIDENT_DEVICE_ID_DX: ··· 181 180 .id_table = snd_trident_ids, 182 181 .probe = snd_trident_probe, 183 182 .remove = __devexit_p(snd_trident_remove), 184 - SND_PCI_PM_CALLBACKS 183 + #ifdef CONFIG_PM 184 + .suspend = snd_trident_suspend, 185 + .resume = snd_trident_resume, 186 + #endif 185 187 }; 186 188 187 189 static int __init alsa_card_trident_init(void)
+17 -24
sound/pci/trident/trident_main.c
··· 52 52 struct snd_pcm_substream *substream); 53 53 static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, 54 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 55 static int snd_trident_sis_reset(struct snd_trident *trident); 60 56 61 57 static void snd_trident_clear_voices(struct snd_trident * trident, ··· 3657 3661 3658 3662 snd_trident_enable_eso(trident); 3659 3663 3660 - 3661 - snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident); 3662 3664 snd_trident_proc_init(trident); 3663 3665 snd_card_set_dev(card, &pci->dev); 3664 3666 *rtrident = trident; ··· 3932 3938 } 3933 3939 3934 3940 #ifdef CONFIG_PM 3935 - static int snd_trident_suspend(struct snd_card *card, pm_message_t state) 3941 + int snd_trident_suspend(struct pci_dev *pci, pm_message_t state) 3936 3942 { 3937 - struct snd_trident *trident = card->pm_private_data; 3943 + struct snd_card *card = pci_get_drvdata(pci); 3944 + struct snd_trident *trident = card->private_data; 3938 3945 3939 3946 trident->in_suspend = 1; 3947 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 3940 3948 snd_pcm_suspend_all(trident->pcm); 3941 - if (trident->foldback) 3942 - snd_pcm_suspend_all(trident->foldback); 3943 - if (trident->spdif) 3944 - snd_pcm_suspend_all(trident->spdif); 3949 + snd_pcm_suspend_all(trident->foldback); 3950 + snd_pcm_suspend_all(trident->spdif); 3945 3951 3946 3952 snd_ac97_suspend(trident->ac97); 3947 - if (trident->ac97_sec) 3948 - snd_ac97_suspend(trident->ac97_sec); 3953 + snd_ac97_suspend(trident->ac97_sec); 3949 3954 3950 3955 switch (trident->device) { 3951 3956 case TRIDENT_DEVICE_ID_DX: ··· 3953 3960 case TRIDENT_DEVICE_ID_SI7018: 3954 3961 break; 3955 3962 } 3956 - pci_disable_device(trident->pci); 3963 + pci_disable_device(pci); 3964 + pci_save_state(pci); 3957 3965 return 0; 3958 3966 } 3959 3967 3960 - static int snd_trident_resume(struct snd_card *card) 3968 + int snd_trident_resume(struct pci_dev *pci) 3961 3969 { 3962 - struct snd_trident *trident = card->pm_private_data; 3970 + struct snd_card *card = pci_get_drvdata(pci); 3971 + struct snd_trident *trident = card->private_data; 3963 3972 3964 - pci_enable_device(trident->pci); 3965 - if (pci_set_dma_mask(trident->pci, 0x3fffffff) < 0 || 3966 - pci_set_consistent_dma_mask(trident->pci, 0x3fffffff) < 0) 3967 - snd_printk(KERN_WARNING "trident: can't set the proper DMA mask\n"); 3968 - pci_set_master(trident->pci); /* to be sure */ 3973 + pci_restore_state(pci); 3974 + pci_enable_device(pci); 3975 + pci_set_master(pci); /* to be sure */ 3969 3976 3970 3977 switch (trident->device) { 3971 3978 case TRIDENT_DEVICE_ID_DX: ··· 3980 3987 } 3981 3988 3982 3989 snd_ac97_resume(trident->ac97); 3983 - if (trident->ac97_sec) 3984 - snd_ac97_resume(trident->ac97_sec); 3990 + snd_ac97_resume(trident->ac97_sec); 3985 3991 3986 3992 /* restore some registers */ 3987 3993 outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); 3988 3994 3989 3995 snd_trident_enable_eso(trident); 3990 3996 3997 + snd_power_change_state(card, SNDRV_CTL_POWER_D0); 3991 3998 trident->in_suspend = 0; 3992 3999 return 0; 3993 4000 }