Re: [PATCH 23/27] ALSA: hda/hdmi: Rewrite to new probe method

Mikhail Paulyshka
2025-08-17T11:04:46Z

On 7/9/25 7:04 PM, Takashi Iwai wrote:
> diff --git a/sound/hda/codecs/hdmi/intelhdmi.c b/sound/hda/codecs/hdmi/intelhdmi.c
> index a88ac1f80db6..23237d527430 100644
> --- a/sound/hda/codecs/hdmi/intelhdmi.c
> +++ b/sound/hda/codecs/hdmi/intelhdmi.c
> @@ -701,51 +698,104 @@ static int patch_i915_byt_hdmi(struct hda_codec *codec)
> }
>
> /* Intel IronLake, SandyBIridge and IvyBridge; with eld notifier */
> -static int patch_i915_cpt_hdmi(struct hda_codec *codec)
> +static int probe_i915_cpt_hdmi(struct hda_codec *codec)
> +{
> + return parse_intel_hdmi(codec);
> +}
> +
> +/*
> + * common driver probe
> + */
> +static int intelhdmi_probe(struct hda_codec *codec, const struct hda_device_id *id)
> {
> int err;
>
> err = alloc_intel_hdmi(codec);
> if (err < 0)
> return err;
> - return parse_intel_hdmi(codec);
> +
> + switch (id->driver_data) {
> + case MODEL_HSW:
> + err = probe_i915_hsw_hdmi(codec);
> + break;
> + case MODEL_GLK:
> + err = probe_i915_glk_hdmi(codec);
> + break;
> + case MODEL_ICL:
> + err = probe_i915_icl_hdmi(codec);
> + break;
> + case MODEL_TGL:
> + err = probe_i915_tgl_hdmi(codec);
> + break;
> + case MODEL_ADLP:
> + err = probe_i915_adlp_hdmi(codec);
> + break;
> + case MODEL_BYT:
> + err = probe_i915_byt_hdmi(codec);
> + break;
> + case MODEL_CPT:
> + err = probe_i915_cpt_hdmi(codec);
> + break;
> + default:
> + err = -EINVAL;
> + break;
> + }
> +
> + if (err < 0) {
> + snd_hda_hdmi_generic_spec_free(codec);

Is this the intended behavior? It modifies the codec state even when it
does not match any Intel model. We have reports from users on 6.17-rc1
with AMD BC-250 hardware experiencing HDMI audio detection issues.
Adding a check for |EINVAL| resolves the problem.

> - if (err < 0) { > + if (err < 0 && err != -EINVAL) {