diff mbox

[(Quantal,SRU)] ALSA: hda - bug fix for invalid connection list of Haswell HDMI codec pins

Message ID 1357118255-3200-1-git-send-email-david.henningsson@canonical.com
State New
Headers show

Commit Message

David Henningsson Jan. 2, 2013, 9:17 a.m. UTC
From: Mengdong Lin <mengdong.lin@intel.com>

Haswell HDMI codec pins may report invalid connection list entries, which
will cause failure to play audio via HDMI or Display Port.

So this patch adds fixup for Haswell to workaround this hardware issue:
enable DP1.2 mode and override the pins' connection list entries with proper
value.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 6ffe168f822cf7f777987cddc00ade542fd73bf0)

BugLink: https://bugs.launchpad.net/bugs/1095242
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---

We're being advised by Intel to include the following patch for the Quantal kernel, to fix a Haswell/Sharkbay HDMI/DP audio issue. As there are no sharkbay machines out there yet, and the patch contains a "if codec->vendor_id == 80862807" I assume this will cause no regressions.

The commit is already in the 3.8 kernel, so this is just for the 3.5 SRU.

 sound/pci/hda/patch_hdmi.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Colin Ian King Jan. 2, 2013, 10:04 a.m. UTC | #1
On 02/01/13 09:17, David Henningsson wrote:
> From: Mengdong Lin <mengdong.lin@intel.com>
>
> Haswell HDMI codec pins may report invalid connection list entries, which
> will cause failure to play audio via HDMI or Display Port.
>
> So this patch adds fixup for Haswell to workaround this hardware issue:
> enable DP1.2 mode and override the pins' connection list entries with proper
> value.
>
> Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
> Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> (cherry picked from commit 6ffe168f822cf7f777987cddc00ade542fd73bf0)
>
> BugLink: https://bugs.launchpad.net/bugs/1095242
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
>
> We're being advised by Intel to include the following patch for the Quantal kernel, to fix a Haswell/Sharkbay HDMI/DP audio issue. As there are no sharkbay machines out there yet, and the patch contains a "if codec->vendor_id == 80862807" I assume this will cause no regressions.
>
> The commit is already in the 3.8 kernel, so this is just for the 3.5 SRU.
>
>   sound/pci/hda/patch_hdmi.c |   28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index dc249b2..a7e4da4 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1323,6 +1323,30 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
>   	.unsol_event		= hdmi_unsol_event,
>   };
>
> +static void intel_haswell_fixup_connect_list(struct hda_codec *codec)
> +{
> +	unsigned int vendor_param;
> +	hda_nid_t list[3] = {0x2, 0x3, 0x4};
> +
> +	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
> +	if (vendor_param == -1 || vendor_param & 0x02)
> +		return;
> +
> +	/* enable DP1.2 mode */
> +	vendor_param |= 0x02;
> +	snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param);
> +
> +	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
> +	if (vendor_param == -1 || !(vendor_param & 0x02))
> +		return;
> +
> +	/* override 3 pins connection list */
> +	snd_hda_override_conn_list(codec, 0x05, 3, list);
> +	snd_hda_override_conn_list(codec, 0x06, 3, list);
> +	snd_hda_override_conn_list(codec, 0x07, 3, list);
> +}
> +
> +
>   static int patch_generic_hdmi(struct hda_codec *codec)
>   {
>   	struct hdmi_spec *spec;
> @@ -1332,6 +1356,10 @@ static int patch_generic_hdmi(struct hda_codec *codec)
>   		return -ENOMEM;
>
>   	codec->spec = spec;
> +
> +	if (codec->vendor_id == 0x80862807)
> +		intel_haswell_fixup_connect_list(codec);
> +
>   	if (hdmi_parse_codec(codec) < 0) {
>   		codec->spec = NULL;
>   		kfree(spec);
>

Minimal regression potential since this contains vendor ID specific checks.

Acked-by: Colin Ian King <colin.king@canonical.com>
Andy Whitcroft Jan. 2, 2013, 11:07 a.m. UTC | #2
On Wed, Jan 02, 2013 at 10:17:35AM +0100, David Henningsson wrote:
> From: Mengdong Lin <mengdong.lin@intel.com>
> 
> Haswell HDMI codec pins may report invalid connection list entries, which
> will cause failure to play audio via HDMI or Display Port.
> 
> So this patch adds fixup for Haswell to workaround this hardware issue:
> enable DP1.2 mode and override the pins' connection list entries with proper
> value.
> 
> Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
> Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> (cherry picked from commit 6ffe168f822cf7f777987cddc00ade542fd73bf0)
> 
> BugLink: https://bugs.launchpad.net/bugs/1095242
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
> 
> We're being advised by Intel to include the following patch for the Quantal kernel, to fix a Haswell/Sharkbay HDMI/DP audio issue. As there are no sharkbay machines out there yet, and the patch contains a "if codec->vendor_id == 80862807" I assume this will cause no regressions.
> 
> The commit is already in the 3.8 kernel, so this is just for the 3.5 SRU.
> 
>  sound/pci/hda/patch_hdmi.c |   28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index dc249b2..a7e4da4 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1323,6 +1323,30 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
>  	.unsol_event		= hdmi_unsol_event,
>  };
>  
> +static void intel_haswell_fixup_connect_list(struct hda_codec *codec)
> +{
> +	unsigned int vendor_param;
> +	hda_nid_t list[3] = {0x2, 0x3, 0x4};
> +
> +	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
> +	if (vendor_param == -1 || vendor_param & 0x02)
> +		return;
> +
> +	/* enable DP1.2 mode */
> +	vendor_param |= 0x02;
> +	snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param);
> +
> +	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
> +	if (vendor_param == -1 || !(vendor_param & 0x02))
> +		return;
> +
> +	/* override 3 pins connection list */
> +	snd_hda_override_conn_list(codec, 0x05, 3, list);
> +	snd_hda_override_conn_list(codec, 0x06, 3, list);
> +	snd_hda_override_conn_list(codec, 0x07, 3, list);
> +}
> +
> +
>  static int patch_generic_hdmi(struct hda_codec *codec)
>  {
>  	struct hdmi_spec *spec;
> @@ -1332,6 +1356,10 @@ static int patch_generic_hdmi(struct hda_codec *codec)
>  		return -ENOMEM;
>  
>  	codec->spec = spec;
> +
> +	if (codec->vendor_id == 0x80862807)
> +		intel_haswell_fixup_connect_list(codec);
> +
>  	if (hdmi_parse_codec(codec) < 0) {
>  		codec->spec = NULL;
>  		kfree(spec);

Seems to be already upstream, highly machine specific, and recommended by the manufacturer,
therefore:

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Andy Whitcroft Jan. 2, 2013, 11:09 a.m. UTC | #3
Applied to Quantal.

-apw
diff mbox

Patch

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index dc249b2..a7e4da4 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1323,6 +1323,30 @@  static const struct hda_codec_ops generic_hdmi_patch_ops = {
 	.unsol_event		= hdmi_unsol_event,
 };
 
+static void intel_haswell_fixup_connect_list(struct hda_codec *codec)
+{
+	unsigned int vendor_param;
+	hda_nid_t list[3] = {0x2, 0x3, 0x4};
+
+	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
+	if (vendor_param == -1 || vendor_param & 0x02)
+		return;
+
+	/* enable DP1.2 mode */
+	vendor_param |= 0x02;
+	snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param);
+
+	vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
+	if (vendor_param == -1 || !(vendor_param & 0x02))
+		return;
+
+	/* override 3 pins connection list */
+	snd_hda_override_conn_list(codec, 0x05, 3, list);
+	snd_hda_override_conn_list(codec, 0x06, 3, list);
+	snd_hda_override_conn_list(codec, 0x07, 3, list);
+}
+
+
 static int patch_generic_hdmi(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec;
@@ -1332,6 +1356,10 @@  static int patch_generic_hdmi(struct hda_codec *codec)
 		return -ENOMEM;
 
 	codec->spec = spec;
+
+	if (codec->vendor_id == 0x80862807)
+		intel_haswell_fixup_connect_list(codec);
+
 	if (hdmi_parse_codec(codec) < 0) {
 		codec->spec = NULL;
 		kfree(spec);