• Kai-Heng Feng's avatar
    ALSA: hda: Refactor codec PM to use direct-complete optimization · 215a22ed
    Kai-Heng Feng authored
    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: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
    Link: https://lore.kernel.org/r/20201027130038.16463-2-kai.heng.feng@canonical.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    215a22ed
hda_codec.c 109 KB