OSDN Git Service

ALSA: hda - Use standard runtime PM for codec power-save control
authorTakashi Iwai <tiwai@suse.de>
Thu, 19 Feb 2015 15:00:22 +0000 (16:00 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 Feb 2015 08:16:07 +0000 (09:16 +0100)
commitcc72da7d4d063ab9e690e56e0ef1ca1c24ee1635
tree7dbde009e56e7e3c9d555df9cb41d1b434657218
parent59ed1eade1d6ec24751baca99305f9713a5d779e
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>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_trace.h