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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:33:07 +0000 (13:33 +0100)
commitf64bb48f27fbe789e9d66930008267cfccccac1e
tree78467db01965b4ab471977b502c03df96b7264b0
parentb4b2c4305cf4fea5f47cc3d5a588264a78a42a71
ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend

[ Upstream commit ee0b089d660021792e4ab4dda191b097ce1e964f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/sound/hda_codec.h
sound/pci/hda/hda_codec.c
sound/pci/hda/patch_hdmi.c