forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/hda/patch_hdmi.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * patch_hdmi.c - routines for HDMI/DisplayPort codecs
....@@ -13,24 +14,11 @@
1314 *
1415 * Maintained by:
1516 * Wu Fengguang <wfg@linux.intel.com>
16
- *
17
- * This program is free software; you can redistribute it and/or modify it
18
- * under the terms of the GNU General Public License as published by the Free
19
- * Software Foundation; either version 2 of the License, or (at your option)
20
- * any later version.
21
- *
22
- * This program is distributed in the hope that it will be useful, but
23
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25
- * for more details.
26
- *
27
- * You should have received a copy of the GNU General Public License
28
- * along with this program; if not, write to the Free Software Foundation,
29
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3017 */
3118
3219 #include <linux/init.h>
3320 #include <linux/delay.h>
21
+#include <linux/pci.h>
3422 #include <linux/slab.h>
3523 #include <linux/module.h>
3624 #include <linux/pm_runtime.h>
....@@ -41,29 +29,23 @@
4129 #include <sound/hdaudio.h>
4230 #include <sound/hda_i915.h>
4331 #include <sound/hda_chmap.h>
44
-#include "hda_codec.h"
32
+#include <sound/hda_codec.h>
4533 #include "hda_local.h"
4634 #include "hda_jack.h"
35
+#include "hda_controller.h"
4736
4837 static bool static_hdmi_pcm;
4938 module_param(static_hdmi_pcm, bool, 0644);
5039 MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
5140
52
-#define is_haswell(codec) ((codec)->core.vendor_id == 0x80862807)
53
-#define is_broadwell(codec) ((codec)->core.vendor_id == 0x80862808)
54
-#define is_skylake(codec) ((codec)->core.vendor_id == 0x80862809)
55
-#define is_broxton(codec) ((codec)->core.vendor_id == 0x8086280a)
56
-#define is_kabylake(codec) ((codec)->core.vendor_id == 0x8086280b)
57
-#define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \
58
- ((codec)->core.vendor_id == 0x80862800))
59
-#define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c)
60
-#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \
61
- || is_skylake(codec) || is_broxton(codec) \
62
- || is_kabylake(codec)) || is_geminilake(codec) \
63
- || is_cannonlake(codec)
64
-#define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882)
65
-#define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883)
66
-#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec))
41
+static bool enable_acomp = true;
42
+module_param(enable_acomp, bool, 0444);
43
+MODULE_PARM_DESC(enable_acomp, "Enable audio component binding (default=yes)");
44
+
45
+static bool enable_silent_stream =
46
+IS_ENABLED(CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM);
47
+module_param(enable_silent_stream, bool, 0644);
48
+MODULE_PARM_DESC(enable_silent_stream, "Enable Silent Stream for HDMI devices");
6749
6850 struct hdmi_spec_per_cvt {
6951 hda_nid_t cvt_nid;
....@@ -96,6 +78,7 @@
9678 int pcm_idx; /* which pcm is attached. -1 means no pcm is attached */
9779 int repoll_count;
9880 bool setup; /* the stream has been set up by prepare callback */
81
+ bool silent_stream;
9982 int channels; /* current number of channels */
10083 bool non_pcm;
10184 bool chmap_set; /* channel-map override by ALSA API? */
....@@ -108,16 +91,19 @@
10891 /* operations used by generic code that can be overridden by patches */
10992 struct hdmi_ops {
11093 int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid,
111
- unsigned char *buf, int *eld_size);
94
+ int dev_id, unsigned char *buf, int *eld_size);
11295
11396 void (*pin_setup_infoframe)(struct hda_codec *codec, hda_nid_t pin_nid,
97
+ int dev_id,
11498 int ca, int active_channels, int conn_type);
11599
116100 /* enable/disable HBR (HD passthrough) */
117
- int (*pin_hbr_setup)(struct hda_codec *codec, hda_nid_t pin_nid, bool hbr);
101
+ int (*pin_hbr_setup)(struct hda_codec *codec, hda_nid_t pin_nid,
102
+ int dev_id, bool hbr);
118103
119104 int (*setup_stream)(struct hda_codec *codec, hda_nid_t cvt_nid,
120
- hda_nid_t pin_nid, u32 stream_tag, int format);
105
+ hda_nid_t pin_nid, int dev_id, u32 stream_tag,
106
+ int format);
121107
122108 void (*pin_cvt_fixup)(struct hda_codec *codec,
123109 struct hdmi_spec_per_pin *per_pin,
....@@ -131,6 +117,7 @@
131117 };
132118
133119 struct hdmi_spec {
120
+ struct hda_codec *codec;
134121 int num_cvts;
135122 struct snd_array cvts; /* struct hdmi_spec_per_cvt */
136123 hda_nid_t cvt_nids[4]; /* only for haswell fix */
....@@ -155,6 +142,7 @@
155142 struct snd_array pins; /* struct hdmi_spec_per_pin */
156143 struct hdmi_pcm pcm_rec[16];
157144 struct mutex pcm_lock;
145
+ struct mutex bind_lock; /* for audio component binding */
158146 /* pcm_bitmap means which pcms have been assigned to pins*/
159147 unsigned long pcm_bitmap;
160148 int pcm_used; /* counter of pcm_rec[] */
....@@ -169,18 +157,27 @@
169157
170158 bool dyn_pin_out;
171159 bool dyn_pcm_assign;
160
+ bool dyn_pcm_no_legacy;
161
+ bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
162
+
163
+ bool intel_hsw_fixup; /* apply Intel platform-specific fixups */
172164 /*
173165 * Non-generic VIA/NVIDIA specific
174166 */
175167 struct hda_multi_out multiout;
176168 struct hda_pcm_stream pcm_playback;
177169
178
- /* i915/powerwell (Haswell+/Valleyview+) specific */
179
- bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */
170
+ bool use_acomp_notifier; /* use eld_notify callback for hotplug */
171
+ bool acomp_registered; /* audio component registered in this driver */
172
+ bool force_connect; /* force connectivity */
180173 struct drm_audio_component_audio_ops drm_audio_ops;
174
+ int (*port2pin)(struct hda_codec *, int); /* reverse port/pin mapping */
181175
182176 struct hdac_chmap chmap;
183177 hda_nid_t vendor_nid;
178
+ const int *port_map;
179
+ int port_num;
180
+ bool send_silent_stream; /* Flag to enable silent stream feature */
184181 };
185182
186183 #ifdef CONFIG_SND_HDA_COMPONENT
....@@ -273,7 +270,7 @@
273270 if (get_pcm_rec(spec, pcm_idx)->stream == hinfo)
274271 return pcm_idx;
275272
276
- codec_warn(codec, "HDMI: hinfo %p not registered\n", hinfo);
273
+ codec_warn(codec, "HDMI: hinfo %p not tied to a PCM\n", hinfo);
277274 return -EINVAL;
278275 }
279276
....@@ -291,7 +288,8 @@
291288 return pin_idx;
292289 }
293290
294
- codec_dbg(codec, "HDMI: hinfo %p not registered\n", hinfo);
291
+ codec_dbg(codec, "HDMI: hinfo %p (pcm %d) not registered\n", hinfo,
292
+ hinfo_to_pcm_index(codec, hinfo));
295293 return -EINVAL;
296294 }
297295
....@@ -389,7 +387,8 @@
389387 }
390388
391389 static const struct snd_kcontrol_new eld_bytes_ctl = {
392
- .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
390
+ .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE |
391
+ SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK,
393392 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
394393 .name = "ELD",
395394 .info = hdmi_eld_ctl_info,
....@@ -657,20 +656,37 @@
657656 return true;
658657 }
659658
659
+static int hdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
660
+ int dev_id, unsigned char *buf, int *eld_size)
661
+{
662
+ snd_hda_set_dev_select(codec, nid, dev_id);
663
+
664
+ return snd_hdmi_get_eld(codec, nid, buf, eld_size);
665
+}
666
+
660667 static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
661
- hda_nid_t pin_nid,
668
+ hda_nid_t pin_nid, int dev_id,
662669 int ca, int active_channels,
663670 int conn_type)
664671 {
672
+ struct hdmi_spec *spec = codec->spec;
665673 union audio_infoframe ai;
666674
667675 memset(&ai, 0, sizeof(ai));
668
- if (conn_type == 0) { /* HDMI */
676
+ if ((conn_type == 0) || /* HDMI */
677
+ /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */
678
+ (conn_type == 1 && spec->nv_dp_workaround)) {
669679 struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
670680
671
- hdmi_ai->type = 0x84;
672
- hdmi_ai->ver = 0x01;
673
- hdmi_ai->len = 0x0a;
681
+ if (conn_type == 0) { /* HDMI */
682
+ hdmi_ai->type = 0x84;
683
+ hdmi_ai->ver = 0x01;
684
+ hdmi_ai->len = 0x0a;
685
+ } else {/* Nvidia DP */
686
+ hdmi_ai->type = 0x84;
687
+ hdmi_ai->ver = 0x1b;
688
+ hdmi_ai->len = 0x11 << 2;
689
+ }
674690 hdmi_ai->CC02_CT47 = active_channels - 1;
675691 hdmi_ai->CA = ca;
676692 hdmi_checksum_audio_infoframe(hdmi_ai);
....@@ -687,6 +703,8 @@
687703 pin_nid);
688704 return;
689705 }
706
+
707
+ snd_hda_set_dev_select(codec, pin_nid, dev_id);
690708
691709 /*
692710 * sizeof(ai) is used instead of sizeof(*hdmi_ai) or
....@@ -713,6 +731,7 @@
713731 struct hdmi_spec *spec = codec->spec;
714732 struct hdac_chmap *chmap = &spec->chmap;
715733 hda_nid_t pin_nid = per_pin->pin_nid;
734
+ int dev_id = per_pin->dev_id;
716735 int channels = per_pin->channels;
717736 int active_channels;
718737 struct hdmi_eld *eld;
....@@ -720,6 +739,8 @@
720739
721740 if (!channels)
722741 return;
742
+
743
+ snd_hda_set_dev_select(codec, pin_nid, dev_id);
723744
724745 /* some HW (e.g. HSW+) needs reprogramming the amp at each time */
725746 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
....@@ -746,8 +767,8 @@
746767 pin_nid, non_pcm, ca, channels,
747768 per_pin->chmap, per_pin->chmap_set);
748769
749
- spec->ops.pin_setup_infoframe(codec, pin_nid, ca, active_channels,
750
- eld->info.conn_type);
770
+ spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id,
771
+ ca, active_channels, eld->info.conn_type);
751772
752773 per_pin->non_pcm = non_pcm;
753774 }
....@@ -756,7 +777,7 @@
756777 * Unsolicited events
757778 */
758779
759
-static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
780
+static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
760781
761782 static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid,
762783 int dev_id)
....@@ -767,42 +788,31 @@
767788 if (pin_idx < 0)
768789 return;
769790 mutex_lock(&spec->pcm_lock);
770
- if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
771
- snd_hda_jack_report_sync(codec);
791
+ hdmi_present_sense(get_pin(spec, pin_idx), 1);
772792 mutex_unlock(&spec->pcm_lock);
773793 }
774794
775795 static void jack_callback(struct hda_codec *codec,
776796 struct hda_jack_callback *jack)
777797 {
778
- /* hda_jack don't support DP MST */
779
- check_presence_and_report(codec, jack->nid, 0);
798
+ /* stop polling when notification is enabled */
799
+ if (codec_has_acomp(codec))
800
+ return;
801
+
802
+ check_presence_and_report(codec, jack->nid, jack->dev_id);
780803 }
781804
782
-static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
805
+static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res,
806
+ struct hda_jack_tbl *jack)
783807 {
784
- int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
785
- struct hda_jack_tbl *jack;
786
- int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT;
787
-
788
- /*
789
- * assume DP MST uses dyn_pcm_assign and acomp and
790
- * never comes here
791
- * if DP MST supports unsol event, below code need
792
- * consider dev_entry
793
- */
794
- jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
795
- if (!jack)
796
- return;
797808 jack->jack_dirty = 1;
798809
799810 codec_dbg(codec,
800811 "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n",
801
- codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
812
+ codec->addr, jack->nid, jack->dev_id, !!(res & AC_UNSOL_RES_IA),
802813 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
803814
804
- /* hda_jack don't support DP MST */
805
- check_presence_and_report(codec, jack->nid, 0);
815
+ check_presence_and_report(codec, jack->nid, jack->dev_id);
806816 }
807817
808818 static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
....@@ -821,10 +831,12 @@
821831 cp_ready);
822832
823833 /* TODO */
824
- if (cp_state)
834
+ if (cp_state) {
825835 ;
826
- if (cp_ready)
836
+ }
837
+ if (cp_ready) {
827838 ;
839
+ }
828840 }
829841
830842
....@@ -832,14 +844,27 @@
832844 {
833845 int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
834846 int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT;
847
+ struct hda_jack_tbl *jack;
835848
836
- if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) {
849
+ if (codec_has_acomp(codec))
850
+ return;
851
+
852
+ if (codec->dp_mst) {
853
+ int dev_entry =
854
+ (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT;
855
+
856
+ jack = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry);
857
+ } else {
858
+ jack = snd_hda_jack_tbl_get_from_tag(codec, tag, 0);
859
+ }
860
+
861
+ if (!jack) {
837862 codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag);
838863 return;
839864 }
840865
841866 if (subtag == 0)
842
- hdmi_intrinsic_event(codec, res);
867
+ hdmi_intrinsic_event(codec, res, jack);
843868 else
844869 hdmi_non_intrinsic_event(codec, res);
845870 }
....@@ -874,11 +899,12 @@
874899 ((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7)
875900
876901 static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
877
- bool hbr)
902
+ int dev_id, bool hbr)
878903 {
879904 int pinctl, new_pinctl;
880905
881906 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
907
+ snd_hda_set_dev_select(codec, pin_nid, dev_id);
882908 pinctl = snd_hda_codec_read(codec, pin_nid, 0,
883909 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
884910
....@@ -908,20 +934,22 @@
908934 }
909935
910936 static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
911
- hda_nid_t pin_nid, u32 stream_tag, int format)
937
+ hda_nid_t pin_nid, int dev_id,
938
+ u32 stream_tag, int format)
912939 {
913940 struct hdmi_spec *spec = codec->spec;
914941 unsigned int param;
915942 int err;
916943
917
- err = spec->ops.pin_hbr_setup(codec, pin_nid, is_hbr_format(format));
944
+ err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id,
945
+ is_hbr_format(format));
918946
919947 if (err) {
920948 codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n");
921949 return err;
922950 }
923951
924
- if (is_haswell_plus(codec)) {
952
+ if (spec->intel_hsw_fixup) {
925953
926954 /*
927955 * on recent platforms IEC Coding Type is required for HBR
....@@ -963,6 +991,13 @@
963991 per_pin = NULL;
964992 else
965993 per_pin = get_pin(spec, pin_idx);
994
+
995
+ if (per_pin && per_pin->silent_stream) {
996
+ cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid);
997
+ if (cvt_id)
998
+ *cvt_id = cvt_idx;
999
+ return 0;
1000
+ }
9661001
9671002 /* Dynamically assign converter to stream */
9681003 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
....@@ -1234,7 +1269,12 @@
12341269 set_bit(pcm_idx, &spec->pcm_in_use);
12351270 per_pin = get_pin(spec, pin_idx);
12361271 per_pin->cvt_nid = per_cvt->cvt_nid;
1272
+ per_pin->silent_stream = false;
12371273 hinfo->nid = per_cvt->cvt_nid;
1274
+
1275
+ /* flip stripe flag for the assigned stream if supported */
1276
+ if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE)
1277
+ azx_stream(get_azx_dev(substream))->stripe = 1;
12381278
12391279 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
12401280 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
....@@ -1288,6 +1328,8 @@
12881328 struct hdmi_spec *spec = codec->spec;
12891329 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
12901330 hda_nid_t pin_nid = per_pin->pin_nid;
1331
+ int dev_id = per_pin->dev_id;
1332
+ int conns;
12911333
12921334 if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) {
12931335 codec_warn(codec,
....@@ -1296,31 +1338,67 @@
12961338 return -EINVAL;
12971339 }
12981340
1341
+ snd_hda_set_dev_select(codec, pin_nid, dev_id);
1342
+
1343
+ if (spec->intel_hsw_fixup) {
1344
+ conns = spec->num_cvts;
1345
+ memcpy(per_pin->mux_nids, spec->cvt_nids,
1346
+ sizeof(hda_nid_t) * conns);
1347
+ } else {
1348
+ conns = snd_hda_get_raw_connections(codec, pin_nid,
1349
+ per_pin->mux_nids,
1350
+ HDA_MAX_CONNECTIONS);
1351
+ }
1352
+
12991353 /* all the device entries on the same pin have the same conn list */
1300
- per_pin->num_mux_nids = snd_hda_get_connections(codec, pin_nid,
1301
- per_pin->mux_nids,
1302
- HDA_MAX_CONNECTIONS);
1354
+ per_pin->num_mux_nids = conns;
13031355
13041356 return 0;
13051357 }
13061358
13071359 static int hdmi_find_pcm_slot(struct hdmi_spec *spec,
1308
- struct hdmi_spec_per_pin *per_pin)
1360
+ struct hdmi_spec_per_pin *per_pin)
13091361 {
13101362 int i;
13111363
1312
- /* try the prefer PCM */
1313
- if (!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap))
1314
- return per_pin->pin_nid_idx;
1364
+ /* on the new machines, try to assign the pcm slot dynamically,
1365
+ * not use the preferred fixed map (legacy way) anymore.
1366
+ */
1367
+ if (spec->dyn_pcm_no_legacy)
1368
+ goto last_try;
13151369
1316
- /* have a second try; check the "reserved area" over num_pins */
1370
+ /*
1371
+ * generic_hdmi_build_pcms() may allocate extra PCMs on some
1372
+ * platforms (with maximum of 'num_nids + dev_num - 1')
1373
+ *
1374
+ * The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n
1375
+ * if m==0. This guarantees that dynamic pcm assignments are compatible
1376
+ * with the legacy static per_pin-pcm assignment that existed in the
1377
+ * days before DP-MST.
1378
+ *
1379
+ * Intel DP-MST prefers this legacy behavior for compatibility, too.
1380
+ *
1381
+ * per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)).
1382
+ */
1383
+
1384
+ if (per_pin->dev_id == 0 || spec->intel_hsw_fixup) {
1385
+ if (!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap))
1386
+ return per_pin->pin_nid_idx;
1387
+ } else {
1388
+ i = spec->num_nids + (per_pin->dev_id - 1);
1389
+ if (i < spec->pcm_used && !(test_bit(i, &spec->pcm_bitmap)))
1390
+ return i;
1391
+ }
1392
+
1393
+ /* have a second try; check the area over num_nids */
13171394 for (i = spec->num_nids; i < spec->pcm_used; i++) {
13181395 if (!test_bit(i, &spec->pcm_bitmap))
13191396 return i;
13201397 }
13211398
1399
+ last_try:
13221400 /* the last try; check the empty slots in pins */
1323
- for (i = 0; i < spec->num_nids; i++) {
1401
+ for (i = 0; i < spec->pcm_used; i++) {
13241402 if (!test_bit(i, &spec->pcm_bitmap))
13251403 return i;
13261404 }
....@@ -1428,21 +1506,60 @@
14281506 per_pin->channels = 0;
14291507 }
14301508
1509
+static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec,
1510
+ struct hdmi_spec_per_pin *per_pin)
1511
+{
1512
+ struct hdmi_spec *spec = codec->spec;
1513
+
1514
+ if (per_pin->pcm_idx >= 0)
1515
+ return spec->pcm_rec[per_pin->pcm_idx].jack;
1516
+ else
1517
+ return NULL;
1518
+}
1519
+
14311520 /* update per_pin ELD from the given new ELD;
14321521 * setup info frame and notification accordingly
1522
+ * also notify ELD kctl and report jack status changes
14331523 */
14341524 static void update_eld(struct hda_codec *codec,
14351525 struct hdmi_spec_per_pin *per_pin,
1436
- struct hdmi_eld *eld)
1526
+ struct hdmi_eld *eld,
1527
+ int repoll)
14371528 {
14381529 struct hdmi_eld *pin_eld = &per_pin->sink_eld;
14391530 struct hdmi_spec *spec = codec->spec;
1531
+ struct snd_jack *pcm_jack;
14401532 bool old_eld_valid = pin_eld->eld_valid;
14411533 bool eld_changed;
1442
- int pcm_idx = -1;
1534
+ int pcm_idx;
1535
+
1536
+ if (eld->eld_valid) {
1537
+ if (eld->eld_size <= 0 ||
1538
+ snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
1539
+ eld->eld_size) < 0) {
1540
+ eld->eld_valid = false;
1541
+ if (repoll) {
1542
+ schedule_delayed_work(&per_pin->work,
1543
+ msecs_to_jiffies(300));
1544
+ return;
1545
+ }
1546
+ }
1547
+ }
1548
+
1549
+ if (!eld->eld_valid || eld->eld_size <= 0) {
1550
+ eld->eld_valid = false;
1551
+ eld->eld_size = 0;
1552
+ }
14431553
14441554 /* for monitor disconnection, save pcm_idx firstly */
14451555 pcm_idx = per_pin->pcm_idx;
1556
+
1557
+ /*
1558
+ * pcm_idx >=0 before update_eld() means it is in monitor
1559
+ * disconnected event. Jack must be fetched before update_eld().
1560
+ */
1561
+ pcm_jack = pin_idx_to_pcm_jack(codec, per_pin);
1562
+
14461563 if (spec->dyn_pcm_assign) {
14471564 if (eld->eld_valid) {
14481565 hdmi_attach_hda_pcm(spec, per_pin);
....@@ -1457,23 +1574,29 @@
14571574 */
14581575 if (pcm_idx == -1)
14591576 pcm_idx = per_pin->pcm_idx;
1577
+ if (!pcm_jack)
1578
+ pcm_jack = pin_idx_to_pcm_jack(codec, per_pin);
14601579
14611580 if (eld->eld_valid)
14621581 snd_hdmi_show_eld(codec, &eld->info);
14631582
14641583 eld_changed = (pin_eld->eld_valid != eld->eld_valid);
1465
- if (eld->eld_valid && pin_eld->eld_valid)
1584
+ eld_changed |= (pin_eld->monitor_present != eld->monitor_present);
1585
+ if (!eld_changed && eld->eld_valid && pin_eld->eld_valid)
14661586 if (pin_eld->eld_size != eld->eld_size ||
14671587 memcmp(pin_eld->eld_buffer, eld->eld_buffer,
14681588 eld->eld_size) != 0)
14691589 eld_changed = true;
14701590
1471
- pin_eld->monitor_present = eld->monitor_present;
1472
- pin_eld->eld_valid = eld->eld_valid;
1473
- pin_eld->eld_size = eld->eld_size;
1474
- if (eld->eld_valid)
1475
- memcpy(pin_eld->eld_buffer, eld->eld_buffer, eld->eld_size);
1476
- pin_eld->info = eld->info;
1591
+ if (eld_changed) {
1592
+ pin_eld->monitor_present = eld->monitor_present;
1593
+ pin_eld->eld_valid = eld->eld_valid;
1594
+ pin_eld->eld_size = eld->eld_size;
1595
+ if (eld->eld_valid)
1596
+ memcpy(pin_eld->eld_buffer, eld->eld_buffer,
1597
+ eld->eld_size);
1598
+ pin_eld->info = eld->info;
1599
+ }
14771600
14781601 /*
14791602 * Re-setup pin and infoframe. This is needed e.g. when
....@@ -1491,17 +1614,23 @@
14911614 SNDRV_CTL_EVENT_MASK_VALUE |
14921615 SNDRV_CTL_EVENT_MASK_INFO,
14931616 &get_hdmi_pcm(spec, pcm_idx)->eld_ctl->id);
1617
+
1618
+ if (eld_changed && pcm_jack)
1619
+ snd_jack_report(pcm_jack,
1620
+ (eld->monitor_present && eld->eld_valid) ?
1621
+ SND_JACK_AVOUT : 0);
14941622 }
14951623
14961624 /* update ELD and jack state via HD-audio verbs */
1497
-static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
1625
+static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
14981626 int repoll)
14991627 {
1500
- struct hda_jack_tbl *jack;
15011628 struct hda_codec *codec = per_pin->codec;
15021629 struct hdmi_spec *spec = codec->spec;
15031630 struct hdmi_eld *eld = &spec->temp_eld;
1631
+ struct device *dev = hda_codec_dev(codec);
15041632 hda_nid_t pin_nid = per_pin->pin_nid;
1633
+ int dev_id = per_pin->dev_id;
15051634 /*
15061635 * Always execute a GetPinSense verb here, even when called from
15071636 * hdmi_intrinsic_event; for some NVIDIA HW, the unsolicited
....@@ -1511,10 +1640,18 @@
15111640 * the unsolicited response to avoid custom WARs.
15121641 */
15131642 int present;
1514
- bool ret;
1515
- bool do_repoll = false;
1643
+ int ret;
15161644
1517
- present = snd_hda_pin_sense(codec, pin_nid);
1645
+#ifdef CONFIG_PM
1646
+ if (dev->power.runtime_status == RPM_SUSPENDING)
1647
+ return;
1648
+#endif
1649
+
1650
+ ret = snd_hda_power_up_pm(codec);
1651
+ if (ret < 0 && pm_runtime_suspended(dev))
1652
+ goto out;
1653
+
1654
+ present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id);
15181655
15191656 mutex_lock(&per_pin->lock);
15201657 eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
....@@ -1528,61 +1665,104 @@
15281665 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
15291666
15301667 if (eld->eld_valid) {
1531
- if (spec->ops.pin_get_eld(codec, pin_nid, eld->eld_buffer,
1532
- &eld->eld_size) < 0)
1668
+ if (spec->ops.pin_get_eld(codec, pin_nid, dev_id,
1669
+ eld->eld_buffer, &eld->eld_size) < 0)
15331670 eld->eld_valid = false;
1534
- else {
1535
- if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
1536
- eld->eld_size) < 0)
1537
- eld->eld_valid = false;
1538
- }
1539
- if (!eld->eld_valid && repoll)
1540
- do_repoll = true;
15411671 }
15421672
1543
- if (do_repoll)
1544
- schedule_delayed_work(&per_pin->work, msecs_to_jiffies(300));
1545
- else
1546
- update_eld(codec, per_pin, eld);
1547
-
1548
- ret = !repoll || !eld->monitor_present || eld->eld_valid;
1549
-
1550
- jack = snd_hda_jack_tbl_get(codec, pin_nid);
1551
- if (jack) {
1552
- jack->block_report = !ret;
1553
- jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?
1554
- AC_PINSENSE_PRESENCE : 0;
1555
- }
1673
+ update_eld(codec, per_pin, eld, repoll);
15561674 mutex_unlock(&per_pin->lock);
1557
- return ret;
1675
+ out:
1676
+ snd_hda_power_down_pm(codec);
15581677 }
15591678
1560
-static struct snd_jack *pin_idx_to_jack(struct hda_codec *codec,
1679
+#define I915_SILENT_RATE 48000
1680
+#define I915_SILENT_CHANNELS 2
1681
+#define I915_SILENT_FORMAT SNDRV_PCM_FORMAT_S16_LE
1682
+#define I915_SILENT_FORMAT_BITS 16
1683
+#define I915_SILENT_FMT_MASK 0xf
1684
+
1685
+static void silent_stream_enable(struct hda_codec *codec,
15611686 struct hdmi_spec_per_pin *per_pin)
15621687 {
15631688 struct hdmi_spec *spec = codec->spec;
1564
- struct snd_jack *jack = NULL;
1565
- struct hda_jack_tbl *jack_tbl;
1689
+ struct hdmi_spec_per_cvt *per_cvt;
1690
+ int cvt_idx, pin_idx, err;
1691
+ unsigned int format;
15661692
1567
- /* if !dyn_pcm_assign, get jack from hda_jack_tbl
1568
- * in !dyn_pcm_assign case, spec->pcm_rec[].jack is not
1569
- * NULL even after snd_hda_jack_tbl_clear() is called to
1570
- * free snd_jack. This may cause access invalid memory
1571
- * when calling snd_jack_report
1572
- */
1573
- if (per_pin->pcm_idx >= 0 && spec->dyn_pcm_assign)
1574
- jack = spec->pcm_rec[per_pin->pcm_idx].jack;
1575
- else if (!spec->dyn_pcm_assign) {
1576
- /*
1577
- * jack tbl doesn't support DP MST
1578
- * DP MST will use dyn_pcm_assign,
1579
- * so DP MST will never come here
1580
- */
1581
- jack_tbl = snd_hda_jack_tbl_get(codec, per_pin->pin_nid);
1582
- if (jack_tbl)
1583
- jack = jack_tbl->jack;
1693
+ mutex_lock(&per_pin->lock);
1694
+
1695
+ if (per_pin->setup) {
1696
+ codec_dbg(codec, "hdmi: PCM already open, no silent stream\n");
1697
+ goto unlock_out;
15841698 }
1585
- return jack;
1699
+
1700
+ pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id);
1701
+ err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx);
1702
+ if (err) {
1703
+ codec_err(codec, "hdmi: no free converter to enable silent mode\n");
1704
+ goto unlock_out;
1705
+ }
1706
+
1707
+ per_cvt = get_cvt(spec, cvt_idx);
1708
+ per_cvt->assigned = 1;
1709
+ per_pin->cvt_nid = per_cvt->cvt_nid;
1710
+ per_pin->silent_stream = true;
1711
+
1712
+ codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n",
1713
+ per_pin->pin_nid, per_cvt->cvt_nid);
1714
+
1715
+ snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
1716
+ snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
1717
+ AC_VERB_SET_CONNECT_SEL,
1718
+ per_pin->mux_idx);
1719
+
1720
+ /* configure unused pins to choose other converters */
1721
+ pin_cvt_fixup(codec, per_pin, 0);
1722
+
1723
+ snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid,
1724
+ per_pin->dev_id, I915_SILENT_RATE);
1725
+
1726
+ /* trigger silent stream generation in hw */
1727
+ format = snd_hdac_calc_stream_format(I915_SILENT_RATE, I915_SILENT_CHANNELS,
1728
+ I915_SILENT_FORMAT, I915_SILENT_FORMAT_BITS, 0);
1729
+ snd_hda_codec_setup_stream(codec, per_pin->cvt_nid,
1730
+ I915_SILENT_FMT_MASK, I915_SILENT_FMT_MASK, format);
1731
+ usleep_range(100, 200);
1732
+ snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, I915_SILENT_FMT_MASK, 0, format);
1733
+
1734
+ per_pin->channels = I915_SILENT_CHANNELS;
1735
+ hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm);
1736
+
1737
+ unlock_out:
1738
+ mutex_unlock(&per_pin->lock);
1739
+}
1740
+
1741
+static void silent_stream_disable(struct hda_codec *codec,
1742
+ struct hdmi_spec_per_pin *per_pin)
1743
+{
1744
+ struct hdmi_spec *spec = codec->spec;
1745
+ struct hdmi_spec_per_cvt *per_cvt;
1746
+ int cvt_idx;
1747
+
1748
+ mutex_lock(&per_pin->lock);
1749
+ if (!per_pin->silent_stream)
1750
+ goto unlock_out;
1751
+
1752
+ codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n",
1753
+ per_pin->pin_nid, per_pin->cvt_nid);
1754
+
1755
+ cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid);
1756
+ if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) {
1757
+ per_cvt = get_cvt(spec, cvt_idx);
1758
+ per_cvt->assigned = 0;
1759
+ }
1760
+
1761
+ per_pin->cvt_nid = 0;
1762
+ per_pin->silent_stream = false;
1763
+
1764
+ unlock_out:
1765
+ mutex_unlock(&per_pin->lock);
15861766 }
15871767
15881768 /* update ELD and jack state via audio component */
....@@ -1591,69 +1771,53 @@
15911771 {
15921772 struct hdmi_spec *spec = codec->spec;
15931773 struct hdmi_eld *eld = &spec->temp_eld;
1594
- struct snd_jack *jack = NULL;
1595
- int size;
1774
+ bool monitor_prev, monitor_next;
15961775
15971776 mutex_lock(&per_pin->lock);
15981777 eld->monitor_present = false;
1599
- size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid,
1778
+ monitor_prev = per_pin->sink_eld.monitor_present;
1779
+ eld->eld_size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid,
16001780 per_pin->dev_id, &eld->monitor_present,
16011781 eld->eld_buffer, ELD_MAX_SIZE);
1602
- if (size > 0) {
1603
- size = min(size, ELD_MAX_SIZE);
1604
- if (snd_hdmi_parse_eld(codec, &eld->info,
1605
- eld->eld_buffer, size) < 0)
1606
- size = -EINVAL;
1607
- }
1608
-
1609
- if (size > 0) {
1610
- eld->eld_valid = true;
1611
- eld->eld_size = size;
1612
- } else {
1613
- eld->eld_valid = false;
1614
- eld->eld_size = 0;
1615
- }
1616
-
1617
- /* pcm_idx >=0 before update_eld() means it is in monitor
1618
- * disconnected event. Jack must be fetched before update_eld()
1619
- */
1620
- jack = pin_idx_to_jack(codec, per_pin);
1621
- update_eld(codec, per_pin, eld);
1622
- if (jack == NULL)
1623
- jack = pin_idx_to_jack(codec, per_pin);
1624
- if (jack == NULL)
1625
- goto unlock;
1626
- snd_jack_report(jack,
1627
- eld->monitor_present ? SND_JACK_AVOUT : 0);
1628
- unlock:
1782
+ eld->eld_valid = (eld->eld_size > 0);
1783
+ update_eld(codec, per_pin, eld, 0);
1784
+ monitor_next = per_pin->sink_eld.monitor_present;
16291785 mutex_unlock(&per_pin->lock);
1630
-}
16311786
1632
-static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1633
-{
1634
- struct hda_codec *codec = per_pin->codec;
1635
- int ret;
1787
+ /*
1788
+ * Power-up will call hdmi_present_sense, so the PM calls
1789
+ * have to be done without mutex held.
1790
+ */
16361791
1637
- /* no temporary power up/down needed for component notifier */
1638
- if (!codec_has_acomp(codec)) {
1639
- ret = snd_hda_power_up_pm(codec);
1640
- if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) {
1641
- snd_hda_power_down_pm(codec);
1642
- return false;
1792
+ if (spec->send_silent_stream) {
1793
+ int pm_ret;
1794
+
1795
+ if (!monitor_prev && monitor_next) {
1796
+ pm_ret = snd_hda_power_up_pm(codec);
1797
+ if (pm_ret < 0)
1798
+ codec_err(codec,
1799
+ "Monitor plugged-in, Failed to power up codec ret=[%d]\n",
1800
+ pm_ret);
1801
+ silent_stream_enable(codec, per_pin);
1802
+ } else if (monitor_prev && !monitor_next) {
1803
+ silent_stream_disable(codec, per_pin);
1804
+ pm_ret = snd_hda_power_down_pm(codec);
1805
+ if (pm_ret < 0)
1806
+ codec_err(codec,
1807
+ "Monitor plugged-out, Failed to power down codec ret=[%d]\n",
1808
+ pm_ret);
16431809 }
16441810 }
1811
+}
16451812
1646
- if (codec_has_acomp(codec)) {
1647
- sync_eld_via_acomp(codec, per_pin);
1648
- ret = false; /* don't call snd_hda_jack_report_sync() */
1649
- } else {
1650
- ret = hdmi_present_sense_via_verbs(per_pin, repoll);
1651
- }
1813
+static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1814
+{
1815
+ struct hda_codec *codec = per_pin->codec;
16521816
16531817 if (!codec_has_acomp(codec))
1654
- snd_hda_power_down_pm(codec);
1655
-
1656
- return ret;
1818
+ hdmi_present_sense_via_verbs(per_pin, repoll);
1819
+ else
1820
+ sync_eld_via_acomp(codec, per_pin);
16571821 }
16581822
16591823 static void hdmi_repoll_eld(struct work_struct *work)
....@@ -1664,7 +1828,8 @@
16641828 struct hdmi_spec *spec = codec->spec;
16651829 struct hda_jack_tbl *jack;
16661830
1667
- jack = snd_hda_jack_tbl_get(codec, per_pin->pin_nid);
1831
+ jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid,
1832
+ per_pin->dev_id);
16681833 if (jack)
16691834 jack->jack_dirty = 1;
16701835
....@@ -1672,13 +1837,9 @@
16721837 per_pin->repoll_count = 0;
16731838
16741839 mutex_lock(&spec->pcm_lock);
1675
- if (hdmi_present_sense(per_pin, per_pin->repoll_count))
1676
- snd_hda_jack_report_sync(per_pin->codec);
1840
+ hdmi_present_sense(per_pin, per_pin->repoll_count);
16771841 mutex_unlock(&spec->pcm_lock);
16781842 }
1679
-
1680
-static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
1681
- hda_nid_t nid);
16821843
16831844 static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
16841845 {
....@@ -1698,14 +1859,15 @@
16981859 * all device entries on the same pin
16991860 */
17001861 config = snd_hda_codec_get_pincfg(codec, pin_nid);
1701
- if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
1862
+ if (get_defcfg_connect(config) == AC_JACK_PORT_NONE &&
1863
+ !spec->force_connect)
17021864 return 0;
17031865
17041866 /*
17051867 * To simplify the implementation, malloc all
17061868 * the virtual pins in the initialization statically
17071869 */
1708
- if (is_haswell_plus(codec)) {
1870
+ if (spec->intel_hsw_fixup) {
17091871 /*
17101872 * On Intel platforms, device entries number is
17111873 * changed dynamically. If there is a DP MST
....@@ -1754,8 +1916,6 @@
17541916 per_pin->dev_id = i;
17551917 per_pin->non_pcm = false;
17561918 snd_hda_set_dev_select(codec, pin_nid, i);
1757
- if (is_haswell_plus(codec))
1758
- intel_haswell_fixup_connect_list(codec, pin_nid);
17591919 err = hdmi_read_pin_conn(codec, pin_idx);
17601920 if (err < 0)
17611921 return err;
....@@ -1802,35 +1962,59 @@
18021962 return 0;
18031963 }
18041964
1965
+static const struct snd_pci_quirk force_connect_list[] = {
1966
+ SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1),
1967
+ SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1),
1968
+ SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
1969
+ {}
1970
+};
1971
+
18051972 static int hdmi_parse_codec(struct hda_codec *codec)
18061973 {
1807
- hda_nid_t nid;
1974
+ struct hdmi_spec *spec = codec->spec;
1975
+ hda_nid_t start_nid;
1976
+ unsigned int caps;
18081977 int i, nodes;
1978
+ const struct snd_pci_quirk *q;
18091979
1810
- nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &nid);
1811
- if (!nid || nodes < 0) {
1980
+ nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid);
1981
+ if (!start_nid || nodes < 0) {
18121982 codec_warn(codec, "HDMI: failed to get afg sub nodes\n");
18131983 return -EINVAL;
18141984 }
18151985
1816
- for (i = 0; i < nodes; i++, nid++) {
1817
- unsigned int caps;
1818
- unsigned int type;
1986
+ q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list);
1987
+
1988
+ if (q && q->value)
1989
+ spec->force_connect = true;
1990
+
1991
+ /*
1992
+ * hdmi_add_pin() assumes total amount of converters to
1993
+ * be known, so first discover all converters
1994
+ */
1995
+ for (i = 0; i < nodes; i++) {
1996
+ hda_nid_t nid = start_nid + i;
18191997
18201998 caps = get_wcaps(codec, nid);
1821
- type = get_wcaps_type(caps);
18221999
18232000 if (!(caps & AC_WCAP_DIGITAL))
18242001 continue;
18252002
1826
- switch (type) {
1827
- case AC_WID_AUD_OUT:
2003
+ if (get_wcaps_type(caps) == AC_WID_AUD_OUT)
18282004 hdmi_add_cvt(codec, nid);
1829
- break;
1830
- case AC_WID_PIN:
2005
+ }
2006
+
2007
+ /* discover audio pins */
2008
+ for (i = 0; i < nodes; i++) {
2009
+ hda_nid_t nid = start_nid + i;
2010
+
2011
+ caps = get_wcaps(codec, nid);
2012
+
2013
+ if (!(caps & AC_WCAP_DIGITAL))
2014
+ continue;
2015
+
2016
+ if (get_wcaps_type(caps) == AC_WID_PIN)
18312017 hdmi_add_pin(codec, nid);
1832
- break;
1833
- }
18342018 }
18352019
18362020 return 0;
....@@ -1871,10 +2055,9 @@
18712055 struct hdmi_spec *spec = codec->spec;
18722056 int pin_idx;
18732057 struct hdmi_spec_per_pin *per_pin;
1874
- hda_nid_t pin_nid;
18752058 struct snd_pcm_runtime *runtime = substream->runtime;
18762059 bool non_pcm;
1877
- int pinctl;
2060
+ int pinctl, stripe;
18782061 int err = 0;
18792062
18802063 mutex_lock(&spec->pcm_lock);
....@@ -1895,7 +2078,6 @@
18952078 goto unlock;
18962079 }
18972080 per_pin = get_pin(spec, pin_idx);
1898
- pin_nid = per_pin->pin_nid;
18992081
19002082 /* Verify pin:cvt selections to avoid silent audio after S3.
19012083 * After S3, the audio driver restores pin:cvt selections
....@@ -1910,27 +2092,37 @@
19102092 /* Call sync_audio_rate to set the N/CTS/M manually if necessary */
19112093 /* Todo: add DP1.2 MST audio support later */
19122094 if (codec_has_acomp(codec))
1913
- snd_hdac_sync_audio_rate(&codec->core, pin_nid, per_pin->dev_id,
1914
- runtime->rate);
2095
+ snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid,
2096
+ per_pin->dev_id, runtime->rate);
19152097
19162098 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
19172099 mutex_lock(&per_pin->lock);
19182100 per_pin->channels = substream->runtime->channels;
19192101 per_pin->setup = true;
19202102
2103
+ if (get_wcaps(codec, cvt_nid) & AC_WCAP_STRIPE) {
2104
+ stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core,
2105
+ substream);
2106
+ snd_hda_codec_write(codec, cvt_nid, 0,
2107
+ AC_VERB_SET_STRIPE_CONTROL,
2108
+ stripe);
2109
+ }
2110
+
19212111 hdmi_setup_audio_infoframe(codec, per_pin, non_pcm);
19222112 mutex_unlock(&per_pin->lock);
19232113 if (spec->dyn_pin_out) {
1924
- pinctl = snd_hda_codec_read(codec, pin_nid, 0,
2114
+ snd_hda_set_dev_select(codec, per_pin->pin_nid,
2115
+ per_pin->dev_id);
2116
+ pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
19252117 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
1926
- snd_hda_codec_write(codec, pin_nid, 0,
2118
+ snd_hda_codec_write(codec, per_pin->pin_nid, 0,
19272119 AC_VERB_SET_PIN_WIDGET_CONTROL,
19282120 pinctl | PIN_OUT);
19292121 }
19302122
19312123 /* snd_hda_set_dev_select() has been called before */
1932
- err = spec->ops.setup_stream(codec, cvt_nid, pin_nid,
1933
- stream_tag, format);
2124
+ err = spec->ops.setup_stream(codec, cvt_nid, per_pin->pin_nid,
2125
+ per_pin->dev_id, stream_tag, format);
19342126 unlock:
19352127 mutex_unlock(&spec->pcm_lock);
19362128 return err;
....@@ -1968,9 +2160,10 @@
19682160 goto unlock;
19692161 }
19702162 per_cvt = get_cvt(spec, cvt_idx);
1971
- snd_BUG_ON(!per_cvt->assigned);
19722163 per_cvt->assigned = 0;
19732164 hinfo->nid = 0;
2165
+
2166
+ azx_stream(get_azx_dev(substream))->stripe = 0;
19742167
19752168 snd_hda_spdif_ctls_unassign(codec, pcm_idx);
19762169 clear_bit(pcm_idx, &spec->pcm_in_use);
....@@ -1985,6 +2178,8 @@
19852178 per_pin = get_pin(spec, pin_idx);
19862179
19872180 if (spec->dyn_pin_out) {
2181
+ snd_hda_set_dev_select(codec, per_pin->pin_nid,
2182
+ per_pin->dev_id);
19882183 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
19892184 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19902185 snd_hda_codec_write(codec, per_pin->pin_nid, 0,
....@@ -2016,7 +2211,7 @@
20162211
20172212 static int hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
20182213 {
2019
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
2214
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
20202215 struct hdmi_spec *spec = codec->spec;
20212216 struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
20222217
....@@ -2029,7 +2224,7 @@
20292224 static void hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx,
20302225 unsigned char *chmap)
20312226 {
2032
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
2227
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
20332228 struct hdmi_spec *spec = codec->spec;
20342229 struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
20352230
....@@ -2043,7 +2238,7 @@
20432238 static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
20442239 unsigned char *chmap, int prepared)
20452240 {
2046
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
2241
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
20472242 struct hdmi_spec *spec = codec->spec;
20482243 struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
20492244
....@@ -2059,7 +2254,7 @@
20592254
20602255 static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)
20612256 {
2062
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
2257
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
20632258 struct hdmi_spec *spec = codec->spec;
20642259 struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
20652260
....@@ -2069,15 +2264,26 @@
20692264 static int generic_hdmi_build_pcms(struct hda_codec *codec)
20702265 {
20712266 struct hdmi_spec *spec = codec->spec;
2072
- int idx;
2267
+ int idx, pcm_num;
20732268
20742269 /*
20752270 * for non-mst mode, pcm number is the same as before
2076
- * for DP MST mode, pcm number is (nid number + dev_num - 1)
2077
- * dev_num is the device entry number in a pin
2078
- *
2271
+ * for DP MST mode without extra PCM, pcm number is same
2272
+ * for DP MST mode with extra PCMs, pcm number is
2273
+ * (nid number + dev_num - 1)
2274
+ * dev_num is the device entry number in a pin
20792275 */
2080
- for (idx = 0; idx < spec->num_nids + spec->dev_num - 1; idx++) {
2276
+
2277
+ if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms)
2278
+ pcm_num = spec->num_cvts;
2279
+ else if (codec->mst_no_extra_pcms)
2280
+ pcm_num = spec->num_nids;
2281
+ else
2282
+ pcm_num = spec->num_nids + spec->dev_num - 1;
2283
+
2284
+ codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num);
2285
+
2286
+ for (idx = 0; idx < pcm_num; idx++) {
20812287 struct hda_pcm *info;
20822288 struct hda_pcm_stream *pstr;
20832289
....@@ -2109,15 +2315,23 @@
21092315 pcm->jack = NULL;
21102316 }
21112317
2112
-static int add_hdmi_jack_kctl(struct hda_codec *codec,
2113
- struct hdmi_spec *spec,
2114
- int pcm_idx,
2115
- const char *name)
2318
+static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx)
21162319 {
2320
+ char hdmi_str[32] = "HDMI/DP";
2321
+ struct hdmi_spec *spec = codec->spec;
2322
+ struct hdmi_spec_per_pin *per_pin = get_pin(spec, pcm_idx);
21172323 struct snd_jack *jack;
2324
+ int pcmdev = get_pcm_rec(spec, pcm_idx)->device;
21182325 int err;
21192326
2120
- err = snd_jack_new(codec->card, name, SND_JACK_AVOUT, &jack,
2327
+ if (pcmdev > 0)
2328
+ sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
2329
+ if (!spec->dyn_pcm_assign &&
2330
+ !is_jack_detectable(codec, per_pin->pin_nid))
2331
+ strncat(hdmi_str, " Phantom",
2332
+ sizeof(hdmi_str) - strlen(hdmi_str) - 1);
2333
+
2334
+ err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack,
21212335 true, false);
21222336 if (err < 0)
21232337 return err;
....@@ -2125,46 +2339,6 @@
21252339 spec->pcm_rec[pcm_idx].jack = jack;
21262340 jack->private_data = &spec->pcm_rec[pcm_idx];
21272341 jack->private_free = free_hdmi_jack_priv;
2128
- return 0;
2129
-}
2130
-
2131
-static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx)
2132
-{
2133
- char hdmi_str[32] = "HDMI/DP";
2134
- struct hdmi_spec *spec = codec->spec;
2135
- struct hdmi_spec_per_pin *per_pin;
2136
- struct hda_jack_tbl *jack;
2137
- int pcmdev = get_pcm_rec(spec, pcm_idx)->device;
2138
- bool phantom_jack;
2139
- int ret;
2140
-
2141
- if (pcmdev > 0)
2142
- sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
2143
-
2144
- if (spec->dyn_pcm_assign)
2145
- return add_hdmi_jack_kctl(codec, spec, pcm_idx, hdmi_str);
2146
-
2147
- /* for !dyn_pcm_assign, we still use hda_jack for compatibility */
2148
- /* if !dyn_pcm_assign, it must be non-MST mode.
2149
- * This means pcms and pins are statically mapped.
2150
- * And pcm_idx is pin_idx.
2151
- */
2152
- per_pin = get_pin(spec, pcm_idx);
2153
- phantom_jack = !is_jack_detectable(codec, per_pin->pin_nid);
2154
- if (phantom_jack)
2155
- strncat(hdmi_str, " Phantom",
2156
- sizeof(hdmi_str) - strlen(hdmi_str) - 1);
2157
- ret = snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str,
2158
- phantom_jack);
2159
- if (ret < 0)
2160
- return ret;
2161
- jack = snd_hda_jack_tbl_get(codec, per_pin->pin_nid);
2162
- if (jack == NULL)
2163
- return 0;
2164
- /* assign jack->jack to pcm_rec[].jack to
2165
- * align with dyn_pcm_assign mode
2166
- */
2167
- spec->pcm_rec[pcm_idx].jack = jack->jack;
21682342 return 0;
21692343 }
21702344
....@@ -2257,6 +2431,7 @@
22572431 struct hdmi_spec *spec = codec->spec;
22582432 int pin_idx;
22592433
2434
+ mutex_lock(&spec->bind_lock);
22602435 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
22612436 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
22622437 hda_nid_t pin_nid = per_pin->pin_nid;
....@@ -2264,11 +2439,12 @@
22642439
22652440 snd_hda_set_dev_select(codec, pin_nid, dev_id);
22662441 hdmi_init_pin(codec, pin_nid);
2267
- if (!codec_has_acomp(codec))
2268
- snd_hda_jack_detect_enable_callback(codec, pin_nid,
2269
- codec->jackpoll_interval > 0 ?
2270
- jack_callback : NULL);
2442
+ if (codec_has_acomp(codec))
2443
+ continue;
2444
+ snd_hda_jack_detect_enable_callback_mst(codec, pin_nid, dev_id,
2445
+ jack_callback);
22712446 }
2447
+ mutex_unlock(&spec->bind_lock);
22722448 return 0;
22732449 }
22742450
....@@ -2301,10 +2477,12 @@
23012477 struct hdmi_spec *spec = codec->spec;
23022478 int pin_idx, pcm_idx;
23032479
2304
- if (codec_has_acomp(codec)) {
2480
+ if (spec->acomp_registered) {
2481
+ snd_hdac_acomp_exit(&codec->bus->core);
2482
+ } else if (codec_has_acomp(codec)) {
23052483 snd_hdac_acomp_register_notifier(&codec->bus->core, NULL);
2306
- codec->relaxed_resume = 0;
23072484 }
2485
+ codec->relaxed_resume = 0;
23082486
23092487 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
23102488 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
....@@ -2344,7 +2522,7 @@
23442522 int pin_idx;
23452523
23462524 codec->patch_ops.init(codec);
2347
- regcache_sync(codec->core.regmap);
2525
+ snd_hda_regmap_sync(codec);
23482526
23492527 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
23502528 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
....@@ -2367,7 +2545,7 @@
23672545 };
23682546
23692547 static const struct hdmi_ops generic_standard_hdmi_ops = {
2370
- .pin_get_eld = snd_hdmi_get_eld,
2548
+ .pin_get_eld = hdmi_pin_get_eld,
23712549 .pin_setup_infoframe = hdmi_pin_setup_infoframe,
23722550 .pin_hbr_setup = hdmi_pin_hbr_setup,
23732551 .setup_stream = hdmi_setup_stream,
....@@ -2382,15 +2560,17 @@
23822560 if (!spec)
23832561 return -ENOMEM;
23842562
2563
+ spec->codec = codec;
23852564 spec->ops = generic_standard_hdmi_ops;
23862565 spec->dev_num = 1; /* initialize to 1 */
23872566 mutex_init(&spec->pcm_lock);
2567
+ mutex_init(&spec->bind_lock);
23882568 snd_hdac_register_chmap_ops(&codec->core, &spec->chmap);
23892569
23902570 spec->chmap.ops.get_chmap = hdmi_get_chmap;
23912571 spec->chmap.ops.set_chmap = hdmi_set_chmap;
23922572 spec->chmap.ops.is_pcm_attached = is_hdmi_pcm_attached;
2393
- spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc,
2573
+ spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc;
23942574
23952575 codec->spec = spec;
23962576 hdmi_array_init(spec, 4);
....@@ -2420,32 +2600,140 @@
24202600 }
24212601
24222602 /*
2603
+ * generic audio component binding
2604
+ */
2605
+
2606
+/* turn on / off the unsol event jack detection dynamically */
2607
+static void reprogram_jack_detect(struct hda_codec *codec, hda_nid_t nid,
2608
+ int dev_id, bool use_acomp)
2609
+{
2610
+ struct hda_jack_tbl *tbl;
2611
+
2612
+ tbl = snd_hda_jack_tbl_get_mst(codec, nid, dev_id);
2613
+ if (tbl) {
2614
+ /* clear unsol even if component notifier is used, or re-enable
2615
+ * if notifier is cleared
2616
+ */
2617
+ unsigned int val = use_acomp ? 0 : (AC_USRSP_EN | tbl->tag);
2618
+ snd_hda_codec_write_cache(codec, nid, 0,
2619
+ AC_VERB_SET_UNSOLICITED_ENABLE, val);
2620
+ }
2621
+}
2622
+
2623
+/* set up / clear component notifier dynamically */
2624
+static void generic_acomp_notifier_set(struct drm_audio_component *acomp,
2625
+ bool use_acomp)
2626
+{
2627
+ struct hdmi_spec *spec;
2628
+ int i;
2629
+
2630
+ spec = container_of(acomp->audio_ops, struct hdmi_spec, drm_audio_ops);
2631
+ mutex_lock(&spec->bind_lock);
2632
+ spec->use_acomp_notifier = use_acomp;
2633
+ spec->codec->relaxed_resume = use_acomp;
2634
+ spec->codec->bus->keep_power = 0;
2635
+ /* reprogram each jack detection logic depending on the notifier */
2636
+ for (i = 0; i < spec->num_pins; i++)
2637
+ reprogram_jack_detect(spec->codec,
2638
+ get_pin(spec, i)->pin_nid,
2639
+ get_pin(spec, i)->dev_id,
2640
+ use_acomp);
2641
+ mutex_unlock(&spec->bind_lock);
2642
+}
2643
+
2644
+/* enable / disable the notifier via master bind / unbind */
2645
+static int generic_acomp_master_bind(struct device *dev,
2646
+ struct drm_audio_component *acomp)
2647
+{
2648
+ generic_acomp_notifier_set(acomp, true);
2649
+ return 0;
2650
+}
2651
+
2652
+static void generic_acomp_master_unbind(struct device *dev,
2653
+ struct drm_audio_component *acomp)
2654
+{
2655
+ generic_acomp_notifier_set(acomp, false);
2656
+}
2657
+
2658
+/* check whether both HD-audio and DRM PCI devices belong to the same bus */
2659
+static int match_bound_vga(struct device *dev, int subtype, void *data)
2660
+{
2661
+ struct hdac_bus *bus = data;
2662
+ struct pci_dev *pci, *master;
2663
+
2664
+ if (!dev_is_pci(dev) || !dev_is_pci(bus->dev))
2665
+ return 0;
2666
+ master = to_pci_dev(bus->dev);
2667
+ pci = to_pci_dev(dev);
2668
+ return master->bus == pci->bus;
2669
+}
2670
+
2671
+/* audio component notifier for AMD/Nvidia HDMI codecs */
2672
+static void generic_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id)
2673
+{
2674
+ struct hda_codec *codec = audio_ptr;
2675
+ struct hdmi_spec *spec = codec->spec;
2676
+ hda_nid_t pin_nid = spec->port2pin(codec, port);
2677
+
2678
+ if (!pin_nid)
2679
+ return;
2680
+ if (get_wcaps_type(get_wcaps(codec, pin_nid)) != AC_WID_PIN)
2681
+ return;
2682
+ /* skip notification during system suspend (but not in runtime PM);
2683
+ * the state will be updated at resume
2684
+ */
2685
+ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND)
2686
+ return;
2687
+
2688
+ check_presence_and_report(codec, pin_nid, dev_id);
2689
+}
2690
+
2691
+/* set up the private drm_audio_ops from the template */
2692
+static void setup_drm_audio_ops(struct hda_codec *codec,
2693
+ const struct drm_audio_component_audio_ops *ops)
2694
+{
2695
+ struct hdmi_spec *spec = codec->spec;
2696
+
2697
+ spec->drm_audio_ops.audio_ptr = codec;
2698
+ /* intel_audio_codec_enable() or intel_audio_codec_disable()
2699
+ * will call pin_eld_notify with using audio_ptr pointer
2700
+ * We need make sure audio_ptr is really setup
2701
+ */
2702
+ wmb();
2703
+ spec->drm_audio_ops.pin2port = ops->pin2port;
2704
+ spec->drm_audio_ops.pin_eld_notify = ops->pin_eld_notify;
2705
+ spec->drm_audio_ops.master_bind = ops->master_bind;
2706
+ spec->drm_audio_ops.master_unbind = ops->master_unbind;
2707
+}
2708
+
2709
+/* initialize the generic HDMI audio component */
2710
+static void generic_acomp_init(struct hda_codec *codec,
2711
+ const struct drm_audio_component_audio_ops *ops,
2712
+ int (*port2pin)(struct hda_codec *, int))
2713
+{
2714
+ struct hdmi_spec *spec = codec->spec;
2715
+
2716
+ if (!enable_acomp) {
2717
+ codec_info(codec, "audio component disabled by module option\n");
2718
+ return;
2719
+ }
2720
+
2721
+ spec->port2pin = port2pin;
2722
+ setup_drm_audio_ops(codec, ops);
2723
+ if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops,
2724
+ match_bound_vga, 0)) {
2725
+ spec->acomp_registered = true;
2726
+ }
2727
+}
2728
+
2729
+/*
24232730 * Intel codec parsers and helpers
24242731 */
24252732
2426
-static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
2427
- hda_nid_t nid)
2428
-{
2429
- struct hdmi_spec *spec = codec->spec;
2430
- hda_nid_t conns[4];
2431
- int nconns;
2432
-
2433
- nconns = snd_hda_get_connections(codec, nid, conns, ARRAY_SIZE(conns));
2434
- if (nconns == spec->num_cvts &&
2435
- !memcmp(conns, spec->cvt_nids, spec->num_cvts * sizeof(hda_nid_t)))
2436
- return;
2437
-
2438
- /* override pins connection list */
2439
- codec_dbg(codec, "hdmi: haswell: override pin connection 0x%x\n", nid);
2440
- snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids);
2441
-}
2442
-
2443
-#define INTEL_VENDOR_NID 0x08
2444
-#define INTEL_GLK_VENDOR_NID 0x0B
2445
-#define INTEL_GET_VENDOR_VERB 0xf81
2446
-#define INTEL_SET_VENDOR_VERB 0x781
2447
-#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */
2448
-#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */
2733
+#define INTEL_GET_VENDOR_VERB 0xf81
2734
+#define INTEL_SET_VENDOR_VERB 0x781
2735
+#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */
2736
+#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */
24492737
24502738 static void intel_haswell_enable_all_pins(struct hda_codec *codec,
24512739 bool update_tree)
....@@ -2525,11 +2813,44 @@
25252813
25262814 static int intel_pin2port(void *audio_ptr, int pin_nid)
25272815 {
2528
- int base_nid = intel_base_nid(audio_ptr);
2816
+ struct hda_codec *codec = audio_ptr;
2817
+ struct hdmi_spec *spec = codec->spec;
2818
+ int base_nid, i;
25292819
2530
- if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3))
2531
- return -1;
2532
- return pin_nid - base_nid + 1; /* intel port is 1-based */
2820
+ if (!spec->port_num) {
2821
+ base_nid = intel_base_nid(codec);
2822
+ if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3))
2823
+ return -1;
2824
+ return pin_nid - base_nid + 1;
2825
+ }
2826
+
2827
+ /*
2828
+ * looking for the pin number in the mapping table and return
2829
+ * the index which indicate the port number
2830
+ */
2831
+ for (i = 0; i < spec->port_num; i++) {
2832
+ if (pin_nid == spec->port_map[i])
2833
+ return i;
2834
+ }
2835
+
2836
+ codec_info(codec, "Can't find the HDMI/DP port for pin %d\n", pin_nid);
2837
+ return -1;
2838
+}
2839
+
2840
+static int intel_port2pin(struct hda_codec *codec, int port)
2841
+{
2842
+ struct hdmi_spec *spec = codec->spec;
2843
+
2844
+ if (!spec->port_num) {
2845
+ /* we assume only from port-B to port-D */
2846
+ if (port < 1 || port > 3)
2847
+ return 0;
2848
+ return port + intel_base_nid(codec) - 1;
2849
+ }
2850
+
2851
+ if (port < 0 || port >= spec->port_num)
2852
+ return 0;
2853
+ return spec->port_map[port];
25332854 }
25342855
25352856 static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
....@@ -2538,24 +2859,23 @@
25382859 int pin_nid;
25392860 int dev_id = pipe;
25402861
2541
- /* we assume only from port-B to port-D */
2542
- if (port < 1 || port > 3)
2862
+ pin_nid = intel_port2pin(codec, port);
2863
+ if (!pin_nid)
25432864 return;
2544
-
2545
- pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */
2546
-
25472865 /* skip notification during system suspend (but not in runtime PM);
25482866 * the state will be updated at resume
25492867 */
2550
- if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0)
2551
- return;
2552
- /* ditto during suspend/resume process itself */
2553
- if (snd_hdac_is_in_pm(&codec->core))
2868
+ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND)
25542869 return;
25552870
25562871 snd_hdac_i915_set_bclk(&codec->bus->core);
25572872 check_presence_and_report(codec, pin_nid, dev_id);
25582873 }
2874
+
2875
+static const struct drm_audio_component_audio_ops intel_audio_ops = {
2876
+ .pin2port = intel_pin2port,
2877
+ .pin_eld_notify = intel_pin_eld_notify,
2878
+};
25592879
25602880 /* register i915 component pin_eld_notify callback */
25612881 static void register_i915_notifier(struct hda_codec *codec)
....@@ -2563,14 +2883,8 @@
25632883 struct hdmi_spec *spec = codec->spec;
25642884
25652885 spec->use_acomp_notifier = true;
2566
- spec->drm_audio_ops.audio_ptr = codec;
2567
- /* intel_audio_codec_enable() or intel_audio_codec_disable()
2568
- * will call pin_eld_notify with using audio_ptr pointer
2569
- * We need make sure audio_ptr is really setup
2570
- */
2571
- wmb();
2572
- spec->drm_audio_ops.pin2port = intel_pin2port;
2573
- spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify;
2886
+ spec->port2pin = intel_port2pin;
2887
+ setup_drm_audio_ops(codec, &intel_audio_ops);
25742888 snd_hdac_acomp_register_notifier(&codec->bus->core,
25752889 &spec->drm_audio_ops);
25762890 /* no need for forcible resume for jack check thanks to notifier */
....@@ -2579,10 +2893,12 @@
25792893
25802894 /* setup_stream ops override for HSW+ */
25812895 static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
2582
- hda_nid_t pin_nid, u32 stream_tag, int format)
2896
+ hda_nid_t pin_nid, int dev_id, u32 stream_tag,
2897
+ int format)
25832898 {
25842899 haswell_verify_D0(codec, cvt_nid, pin_nid);
2585
- return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
2900
+ return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
2901
+ stream_tag, format);
25862902 }
25872903
25882904 /* pin_cvt_fixup ops override for HSW+ and VLV+ */
....@@ -2643,7 +2959,8 @@
26432959 }
26442960
26452961 /* Intel Haswell and onwards; audio component with eld notifier */
2646
-static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid)
2962
+static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid,
2963
+ const int *port_map, int port_num)
26472964 {
26482965 struct hdmi_spec *spec;
26492966 int err;
....@@ -2655,15 +2972,14 @@
26552972 codec->dp_mst = true;
26562973 spec->dyn_pcm_assign = true;
26572974 spec->vendor_nid = vendor_nid;
2975
+ spec->port_map = port_map;
2976
+ spec->port_num = port_num;
2977
+ spec->intel_hsw_fixup = true;
26582978
26592979 intel_haswell_enable_all_pins(codec, true);
26602980 intel_haswell_fixup_enable_dp12(codec);
26612981
2662
- /* For Haswell/Broadwell, the controller is also in the power well and
2663
- * can cover the codec power request, and so need not set this flag.
2664
- */
2665
- if (!is_haswell(codec) && !is_broadwell(codec))
2666
- codec->core.link_power_control = 1;
2982
+ codec->display_power_control = 1;
26672983
26682984 codec->patch_ops.set_power_state = haswell_set_power_state;
26692985 codec->depop_delay = 0;
....@@ -2672,17 +2988,54 @@
26722988 spec->ops.setup_stream = i915_hsw_setup_stream;
26732989 spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
26742990
2991
+ /*
2992
+ * Enable silent stream feature, if it is enabled via
2993
+ * module param or Kconfig option
2994
+ */
2995
+ if (enable_silent_stream)
2996
+ spec->send_silent_stream = true;
2997
+
26752998 return parse_intel_hdmi(codec);
26762999 }
26773000
26783001 static int patch_i915_hsw_hdmi(struct hda_codec *codec)
26793002 {
2680
- return intel_hsw_common_init(codec, INTEL_VENDOR_NID);
3003
+ return intel_hsw_common_init(codec, 0x08, NULL, 0);
26813004 }
26823005
26833006 static int patch_i915_glk_hdmi(struct hda_codec *codec)
26843007 {
2685
- return intel_hsw_common_init(codec, INTEL_GLK_VENDOR_NID);
3008
+ return intel_hsw_common_init(codec, 0x0b, NULL, 0);
3009
+}
3010
+
3011
+static int patch_i915_icl_hdmi(struct hda_codec *codec)
3012
+{
3013
+ /*
3014
+ * pin to port mapping table where the value indicate the pin number and
3015
+ * the index indicate the port number.
3016
+ */
3017
+ static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb};
3018
+
3019
+ return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
3020
+}
3021
+
3022
+static int patch_i915_tgl_hdmi(struct hda_codec *codec)
3023
+{
3024
+ /*
3025
+ * pin to port mapping table where the value indicate the pin number and
3026
+ * the index indicate the port number.
3027
+ */
3028
+ static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
3029
+ int ret;
3030
+
3031
+ ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
3032
+ if (!ret) {
3033
+ struct hdmi_spec *spec = codec->spec;
3034
+
3035
+ spec->dyn_pcm_no_legacy = true;
3036
+ }
3037
+
3038
+ return ret;
26863039 }
26873040
26883041 /* Intel Baytrail and Braswell; with eld notifier */
....@@ -2699,7 +3052,7 @@
26993052 /* For Valleyview/Cherryview, only the display codec is in the display
27003053 * power well and can use link_power ops to request/release the power.
27013054 */
2702
- codec->core.link_power_control = 1;
3055
+ codec->display_power_control = 1;
27033056
27043057 codec->depop_delay = 0;
27053058 codec->auto_runtime_pm = 1;
....@@ -2790,7 +3143,7 @@
27903143 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
27913144 snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE,
27923145 AMP_OUT_UNMUTE);
2793
- snd_hda_jack_detect_enable(codec, pin);
3146
+ snd_hda_jack_detect_enable(codec, pin, per_pin->dev_id);
27943147 return 0;
27953148 }
27963149
....@@ -2969,6 +3322,7 @@
29693322 if (!spec)
29703323 return -ENOMEM;
29713324
3325
+ spec->codec = codec;
29723326 codec->spec = spec;
29733327 hdmi_array_init(spec, 1);
29743328
....@@ -3180,6 +3534,7 @@
31803534 spec->pcm_playback.rates = SUPPORTED_RATES;
31813535 spec->pcm_playback.maxbps = SUPPORTED_MAXBPS;
31823536 spec->pcm_playback.formats = SUPPORTED_FORMATS;
3537
+ spec->nv_dp_workaround = true;
31833538 return 0;
31843539 }
31853540
....@@ -3273,7 +3628,62 @@
32733628 return 0;
32743629 }
32753630
3631
+/* map from pin NID to port; port is 0-based */
3632
+/* for Nvidia: assume widget NID starting from 4, with step 1 (4, 5, 6, ...) */
3633
+static int nvhdmi_pin2port(void *audio_ptr, int pin_nid)
3634
+{
3635
+ return pin_nid - 4;
3636
+}
3637
+
3638
+/* reverse-map from port to pin NID: see above */
3639
+static int nvhdmi_port2pin(struct hda_codec *codec, int port)
3640
+{
3641
+ return port + 4;
3642
+}
3643
+
3644
+static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = {
3645
+ .pin2port = nvhdmi_pin2port,
3646
+ .pin_eld_notify = generic_acomp_pin_eld_notify,
3647
+ .master_bind = generic_acomp_master_bind,
3648
+ .master_unbind = generic_acomp_master_unbind,
3649
+};
3650
+
32763651 static int patch_nvhdmi(struct hda_codec *codec)
3652
+{
3653
+ struct hdmi_spec *spec;
3654
+ int err;
3655
+
3656
+ err = alloc_generic_hdmi(codec);
3657
+ if (err < 0)
3658
+ return err;
3659
+ codec->dp_mst = true;
3660
+
3661
+ spec = codec->spec;
3662
+ spec->dyn_pcm_assign = true;
3663
+
3664
+ err = hdmi_parse_codec(codec);
3665
+ if (err < 0) {
3666
+ generic_spec_free(codec);
3667
+ return err;
3668
+ }
3669
+
3670
+ generic_hdmi_init_per_pins(codec);
3671
+
3672
+ spec->dyn_pin_out = true;
3673
+
3674
+ spec->chmap.ops.chmap_cea_alloc_validate_get_type =
3675
+ nvhdmi_chmap_cea_alloc_validate_get_type;
3676
+ spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
3677
+ spec->nv_dp_workaround = true;
3678
+
3679
+ codec->link_down_at_suspend = 1;
3680
+
3681
+ generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin);
3682
+
3683
+ return 0;
3684
+}
3685
+
3686
+static int patch_nvhdmi_legacy(struct hda_codec *codec)
32773687 {
32783688 struct hdmi_spec *spec;
32793689 int err;
....@@ -3288,6 +3698,7 @@
32883698 spec->chmap.ops.chmap_cea_alloc_validate_get_type =
32893699 nvhdmi_chmap_cea_alloc_validate_get_type;
32903700 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
3701
+ spec->nv_dp_workaround = true;
32913702
32923703 codec->link_down_at_suspend = 1;
32933704
....@@ -3455,11 +3866,13 @@
34553866 if (err)
34563867 return err;
34573868
3869
+ codec->depop_delay = 10;
34583870 codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
34593871 spec = codec->spec;
34603872 spec->chmap.ops.chmap_cea_alloc_validate_get_type =
34613873 nvhdmi_chmap_cea_alloc_validate_get_type;
34623874 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
3875
+ spec->nv_dp_workaround = true;
34633876
34643877 return 0;
34653878 }
....@@ -3512,16 +3925,19 @@
35123925 #define ATI_HBR_ENABLE 0x10
35133926
35143927 static int atihdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
3515
- unsigned char *buf, int *eld_size)
3928
+ int dev_id, unsigned char *buf, int *eld_size)
35163929 {
3930
+ WARN_ON(dev_id != 0);
35173931 /* call hda_eld.c ATI/AMD-specific function */
35183932 return snd_hdmi_get_eld_ati(codec, nid, buf, eld_size,
35193933 is_amdhdmi_rev3_or_later(codec));
35203934 }
35213935
3522
-static void atihdmi_pin_setup_infoframe(struct hda_codec *codec, hda_nid_t pin_nid, int ca,
3936
+static void atihdmi_pin_setup_infoframe(struct hda_codec *codec,
3937
+ hda_nid_t pin_nid, int dev_id, int ca,
35233938 int active_channels, int conn_type)
35243939 {
3940
+ WARN_ON(dev_id != 0);
35253941 snd_hda_codec_write(codec, pin_nid, 0, ATI_VERB_SET_CHANNEL_ALLOCATION, ca);
35263942 }
35273943
....@@ -3593,7 +4009,7 @@
35934009 static int atihdmi_pin_set_slot_channel(struct hdac_device *hdac,
35944010 hda_nid_t pin_nid, int hdmi_slot, int stream_channel)
35954011 {
3596
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
4012
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
35974013 int verb;
35984014 int ati_channel_setup = 0;
35994015
....@@ -3629,7 +4045,7 @@
36294045 static int atihdmi_pin_get_slot_channel(struct hdac_device *hdac,
36304046 hda_nid_t pin_nid, int asp_slot)
36314047 {
3632
- struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
4048
+ struct hda_codec *codec = hdac_to_hda_codec(hdac);
36334049 bool was_odd = false;
36344050 int ati_asp_slot = asp_slot;
36354051 int verb;
....@@ -3712,9 +4128,11 @@
37124128 }
37134129
37144130 static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
3715
- bool hbr)
4131
+ int dev_id, bool hbr)
37164132 {
37174133 int hbr_ctl, hbr_ctl_new;
4134
+
4135
+ WARN_ON(dev_id != 0);
37184136
37194137 hbr_ctl = snd_hda_codec_read(codec, pin_nid, 0, ATI_VERB_GET_HBR_CONTROL, 0);
37204138 if (hbr_ctl >= 0 && (hbr_ctl & ATI_HBR_CAPABLE)) {
....@@ -3741,9 +4159,9 @@
37414159 }
37424160
37434161 static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
3744
- hda_nid_t pin_nid, u32 stream_tag, int format)
4162
+ hda_nid_t pin_nid, int dev_id,
4163
+ u32 stream_tag, int format)
37454164 {
3746
-
37474165 if (is_amdhdmi_rev3_or_later(codec)) {
37484166 int ramp_rate = 180; /* default as per AMD spec */
37494167 /* disable ramp-up/down for non-pcm as per AMD spec */
....@@ -3753,7 +4171,8 @@
37534171 snd_hda_codec_write(codec, cvt_nid, 0, ATI_VERB_SET_RAMP_RATE, ramp_rate);
37544172 }
37554173
3756
- return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
4174
+ return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
4175
+ stream_tag, format);
37574176 }
37584177
37594178
....@@ -3779,9 +4198,30 @@
37794198 ATI_VERB_SET_MULTICHANNEL_MODE,
37804199 ATI_MULTICHANNEL_MODE_SINGLE);
37814200 }
4201
+ codec->auto_runtime_pm = 1;
37824202
37834203 return 0;
37844204 }
4205
+
4206
+/* map from pin NID to port; port is 0-based */
4207
+/* for AMD: assume widget NID starting from 3, with step 2 (3, 5, 7, ...) */
4208
+static int atihdmi_pin2port(void *audio_ptr, int pin_nid)
4209
+{
4210
+ return pin_nid / 2 - 1;
4211
+}
4212
+
4213
+/* reverse-map from port to pin NID: see above */
4214
+static int atihdmi_port2pin(struct hda_codec *codec, int port)
4215
+{
4216
+ return port * 2 + 3;
4217
+}
4218
+
4219
+static const struct drm_audio_component_audio_ops atihdmi_audio_ops = {
4220
+ .pin2port = atihdmi_pin2port,
4221
+ .pin_eld_notify = generic_acomp_pin_eld_notify,
4222
+ .master_bind = generic_acomp_master_bind,
4223
+ .master_unbind = generic_acomp_master_unbind,
4224
+};
37854225
37864226 static int patch_atihdmi(struct hda_codec *codec)
37874227 {
....@@ -3831,6 +4271,8 @@
38314271 */
38324272 codec->link_down_at_suspend = 1;
38334273
4274
+ generic_acomp_init(codec, &atihdmi_audio_ops, atihdmi_port2pin);
4275
+
38344276 return 0;
38354277 }
38364278
....@@ -3861,29 +4303,33 @@
38614303 HDA_CODEC_ENTRY(0x10de0005, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
38624304 HDA_CODEC_ENTRY(0x10de0006, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
38634305 HDA_CODEC_ENTRY(0x10de0007, "MCP79/7A HDMI", patch_nvhdmi_8ch_7x),
3864
-HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi),
3865
-HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi),
3866
-HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi),
3867
-HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi),
3868
-HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi),
3869
-HDA_CODEC_ENTRY(0x10de000d, "GPU 0d HDMI/DP", patch_nvhdmi),
3870
-HDA_CODEC_ENTRY(0x10de0010, "GPU 10 HDMI/DP", patch_nvhdmi),
3871
-HDA_CODEC_ENTRY(0x10de0011, "GPU 11 HDMI/DP", patch_nvhdmi),
3872
-HDA_CODEC_ENTRY(0x10de0012, "GPU 12 HDMI/DP", patch_nvhdmi),
3873
-HDA_CODEC_ENTRY(0x10de0013, "GPU 13 HDMI/DP", patch_nvhdmi),
3874
-HDA_CODEC_ENTRY(0x10de0014, "GPU 14 HDMI/DP", patch_nvhdmi),
3875
-HDA_CODEC_ENTRY(0x10de0015, "GPU 15 HDMI/DP", patch_nvhdmi),
3876
-HDA_CODEC_ENTRY(0x10de0016, "GPU 16 HDMI/DP", patch_nvhdmi),
4306
+HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi_legacy),
4307
+HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi_legacy),
4308
+HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi_legacy),
4309
+HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi_legacy),
4310
+HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi_legacy),
4311
+HDA_CODEC_ENTRY(0x10de000d, "GPU 0d HDMI/DP", patch_nvhdmi_legacy),
4312
+HDA_CODEC_ENTRY(0x10de0010, "GPU 10 HDMI/DP", patch_nvhdmi_legacy),
4313
+HDA_CODEC_ENTRY(0x10de0011, "GPU 11 HDMI/DP", patch_nvhdmi_legacy),
4314
+HDA_CODEC_ENTRY(0x10de0012, "GPU 12 HDMI/DP", patch_nvhdmi_legacy),
4315
+HDA_CODEC_ENTRY(0x10de0013, "GPU 13 HDMI/DP", patch_nvhdmi_legacy),
4316
+HDA_CODEC_ENTRY(0x10de0014, "GPU 14 HDMI/DP", patch_nvhdmi_legacy),
4317
+HDA_CODEC_ENTRY(0x10de0015, "GPU 15 HDMI/DP", patch_nvhdmi_legacy),
4318
+HDA_CODEC_ENTRY(0x10de0016, "GPU 16 HDMI/DP", patch_nvhdmi_legacy),
38774319 /* 17 is known to be absent */
3878
-HDA_CODEC_ENTRY(0x10de0018, "GPU 18 HDMI/DP", patch_nvhdmi),
3879
-HDA_CODEC_ENTRY(0x10de0019, "GPU 19 HDMI/DP", patch_nvhdmi),
3880
-HDA_CODEC_ENTRY(0x10de001a, "GPU 1a HDMI/DP", patch_nvhdmi),
3881
-HDA_CODEC_ENTRY(0x10de001b, "GPU 1b HDMI/DP", patch_nvhdmi),
3882
-HDA_CODEC_ENTRY(0x10de001c, "GPU 1c HDMI/DP", patch_nvhdmi),
4320
+HDA_CODEC_ENTRY(0x10de0018, "GPU 18 HDMI/DP", patch_nvhdmi_legacy),
4321
+HDA_CODEC_ENTRY(0x10de0019, "GPU 19 HDMI/DP", patch_nvhdmi_legacy),
4322
+HDA_CODEC_ENTRY(0x10de001a, "GPU 1a HDMI/DP", patch_nvhdmi_legacy),
4323
+HDA_CODEC_ENTRY(0x10de001b, "GPU 1b HDMI/DP", patch_nvhdmi_legacy),
4324
+HDA_CODEC_ENTRY(0x10de001c, "GPU 1c HDMI/DP", patch_nvhdmi_legacy),
38834325 HDA_CODEC_ENTRY(0x10de0020, "Tegra30 HDMI", patch_tegra_hdmi),
38844326 HDA_CODEC_ENTRY(0x10de0022, "Tegra114 HDMI", patch_tegra_hdmi),
38854327 HDA_CODEC_ENTRY(0x10de0028, "Tegra124 HDMI", patch_tegra_hdmi),
38864328 HDA_CODEC_ENTRY(0x10de0029, "Tegra210 HDMI/DP", patch_tegra_hdmi),
4329
+HDA_CODEC_ENTRY(0x10de002d, "Tegra186 HDMI/DP0", patch_tegra_hdmi),
4330
+HDA_CODEC_ENTRY(0x10de002e, "Tegra186 HDMI/DP1", patch_tegra_hdmi),
4331
+HDA_CODEC_ENTRY(0x10de002f, "Tegra194 HDMI/DP2", patch_tegra_hdmi),
4332
+HDA_CODEC_ENTRY(0x10de0030, "Tegra194 HDMI/DP3", patch_tegra_hdmi),
38874333 HDA_CODEC_ENTRY(0x10de0040, "GPU 40 HDMI/DP", patch_nvhdmi),
38884334 HDA_CODEC_ENTRY(0x10de0041, "GPU 41 HDMI/DP", patch_nvhdmi),
38894335 HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi),
....@@ -3933,6 +4379,7 @@
39334379 HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi),
39344380 HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi),
39354381 HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi),
4382
+HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi),
39364383 HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi),
39374384 HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi),
39384385 HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi),
....@@ -3946,7 +4393,15 @@
39464393 HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi),
39474394 HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi),
39484395 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
3949
-HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi),
4396
+HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),
4397
+HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),
4398
+HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi),
4399
+HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI", patch_i915_tgl_hdmi),
4400
+HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi),
4401
+HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_tgl_hdmi),
4402
+HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),
4403
+HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi),
4404
+HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi),
39504405 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
39514406 HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
39524407 HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),