aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/dt019x.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/dt019x.c')
-rw-r--r--sound/isa/dt019x.c57
1 files changed, 44 insertions, 13 deletions
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index db7c3397b323..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[] = {
@@ -188,15 +189,15 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
188static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) 189static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid)
189{ 190{
190 int error; 191 int error;
191 sb_t *chip; 192 struct snd_sb *chip;
192 snd_card_t *card; 193 struct snd_card *card;
193 struct snd_card_dt019x *acard; 194 struct snd_card_dt019x *acard;
194 opl3_t *opl3; 195 struct snd_opl3 *opl3;
195 196
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,32 +292,61 @@ 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 snd_card_t *card = (snd_card_t *) 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);
296} 297}
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;
322}
323#endif
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,
300 .name = "dt019x", 327 .name = "dt019x",
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)