aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/dt019x.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 11:04:35 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:28:23 -0500
commite2fa213591518bb1387f6042b8572c76ecdc6c6e (patch)
treea57921931676bc83ec207f813ecb382981b0056d /sound/isa/dt019x.c
parentb6cc25cae365bada36c9f006e314b998eb2c5e7c (diff)
[ALSA] dt019x - Add PM support
Modules: DT019x driver Add PM support to dt019x driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/dt019x.c')
-rw-r--r--sound/isa/dt019x.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index 7559956157e9..50e7bc5ef561 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -74,6 +74,7 @@ struct snd_card_dt019x {
74 struct pnp_dev *dev; 74 struct pnp_dev *dev;
75 struct pnp_dev *devmpu; 75 struct pnp_dev *devmpu;
76 struct pnp_dev *devopl; 76 struct pnp_dev *devopl;
77 struct snd_sb *chip;
77}; 78};
78 79
79static struct pnp_card_device_id snd_dt019x_pnpids[] = { 80static struct pnp_card_device_id snd_dt019x_pnpids[] = {
@@ -196,7 +197,7 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard,
196 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, 197 if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
197 sizeof(struct snd_card_dt019x))) == NULL) 198 sizeof(struct snd_card_dt019x))) == NULL)
198 return -ENOMEM; 199 return -ENOMEM;
199 acard = (struct snd_card_dt019x *)card->private_data; 200 acard = card->private_data;
200 201
201 snd_card_set_dev(card, &pcard->card->dev); 202 snd_card_set_dev(card, &pcard->card->dev);
202 if ((error = snd_card_dt019x_pnp(dev, acard, pcard, pid))) { 203 if ((error = snd_card_dt019x_pnp(dev, acard, pcard, pid))) {
@@ -214,6 +215,7 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard,
214 snd_card_free(card); 215 snd_card_free(card);
215 return error; 216 return error;
216 } 217 }
218 acard->chip = chip;
217 219
218 strcpy(card->driver, "DT-019X"); 220 strcpy(card->driver, "DT-019X");
219 strcpy(card->shortname, "Diamond Tech. DT-019X"); 221 strcpy(card->shortname, "Diamond Tech. DT-019X");
@@ -290,10 +292,35 @@ static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card,
290 292
291static void __devexit snd_dt019x_pnp_remove(struct pnp_card_link * pcard) 293static void __devexit snd_dt019x_pnp_remove(struct pnp_card_link * pcard)
292{ 294{
293 struct snd_card *card = (struct snd_card *) pnp_get_card_drvdata(pcard); 295 snd_card_free(pnp_get_card_drvdata(pcard));
294 snd_card_disconnect(card); 296 pnp_set_card_drvdata(pcard, NULL);
295 snd_card_free_in_thread(card); 297}
298
299#ifdef CONFIG_PM
300static int snd_dt019x_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state)
301{
302 struct snd_card *card = pnp_get_card_drvdata(pcard);
303 struct snd_card_dt019x *acard = card->private_data;
304 struct snd_sb *chip = acard->chip;
305
306 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
307 snd_pcm_suspend_all(chip->pcm);
308 snd_sbmixer_suspend(chip);
309 return 0;
310}
311
312static int snd_dt019x_pnp_resume(struct pnp_card_link *pcard)
313{
314 struct snd_card *card = pnp_get_card_drvdata(pcard);
315 struct snd_card_dt019x *acard = card->private_data;
316 struct snd_sb *chip = acard->chip;
317
318 snd_sbdsp_reset(chip);
319 snd_sbmixer_resume(chip);
320 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
321 return 0;
296} 322}
323#endif
297 324
298static struct pnp_card_driver dt019x_pnpc_driver = { 325static struct pnp_card_driver dt019x_pnpc_driver = {
299 .flags = PNP_DRIVER_RES_DISABLE, 326 .flags = PNP_DRIVER_RES_DISABLE,
@@ -301,21 +328,25 @@ static struct pnp_card_driver dt019x_pnpc_driver = {
301 .id_table = snd_dt019x_pnpids, 328 .id_table = snd_dt019x_pnpids,
302 .probe = snd_dt019x_pnp_probe, 329 .probe = snd_dt019x_pnp_probe,
303 .remove = __devexit_p(snd_dt019x_pnp_remove), 330 .remove = __devexit_p(snd_dt019x_pnp_remove),
331#ifdef CONFIG_PM
332 .suspend = snd_dt019x_pnp_suspend,
333 .resume = snd_dt019x_pnp_resume,
334#endif
304}; 335};
305 336
306static int __init alsa_card_dt019x_init(void) 337static int __init alsa_card_dt019x_init(void)
307{ 338{
308 int cards = 0; 339 int cards = 0;
309 340
310 cards += pnp_register_card_driver(&dt019x_pnpc_driver); 341 cards = pnp_register_card_driver(&dt019x_pnpc_driver);
311 342 if (cards <= 0) {
312#ifdef MODULE
313 if (!cards) {
314 pnp_unregister_card_driver(&dt019x_pnpc_driver); 343 pnp_unregister_card_driver(&dt019x_pnpc_driver);
344#ifdef MODULE
315 snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n"); 345 snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n");
316 }
317#endif 346#endif
318 return cards ? 0 : -ENODEV; 347 return -ENODEV;
348 }
349 return 0;
319} 350}
320 351
321static void __exit alsa_card_dt019x_exit(void) 352static void __exit alsa_card_dt019x_exit(void)