summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-07-15 17:14:53 -0400
committerTakashi Iwai <tiwai@suse.de>2019-07-16 10:39:35 -0400
commit3140aafb22edeab0cc41f15f53b12a118c0ac215 (patch)
tree7dcdf82142543c6c599d02f8e7c3d62c7e4f8644
parenteb4177116bf568a413c544eca3f4446cb4064be9 (diff)
ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
The recent fix for Icelake HDMI codec introduced the mapping from pin NID to the i915 gfx port number. However, it forgot the reverse mapping from the port number to the pin NID that is used in the ELD notifier callback. As a result, it's processed to a wrong widget and gives a warning like snd_hda_codec_hdmi hdaudioC0D2: HDMI: pin nid 5 not registered This patch corrects it with a proper reverse mapping function. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204133 Fixes: b0d8bc50b9f2 ("ALSA: hda: hdmi - add Icelake support") Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_hdmi.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 1e6c489bca15..0b2a26e2c5f1 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2524,18 +2524,32 @@ static int intel_pin2port(void *audio_ptr, int pin_nid)
2524 return -1; 2524 return -1;
2525} 2525}
2526 2526
2527static int intel_port2pin(struct hda_codec *codec, int port)
2528{
2529 struct hdmi_spec *spec = codec->spec;
2530
2531 if (!spec->port_num) {
2532 /* we assume only from port-B to port-D */
2533 if (port < 1 || port > 3)
2534 return 0;
2535 /* intel port is 1-based */
2536 return port + intel_base_nid(codec) - 1;
2537 }
2538
2539 if (port < 1 || port > spec->port_num)
2540 return 0;
2541 return spec->port_map[port - 1];
2542}
2543
2527static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) 2544static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
2528{ 2545{
2529 struct hda_codec *codec = audio_ptr; 2546 struct hda_codec *codec = audio_ptr;
2530 int pin_nid; 2547 int pin_nid;
2531 int dev_id = pipe; 2548 int dev_id = pipe;
2532 2549
2533 /* we assume only from port-B to port-D */ 2550 pin_nid = intel_port2pin(codec, port);
2534 if (port < 1 || port > 3) 2551 if (!pin_nid)
2535 return; 2552 return;
2536
2537 pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */
2538
2539 /* skip notification during system suspend (but not in runtime PM); 2553 /* skip notification during system suspend (but not in runtime PM);
2540 * the state will be updated at resume 2554 * the state will be updated at resume
2541 */ 2555 */