From: Takashi Iwai Subject: Re: [PATCH 1/1] ALSA: hda - bug fix for invalid connection list of Haswell HDMI codec pin Date: Fri, 14 Dec 2012 08:09:37 +0100 Message-ID: References: <1355511450-2031-1-git-send-email-mengdong.lin@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id F389D2616F7 for ; Fri, 14 Dec 2012 08:09:39 +0100 (CET) In-Reply-To: <1355511450-2031-1-git-send-email-mengdong.lin@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: mengdong.lin@intel.com Cc: alsa-devel@alsa-project.org, Xingchao Wang List-Id: alsa-devel@alsa-project.org At Fri, 14 Dec 2012 13:57:30 -0500, mengdong.lin@intel.com wrote: > > From: Mengdong Lin > > Haswell HDMI codec pins may report invalid connection list entries, which > will cause failure to play audio via HDMI. > > So this patch > - allow generic hdmi patch to pick up and apply fixups for different codecs. > - add fixup for Haswell to workaround this hardware issue: enable DP1.2 mode > and override invalid connection list entries reported by hardware. How is DP1.2 enablement involved with this? I don't see a link between DP1.2 and the lack of connection list... > Signed-off-by: Mengdong Lin > Signed-off-by: Xingchao Wang > > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > index 71555cc..2bf1758 100644 > --- a/sound/pci/hda/patch_hdmi.c > +++ b/sound/pci/hda/patch_hdmi.c > @@ -38,6 +38,7 @@ > #include > #include "hda_codec.h" > #include "hda_local.h" > +#include "hda_auto_parser.h" > #include "hda_jack.h" > > static bool static_hdmi_pcm; > @@ -79,6 +80,7 @@ struct hdmi_spec_per_pin { > }; > > struct hdmi_spec { > + struct hda_gen_spec gen; > int num_cvts; > struct hdmi_spec_per_cvt cvts[MAX_HDMI_CVTS]; > > @@ -1687,6 +1689,69 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = { > .unsol_event = hdmi_unsol_event, > }; > > +static void intel_haswell_fixup_enable_dp12_mode(struct hda_codec *codec, > + const struct hda_fixup *fix, int action) > +{ > + unsigned int vendor_param; > + > + if (action != HDA_FIXUP_ACT_PRE_PROBE) > + return; Isn't this needed after S4? > + vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0); > + if (vendor_param == -1 || vendor_param & 0x02) > + return; > + > + vendor_param |= 0x02; > + snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param); > +} > + > +static void intel_haswell_fixup_connect_list(struct hda_codec *codec, > + const struct hda_fixup *fix, int action) > +{ > + hda_nid_t list[3] = {0x2, 0x3, 0x4}; > + unsigned int vendor_param; > + > + if (action != HDA_FIXUP_ACT_PROBE) > + return; Is this ACT_PROBE, that is, applied only after parsing the codec? Usually a fixup for overriding the connection list is applied before parsing the tree. thanks, Takashi > + vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0); > + if (vendor_param == -1 || !(vendor_param & 0x02)) > + return; > + > + snd_hda_override_conn_list(codec, 0x06, 3, list); > + hdmi_read_pin_conn(codec, 1); > +} > + > + > +/* available models for fixup */ > +enum { > + INTEL_HASWELL, > + INTEL_HASWELL_CONNECT_LIST, > +}; > + > +static const struct hda_model_fixup hdmi_models[] = { > + {.id = INTEL_HASWELL, .name = "Haswell"}, > + {} > +}; > + > +static const struct snd_pci_quirk hdmi_fixup_tbl[] = { > + SND_PCI_QUIRK(0x8086, 0x2010, "Haswell", INTEL_HASWELL), > + {} /* terminator */ > +}; > + > +static const struct hda_fixup hdmi_fixups[] = { > + [INTEL_HASWELL] = { > + .type = HDA_FIXUP_FUNC, > + .v.func = intel_haswell_fixup_enable_dp12_mode, > + .chained = true, > + .chain_id = INTEL_HASWELL_CONNECT_LIST, > + }, > + [INTEL_HASWELL_CONNECT_LIST] = { > + .type = HDA_FIXUP_FUNC, > + .v.func = intel_haswell_fixup_connect_list, > + }, > +}; > + > static int patch_generic_hdmi(struct hda_codec *codec) > { > struct hdmi_spec *spec; > @@ -1696,11 +1761,19 @@ static int patch_generic_hdmi(struct hda_codec *codec) > return -ENOMEM; > > codec->spec = spec; > + snd_hda_gen_init(&spec->gen); > + > + snd_hda_pick_fixup(codec, hdmi_models, hdmi_fixup_tbl, hdmi_fixups); > + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); > + > if (hdmi_parse_codec(codec) < 0) { > codec->spec = NULL; > kfree(spec); > return -EINVAL; > } > + > + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); > + > codec->patch_ops = generic_hdmi_patch_ops; > generic_hdmi_init_per_pins(codec); > > -- > 1.7.9.5 >