aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_codec.c29
-rw-r--r--sound/pci/hda/hda_codec.h4
2 files changed, 26 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 85886220ee74..472e5d04701e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -96,7 +96,8 @@ EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset);
96 96
97#ifdef CONFIG_PM 97#ifdef CONFIG_PM
98#define codec_in_pm(codec) ((codec)->in_pm) 98#define codec_in_pm(codec) ((codec)->in_pm)
99static void hda_pm_work(struct work_struct *work); 99static void hda_suspend_work(struct work_struct *work);
100static void hda_resume_work(struct work_struct *work);
100static void hda_power_work(struct work_struct *work); 101static void hda_power_work(struct work_struct *work);
101static void hda_keep_power_on(struct hda_codec *codec); 102static void hda_keep_power_on(struct hda_codec *codec);
102#define hda_codec_is_power_on(codec) ((codec)->power_on) 103#define hda_codec_is_power_on(codec) ((codec)->power_on)
@@ -1474,7 +1475,8 @@ int snd_hda_codec_new(struct hda_bus *bus,
1474#ifdef CONFIG_PM 1475#ifdef CONFIG_PM
1475 spin_lock_init(&codec->power_lock); 1476 spin_lock_init(&codec->power_lock);
1476 INIT_DELAYED_WORK(&codec->power_work, hda_power_work); 1477 INIT_DELAYED_WORK(&codec->power_work, hda_power_work);
1477 INIT_WORK(&codec->pm_work, hda_pm_work); 1478 INIT_WORK(&codec->suspend_work, hda_suspend_work);
1479 INIT_WORK(&codec->resume_work, hda_resume_work);
1478 /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. 1480 /* snd_hda_codec_new() marks the codec as power-up, and leave it as is.
1479 * the caller has to power down appropriatley after initialization 1481 * the caller has to power down appropriatley after initialization
1480 * phase. 1482 * phase.
@@ -5116,13 +5118,21 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
5116} 5118}
5117EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power); 5119EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power);
5118 5120
5119static void hda_pm_work(struct work_struct *work) 5121static void hda_suspend_work(struct work_struct *work)
5120{ 5122{
5121 struct hda_codec *codec = 5123 struct hda_codec *codec =
5122 container_of(work, struct hda_codec, pm_work); 5124 container_of(work, struct hda_codec, suspend_work);
5123 5125
5124 hda_call_codec_suspend(codec, false); 5126 hda_call_codec_suspend(codec, false);
5125} 5127}
5128
5129static void hda_resume_work(struct work_struct *work)
5130{
5131 struct hda_codec *codec =
5132 container_of(work, struct hda_codec, resume_work);
5133
5134 hda_call_codec_resume(codec);
5135}
5126#endif 5136#endif
5127 5137
5128/* 5138/*
@@ -5700,7 +5710,7 @@ int snd_hda_suspend(struct hda_bus *bus)
5700 cancel_delayed_work_sync(&codec->jackpoll_work); 5710 cancel_delayed_work_sync(&codec->jackpoll_work);
5701 if (hda_codec_is_power_on(codec)) { 5711 if (hda_codec_is_power_on(codec)) {
5702 if (bus->num_codecs > 1) 5712 if (bus->num_codecs > 1)
5703 queue_work(bus->pm_wq, &codec->pm_work); 5713 queue_work(bus->pm_wq, &codec->suspend_work);
5704 else 5714 else
5705 hda_call_codec_suspend(codec, false); 5715 hda_call_codec_suspend(codec, false);
5706 } 5716 }
@@ -5724,8 +5734,15 @@ int snd_hda_resume(struct hda_bus *bus)
5724 struct hda_codec *codec; 5734 struct hda_codec *codec;
5725 5735
5726 list_for_each_entry(codec, &bus->codec_list, list) { 5736 list_for_each_entry(codec, &bus->codec_list, list) {
5727 hda_call_codec_resume(codec); 5737 if (bus->num_codecs > 1)
5738 queue_work(bus->pm_wq, &codec->resume_work);
5739 else
5740 hda_call_codec_resume(codec);
5728 } 5741 }
5742
5743 if (bus->num_codecs > 1)
5744 flush_workqueue(bus->pm_wq);
5745
5729 return 0; 5746 return 0;
5730} 5747}
5731EXPORT_SYMBOL_HDA(snd_hda_resume); 5748EXPORT_SYMBOL_HDA(snd_hda_resume);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 9a2798a0313c..01b248d3f7b2 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -921,7 +921,9 @@ struct hda_codec {
921 unsigned long power_off_acct; 921 unsigned long power_off_acct;
922 unsigned long power_jiffies; 922 unsigned long power_jiffies;
923 spinlock_t power_lock; 923 spinlock_t power_lock;
924 struct work_struct pm_work; /* task to parallel multi-codec PM */ 924 /* tasks to parallel multi-codec suspend/resume */
925 struct work_struct suspend_work;
926 struct work_struct resume_work;
925#endif 927#endif
926 928
927 /* filter the requested power state per nid */ 929 /* filter the requested power state per nid */