]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda: Balance runtime/system PM if direct-complete is disabled
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Tue, 19 Jan 2021 15:21:43 +0000 (23:21 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 19 Jan 2021 15:42:39 +0000 (16:42 +0100)
commitedc715d97960070aa9fb9cb30cadf79ba3060bf2
tree3209fade0d94351251037eaaf98e6fd2e35d8574
parent3e561e412c8db1d620a226cf8d5ae104c39ac9e3
ALSA: hda: Balance runtime/system PM if direct-complete is disabled

After hibernation, HDA controller can't be runtime-suspended after
commit 3562889743c8 ("ALSA: hda: Refactor codjc PM to use
direct-complete optimization"), which enables direct-complete for HDA
codec.

The HDA codec driver didn't expect direct-complete will be disabled
after it returns a positive value from prepare() callback. However,
there are some places that PM core can disable direct-complete. For
instance, system hibernation or when codec has subordinates like LEDs.

So if the codec is prepared for direct-complete but PM core still calls
codec's suspend or freeze callback, partially revert the commit and take
the original approach, which uses pm_runtime_force_*() helpers to
ensure PM refcount are balanced. Meanwhile, still keep prepare() and
complete() callbacks to enable direct-complete and request a resume for
jack detection, respectively.

Reported-by: Kenneth R. Crudup <kenny@panix.com>
Fixes: 3562889743c8 ("ALSA: hda: Refactor codec PM to use direct-complete optimization")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20210119152145.346558-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c