diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 11:04:12 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:28:21 -0500 |
commit | b6cc25cae365bada36c9f006e314b998eb2c5e7c (patch) | |
tree | f3b3b2df9b698c3004308b342a7b3d65f7ca26fc /sound/isa | |
parent | 480615f33fa48e1a4db33e40b21d4009250f5b23 (diff) |
[ALSA] azt2320 - Add PM support
Modules: AZT2320 driver
Add PM support to azt2320 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/azt2320.c | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index db4e7334a67d..a530691bf4f7 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c | |||
@@ -93,6 +93,7 @@ struct snd_card_azt2320 { | |||
93 | int dev_no; | 93 | int dev_no; |
94 | struct pnp_dev *dev; | 94 | struct pnp_dev *dev; |
95 | struct pnp_dev *devmpu; | 95 | struct pnp_dev *devmpu; |
96 | struct snd_cs4231 *chip; | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | static struct pnp_card_device_id snd_azt2320_pnpids[] = { | 99 | static struct pnp_card_device_id snd_azt2320_pnpids[] = { |
@@ -329,11 +330,33 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, | |||
329 | 330 | ||
330 | static void __devexit snd_azt2320_pnp_remove(struct pnp_card_link * pcard) | 331 | static void __devexit snd_azt2320_pnp_remove(struct pnp_card_link * pcard) |
331 | { | 332 | { |
332 | struct snd_card *card = (struct snd_card *) pnp_get_card_drvdata(pcard); | 333 | snd_card_free(pnp_get_card_drvdata(pcard)); |
334 | pnp_set_card_drvdata(pcard, NULL); | ||
335 | } | ||
336 | |||
337 | #ifdef CONFIG_PM | ||
338 | static int snd_azt2320_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state) | ||
339 | { | ||
340 | struct snd_card *card = pnp_get_card_drvdata(pcard); | ||
341 | struct snd_card_azt2320 *acard = card->private_data; | ||
342 | struct snd_cs4231 *chip = acard->chip; | ||
343 | |||
344 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
345 | chip->suspend(chip); | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int snd_azt2320_pnp_resume(struct pnp_card_link *pcard) | ||
350 | { | ||
351 | struct snd_card *card = pnp_get_card_drvdata(pcard); | ||
352 | struct snd_card_azt2320 *acard = card->private_data; | ||
353 | struct snd_cs4231 *chip = acard->chip; | ||
333 | 354 | ||
334 | snd_card_disconnect(card); | 355 | chip->resume(chip); |
335 | snd_card_free_in_thread(card); | 356 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
357 | return 0; | ||
336 | } | 358 | } |
359 | #endif | ||
337 | 360 | ||
338 | static struct pnp_card_driver azt2320_pnpc_driver = { | 361 | static struct pnp_card_driver azt2320_pnpc_driver = { |
339 | .flags = PNP_DRIVER_RES_DISABLE, | 362 | .flags = PNP_DRIVER_RES_DISABLE, |
@@ -341,20 +364,25 @@ static struct pnp_card_driver azt2320_pnpc_driver = { | |||
341 | .id_table = snd_azt2320_pnpids, | 364 | .id_table = snd_azt2320_pnpids, |
342 | .probe = snd_azt2320_pnp_detect, | 365 | .probe = snd_azt2320_pnp_detect, |
343 | .remove = __devexit_p(snd_azt2320_pnp_remove), | 366 | .remove = __devexit_p(snd_azt2320_pnp_remove), |
367 | #ifdef CONFIG_PM | ||
368 | .suspend = snd_azt2320_pnp_suspend, | ||
369 | .resume = snd_azt2320_pnp_resume, | ||
370 | #endif | ||
344 | }; | 371 | }; |
345 | 372 | ||
346 | static int __init alsa_card_azt2320_init(void) | 373 | static int __init alsa_card_azt2320_init(void) |
347 | { | 374 | { |
348 | int cards = 0; | 375 | int cards; |
349 | 376 | ||
350 | cards += pnp_register_card_driver(&azt2320_pnpc_driver); | 377 | cards = pnp_register_card_driver(&azt2320_pnpc_driver); |
351 | #ifdef MODULE | 378 | if (cards <= 0) { |
352 | if (!cards) { | ||
353 | pnp_unregister_card_driver(&azt2320_pnpc_driver); | 379 | pnp_unregister_card_driver(&azt2320_pnpc_driver); |
380 | #ifdef MODULE | ||
354 | snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); | 381 | snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); |
355 | } | ||
356 | #endif | 382 | #endif |
357 | return cards ? 0 : -ENODEV; | 383 | return -ENODEV; |
384 | } | ||
385 | return 0; | ||
358 | } | 386 | } |
359 | 387 | ||
360 | static void __exit alsa_card_azt2320_exit(void) | 388 | static void __exit alsa_card_azt2320_exit(void) |