Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] es1968 - Fix PM support

Modules: ES1968 driver

Fix PM support on ES1968 driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
1d4b822b b34a580e

+18 -11
+18 -11
sound/pci/es1968.c
··· 2378 2378 /* 2379 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 2386 if (! chip->do_pm) 2386 2387 return 0; 2387 2388 2388 2389 chip->in_suspend = 1; 2390 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2389 2391 snd_pcm_suspend_all(chip->pcm); 2390 2392 snd_ac97_suspend(chip->ac97); 2391 2393 snd_es1968_bob_stop(chip); 2392 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 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 2404 struct list_head *p; 2401 2405 2402 2406 if (! chip->do_pm) 2403 2407 return 0; 2404 2408 2405 2409 /* restore all our config */ 2406 - pci_enable_device(chip->pci); 2407 - pci_set_master(chip->pci); 2410 + pci_restore_state(pci); 2411 + pci_enable_device(pci); 2412 + pci_set_master(pci); 2408 2413 snd_es1968_chip_init(chip); 2409 2414 2410 2415 /* need to restore the base pointers.. */ ··· 2439 2434 if (chip->bobclient) 2440 2435 snd_es1968_bob_start(chip); 2441 2436 2437 + snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2442 2438 chip->in_suspend = 0; 2443 2439 return 0; 2444 2440 } ··· 2637 2631 2638 2632 snd_es1968_chip_init(chip); 2639 2633 2640 - if (chip->do_pm) 2641 - snd_card_set_pm_callback(card, es1968_suspend, es1968_resume, chip); 2642 - 2643 2634 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 2644 2635 snd_es1968_free(chip); 2645 2636 return err; ··· 2686 2683 snd_card_free(card); 2687 2684 return err; 2688 2685 } 2686 + card->private_data = chip; 2689 2687 2690 2688 switch (chip->type) { 2691 2689 case TYPE_MAESTRO2E: ··· 2764 2760 .id_table = snd_es1968_ids, 2765 2761 .probe = snd_es1968_probe, 2766 2762 .remove = __devexit_p(snd_es1968_remove), 2767 - SND_PCI_PM_CALLBACKS 2763 + #ifdef CONFIG_PM 2764 + .suspend = es1968_suspend, 2765 + .resume = es1968_resume, 2766 + #endif 2768 2767 }; 2769 2768 2770 2769 static int __init alsa_card_es1968_init(void)