ALSA: hda - Use standard runtime PM for codec power-save control
Like the previous transition of suspend/resume, now move the
power-save code to the standard runtime PM. As usual for runtime PM,
it's a bit tricky, but this simplified codes a lot in the end.
For keeping the usage compatibility, power_save module option still
controls the whole power-saving behavior on all codecs. The value is
translated to pm_runtime_*_autosuspend() and pm_runtime_allow() /
pm_runtime_forbid() calls.
snd_hda_power_up() and snd_hda_power_down() are translated to
pm_runtime_get_sync() and pm_runtime_put_autosuspend(), respectively.
Since we can do call pm_runtime_get_sync() more reliably, the sync
version is used always and snd_hda_power_up_d3wait() is dropped.
Another slight difference is that snd_hda_power_up()/down() don't call
runtime_pm code during the suspend/resume transition phase. Calling
them there isn't safe unlike our own code, resulted in unexpected
behavior (endless wakeups).
The hda_power_count tracepoint was removed, as it doesn't match well
with the new code.
Last but not least, we need to set ignore_children flag in the parent
dev.power field so that the runtime PM of the controller chip won't
get confused. The notification is still done in the bus pm_notify
callback. We'll get rid of this hack in the later patch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing
Please register or sign in to comment