ALSA: hda: Always use jackpoll helper for jack update after resume
authorTakashi Iwai <tiwai@suse.de>
Wed, 22 Apr 2020 20:37:44 +0000 (22:37 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 23 Apr 2020 10:24:14 +0000 (12:24 +0200)
commit8d6762af302d69f76fa788a277a56a9d9cd275d5
treebbcb1cc17f4ccd7c7eb8b357c6816ca3776824ef
parent7fbdcd8301a84c09cebfa64f1317a6dafeec9188
ALSA: hda: Always use jackpoll helper for jack update after resume

HD-audio codec driver applies a tricky procedure to forcibly perform
the runtime resume by mimicking the usage count even if the device has
been runtime-suspended beforehand.  This was needed to assure to
trigger the jack detection update after the system resume.

And recently we also applied the similar logic to the HD-audio
controller side.  However this seems leading to some inconsistency,
and eventually PCI controller gets screwed up.

This patch is an attempt to fix and clean up those behavior: instead
of the tricky runtime resume procedure, the existing jackpoll work is
scheduled when such a forced codec resume is required.  The jackpoll
work will power up the codec, and this alone should suffice for the
jack status update in usual cases.  If the extra polling is requested
(by checking codec->jackpoll_interval), the manual update is invoked
after that, and the codec is powered down again.

Also, we filter the spurious wake up of the codec from the controller
runtime resume by checking codec->relaxed_resume flag.  If this flag
is set, basically we don't need to wake up explicitly, but it's
supposed to be done via the audio component notifier.

Fixes: c4c8dd6ef807 ("ALSA: hda: Skip controller resume if not needed")
Link: https://lore.kernel.org/r/20200422203744.26299-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_intel.c