aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-07-02 09:20:37 -0400
committerTakashi Iwai <tiwai@suse.de>2012-07-03 02:23:03 -0400
commit68cb2b559278858ef9f3a7722f95df88797c7840 (patch)
tree3dd568aac5e1004ffd1e8400aa5a50ca6a11ad01 /sound/pci/hda/hda_intel.c
parent284e7ca75f96a18f182cce38ba76ee724fb97e16 (diff)
ALSA: Convert to new pm_ops for PCI drivers
Straightforward conversion to the new pm_ops from the legacy suspend/resume ops. Since we change vx222, vx_core and vxpocket have to be converted, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 7757536b9d5f..a69ec7448714 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2403,9 +2403,10 @@ static void azx_power_notify(struct hda_bus *bus)
2403 * power management 2403 * power management
2404 */ 2404 */
2405 2405
2406static int azx_suspend(struct pci_dev *pci, pm_message_t state) 2406static int azx_suspend(struct device *dev)
2407{ 2407{
2408 struct snd_card *card = pci_get_drvdata(pci); 2408 struct pci_dev *pci = to_pci_dev(dev);
2409 struct snd_card *card = dev_get_drvdata(dev);
2409 struct azx *chip = card->private_data; 2410 struct azx *chip = card->private_data;
2410 struct azx_pcm *p; 2411 struct azx_pcm *p;
2411 2412
@@ -2424,13 +2425,14 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
2424 pci_disable_msi(chip->pci); 2425 pci_disable_msi(chip->pci);
2425 pci_disable_device(pci); 2426 pci_disable_device(pci);
2426 pci_save_state(pci); 2427 pci_save_state(pci);
2427 pci_set_power_state(pci, pci_choose_state(pci, state)); 2428 pci_set_power_state(pci, PCI_D3hot);
2428 return 0; 2429 return 0;
2429} 2430}
2430 2431
2431static int azx_resume(struct pci_dev *pci) 2432static int azx_resume(struct device *dev)
2432{ 2433{
2433 struct snd_card *card = pci_get_drvdata(pci); 2434 struct pci_dev *pci = to_pci_dev(dev);
2435 struct snd_card *card = dev_get_drvdata(dev);
2434 struct azx *chip = card->private_data; 2436 struct azx *chip = card->private_data;
2435 2437
2436 pci_set_power_state(pci, PCI_D0); 2438 pci_set_power_state(pci, PCI_D0);
@@ -2455,6 +2457,12 @@ static int azx_resume(struct pci_dev *pci)
2455 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2457 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
2456 return 0; 2458 return 0;
2457} 2459}
2460static SIMPLE_DEV_PM_OPS(azx_pm, azx_suspend, azx_resume);
2461#define AZX_PM_OPS &azx_pm
2462#else
2463#define azx_suspend(dev)
2464#define azx_resume(dev)
2465#define AZX_PM_OPS NULL
2458#endif /* CONFIG_PM */ 2466#endif /* CONFIG_PM */
2459 2467
2460 2468
@@ -2521,13 +2529,13 @@ static void azx_vs_set_state(struct pci_dev *pci,
2521 disabled ? "Disabling" : "Enabling", 2529 disabled ? "Disabling" : "Enabling",
2522 pci_name(chip->pci)); 2530 pci_name(chip->pci));
2523 if (disabled) { 2531 if (disabled) {
2524 azx_suspend(pci, PMSG_FREEZE); 2532 azx_suspend(&pci->dev);
2525 chip->disabled = true; 2533 chip->disabled = true;
2526 snd_hda_lock_devices(chip->bus); 2534 snd_hda_lock_devices(chip->bus);
2527 } else { 2535 } else {
2528 snd_hda_unlock_devices(chip->bus); 2536 snd_hda_unlock_devices(chip->bus);
2529 chip->disabled = false; 2537 chip->disabled = false;
2530 azx_resume(pci); 2538 azx_resume(&pci->dev);
2531 } 2539 }
2532 } 2540 }
2533} 2541}
@@ -3398,10 +3406,9 @@ static struct pci_driver azx_driver = {
3398 .id_table = azx_ids, 3406 .id_table = azx_ids,
3399 .probe = azx_probe, 3407 .probe = azx_probe,
3400 .remove = __devexit_p(azx_remove), 3408 .remove = __devexit_p(azx_remove),
3401#ifdef CONFIG_PM 3409 .driver = {
3402 .suspend = azx_suspend, 3410 .pm = AZX_PM_OPS,
3403 .resume = azx_resume, 3411 },
3404#endif
3405}; 3412};
3406 3413
3407module_pci_driver(azx_driver); 3414module_pci_driver(azx_driver);