summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Vehmanen <kai.vehmanen@linux.intel.com>2019-11-15 14:44:47 +0200
committerTakashi Iwai <tiwai@suse.de>2019-11-15 14:18:09 +0100
commitd577cf76fa3192f9e656bb101aa54d25a6a71347 (patch)
tree5fc0a9384f577504ef7361388c235988484bc0a0
parentf35ef592477c5347b8f780a5f0d4970671e22c61 (diff)
downloadlinux-d577cf76fa3192f9e656bb101aa54d25a6a71347.tar.bz2
ALSA: hda: hdmi - fix port numbering for ICL and TGL platforms
Semantics of port#0 differ between ICL and TGL: ICL port#0 -> never used for HDAudio ICL port#1 -> should be mapped to first pin (0x04) TGL port#0 -> typically not used, but HW has the support, so should be mapped to first pin (0x04) TGL port#1 -> should be mapped to 2nd pin (0x06) Refactor the port mapping logic to allow to take the above differences into account. Fixes issues with HDAudio on some TGL platforms. Co-developed-by: Pan Xiuli <xiuli.pan@linux.intel.com> Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20191115124449.20512-2-kai.vehmanen@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_hdmi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 69d1a6e41f0d..dec90f931bae 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2664,7 +2664,7 @@ static int intel_pin2port(void *audio_ptr, int pin_nid)
*/
for (i = 0; i < spec->port_num; i++) {
if (pin_nid == spec->port_map[i])
- return i + 1;
+ return i;
}
/* return -1 if pin number exceeds our expectation */
@@ -2684,9 +2684,9 @@ static int intel_port2pin(struct hda_codec *codec, int port)
return port + intel_base_nid(codec) - 1;
}
- if (port < 1 || port > spec->port_num)
+ if (port < 0 || port >= spec->port_num)
return 0;
- return spec->port_map[port - 1];
+ return spec->port_map[port];
}
static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
@@ -2838,9 +2838,9 @@ static int patch_i915_icl_hdmi(struct hda_codec *codec)
{
/*
* pin to port mapping table where the value indicate the pin number and
- * the index indicate the port number with 1 base.
+ * the index indicate the port number.
*/
- static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb};
+ static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb};
return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
}
@@ -2849,7 +2849,7 @@ static int patch_i915_tgl_hdmi(struct hda_codec *codec)
{
/*
* pin to port mapping table where the value indicate the pin number and
- * the index indicate the port number with 1 base.
+ * the index indicate the port number.
*/
static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};