On Tue, Jan 5, 2021 at 8:28 PM Kai Vehmanen kai.vehmanen@linux.intel.com wrote:
Hey,
On Mon, 4 Jan 2021, Kai-Heng Feng wrote:
System takes a very long time to suspend after commit 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization"): [ 90.065964] PM: suspend entry (s2idle)
the patch itself looks good, but can you explain a bit more in what conditions you hit the delay?
If both controller and codec are suspended, I can 100% reproduce the issue.
I tried to reproduce the delay on multiple systems (with tip of tiwai/master), but with no luck. I can see hda_jackpoll_work() called, but at this point runtime pm has been disabled already (via __device_suspend()) and snd_hdac_is_power_on() will return true even when pm_runtime_suspended() is true as well (which is expected as runtime-pm is disabled at this point for system suspend). End result is codec is not powered up in hda_jackpoll_work() and suspend is not delayed.
On my system snd_hdac_is_power_on() calls hda_set_power_state() which takes long time to write to (suspended) codec. I am not sure why it doesn't power up codec on your system.
The patch still seems correct. You would hit the problem you describe if jackpoll_interval was set to a non-zero value (not the case on most systems supported by SOF, but still a possibility). I'm still curious how you hit the problem. At minimum, we are missing a scenario in our testing.
The issue happens with zero jackpoll_interval.
Kai-Heng
Br, Kai