aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ens1370.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:13:41 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:27:56 -0500
commitfe8be10786c040bce53c18048d75b1b23aec64ae (patch)
tree5f96e9b242637dd5c654cf9d9e5baeaf680407e1 /sound/pci/ens1370.c
parent11d3824ad7d6240d7ce44bdf1d9e81e62a903f72 (diff)
[ALSA] ens137x - Fix and ADD PM support
Modules: ENS1370/1+ driver Fix PM support on ens1371 driver. Add PM support on ens1370 (together with AK4531), too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ens1370.c')
-rw-r--r--sound/pci/ens1370.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 2cc0f83a0fde..ff86fabc98c3 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2034,40 +2034,45 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq)
2034} 2034}
2035 2035
2036#ifdef CONFIG_PM 2036#ifdef CONFIG_PM
2037static int snd_ensoniq_suspend(struct snd_card *card, pm_message_t state) 2037static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state)
2038{ 2038{
2039 struct ensoniq *ensoniq = card->pm_private_data; 2039 struct snd_card *card = pci_get_drvdata(pci);
2040 struct ensoniq *ensoniq = card->private_data;
2040 2041
2042 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2043
2041 snd_pcm_suspend_all(ensoniq->pcm1); 2044 snd_pcm_suspend_all(ensoniq->pcm1);
2042 snd_pcm_suspend_all(ensoniq->pcm2); 2045 snd_pcm_suspend_all(ensoniq->pcm2);
2043 2046
2044#ifdef CHIP1371 2047#ifdef CHIP1371
2045 if (ensoniq->u.es1371.ac97) 2048 snd_ac97_suspend(ensoniq->u.es1371.ac97);
2046 snd_ac97_suspend(ensoniq->u.es1371.ac97);
2047#else 2049#else
2048 /* FIXME */ 2050 snd_ak4531_suspend(ensoniq->u.es1370.ak4531);
2049#endif 2051#endif
2050 pci_set_power_state(ensoniq->pci, 3); 2052 pci_set_power_state(pci, PCI_D3hot);
2051 pci_disable_device(ensoniq->pci); 2053 pci_disable_device(pci);
2054 pci_save_state(pci);
2052 return 0; 2055 return 0;
2053} 2056}
2054 2057
2055static int snd_ensoniq_resume(struct snd_card *card) 2058static int snd_ensoniq_resume(struct pci_dev *pci)
2056{ 2059{
2057 struct ensoniq *ensoniq = card->pm_private_data; 2060 struct snd_card *card = pci_get_drvdata(pci);
2061 struct ensoniq *ensoniq = card->private_data;
2058 2062
2059 pci_enable_device(ensoniq->pci); 2063 pci_restore_state(pci);
2060 pci_set_power_state(ensoniq->pci, 0); 2064 pci_enable_device(pci);
2061 pci_set_master(ensoniq->pci); 2065 pci_set_power_state(pci, PCI_D0);
2066 pci_set_master(pci);
2062 2067
2063 snd_ensoniq_chip_init(ensoniq); 2068 snd_ensoniq_chip_init(ensoniq);
2064 2069
2065#ifdef CHIP1371 2070#ifdef CHIP1371
2066 if (ensoniq->u.es1371.ac97) 2071 snd_ac97_resume(ensoniq->u.es1371.ac97);
2067 snd_ac97_resume(ensoniq->u.es1371.ac97);
2068#else 2072#else
2069 /* FIXME */ 2073 snd_ak4531_resume(ensoniq->u.es1370.ak4531);
2070#endif 2074#endif
2075 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
2071 return 0; 2076 return 0;
2072} 2077}
2073#endif /* CONFIG_PM */ 2078#endif /* CONFIG_PM */
@@ -2165,8 +2170,6 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2165 2170
2166 snd_ensoniq_proc_init(ensoniq); 2171 snd_ensoniq_proc_init(ensoniq);
2167 2172
2168 snd_card_set_pm_callback(card, snd_ensoniq_suspend, snd_ensoniq_resume, ensoniq);
2169
2170 snd_card_set_dev(card, &pci->dev); 2173 snd_card_set_dev(card, &pci->dev);
2171 2174
2172 *rensoniq = ensoniq; 2175 *rensoniq = ensoniq;
@@ -2436,6 +2439,7 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci,
2436 snd_card_free(card); 2439 snd_card_free(card);
2437 return err; 2440 return err;
2438 } 2441 }
2442 card->private_data = ensoniq;
2439 2443
2440 pcm_devs[0] = 0; pcm_devs[1] = 1; 2444 pcm_devs[0] = 0; pcm_devs[1] = 1;
2441#ifdef CHIP1370 2445#ifdef CHIP1370
@@ -2495,7 +2499,10 @@ static struct pci_driver driver = {
2495 .id_table = snd_audiopci_ids, 2499 .id_table = snd_audiopci_ids,
2496 .probe = snd_audiopci_probe, 2500 .probe = snd_audiopci_probe,
2497 .remove = __devexit_p(snd_audiopci_remove), 2501 .remove = __devexit_p(snd_audiopci_remove),
2498 SND_PCI_PM_CALLBACKS 2502#ifdef CONFIG_PM
2503 .suspend = snd_ensoniq_suspend,
2504 .resume = snd_ensoniq_resume,
2505#endif
2499}; 2506};
2500 2507
2501static int __init alsa_card_ens137x_init(void) 2508static int __init alsa_card_ens137x_init(void)