diff options
author | Mengdong Lin <mengdong.lin@intel.com> | 2013-11-27 05:32:23 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-27 12:37:07 +0100 |
commit | 12edb893082b89f4d3af85ab9f4750aa8d3c34f3 (patch) | |
tree | 078aa14e02d8c49a9cb416d711c6fe218be840e9 /sound | |
parent | Merge branch 'topic/hda' into for-next (diff) | |
download | linux-12edb893082b89f4d3af85ab9f4750aa8d3c34f3.tar.xz linux-12edb893082b89f4d3af85ab9f4750aa8d3c34f3.zip |
ALSA: hda - resume codecs in parallel
To reduce driver resume time, this patch resumes the codecs in parallel
if there are multiple codecs on the bus.
- The PM workqueue of bus is also used to parallel resuming multiple codecs.
- The work item 'pm_work' is renamed to 'suspend_work' to parallel suspending
codecs.
- Add a work item 'resume_work' to parallel resuming codecs.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 29 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 4 |
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); #ifdef CONFIG_PM #define codec_in_pm(codec) ((codec)->in_pm) -static void hda_pm_work(struct work_struct *work); +static void hda_suspend_work(struct work_struct *work); +static void hda_resume_work(struct work_struct *work); static void hda_power_work(struct work_struct *work); static void hda_keep_power_on(struct hda_codec *codec); #define hda_codec_is_power_on(codec) ((codec)->power_on) @@ -1474,7 +1475,8 @@ int snd_hda_codec_new(struct hda_bus *bus, #ifdef CONFIG_PM spin_lock_init(&codec->power_lock); INIT_DELAYED_WORK(&codec->power_work, hda_power_work); - INIT_WORK(&codec->pm_work, hda_pm_work); + INIT_WORK(&codec->suspend_work, hda_suspend_work); + INIT_WORK(&codec->resume_work, hda_resume_work); /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. * the caller has to power down appropriatley after initialization * phase. @@ -5116,13 +5118,21 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power); -static void hda_pm_work(struct work_struct *work) +static void hda_suspend_work(struct work_struct *work) { struct hda_codec *codec = - container_of(work, struct hda_codec, pm_work); + container_of(work, struct hda_codec, suspend_work); hda_call_codec_suspend(codec, false); } + +static void hda_resume_work(struct work_struct *work) +{ + struct hda_codec *codec = + container_of(work, struct hda_codec, resume_work); + + hda_call_codec_resume(codec); +} #endif /* @@ -5700,7 +5710,7 @@ int snd_hda_suspend(struct hda_bus *bus) cancel_delayed_work_sync(&codec->jackpoll_work); if (hda_codec_is_power_on(codec)) { if (bus->num_codecs > 1) - queue_work(bus->pm_wq, &codec->pm_work); + queue_work(bus->pm_wq, &codec->suspend_work); else hda_call_codec_suspend(codec, false); } @@ -5724,8 +5734,15 @@ int snd_hda_resume(struct hda_bus *bus) struct hda_codec *codec; list_for_each_entry(codec, &bus->codec_list, list) { - hda_call_codec_resume(codec); + if (bus->num_codecs > 1) + queue_work(bus->pm_wq, &codec->resume_work); + else + hda_call_codec_resume(codec); } + + if (bus->num_codecs > 1) + flush_workqueue(bus->pm_wq); + return 0; } EXPORT_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 { unsigned long power_off_acct; unsigned long power_jiffies; spinlock_t power_lock; - struct work_struct pm_work; /* task to parallel multi-codec PM */ + /* tasks to parallel multi-codec suspend/resume */ + struct work_struct suspend_work; + struct work_struct resume_work; #endif /* filter the requested power state per nid */ |