]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda: Refactor codec PM to use direct-complete optimization
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Tue, 27 Oct 2020 13:00:36 +0000 (21:00 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 28 Oct 2020 08:42:46 +0000 (09:42 +0100)
commit3562889743c8c8f9086ba93ed8ce57393b10684f
tree840352c767f3b4487d2da81458f6e0f979f60272
parent32ace6b7625bc2f6ab35cb1b0257b5f3381c8da3
ALSA: hda: Refactor codec PM to use direct-complete optimization

Upon system resume, hda_codec_pm_resume() uses hda_codec_force_resume()
to resume the codec. However, pm_runtime_force_resume() won't really
resume the codec because of pm_runtime_need_not_resume() check.

Hence, hda_codec_force_resume() schedules a jackpoll work, which is to
really power up the codec.

Instead of doing that, we can use direct-complete to make the PM flow
more straightforward, and keep codec always suspended through system PM
flow if conditions are met.

On system suspend, PM core will decide what to do based on
hda_codec_pm_prepare():
- If codec is not runtime-suspended, PM core will suspend and resume the
device as normal.
- If codec is runtime-suspended, PM core will try to keep it suspended.
If it's still suspended after system resume, we use
hda_codec_pm_complete() to resume codec if it's needed.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20201027130038.16463-2-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c