ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Fri, 9 Dec 2022 10:18:22 +0000 (12:18 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 9 Dec 2022 11:06:15 +0000 (12:06 +0100)
commitee0b089d660021792e4ab4dda191b097ce1e964f
tree102327f52802e3fd63c8a4c254b1ca813fc0b291
parentb17e7ea041d8b565063632501ca4597afd105102
ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend

When the new style KAE keep-alive implementation is used on compatible
Intel hardware, the clocks are maintained when codec is in D3. The
generic code in hda_cleanup_all_streams() can however interfere with
generation of audio samples in this mode, by setting the stream and
channel ids to zero.

To get full benefit of the keepalive, set the new
no_stream_clean_at_suspend quirk bit on affected Intel hardware. When
this bit is set, stream cleanup is skipped in hda_call_codec_suspend().

Special handling is needed for the case when system goes to suspend. The
stream id programming can be lost in this case. This will also cause
codec->cvt_setups to be out of sync. Handle this by implementing custom
suspend/resume handlers. If keep-alive is active for any converter, set
the quirk flags no_stream_clean_at_suspend and forced_resume. Upon
resume, keepalive programming is restored if needed.

Fixes: 15175a4f2bbb ("ALSA: hda/hdmi: add keep-alive support for ADL-P and DG2")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221209101822.3893675-4-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hda_codec.h
sound/pci/hda/hda_codec.c
sound/pci/hda/patch_hdmi.c