FAILED: patch "[PATCH] ALSA: hda: codecs: hdmi: disable keep-alive before audio" failed to apply to 6.6-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x a3d6d3cedfe87bbd5a677d52b22ac20d28e59cf8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072952-henna-smolder-cd89@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a3d6d3cedfe87bbd5a677d52b22ac20d28e59cf8 Mon Sep 17 00:00:00 2001
From: Kai Vehmanen <[email protected]>
Date: Wed, 15 Jul 2026 21:06:10 +0300
Subject: [PATCH] ALSA: hda: codecs: hdmi: disable keep-alive before audio
format change
When a keep-alive (KAE) silent stream is active on an Intel HDMI/DP codec, opening a real PCM stream reprograms the converter format and the audio infoframe in snd_hda_hdmi_generic_pcm_prepare(). Part of that reprogramming - the converter channel count and the channel mapping in snd_hda_hdmi_setup_audio_infoframe() - is not safe to do while a keep-alive stream is active. This is most visible when switching to a multichannel PCM configuration, where the active channel count actually changes. In that case the newly opened PCM stream plays no sound.
Add an optional hdmi_ops .prepare hook, called at the start of the PCM prepare sequence (before the format and infoframe are touched), and implement it for HSW+ to release keep-alive. Keep-alive is then re-enabled as before once the new stream has been set up, in the setup_stream op.
sound/hda/codecs/hdmi/hdmi.c +3 -0
@@ -1688,6 +1688,9 @@ int snd_hda_hdmi_generic_pcm_prepare(struct hda_pcm_stream *hinfo, per_pin->channels = substream->runtime->channels; per_pin->setup = true; +if (spec->ops.prepare) + spec->ops.prepare (codec, per_pin); +if (get_wcaps (codec, cvt_nid) &AC_WCAP_STRIPE ) { stripe =snd_hdac_get_stream_stripe_ctl (&codec->bus->core, substream);
sound/hda/codecs/hdmi/hdmi_local.h +9 -0
@@ -74,6 +74,15 @@ struct hdmi_ops { hda_nid_t pin_nid, int dev_id, u32 stream_tag, int format); +/* +* Optional hook invoked at the beginning of the PCM prepare +* sequence, before the audio infoframe and stream format are +* (re)programmed. Used to disable keep-alive / silent stream so +* that the format change is not done while keep-alive is active. +*/ +void (*prepare)(struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin); +void (*pin_cvt_fixup)(struct hda_codec *codec,struct hdmi_spec_per_pin *per_pin,hda_nid_t cvt_nid);
sound/hda/codecs/hdmi/intelhdmi.c +30 -6
@@ -418,6 +418,28 @@ static void intel_not_share_assigned_cvt_nid(struct hda_codec *codec,intel_not_share_assigned_cvt (codec, pin_nid, dev_id, mux_idx); } +/* +* prepare ops override for HSW+ +* +* Disable keep-alive before the converter format and audio infoframe are +* reprogrammed by the PCM prepare sequence. Changing the audio format (e.g. +* the channel count when switching to multichannel PCM) while a keep-alive +* stream is active is not safe, so release keep-alive here, early in the +* sequence. It is re-enabled once the new stream has been set up, in +* i915_hsw_setup_stream(). +*/ +static void i915_hsw_prepare (struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin) +{ +struct hdmi_spec *spec = codec->spec; + +if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin->silent_stream) { +silent_stream_set_kae (codec, per_pin, false); +/* wait for pending transfers in codec to clear */ +usleep_range (100 ,200 ); + } +} +/* setup_stream ops override for HSW+ */ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, hda_nid_t pin_nid, int dev_id, u32 stream_tag,
@@ -435,15 +457,16 @@ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,haswell_verify_D0 (codec, cvt_nid, pin_nid); -if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) { -silent_stream_set_kae (codec, per_pin, false); -/* wait for pending transfers in codec to clear */ -usleep_range (100 ,200 ); - } - res =snd_hda_hdmi_setup_stream (codec, cvt_nid, pin_nid, dev_id, stream_tag, format); +/* +* Keep-alive was disabled in i915_hsw_prepare(), re-enable it now. +* The pin lookup above resolves to the same per_pin that prepare +* used (pin_nid comes from that per_pin), so this stays balanced; a +* NULL per_pin only occurs on a lookup failure that also implies no +* active keep-alive stream to restore. +*/ if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {usleep_range (100 ,200 );silent_stream_set_kae (codec, per_pin, true);
@@ -607,6 +630,7 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, codec->depop_delay =0 ; codec->auto_runtime_pm =1 ; + spec->ops.prepare = i915_hsw_prepare; spec->ops.setup_stream = i915_hsw_setup_stream; spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup; spec->ops.silent_stream = i915_set_silent_stream;
Sasha Levin
maintainerPATCH 1/1 ALSA: hda: codecs: hdmi: disable keep-alive before audio format change
From: Kai Vehmanen <[email protected]>
[ Upstream commit a3d6d3cedfe87bbd5a677d52b22ac20d28e59cf8 ]
When a keep-alive (KAE) silent stream is active on an Intel HDMI/DP codec, opening a real PCM stream reprograms the converter format and the audio infoframe in snd_hda_hdmi_generic_pcm_prepare(). Part of that reprogramming - the converter channel count and the channel mapping in snd_hda_hdmi_setup_audio_infoframe() - is not safe to do while a keep-alive stream is active. This is most visible when switching to a multichannel PCM configuration, where the active channel count actually changes. In that case the newly opened PCM stream plays no sound.
Add an optional hdmi_ops .prepare hook, called at the start of the PCM prepare sequence (before the format and infoframe are touched), and implement it for HSW+ to release keep-alive. Keep-alive is then re-enabled as before once the new stream has been set up, in the setup_stream op.
--- sound/pci/hda/patch_hdmi.c | 48 +++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-)
sound/pci/hda/patch_hdmi.c +42 -6
@@ -111,6 +111,15 @@ struct hdmi_ops { hda_nid_t pin_nid, int dev_id, u32 stream_tag, int format); +/* +* Optional hook invoked at the beginning of the PCM prepare +* sequence, before the audio infoframe and stream format are +* (re)programmed. Used to disable keep-alive / silent stream so +* that the format change is not done while keep-alive is active. +*/ +void (*prepare)(struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin); +void (*pin_cvt_fixup)(struct hda_codec *codec,struct hdmi_spec_per_pin *per_pin,hda_nid_t cvt_nid);
@@ -2134,6 +2143,9 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, per_pin->channels = substream->runtime->channels; per_pin->setup = true; +if (spec->ops.prepare) + spec->ops.prepare (codec, per_pin); +if (get_wcaps (codec, cvt_nid) &AC_WCAP_STRIPE ) { stripe =snd_hdac_get_stream_stripe_ctl (&codec->bus->core, substream);
@@ -2905,6 +2917,28 @@ static void register_i915_notifier(struct hda_codec *codec) codec->relaxed_resume =1 ; } +/* +* prepare ops override for HSW+ +* +* Disable keep-alive before the converter format and audio infoframe are +* reprogrammed by the PCM prepare sequence. Changing the audio format (e.g. +* the channel count when switching to multichannel PCM) while a keep-alive +* stream is active is not safe, so release keep-alive here, early in the +* sequence. It is re-enabled once the new stream has been set up, in +* i915_hsw_setup_stream(). +*/ +static void i915_hsw_prepare (struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin) +{ +struct hdmi_spec *spec = codec->spec; + +if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin->silent_stream) { +silent_stream_set_kae (codec, per_pin, false); +/* wait for pending transfers in codec to clear */ +usleep_range (100 ,200 ); + } +} +/* setup_stream ops override for HSW+ */ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, hda_nid_t pin_nid, int dev_id, u32 stream_tag,
@@ -2922,15 +2956,16 @@ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,haswell_verify_D0 (codec, cvt_nid, pin_nid); -if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) { -silent_stream_set_kae (codec, per_pin, false); -/* wait for pending transfers in codec to clear */ -usleep_range (100 ,200 ); - } - res =hdmi_setup_stream (codec, cvt_nid, pin_nid, dev_id, stream_tag, format); +/* +* Keep-alive was disabled in i915_hsw_prepare(), re-enable it now. +* The pin lookup above resolves to the same per_pin that prepare +* used (pin_nid comes from that per_pin), so this stays balanced; a +* NULL per_pin only occurs on a lookup failure that also implies no +* active keep-alive stream to restore. +*/ if (spec->silent_stream_type ==SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {usleep_range (100 ,200 );silent_stream_set_kae (codec, per_pin, true);
@@ -3106,6 +3141,7 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, codec->depop_delay =0 ; codec->auto_runtime_pm =1 ; + spec->ops.prepare = i915_hsw_prepare; spec->ops.setup_stream = i915_hsw_setup_stream; spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
Signature · 1 line
2.53.0