diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 10:08:43 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:27:34 -0500 |
commit | 1d4b822be64b119b47c172aaac7ee76949470e28 (patch) | |
tree | 04f56645155654cf6ac411c42b0c44b3adac7287 | |
parent | b34a580ec5b2eb7d3a7645552821e9dadb42bdab (diff) |
[ALSA] es1968 - Fix PM support
Modules: ES1968 driver
Fix PM support on ES1968 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/es1968.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 021862d28f2b..240cf2b42054 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -2378,33 +2378,38 @@ static void snd_es1968_start_irq(struct es1968 *chip) | |||
2378 | /* | 2378 | /* |
2379 | * PM support | 2379 | * PM support |
2380 | */ | 2380 | */ |
2381 | static int es1968_suspend(struct snd_card *card, pm_message_t state) | 2381 | static int es1968_suspend(struct pci_dev *pci, pm_message_t state) |
2382 | { | 2382 | { |
2383 | struct es1968 *chip = card->pm_private_data; | 2383 | struct snd_card *card = pci_get_drvdata(pci); |
2384 | struct es1968 *chip = card->private_data; | ||
2384 | 2385 | ||
2385 | if (! chip->do_pm) | 2386 | if (! chip->do_pm) |
2386 | return 0; | 2387 | return 0; |
2387 | 2388 | ||
2388 | chip->in_suspend = 1; | 2389 | chip->in_suspend = 1; |
2390 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
2389 | snd_pcm_suspend_all(chip->pcm); | 2391 | snd_pcm_suspend_all(chip->pcm); |
2390 | snd_ac97_suspend(chip->ac97); | 2392 | snd_ac97_suspend(chip->ac97); |
2391 | snd_es1968_bob_stop(chip); | 2393 | snd_es1968_bob_stop(chip); |
2392 | snd_es1968_set_acpi(chip, ACPI_D3); | 2394 | snd_es1968_set_acpi(chip, ACPI_D3); |
2393 | pci_disable_device(chip->pci); | 2395 | pci_disable_device(pci); |
2396 | pci_save_state(pci); | ||
2394 | return 0; | 2397 | return 0; |
2395 | } | 2398 | } |
2396 | 2399 | ||
2397 | static int es1968_resume(struct snd_card *card) | 2400 | static int es1968_resume(struct pci_dev *pci) |
2398 | { | 2401 | { |
2399 | struct es1968 *chip = card->pm_private_data; | 2402 | struct snd_card *card = pci_get_drvdata(pci); |
2403 | struct es1968 *chip = card->private_data; | ||
2400 | struct list_head *p; | 2404 | struct list_head *p; |
2401 | 2405 | ||
2402 | if (! chip->do_pm) | 2406 | if (! chip->do_pm) |
2403 | return 0; | 2407 | return 0; |
2404 | 2408 | ||
2405 | /* restore all our config */ | 2409 | /* restore all our config */ |
2406 | pci_enable_device(chip->pci); | 2410 | pci_restore_state(pci); |
2407 | pci_set_master(chip->pci); | 2411 | pci_enable_device(pci); |
2412 | pci_set_master(pci); | ||
2408 | snd_es1968_chip_init(chip); | 2413 | snd_es1968_chip_init(chip); |
2409 | 2414 | ||
2410 | /* need to restore the base pointers.. */ | 2415 | /* need to restore the base pointers.. */ |
@@ -2434,6 +2439,7 @@ static int es1968_resume(struct snd_card *card) | |||
2434 | if (chip->bobclient) | 2439 | if (chip->bobclient) |
2435 | snd_es1968_bob_start(chip); | 2440 | snd_es1968_bob_start(chip); |
2436 | 2441 | ||
2442 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
2437 | chip->in_suspend = 0; | 2443 | chip->in_suspend = 0; |
2438 | return 0; | 2444 | return 0; |
2439 | } | 2445 | } |
@@ -2631,9 +2637,6 @@ static int __devinit snd_es1968_create(struct snd_card *card, | |||
2631 | 2637 | ||
2632 | snd_es1968_chip_init(chip); | 2638 | snd_es1968_chip_init(chip); |
2633 | 2639 | ||
2634 | if (chip->do_pm) | ||
2635 | snd_card_set_pm_callback(card, es1968_suspend, es1968_resume, chip); | ||
2636 | |||
2637 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 2640 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
2638 | snd_es1968_free(chip); | 2641 | snd_es1968_free(chip); |
2639 | return err; | 2642 | return err; |
@@ -2683,6 +2686,7 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci, | |||
2683 | snd_card_free(card); | 2686 | snd_card_free(card); |
2684 | return err; | 2687 | return err; |
2685 | } | 2688 | } |
2689 | card->private_data = chip; | ||
2686 | 2690 | ||
2687 | switch (chip->type) { | 2691 | switch (chip->type) { |
2688 | case TYPE_MAESTRO2E: | 2692 | case TYPE_MAESTRO2E: |
@@ -2760,7 +2764,10 @@ static struct pci_driver driver = { | |||
2760 | .id_table = snd_es1968_ids, | 2764 | .id_table = snd_es1968_ids, |
2761 | .probe = snd_es1968_probe, | 2765 | .probe = snd_es1968_probe, |
2762 | .remove = __devexit_p(snd_es1968_remove), | 2766 | .remove = __devexit_p(snd_es1968_remove), |
2763 | SND_PCI_PM_CALLBACKS | 2767 | #ifdef CONFIG_PM |
2768 | .suspend = es1968_suspend, | ||
2769 | .resume = es1968_resume, | ||
2770 | #endif | ||
2764 | }; | 2771 | }; |
2765 | 2772 | ||
2766 | static int __init alsa_card_es1968_init(void) | 2773 | static int __init alsa_card_es1968_init(void) |