diff mbox series

[SRU,OEM-5.6/G/unstable,1/1] UBUNTU: SAUCE: Revert "ALSA: hda - Disable audio component for legacy Nvidia HDMI codecs"

Message ID 20200514080057.27315-2-hui.wang@canonical.com
State New
Headers show
Series [SRU,OEM-5.6/G/unstable,1/1] UBUNTU: SAUCE: Revert "ALSA: hda - Disable audio component for legacy Nvidia HDMI codecs" | expand

Commit Message

Hui Wang May 14, 2020, 8 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1878554

This reverts commit c91775c0b37249366e616705e5a27a238d7e79ac.

There are two reasons to revert this patch:
1) the reverted patch should disable the component for
   patch_nvhdmi_legacy() instead of patch_nvhdmi(), and in the kernel
   of mainline, the patch_nvhdmi() still has component.
2) the nvidia prorprietary graphic driver 440.82 already supported
   component, this needs the patch_nvhdmi() to also support component,
   otherwise the hdmi audio could not work.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/pci/hda/patch_hdmi.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index d5c4185c6dcf..8bc4d66ff986 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -3544,6 +3544,26 @@  static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
 	return 0;
 }
 
+/* map from pin NID to port; port is 0-based */
+/* for Nvidia: assume widget NID starting from 4, with step 1 (4, 5, 6, ...) */
+static int nvhdmi_pin2port(void *audio_ptr, int pin_nid)
+{
+	return pin_nid - 4;
+}
+
+/* reverse-map from port to pin NID: see above */
+static int nvhdmi_port2pin(struct hda_codec *codec, int port)
+{
+	return port + 4;
+}
+
+static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = {
+	.pin2port = nvhdmi_pin2port,
+	.pin_eld_notify = generic_acomp_pin_eld_notify,
+	.master_bind = generic_acomp_master_bind,
+	.master_unbind = generic_acomp_master_unbind,
+};
+
 static int patch_nvhdmi(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec;
@@ -3573,6 +3593,8 @@  static int patch_nvhdmi(struct hda_codec *codec)
 
 	codec->link_down_at_suspend = 1;
 
+	generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin);
+
 	return 0;
 }