Lines Matching +full:hdmi +full:- +full:dp1
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * patch_hdmi.c - routines for HDMI/DisplayPort codecs
6 * Copyright(c) 2008-2010 Intel Corporation. All rights reserved.
48 MODULE_PARM_DESC(enable_silent_stream, "Enable Silent Stream for HDMI devices");
82 struct hdmi_pcm *pcm; /* pointer to spec->pcm_rec[n] dynamically*/
83 int pcm_idx; /* which pcm is attached. -1 means no pcm is attached */
89 bool chmap_set; /* channel-map override by ALSA API? */
90 unsigned char chmap[8]; /* ALSA API channel-map */
126 SILENT_STREAM_KAE, /* use standard HDA Keep-Alive */
170 /* hdmi interrupt trigger control flag for Nvidia codec */
174 bool intel_hsw_fixup; /* apply Intel platform-specific fixups */
176 * Non-generic VIA/NVIDIA specific
197 struct hdmi_spec *spec = codec->spec; in codec_has_acomp()
198 return spec->use_acomp_notifier; in codec_has_acomp()
223 u8 CC02_CT47; /* match with HDMI infoframe from this on */
231 struct hdmi_audio_infoframe hdmi; member
237 * HDMI routines
241 ((struct hdmi_spec_per_pin *)snd_array_elem(&spec->pins, idx))
243 ((struct hdmi_spec_per_cvt *)snd_array_elem(&spec->cvts, idx))
245 #define get_hdmi_pcm(spec, idx) (&(spec)->pcm_rec[idx])
247 #define get_pcm_rec(spec, idx) (get_hdmi_pcm(spec, idx)->pcm)
252 struct hdmi_spec *spec = codec->spec; in pin_id_to_pin_index()
257 * (dev_id == -1) means it is NON-MST pin in pin_id_to_pin_index()
260 if (dev_id == -1) in pin_id_to_pin_index()
263 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in pin_id_to_pin_index()
265 if ((per_pin->pin_nid == pin_nid) && in pin_id_to_pin_index()
266 (per_pin->dev_id == dev_id)) in pin_id_to_pin_index()
270 codec_warn(codec, "HDMI: pin NID 0x%x not registered\n", pin_nid); in pin_id_to_pin_index()
271 return -EINVAL; in pin_id_to_pin_index()
277 struct hdmi_spec *spec = codec->spec; in hinfo_to_pcm_index()
280 for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) in hinfo_to_pcm_index()
281 if (get_pcm_rec(spec, pcm_idx)->stream == hinfo) in hinfo_to_pcm_index()
284 codec_warn(codec, "HDMI: hinfo %p not tied to a PCM\n", hinfo); in hinfo_to_pcm_index()
285 return -EINVAL; in hinfo_to_pcm_index()
291 struct hdmi_spec *spec = codec->spec; in hinfo_to_pin_index()
295 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in hinfo_to_pin_index()
297 if (per_pin->pcm && in hinfo_to_pin_index()
298 per_pin->pcm->pcm->stream == hinfo) in hinfo_to_pin_index()
302 codec_dbg(codec, "HDMI: hinfo %p (pcm %d) not registered\n", hinfo, in hinfo_to_pin_index()
304 return -EINVAL; in hinfo_to_pin_index()
313 for (i = 0; i < spec->num_pins; i++) { in pcm_idx_to_pin()
315 if (per_pin->pcm_idx == pcm_idx) in pcm_idx_to_pin()
323 struct hdmi_spec *spec = codec->spec; in cvt_nid_to_cvt_index()
326 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) in cvt_nid_to_cvt_index()
327 if (get_cvt(spec, cvt_idx)->cvt_nid == cvt_nid) in cvt_nid_to_cvt_index()
330 codec_warn(codec, "HDMI: cvt NID 0x%x not registered\n", cvt_nid); in cvt_nid_to_cvt_index()
331 return -EINVAL; in cvt_nid_to_cvt_index()
338 struct hdmi_spec *spec = codec->spec; in hdmi_eld_ctl_info()
343 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in hdmi_eld_ctl_info()
345 pcm_idx = kcontrol->private_value; in hdmi_eld_ctl_info()
346 mutex_lock(&spec->pcm_lock); in hdmi_eld_ctl_info()
350 uinfo->count = 0; in hdmi_eld_ctl_info()
353 eld = &per_pin->sink_eld; in hdmi_eld_ctl_info()
354 uinfo->count = eld->eld_valid ? eld->eld_size : 0; in hdmi_eld_ctl_info()
357 mutex_unlock(&spec->pcm_lock); in hdmi_eld_ctl_info()
365 struct hdmi_spec *spec = codec->spec; in hdmi_eld_ctl_get()
371 pcm_idx = kcontrol->private_value; in hdmi_eld_ctl_get()
372 mutex_lock(&spec->pcm_lock); in hdmi_eld_ctl_get()
376 memset(ucontrol->value.bytes.data, 0, in hdmi_eld_ctl_get()
377 ARRAY_SIZE(ucontrol->value.bytes.data)); in hdmi_eld_ctl_get()
381 eld = &per_pin->sink_eld; in hdmi_eld_ctl_get()
382 if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || in hdmi_eld_ctl_get()
383 eld->eld_size > ELD_MAX_SIZE) { in hdmi_eld_ctl_get()
385 err = -EINVAL; in hdmi_eld_ctl_get()
389 memset(ucontrol->value.bytes.data, 0, in hdmi_eld_ctl_get()
390 ARRAY_SIZE(ucontrol->value.bytes.data)); in hdmi_eld_ctl_get()
391 if (eld->eld_valid) in hdmi_eld_ctl_get()
392 memcpy(ucontrol->value.bytes.data, eld->eld_buffer, in hdmi_eld_ctl_get()
393 eld->eld_size); in hdmi_eld_ctl_get()
396 mutex_unlock(&spec->pcm_lock); in hdmi_eld_ctl_get()
413 struct hdmi_spec *spec = codec->spec; in hdmi_create_eld_ctl()
418 return -ENOMEM; in hdmi_create_eld_ctl()
419 kctl->private_value = pcm_idx; in hdmi_create_eld_ctl()
420 kctl->id.device = device; in hdmi_create_eld_ctl()
429 get_hdmi_pcm(spec, pcm_idx)->eld_ctl = kctl; in hdmi_create_eld_ctl()
465 struct hdmi_spec *spec = codec->spec; in hdmi_init_pin()
473 if (spec->dyn_pin_out) in hdmi_init_pin()
478 * when the pin is disabled or changed while using with HDMI in hdmi_init_pin()
494 struct hdmi_spec_per_pin *per_pin = entry->private_data; in print_eld_info()
496 mutex_lock(&per_pin->lock); in print_eld_info()
497 snd_hdmi_print_eld_info(&per_pin->sink_eld, buffer, per_pin->pin_nid, in print_eld_info()
498 per_pin->dev_id, per_pin->cvt_nid); in print_eld_info()
499 mutex_unlock(&per_pin->lock); in print_eld_info()
505 struct hdmi_spec_per_pin *per_pin = entry->private_data; in write_eld_info()
507 mutex_lock(&per_pin->lock); in write_eld_info()
508 snd_hdmi_write_eld_info(&per_pin->sink_eld, buffer); in write_eld_info()
509 mutex_unlock(&per_pin->lock); in write_eld_info()
515 struct hda_codec *codec = per_pin->codec; in eld_proc_new()
519 snprintf(name, sizeof(name), "eld#%d.%d", codec->addr, index); in eld_proc_new()
520 err = snd_card_proc_new(codec->card, name, &entry); in eld_proc_new()
525 entry->c.text.write = write_eld_info; in eld_proc_new()
526 entry->mode |= 0200; in eld_proc_new()
527 per_pin->proc_entry = entry; in eld_proc_new()
534 if (!per_pin->codec->bus->shutdown) { in eld_proc_free()
535 snd_info_free_entry(per_pin->proc_entry); in eld_proc_free()
536 per_pin->proc_entry = NULL; in eld_proc_free()
583 codec_dbg(codec, "HDMI: ELD buf size is %d\n", size); in hdmi_debug_dip_size()
588 codec_dbg(codec, "HDMI: DIP GP[%d] buf size is %d\n", i, size); in hdmi_debug_dip_size()
616 "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", in hdmi_clear_dip_buffers()
628 hdmi_ai->checksum = 0; in hdmi_checksum_audio_infoframe()
633 hdmi_ai->checksum = -sum; in hdmi_checksum_audio_infoframe()
684 struct hdmi_spec *spec = codec->spec; in hdmi_pin_setup_infoframe()
688 if ((conn_type == 0) || /* HDMI */ in hdmi_pin_setup_infoframe()
689 /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ in hdmi_pin_setup_infoframe()
690 (conn_type == 1 && spec->nv_dp_workaround)) { in hdmi_pin_setup_infoframe()
691 struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi; in hdmi_pin_setup_infoframe()
693 if (conn_type == 0) { /* HDMI */ in hdmi_pin_setup_infoframe()
694 hdmi_ai->type = 0x84; in hdmi_pin_setup_infoframe()
695 hdmi_ai->ver = 0x01; in hdmi_pin_setup_infoframe()
696 hdmi_ai->len = 0x0a; in hdmi_pin_setup_infoframe()
698 hdmi_ai->type = 0x84; in hdmi_pin_setup_infoframe()
699 hdmi_ai->ver = 0x1b; in hdmi_pin_setup_infoframe()
700 hdmi_ai->len = 0x11 << 2; in hdmi_pin_setup_infoframe()
702 hdmi_ai->CC02_CT47 = active_channels - 1; in hdmi_pin_setup_infoframe()
703 hdmi_ai->CA = ca; in hdmi_pin_setup_infoframe()
708 dp_ai->type = 0x84; in hdmi_pin_setup_infoframe()
709 dp_ai->len = 0x1b; in hdmi_pin_setup_infoframe()
710 dp_ai->ver = 0x11 << 2; in hdmi_pin_setup_infoframe()
711 dp_ai->CC02_CT47 = active_channels - 1; in hdmi_pin_setup_infoframe()
712 dp_ai->CA = ca; in hdmi_pin_setup_infoframe()
714 codec_dbg(codec, "HDMI: unknown connection type at pin NID 0x%x\n", pin_nid); in hdmi_pin_setup_infoframe()
723 * the user switches between HDMI/DP monitors. in hdmi_pin_setup_infoframe()
740 struct hdmi_spec *spec = codec->spec; in hdmi_setup_audio_infoframe()
741 struct hdac_chmap *chmap = &spec->chmap; in hdmi_setup_audio_infoframe()
742 hda_nid_t pin_nid = per_pin->pin_nid; in hdmi_setup_audio_infoframe()
743 int dev_id = per_pin->dev_id; in hdmi_setup_audio_infoframe()
744 int channels = per_pin->channels; in hdmi_setup_audio_infoframe()
760 eld = &per_pin->sink_eld; in hdmi_setup_audio_infoframe()
762 ca = snd_hdac_channel_allocation(&codec->core, in hdmi_setup_audio_infoframe()
763 eld->info.spk_alloc, channels, in hdmi_setup_audio_infoframe()
764 per_pin->chmap_set, non_pcm, per_pin->chmap); in hdmi_setup_audio_infoframe()
768 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid, in hdmi_setup_audio_infoframe()
775 snd_hdac_setup_channel_mapping(&spec->chmap, in hdmi_setup_audio_infoframe()
777 per_pin->chmap, per_pin->chmap_set); in hdmi_setup_audio_infoframe()
779 spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id, in hdmi_setup_audio_infoframe()
780 ca, active_channels, eld->info.conn_type); in hdmi_setup_audio_infoframe()
782 per_pin->non_pcm = non_pcm; in hdmi_setup_audio_infoframe()
794 struct hdmi_spec *spec = codec->spec; in check_presence_and_report()
799 mutex_lock(&spec->pcm_lock); in check_presence_and_report()
801 mutex_unlock(&spec->pcm_lock); in check_presence_and_report()
811 check_presence_and_report(codec, jack->nid, jack->dev_id); in jack_callback()
817 jack->jack_dirty = 1; in hdmi_intrinsic_event()
820 "HDMI hot plug event: Codec=%d NID=0x%x Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", in hdmi_intrinsic_event()
821 codec->addr, jack->nid, jack->dev_id, !!(res & AC_UNSOL_RES_IA), in hdmi_intrinsic_event()
824 check_presence_and_report(codec, jack->nid, jack->dev_id); in hdmi_intrinsic_event()
835 "HDMI CP event: CODEC=%d TAG=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", in hdmi_non_intrinsic_event()
836 codec->addr, in hdmi_non_intrinsic_event()
861 if (codec->dp_mst) { in hdmi_unsol_event()
871 codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag); in hdmi_unsol_event()
898 codec_dbg(codec, "Haswell HDMI audio: Power for NID 0x%x is now D%d\n", nid, pwr); in haswell_verify_D0()
906 /* HBR should be Non-PCM, 8 channels */
921 return hbr ? -EINVAL : 0; in hdmi_pin_hbr_setup()
932 pinctl == new_pinctl ? "" : "new-", in hdmi_pin_hbr_setup()
940 return -EINVAL; in hdmi_pin_hbr_setup()
949 struct hdmi_spec *spec = codec->spec; in hdmi_setup_stream()
953 err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id, in hdmi_setup_stream()
961 if (spec->intel_hsw_fixup) { in hdmi_setup_stream()
994 struct hdmi_spec *spec = codec->spec; in hdmi_choose_cvt()
1005 if (per_pin && per_pin->silent_stream) { in hdmi_choose_cvt()
1006 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in hdmi_choose_cvt()
1008 if (per_cvt->assigned && !silent) in hdmi_choose_cvt()
1009 return -EBUSY; in hdmi_choose_cvt()
1016 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { in hdmi_choose_cvt()
1020 if (per_cvt->assigned || per_cvt->silent_stream) in hdmi_choose_cvt()
1025 for (mux_idx = 0; mux_idx < per_pin->num_mux_nids; mux_idx++) in hdmi_choose_cvt()
1026 if (per_pin->mux_nids[mux_idx] == per_cvt->cvt_nid) in hdmi_choose_cvt()
1029 if (mux_idx == per_pin->num_mux_nids) in hdmi_choose_cvt()
1035 if (cvt_idx == spec->num_cvts) in hdmi_choose_cvt()
1036 return -EBUSY; in hdmi_choose_cvt()
1039 per_pin->mux_idx = mux_idx; in hdmi_choose_cvt()
1051 hda_nid_t pin_nid = per_pin->pin_nid; in intel_verify_pin_cvt_connect()
1054 mux_idx = per_pin->mux_idx; in intel_verify_pin_cvt_connect()
1071 for (i = 0; i < spec->num_cvts; i++) in intel_cvt_id_to_mux_idx()
1072 if (spec->cvt_nids[i] == cvt_nid) in intel_cvt_id_to_mux_idx()
1074 return -EINVAL; in intel_cvt_id_to_mux_idx()
1077 /* Intel HDMI workaround to fix audio routing issue:
1090 struct hdmi_spec *spec = codec->spec; in intel_not_share_assigned_cvt()
1098 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in intel_not_share_assigned_cvt()
1107 if (!per_pin->pcm) in intel_not_share_assigned_cvt()
1110 if ((per_pin->pin_nid == pin_nid) && in intel_not_share_assigned_cvt()
1111 (per_pin->dev_id == dev_id)) in intel_not_share_assigned_cvt()
1115 * if per_pin->dev_id >= dev_num, in intel_not_share_assigned_cvt()
1120 dev_num = snd_hda_get_num_devices(codec, per_pin->pin_nid) + 1; in intel_not_share_assigned_cvt()
1121 if (per_pin->dev_id >= dev_num) in intel_not_share_assigned_cvt()
1124 nid = per_pin->pin_nid; in intel_not_share_assigned_cvt()
1133 snd_hda_set_dev_select(codec, nid, per_pin->dev_id); in intel_not_share_assigned_cvt()
1145 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { in intel_not_share_assigned_cvt()
1147 if (!per_cvt->assigned) { in intel_not_share_assigned_cvt()
1166 struct hdmi_spec *spec = codec->spec; in intel_not_share_assigned_cvt_nid()
1183 struct hdmi_spec *spec = codec->spec; in pin_cvt_fixup()
1185 if (spec->ops.pin_cvt_fixup) in pin_cvt_fixup()
1186 spec->ops.pin_cvt_fixup(codec, per_pin, cvt_nid); in pin_cvt_fixup()
1194 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open_no_pin()
1195 struct snd_pcm_runtime *runtime = substream->runtime; in hdmi_pcm_open_no_pin()
1202 return -EINVAL; in hdmi_pcm_open_no_pin()
1204 err = hdmi_choose_cvt(codec, -1, &cvt_idx, false); in hdmi_pcm_open_no_pin()
1209 per_cvt->assigned = true; in hdmi_pcm_open_no_pin()
1210 hinfo->nid = per_cvt->cvt_nid; in hdmi_pcm_open_no_pin()
1212 pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid); in hdmi_pcm_open_no_pin()
1214 set_bit(pcm_idx, &spec->pcm_in_use); in hdmi_pcm_open_no_pin()
1218 hinfo->channels_min = per_cvt->channels_min; in hdmi_pcm_open_no_pin()
1219 hinfo->channels_max = per_cvt->channels_max; in hdmi_pcm_open_no_pin()
1220 hinfo->rates = per_cvt->rates; in hdmi_pcm_open_no_pin()
1221 hinfo->formats = per_cvt->formats; in hdmi_pcm_open_no_pin()
1222 hinfo->maxbps = per_cvt->maxbps; in hdmi_pcm_open_no_pin()
1225 runtime->hw.channels_min = hinfo->channels_min; in hdmi_pcm_open_no_pin()
1226 runtime->hw.channels_max = hinfo->channels_max; in hdmi_pcm_open_no_pin()
1227 runtime->hw.formats = hinfo->formats; in hdmi_pcm_open_no_pin()
1228 runtime->hw.rates = hinfo->rates; in hdmi_pcm_open_no_pin()
1230 snd_pcm_hw_constraint_step(substream->runtime, 0, in hdmi_pcm_open_no_pin()
1242 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open()
1243 struct snd_pcm_runtime *runtime = substream->runtime; in hdmi_pcm_open()
1253 return -EINVAL; in hdmi_pcm_open()
1255 mutex_lock(&spec->pcm_lock); in hdmi_pcm_open()
1271 per_cvt->assigned = true; in hdmi_pcm_open()
1273 set_bit(pcm_idx, &spec->pcm_in_use); in hdmi_pcm_open()
1275 per_pin->cvt_nid = per_cvt->cvt_nid; in hdmi_pcm_open()
1276 hinfo->nid = per_cvt->cvt_nid; in hdmi_pcm_open()
1279 if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE) in hdmi_pcm_open()
1280 azx_stream(get_azx_dev(substream))->stripe = 1; in hdmi_pcm_open()
1282 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in hdmi_pcm_open()
1283 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_open()
1285 per_pin->mux_idx); in hdmi_pcm_open()
1290 snd_hda_spdif_ctls_assign(codec, pcm_idx, per_cvt->cvt_nid); in hdmi_pcm_open()
1293 hinfo->channels_min = per_cvt->channels_min; in hdmi_pcm_open()
1294 hinfo->channels_max = per_cvt->channels_max; in hdmi_pcm_open()
1295 hinfo->rates = per_cvt->rates; in hdmi_pcm_open()
1296 hinfo->formats = per_cvt->formats; in hdmi_pcm_open()
1297 hinfo->maxbps = per_cvt->maxbps; in hdmi_pcm_open()
1299 eld = &per_pin->sink_eld; in hdmi_pcm_open()
1301 if (!static_hdmi_pcm && eld->eld_valid) { in hdmi_pcm_open()
1302 snd_hdmi_eld_update_pcm_info(&eld->info, hinfo); in hdmi_pcm_open()
1303 if (hinfo->channels_min > hinfo->channels_max || in hdmi_pcm_open()
1304 !hinfo->rates || !hinfo->formats) { in hdmi_pcm_open()
1305 per_cvt->assigned = false; in hdmi_pcm_open()
1306 hinfo->nid = 0; in hdmi_pcm_open()
1308 err = -ENODEV; in hdmi_pcm_open()
1314 runtime->hw.channels_min = hinfo->channels_min; in hdmi_pcm_open()
1315 runtime->hw.channels_max = hinfo->channels_max; in hdmi_pcm_open()
1316 runtime->hw.formats = hinfo->formats; in hdmi_pcm_open()
1317 runtime->hw.rates = hinfo->rates; in hdmi_pcm_open()
1319 snd_pcm_hw_constraint_step(substream->runtime, 0, in hdmi_pcm_open()
1322 mutex_unlock(&spec->pcm_lock); in hdmi_pcm_open()
1327 * HDA/HDMI auto parsing
1331 struct hdmi_spec *spec = codec->spec; in hdmi_read_pin_conn()
1333 hda_nid_t pin_nid = per_pin->pin_nid; in hdmi_read_pin_conn()
1334 int dev_id = per_pin->dev_id; in hdmi_read_pin_conn()
1339 "HDMI: pin NID 0x%x wcaps %#x does not support connection list\n", in hdmi_read_pin_conn()
1341 return -EINVAL; in hdmi_read_pin_conn()
1346 if (spec->intel_hsw_fixup) { in hdmi_read_pin_conn()
1347 conns = spec->num_cvts; in hdmi_read_pin_conn()
1348 memcpy(per_pin->mux_nids, spec->cvt_nids, in hdmi_read_pin_conn()
1352 per_pin->mux_nids, in hdmi_read_pin_conn()
1357 per_pin->num_mux_nids = conns; in hdmi_read_pin_conn()
1367 for (i = 0; i < spec->pcm_used; i++) { in hdmi_find_pcm_slot()
1368 if (!test_bit(i, &spec->pcm_bitmap)) in hdmi_find_pcm_slot()
1371 return -EBUSY; in hdmi_find_pcm_slot()
1380 if (per_pin->pcm) in hdmi_attach_hda_pcm()
1383 if (idx == -EBUSY) in hdmi_attach_hda_pcm()
1385 per_pin->pcm_idx = idx; in hdmi_attach_hda_pcm()
1386 per_pin->pcm = get_hdmi_pcm(spec, idx); in hdmi_attach_hda_pcm()
1387 set_bit(idx, &spec->pcm_bitmap); in hdmi_attach_hda_pcm()
1396 if (!per_pin->pcm) in hdmi_detach_hda_pcm()
1398 idx = per_pin->pcm_idx; in hdmi_detach_hda_pcm()
1399 per_pin->pcm_idx = -1; in hdmi_detach_hda_pcm()
1400 per_pin->pcm = NULL; in hdmi_detach_hda_pcm()
1401 if (idx >= 0 && idx < spec->pcm_used) in hdmi_detach_hda_pcm()
1402 clear_bit(idx, &spec->pcm_bitmap); in hdmi_detach_hda_pcm()
1410 for (mux_idx = 0; mux_idx < per_pin->num_mux_nids; mux_idx++) in hdmi_get_pin_cvt_mux()
1411 if (per_pin->mux_nids[mux_idx] == cvt_nid) in hdmi_get_pin_cvt_mux()
1421 struct hda_codec *codec = per_pin->codec; in hdmi_pcm_setup_pin()
1428 if (per_pin->pcm_idx < 0 || per_pin->pcm_idx >= spec->pcm_used) in hdmi_pcm_setup_pin()
1430 pcm = get_pcm_rec(spec, per_pin->pcm_idx); in hdmi_pcm_setup_pin()
1431 if (!pcm->pcm) in hdmi_pcm_setup_pin()
1433 if (!test_bit(per_pin->pcm_idx, &spec->pcm_in_use)) in hdmi_pcm_setup_pin()
1436 /* hdmi audio only uses playback and one substream */ in hdmi_pcm_setup_pin()
1437 hinfo = pcm->stream; in hdmi_pcm_setup_pin()
1438 substream = pcm->pcm->streams[0].substream; in hdmi_pcm_setup_pin()
1440 per_pin->cvt_nid = hinfo->nid; in hdmi_pcm_setup_pin()
1442 mux_idx = hdmi_get_pin_cvt_mux(spec, per_pin, hinfo->nid); in hdmi_pcm_setup_pin()
1443 if (mux_idx < per_pin->num_mux_nids) { in hdmi_pcm_setup_pin()
1444 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_setup_pin()
1445 per_pin->dev_id); in hdmi_pcm_setup_pin()
1446 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_setup_pin()
1450 snd_hda_spdif_ctls_assign(codec, per_pin->pcm_idx, hinfo->nid); in hdmi_pcm_setup_pin()
1452 non_pcm = check_non_pcm_per_cvt(codec, hinfo->nid); in hdmi_pcm_setup_pin()
1453 if (substream->runtime) in hdmi_pcm_setup_pin()
1454 per_pin->channels = substream->runtime->channels; in hdmi_pcm_setup_pin()
1455 per_pin->setup = true; in hdmi_pcm_setup_pin()
1456 per_pin->mux_idx = mux_idx; in hdmi_pcm_setup_pin()
1464 if (per_pin->pcm_idx >= 0 && per_pin->pcm_idx < spec->pcm_used) in hdmi_pcm_reset_pin()
1465 snd_hda_spdif_ctls_unassign(per_pin->codec, per_pin->pcm_idx); in hdmi_pcm_reset_pin()
1467 per_pin->chmap_set = false; in hdmi_pcm_reset_pin()
1468 memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); in hdmi_pcm_reset_pin()
1470 per_pin->setup = false; in hdmi_pcm_reset_pin()
1471 per_pin->channels = 0; in hdmi_pcm_reset_pin()
1477 struct hdmi_spec *spec = codec->spec; in pin_idx_to_pcm_jack()
1479 if (per_pin->pcm_idx >= 0) in pin_idx_to_pcm_jack()
1480 return spec->pcm_rec[per_pin->pcm_idx].jack; in pin_idx_to_pcm_jack()
1494 struct hdmi_eld *pin_eld = &per_pin->sink_eld; in update_eld()
1495 struct hdmi_spec *spec = codec->spec; in update_eld()
1497 bool old_eld_valid = pin_eld->eld_valid; in update_eld()
1501 if (eld->eld_valid) { in update_eld()
1502 if (eld->eld_size <= 0 || in update_eld()
1503 snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, in update_eld()
1504 eld->eld_size) < 0) { in update_eld()
1505 eld->eld_valid = false; in update_eld()
1507 schedule_delayed_work(&per_pin->work, in update_eld()
1514 if (!eld->eld_valid || eld->eld_size <= 0 || eld->info.sad_count <= 0) { in update_eld()
1515 eld->eld_valid = false; in update_eld()
1516 eld->eld_size = 0; in update_eld()
1520 pcm_idx = per_pin->pcm_idx; in update_eld()
1528 if (eld->eld_valid) { in update_eld()
1535 /* if pcm_idx == -1, it means this is in monitor connection event in update_eld()
1538 if (pcm_idx == -1) in update_eld()
1539 pcm_idx = per_pin->pcm_idx; in update_eld()
1543 if (eld->eld_valid) in update_eld()
1544 snd_hdmi_show_eld(codec, &eld->info); in update_eld()
1546 eld_changed = (pin_eld->eld_valid != eld->eld_valid); in update_eld()
1547 eld_changed |= (pin_eld->monitor_present != eld->monitor_present); in update_eld()
1548 if (!eld_changed && eld->eld_valid && pin_eld->eld_valid) in update_eld()
1549 if (pin_eld->eld_size != eld->eld_size || in update_eld()
1550 memcmp(pin_eld->eld_buffer, eld->eld_buffer, in update_eld()
1551 eld->eld_size) != 0) in update_eld()
1555 pin_eld->monitor_present = eld->monitor_present; in update_eld()
1556 pin_eld->eld_valid = eld->eld_valid; in update_eld()
1557 pin_eld->eld_size = eld->eld_size; in update_eld()
1558 if (eld->eld_valid) in update_eld()
1559 memcpy(pin_eld->eld_buffer, eld->eld_buffer, in update_eld()
1560 eld->eld_size); in update_eld()
1561 pin_eld->info = eld->info; in update_eld()
1565 * Re-setup pin and infoframe. This is needed e.g. when in update_eld()
1566 * - sink is first plugged-in in update_eld()
1567 * - transcoder can change during stream playback on Haswell in update_eld()
1570 if (eld->eld_valid && !old_eld_valid && per_pin->setup) { in update_eld()
1572 hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in update_eld()
1576 snd_ctl_notify(codec->card, in update_eld()
1579 &get_hdmi_pcm(spec, pcm_idx)->eld_ctl->id); in update_eld()
1583 (eld->monitor_present && eld->eld_valid) ? in update_eld()
1587 /* update ELD and jack state via HD-audio verbs */
1591 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense_via_verbs()
1592 struct hdmi_spec *spec = codec->spec; in hdmi_present_sense_via_verbs()
1593 struct hdmi_eld *eld = &spec->temp_eld; in hdmi_present_sense_via_verbs()
1595 hda_nid_t pin_nid = per_pin->pin_nid; in hdmi_present_sense_via_verbs()
1596 int dev_id = per_pin->dev_id; in hdmi_present_sense_via_verbs()
1601 * the real PD value changed. An older version of the HD-audio in hdmi_present_sense_via_verbs()
1609 if (dev->power.runtime_status == RPM_SUSPENDING) in hdmi_present_sense_via_verbs()
1619 mutex_lock(&per_pin->lock); in hdmi_present_sense_via_verbs()
1620 eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); in hdmi_present_sense_via_verbs()
1621 if (eld->monitor_present) in hdmi_present_sense_via_verbs()
1622 eld->eld_valid = !!(present & AC_PINSENSE_ELDV); in hdmi_present_sense_via_verbs()
1624 eld->eld_valid = false; in hdmi_present_sense_via_verbs()
1627 "HDMI status: Codec=%d NID=0x%x Presence_Detect=%d ELD_Valid=%d\n", in hdmi_present_sense_via_verbs()
1628 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); in hdmi_present_sense_via_verbs()
1630 if (eld->eld_valid) { in hdmi_present_sense_via_verbs()
1631 if (spec->ops.pin_get_eld(codec, pin_nid, dev_id, in hdmi_present_sense_via_verbs()
1632 eld->eld_buffer, &eld->eld_size) < 0) in hdmi_present_sense_via_verbs()
1633 eld->eld_valid = false; in hdmi_present_sense_via_verbs()
1637 mutex_unlock(&per_pin->lock); in hdmi_present_sense_via_verbs()
1653 snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, in silent_stream_enable_i915()
1654 per_pin->dev_id, I915_SILENT_RATE); in silent_stream_enable_i915()
1659 snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, in silent_stream_enable_i915()
1662 snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, I915_SILENT_FMT_MASK, 0, format); in silent_stream_enable_i915()
1664 per_pin->channels = I915_SILENT_CHANNELS; in silent_stream_enable_i915()
1665 hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in silent_stream_enable_i915()
1674 codec_dbg(codec, "HDMI: KAE %d cvt-NID=0x%x\n", enable, per_pin->cvt_nid); in silent_stream_set_kae()
1676 param = snd_hda_codec_read(codec, per_pin->cvt_nid, 0, AC_VERB_GET_DIGI_CONVERT_1, 0); in silent_stream_set_kae()
1684 snd_hda_codec_write(codec, per_pin->cvt_nid, 0, AC_VERB_SET_DIGI_CONVERT_3, param); in silent_stream_set_kae()
1690 struct hdmi_spec *spec = codec->spec; in silent_stream_enable()
1696 * Power-up will call hdmi_present_sense, so the PM calls in silent_stream_enable()
1701 if (err < 0 && err != -EACCES) { in silent_stream_enable()
1708 mutex_lock(&per_pin->lock); in silent_stream_enable()
1710 if (per_pin->setup) { in silent_stream_enable()
1711 codec_dbg(codec, "hdmi: PCM already open, no silent stream\n"); in silent_stream_enable()
1712 err = -EBUSY; in silent_stream_enable()
1716 pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1719 codec_err(codec, "hdmi: no free converter to enable silent mode\n"); in silent_stream_enable()
1724 per_cvt->silent_stream = true; in silent_stream_enable()
1725 per_pin->cvt_nid = per_cvt->cvt_nid; in silent_stream_enable()
1726 per_pin->silent_stream = true; in silent_stream_enable()
1728 codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_enable()
1729 per_pin->pin_nid, per_cvt->cvt_nid); in silent_stream_enable()
1731 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1732 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in silent_stream_enable()
1734 per_pin->mux_idx); in silent_stream_enable()
1739 switch (spec->silent_stream_type) { in silent_stream_enable()
1752 mutex_unlock(&per_pin->lock); in silent_stream_enable()
1761 struct hdmi_spec *spec = codec->spec; in silent_stream_disable()
1766 if (err < 0 && err != -EACCES) { in silent_stream_disable()
1774 mutex_lock(&per_pin->lock); in silent_stream_disable()
1775 if (!per_pin->silent_stream) in silent_stream_disable()
1778 codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_disable()
1779 per_pin->pin_nid, per_pin->cvt_nid); in silent_stream_disable()
1781 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in silent_stream_disable()
1782 if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { in silent_stream_disable()
1784 per_cvt->silent_stream = false; in silent_stream_disable()
1787 if (spec->silent_stream_type == SILENT_STREAM_I915) { in silent_stream_disable()
1790 } else if (spec->silent_stream_type == SILENT_STREAM_KAE) { in silent_stream_disable()
1794 per_pin->cvt_nid = 0; in silent_stream_disable()
1795 per_pin->silent_stream = false; in silent_stream_disable()
1798 mutex_unlock(&per_pin->lock); in silent_stream_disable()
1807 struct hdmi_spec *spec = codec->spec; in sync_eld_via_acomp()
1808 struct hdmi_eld *eld = &spec->temp_eld; in sync_eld_via_acomp()
1811 mutex_lock(&per_pin->lock); in sync_eld_via_acomp()
1812 eld->monitor_present = false; in sync_eld_via_acomp()
1813 monitor_prev = per_pin->sink_eld.monitor_present; in sync_eld_via_acomp()
1814 eld->eld_size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, in sync_eld_via_acomp()
1815 per_pin->dev_id, &eld->monitor_present, in sync_eld_via_acomp()
1816 eld->eld_buffer, ELD_MAX_SIZE); in sync_eld_via_acomp()
1817 eld->eld_valid = (eld->eld_size > 0); in sync_eld_via_acomp()
1819 monitor_next = per_pin->sink_eld.monitor_present; in sync_eld_via_acomp()
1820 mutex_unlock(&per_pin->lock); in sync_eld_via_acomp()
1822 if (spec->silent_stream_type) { in sync_eld_via_acomp()
1832 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense()
1844 struct hda_codec *codec = per_pin->codec; in hdmi_repoll_eld()
1845 struct hdmi_spec *spec = codec->spec; in hdmi_repoll_eld()
1848 jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, in hdmi_repoll_eld()
1849 per_pin->dev_id); in hdmi_repoll_eld()
1851 jack->jack_dirty = 1; in hdmi_repoll_eld()
1853 if (per_pin->repoll_count++ > 6) in hdmi_repoll_eld()
1854 per_pin->repoll_count = 0; in hdmi_repoll_eld()
1856 mutex_lock(&spec->pcm_lock); in hdmi_repoll_eld()
1857 hdmi_present_sense(per_pin, per_pin->repoll_count); in hdmi_repoll_eld()
1858 mutex_unlock(&spec->pcm_lock); in hdmi_repoll_eld()
1863 struct hdmi_spec *spec = codec->spec; in hdmi_add_pin()
1880 !spec->force_connect) in hdmi_add_pin()
1887 if (spec->intel_hsw_fixup) { in hdmi_add_pin()
1894 dev_num = spec->dev_num; in hdmi_add_pin()
1895 } else if (codec->dp_mst) { in hdmi_add_pin()
1898 * spec->dev_num is the maxinum number of device entries in hdmi_add_pin()
1901 spec->dev_num = (spec->dev_num > dev_num) ? in hdmi_add_pin()
1902 spec->dev_num : dev_num; in hdmi_add_pin()
1910 spec->dev_num = 1; in hdmi_add_pin()
1914 pin_idx = spec->num_pins; in hdmi_add_pin()
1915 per_pin = snd_array_new(&spec->pins); in hdmi_add_pin()
1918 return -ENOMEM; in hdmi_add_pin()
1920 per_pin->pcm = NULL; in hdmi_add_pin()
1921 per_pin->pcm_idx = -1; in hdmi_add_pin()
1922 per_pin->pin_nid = pin_nid; in hdmi_add_pin()
1923 per_pin->pin_nid_idx = spec->num_nids; in hdmi_add_pin()
1924 per_pin->dev_id = i; in hdmi_add_pin()
1925 per_pin->non_pcm = false; in hdmi_add_pin()
1931 codec_warn(codec, "HDMI: pin NID 0x%x - jack not detectable\n", pin_nid); in hdmi_add_pin()
1932 spec->num_pins++; in hdmi_add_pin()
1934 spec->num_nids++; in hdmi_add_pin()
1941 struct hdmi_spec *spec = codec->spec; in hdmi_add_cvt()
1949 per_cvt = snd_array_new(&spec->cvts); in hdmi_add_cvt()
1951 return -ENOMEM; in hdmi_add_cvt()
1953 per_cvt->cvt_nid = cvt_nid; in hdmi_add_cvt()
1954 per_cvt->channels_min = 2; in hdmi_add_cvt()
1956 per_cvt->channels_max = chans; in hdmi_add_cvt()
1957 if (chans > spec->chmap.channels_max) in hdmi_add_cvt()
1958 spec->chmap.channels_max = chans; in hdmi_add_cvt()
1962 &per_cvt->rates, in hdmi_add_cvt()
1963 &per_cvt->formats, in hdmi_add_cvt()
1964 &per_cvt->maxbps); in hdmi_add_cvt()
1968 if (spec->num_cvts < ARRAY_SIZE(spec->cvt_nids)) in hdmi_add_cvt()
1969 spec->cvt_nids[spec->num_cvts] = cvt_nid; in hdmi_add_cvt()
1970 spec->num_cvts++; in hdmi_add_cvt()
1978 SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
1985 struct hdmi_spec *spec = codec->spec; in hdmi_parse_codec()
1991 nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); in hdmi_parse_codec()
1993 codec_warn(codec, "HDMI: failed to get afg sub nodes\n"); in hdmi_parse_codec()
1994 return -EINVAL; in hdmi_parse_codec()
1998 spec->force_connect = true; in hdmi_parse_codec()
2000 q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); in hdmi_parse_codec()
2002 if (q && q->value) in hdmi_parse_codec()
2003 spec->force_connect = true; in hdmi_parse_codec()
2044 mutex_lock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
2050 mutex_unlock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
2053 non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO); in check_non_pcm_per_cvt()
2054 mutex_unlock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
2059 * HDMI callbacks
2068 hda_nid_t cvt_nid = hinfo->nid; in generic_hdmi_playback_pcm_prepare()
2069 struct hdmi_spec *spec = codec->spec; in generic_hdmi_playback_pcm_prepare()
2072 struct snd_pcm_runtime *runtime = substream->runtime; in generic_hdmi_playback_pcm_prepare()
2077 mutex_lock(&spec->pcm_lock); in generic_hdmi_playback_pcm_prepare()
2090 err = -EINVAL; in generic_hdmi_playback_pcm_prepare()
2106 /* Todo: add DP1.2 MST audio support later */ in generic_hdmi_playback_pcm_prepare()
2108 snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, in generic_hdmi_playback_pcm_prepare()
2109 per_pin->dev_id, runtime->rate); in generic_hdmi_playback_pcm_prepare()
2112 mutex_lock(&per_pin->lock); in generic_hdmi_playback_pcm_prepare()
2113 per_pin->channels = substream->runtime->channels; in generic_hdmi_playback_pcm_prepare()
2114 per_pin->setup = true; in generic_hdmi_playback_pcm_prepare()
2117 stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core, in generic_hdmi_playback_pcm_prepare()
2125 mutex_unlock(&per_pin->lock); in generic_hdmi_playback_pcm_prepare()
2126 if (spec->dyn_pin_out) { in generic_hdmi_playback_pcm_prepare()
2127 snd_hda_set_dev_select(codec, per_pin->pin_nid, in generic_hdmi_playback_pcm_prepare()
2128 per_pin->dev_id); in generic_hdmi_playback_pcm_prepare()
2129 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in generic_hdmi_playback_pcm_prepare()
2131 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in generic_hdmi_playback_pcm_prepare()
2137 err = spec->ops.setup_stream(codec, cvt_nid, per_pin->pin_nid, in generic_hdmi_playback_pcm_prepare()
2138 per_pin->dev_id, stream_tag, format); in generic_hdmi_playback_pcm_prepare()
2140 mutex_unlock(&spec->pcm_lock); in generic_hdmi_playback_pcm_prepare()
2148 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in generic_hdmi_playback_pcm_cleanup()
2156 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_close()
2163 mutex_lock(&spec->pcm_lock); in hdmi_pcm_close()
2164 if (hinfo->nid) { in hdmi_pcm_close()
2167 err = -EINVAL; in hdmi_pcm_close()
2170 cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); in hdmi_pcm_close()
2172 err = -EINVAL; in hdmi_pcm_close()
2176 per_cvt->assigned = false; in hdmi_pcm_close()
2177 hinfo->nid = 0; in hdmi_pcm_close()
2179 azx_stream(get_azx_dev(substream))->stripe = 0; in hdmi_pcm_close()
2182 clear_bit(pcm_idx, &spec->pcm_in_use); in hdmi_pcm_close()
2188 err = -EINVAL; in hdmi_pcm_close()
2193 if (spec->dyn_pin_out) { in hdmi_pcm_close()
2194 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_close()
2195 per_pin->dev_id); in hdmi_pcm_close()
2196 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
2198 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
2203 mutex_lock(&per_pin->lock); in hdmi_pcm_close()
2204 per_pin->chmap_set = false; in hdmi_pcm_close()
2205 memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); in hdmi_pcm_close()
2207 per_pin->setup = false; in hdmi_pcm_close()
2208 per_pin->channels = 0; in hdmi_pcm_close()
2209 mutex_unlock(&per_pin->lock); in hdmi_pcm_close()
2213 mutex_unlock(&spec->pcm_lock); in hdmi_pcm_close()
2228 struct hdmi_spec *spec = codec->spec; in hdmi_get_spk_alloc()
2234 return per_pin->sink_eld.info.spk_alloc; in hdmi_get_spk_alloc()
2241 struct hdmi_spec *spec = codec->spec; in hdmi_get_chmap()
2248 memcpy(chmap, per_pin->chmap, ARRAY_SIZE(per_pin->chmap)); in hdmi_get_chmap()
2255 struct hdmi_spec *spec = codec->spec; in hdmi_set_chmap()
2260 mutex_lock(&per_pin->lock); in hdmi_set_chmap()
2261 per_pin->chmap_set = true; in hdmi_set_chmap()
2262 memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap)); in hdmi_set_chmap()
2264 hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in hdmi_set_chmap()
2265 mutex_unlock(&per_pin->lock); in hdmi_set_chmap()
2271 struct hdmi_spec *spec = codec->spec; in is_hdmi_pcm_attached()
2279 struct hdmi_spec *spec = codec->spec; in generic_hdmi_build_pcms()
2283 pcm_num = spec->num_cvts; in generic_hdmi_build_pcms()
2284 codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); in generic_hdmi_build_pcms()
2290 info = snd_hda_codec_pcm_new(codec, "HDMI %d", idx); in generic_hdmi_build_pcms()
2292 return -ENOMEM; in generic_hdmi_build_pcms()
2294 spec->pcm_rec[idx].pcm = info; in generic_hdmi_build_pcms()
2295 spec->pcm_used++; in generic_hdmi_build_pcms()
2296 info->pcm_type = HDA_PCM_TYPE_HDMI; in generic_hdmi_build_pcms()
2297 info->own_chmap = true; in generic_hdmi_build_pcms()
2299 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; in generic_hdmi_build_pcms()
2300 pstr->substreams = 1; in generic_hdmi_build_pcms()
2301 pstr->ops = generic_ops; in generic_hdmi_build_pcms()
2303 if (spec->pcm_used >= ARRAY_SIZE(spec->pcm_rec)) in generic_hdmi_build_pcms()
2313 struct hdmi_pcm *pcm = jack->private_data; in free_hdmi_jack_priv()
2315 pcm->jack = NULL; in free_hdmi_jack_priv()
2320 char hdmi_str[32] = "HDMI/DP"; in generic_hdmi_build_jack()
2321 struct hdmi_spec *spec = codec->spec; in generic_hdmi_build_jack()
2323 int pcmdev = get_pcm_rec(spec, pcm_idx)->device; in generic_hdmi_build_jack()
2329 err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack, in generic_hdmi_build_jack()
2334 spec->pcm_rec[pcm_idx].jack = jack; in generic_hdmi_build_jack()
2335 jack->private_data = &spec->pcm_rec[pcm_idx]; in generic_hdmi_build_jack()
2336 jack->private_free = free_hdmi_jack_priv; in generic_hdmi_build_jack()
2342 struct hdmi_spec *spec = codec->spec; in generic_hdmi_build_controls()
2346 for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { in generic_hdmi_build_controls()
2347 if (!get_pcm_rec(spec, pcm_idx)->pcm) { in generic_hdmi_build_controls()
2349 set_bit(pcm_idx, &spec->pcm_bitmap); in generic_hdmi_build_controls()
2361 0, spec->cvt_nids[0], in generic_hdmi_build_controls()
2367 dev = get_pcm_rec(spec, pcm_idx)->device; in generic_hdmi_build_controls()
2376 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_build_controls()
2378 struct hdmi_eld *pin_eld = &per_pin->sink_eld; in generic_hdmi_build_controls()
2380 pin_eld->eld_valid = false; in generic_hdmi_build_controls()
2385 for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { in generic_hdmi_build_controls()
2389 if (!pcm || !pcm->pcm) in generic_hdmi_build_controls()
2391 err = snd_hdac_add_chmap_ctls(pcm->pcm, pcm_idx, &spec->chmap); in generic_hdmi_build_controls()
2401 struct hdmi_spec *spec = codec->spec; in generic_hdmi_init_per_pins()
2404 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_init_per_pins()
2407 per_pin->codec = codec; in generic_hdmi_init_per_pins()
2408 mutex_init(&per_pin->lock); in generic_hdmi_init_per_pins()
2409 INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); in generic_hdmi_init_per_pins()
2417 struct hdmi_spec *spec = codec->spec; in generic_hdmi_init()
2420 mutex_lock(&spec->bind_lock); in generic_hdmi_init()
2421 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_init()
2423 hda_nid_t pin_nid = per_pin->pin_nid; in generic_hdmi_init()
2424 int dev_id = per_pin->dev_id; in generic_hdmi_init()
2433 mutex_unlock(&spec->bind_lock); in generic_hdmi_init()
2439 snd_array_init(&spec->pins, sizeof(struct hdmi_spec_per_pin), nums); in hdmi_array_init()
2440 snd_array_init(&spec->cvts, sizeof(struct hdmi_spec_per_cvt), nums); in hdmi_array_init()
2445 snd_array_free(&spec->pins); in hdmi_array_free()
2446 snd_array_free(&spec->cvts); in hdmi_array_free()
2451 struct hdmi_spec *spec = codec->spec; in generic_spec_free()
2456 codec->spec = NULL; in generic_spec_free()
2458 codec->dp_mst = false; in generic_spec_free()
2463 struct hdmi_spec *spec = codec->spec; in generic_hdmi_free()
2466 if (spec->acomp_registered) { in generic_hdmi_free()
2467 snd_hdac_acomp_exit(&codec->bus->core); in generic_hdmi_free()
2469 snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); in generic_hdmi_free()
2471 codec->relaxed_resume = 0; in generic_hdmi_free()
2473 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_free()
2475 cancel_delayed_work_sync(&per_pin->work); in generic_hdmi_free()
2479 for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { in generic_hdmi_free()
2480 if (spec->pcm_rec[pcm_idx].jack == NULL) in generic_hdmi_free()
2482 snd_device_free(codec->card, spec->pcm_rec[pcm_idx].jack); in generic_hdmi_free()
2491 struct hdmi_spec *spec = codec->spec; in generic_hdmi_suspend()
2494 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_suspend()
2496 cancel_delayed_work_sync(&per_pin->work); in generic_hdmi_suspend()
2503 struct hdmi_spec *spec = codec->spec; in generic_hdmi_resume()
2506 codec->patch_ops.init(codec); in generic_hdmi_resume()
2509 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in generic_hdmi_resume()
2536 /* allocate codec->spec and assign/initialize generic parser ops */
2543 return -ENOMEM; in alloc_generic_hdmi()
2545 spec->codec = codec; in alloc_generic_hdmi()
2546 spec->ops = generic_standard_hdmi_ops; in alloc_generic_hdmi()
2547 spec->dev_num = 1; /* initialize to 1 */ in alloc_generic_hdmi()
2548 mutex_init(&spec->pcm_lock); in alloc_generic_hdmi()
2549 mutex_init(&spec->bind_lock); in alloc_generic_hdmi()
2550 snd_hdac_register_chmap_ops(&codec->core, &spec->chmap); in alloc_generic_hdmi()
2552 spec->chmap.ops.get_chmap = hdmi_get_chmap; in alloc_generic_hdmi()
2553 spec->chmap.ops.set_chmap = hdmi_set_chmap; in alloc_generic_hdmi()
2554 spec->chmap.ops.is_pcm_attached = is_hdmi_pcm_attached; in alloc_generic_hdmi()
2555 spec->chmap.ops.get_spk_alloc = hdmi_get_spk_alloc; in alloc_generic_hdmi()
2557 codec->spec = spec; in alloc_generic_hdmi()
2560 codec->patch_ops = generic_hdmi_patch_ops; in alloc_generic_hdmi()
2565 /* generic HDMI parser */
2596 /* clear unsol even if component notifier is used, or re-enable in reprogram_jack_detect()
2599 unsigned int val = use_acomp ? 0 : (AC_USRSP_EN | tbl->tag); in reprogram_jack_detect()
2612 spec = container_of(acomp->audio_ops, struct hdmi_spec, drm_audio_ops); in generic_acomp_notifier_set()
2613 mutex_lock(&spec->bind_lock); in generic_acomp_notifier_set()
2614 spec->use_acomp_notifier = use_acomp; in generic_acomp_notifier_set()
2615 spec->codec->relaxed_resume = use_acomp; in generic_acomp_notifier_set()
2616 spec->codec->bus->keep_power = 0; in generic_acomp_notifier_set()
2618 for (i = 0; i < spec->num_pins; i++) in generic_acomp_notifier_set()
2619 reprogram_jack_detect(spec->codec, in generic_acomp_notifier_set()
2620 get_pin(spec, i)->pin_nid, in generic_acomp_notifier_set()
2621 get_pin(spec, i)->dev_id, in generic_acomp_notifier_set()
2623 mutex_unlock(&spec->bind_lock); in generic_acomp_notifier_set()
2640 /* check whether both HD-audio and DRM PCI devices belong to the same bus */
2646 if (!dev_is_pci(dev) || !dev_is_pci(bus->dev)) in match_bound_vga()
2648 master = to_pci_dev(bus->dev); in match_bound_vga()
2650 return master->bus == pci->bus; in match_bound_vga()
2653 /* audio component notifier for AMD/Nvidia HDMI codecs */
2657 struct hdmi_spec *spec = codec->spec; in generic_acomp_pin_eld_notify()
2658 hda_nid_t pin_nid = spec->port2pin(codec, port); in generic_acomp_pin_eld_notify()
2667 if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) in generic_acomp_pin_eld_notify()
2677 struct hdmi_spec *spec = codec->spec; in setup_drm_audio_ops()
2679 spec->drm_audio_ops.audio_ptr = codec; in setup_drm_audio_ops()
2685 spec->drm_audio_ops.pin2port = ops->pin2port; in setup_drm_audio_ops()
2686 spec->drm_audio_ops.pin_eld_notify = ops->pin_eld_notify; in setup_drm_audio_ops()
2687 spec->drm_audio_ops.master_bind = ops->master_bind; in setup_drm_audio_ops()
2688 spec->drm_audio_ops.master_unbind = ops->master_unbind; in setup_drm_audio_ops()
2691 /* initialize the generic HDMI audio component */
2696 struct hdmi_spec *spec = codec->spec; in generic_acomp_init()
2703 spec->port2pin = port2pin; in generic_acomp_init()
2705 if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, in generic_acomp_init()
2707 spec->acomp_registered = true; in generic_acomp_init()
2724 struct hdmi_spec *spec = codec->spec; in intel_haswell_enable_all_pins()
2726 vendor_param = snd_hda_codec_read(codec, spec->vendor_nid, 0, in intel_haswell_enable_all_pins()
2728 if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS) in intel_haswell_enable_all_pins()
2732 vendor_param = snd_hda_codec_read(codec, spec->vendor_nid, 0, in intel_haswell_enable_all_pins()
2734 if (vendor_param == -1) in intel_haswell_enable_all_pins()
2744 struct hdmi_spec *spec = codec->spec; in intel_haswell_fixup_enable_dp12()
2746 vendor_param = snd_hda_codec_read(codec, spec->vendor_nid, 0, in intel_haswell_fixup_enable_dp12()
2748 if (vendor_param == -1 || vendor_param & INTEL_EN_DP12) in intel_haswell_fixup_enable_dp12()
2751 /* enable DP1.2 mode */ in intel_haswell_fixup_enable_dp12()
2753 snd_hdac_regmap_add_vendor_verb(&codec->core, INTEL_SET_VENDOR_VERB); in intel_haswell_fixup_enable_dp12()
2754 snd_hda_codec_write_cache(codec, spec->vendor_nid, 0, in intel_haswell_fixup_enable_dp12()
2758 /* Haswell needs to re-issue the vendor-specific verbs before turning to D0.
2775 * Pin Widget 5 - PORT B (port = 1 in i915 driver)
2776 * Pin Widget 6 - PORT C (port = 2 in i915 driver)
2777 * Pin Widget 7 - PORT D (port = 3 in i915 driver)
2780 * Pin Widget 4 - PORT B (port = 1 in i915 driver)
2781 * Pin Widget 5 - PORT C (port = 2 in i915 driver)
2782 * Pin Widget 6 - PORT D (port = 3 in i915 driver)
2786 switch (codec->core.vendor_id) { in intel_base_nid()
2799 struct hdmi_spec *spec = codec->spec; in intel_pin2port()
2802 if (!spec->port_num) { in intel_pin2port()
2805 return -1; in intel_pin2port()
2806 return pin_nid - base_nid + 1; in intel_pin2port()
2813 for (i = 0; i < spec->port_num; i++) { in intel_pin2port()
2814 if (pin_nid == spec->port_map[i]) in intel_pin2port()
2818 codec_info(codec, "Can't find the HDMI/DP port for pin NID 0x%x\n", pin_nid); in intel_pin2port()
2819 return -1; in intel_pin2port()
2824 struct hdmi_spec *spec = codec->spec; in intel_port2pin()
2826 if (!spec->port_num) { in intel_port2pin()
2827 /* we assume only from port-B to port-D */ in intel_port2pin()
2830 return port + intel_base_nid(codec) - 1; in intel_port2pin()
2833 if (port < 0 || port >= spec->port_num) in intel_port2pin()
2835 return spec->port_map[port]; in intel_port2pin()
2850 if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) in intel_pin_eld_notify()
2853 snd_hdac_i915_set_bclk(&codec->bus->core); in intel_pin_eld_notify()
2865 struct hdmi_spec *spec = codec->spec; in register_i915_notifier()
2867 spec->use_acomp_notifier = true; in register_i915_notifier()
2868 spec->port2pin = intel_port2pin; in register_i915_notifier()
2870 snd_hdac_acomp_register_notifier(&codec->bus->core, in register_i915_notifier()
2871 &spec->drm_audio_ops); in register_i915_notifier()
2873 codec->relaxed_resume = 1; in register_i915_notifier()
2892 haswell_verify_D0(codec, per_pin->cvt_nid, per_pin->pin_nid); in i915_pin_cvt_fixup()
2893 snd_hda_set_dev_select(codec, per_pin->pin_nid, in i915_pin_cvt_fixup()
2894 per_pin->dev_id); in i915_pin_cvt_fixup()
2896 intel_not_share_assigned_cvt(codec, per_pin->pin_nid, in i915_pin_cvt_fixup()
2897 per_pin->dev_id, per_pin->mux_idx); in i915_pin_cvt_fixup()
2909 if (!codec->bus->core.audio_component) { in alloc_intel_hdmi()
2910 codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n"); in alloc_intel_hdmi()
2912 codec->probe_id = HDA_CODEC_ID_SKIP_PROBE; in alloc_intel_hdmi()
2913 return -ENODEV; in alloc_intel_hdmi()
2920 codec->patch_ops.unsol_event = NULL; in alloc_intel_hdmi()
2924 /* parse and post-process for Intel codecs */
2931 } while (err < 0 && retries--); in parse_intel_hdmi()
2954 spec = codec->spec; in intel_hsw_common_init()
2955 codec->dp_mst = true; in intel_hsw_common_init()
2956 spec->vendor_nid = vendor_nid; in intel_hsw_common_init()
2957 spec->port_map = port_map; in intel_hsw_common_init()
2958 spec->port_num = port_num; in intel_hsw_common_init()
2959 spec->intel_hsw_fixup = true; in intel_hsw_common_init()
2960 spec->dev_num = dev_num; in intel_hsw_common_init()
2965 codec->display_power_control = 1; in intel_hsw_common_init()
2967 codec->patch_ops.set_power_state = haswell_set_power_state; in intel_hsw_common_init()
2968 codec->depop_delay = 0; in intel_hsw_common_init()
2969 codec->auto_runtime_pm = 1; in intel_hsw_common_init()
2971 spec->ops.setup_stream = i915_hsw_setup_stream; in intel_hsw_common_init()
2972 spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup; in intel_hsw_common_init()
2979 spec->silent_stream_type = SILENT_STREAM_I915; in intel_hsw_common_init()
3031 spec = codec->spec; in patch_i915_adlp_hdmi()
3033 if (spec->silent_stream_type) in patch_i915_adlp_hdmi()
3034 spec->silent_stream_type = SILENT_STREAM_KAE; in patch_i915_adlp_hdmi()
3049 spec = codec->spec; in patch_i915_byt_hdmi()
3054 codec->display_power_control = 1; in patch_i915_byt_hdmi()
3056 codec->depop_delay = 0; in patch_i915_byt_hdmi()
3057 codec->auto_runtime_pm = 1; in patch_i915_byt_hdmi()
3059 spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup; in patch_i915_byt_hdmi()
3076 * Shared non-generic implementations
3081 struct hdmi_spec *spec = codec->spec; in simple_playback_build_pcms()
3088 chans = get_wcaps(codec, per_cvt->cvt_nid); in simple_playback_build_pcms()
3091 info = snd_hda_codec_pcm_new(codec, "HDMI 0"); in simple_playback_build_pcms()
3093 return -ENOMEM; in simple_playback_build_pcms()
3094 spec->pcm_rec[0].pcm = info; in simple_playback_build_pcms()
3095 info->pcm_type = HDA_PCM_TYPE_HDMI; in simple_playback_build_pcms()
3096 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; in simple_playback_build_pcms()
3097 *pstr = spec->pcm_playback; in simple_playback_build_pcms()
3098 pstr->nid = per_cvt->cvt_nid; in simple_playback_build_pcms()
3099 if (pstr->channels_max <= 2 && chans && chans <= 16) in simple_playback_build_pcms()
3100 pstr->channels_max = chans; in simple_playback_build_pcms()
3114 * as long as spec->pins[] is set correctly
3120 struct hdmi_spec *spec = codec->spec; in simple_playback_build_controls()
3125 err = snd_hda_create_dig_out_ctls(codec, per_cvt->cvt_nid, in simple_playback_build_controls()
3126 per_cvt->cvt_nid, in simple_playback_build_controls()
3135 struct hdmi_spec *spec = codec->spec; in simple_playback_init()
3137 hda_nid_t pin = per_pin->pin_nid; in simple_playback_init()
3145 snd_hda_jack_detect_enable(codec, pin, per_pin->dev_id); in simple_playback_init()
3151 struct hdmi_spec *spec = codec->spec; in simple_playback_free()
3246 struct hdmi_spec *spec = codec->spec; in simple_playback_pcm_open()
3249 switch (codec->preset->vendor_id) { in simple_playback_pcm_open()
3264 snd_pcm_hw_constraint_list(substream->runtime, 0, in simple_playback_pcm_open()
3268 snd_pcm_hw_constraint_step(substream->runtime, 0, in simple_playback_pcm_open()
3272 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in simple_playback_pcm_open()
3279 struct hdmi_spec *spec = codec->spec; in simple_playback_pcm_close()
3280 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in simple_playback_pcm_close()
3289 struct hdmi_spec *spec = codec->spec; in simple_playback_pcm_prepare()
3290 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in simple_playback_pcm_prepare()
3322 return -ENOMEM; in patch_simple_hdmi()
3324 spec->codec = codec; in patch_simple_hdmi()
3325 codec->spec = spec; in patch_simple_hdmi()
3328 spec->multiout.num_dacs = 0; /* no analog */ in patch_simple_hdmi()
3329 spec->multiout.max_channels = 2; in patch_simple_hdmi()
3330 spec->multiout.dig_out_nid = cvt_nid; in patch_simple_hdmi()
3331 spec->num_cvts = 1; in patch_simple_hdmi()
3332 spec->num_pins = 1; in patch_simple_hdmi()
3333 per_pin = snd_array_new(&spec->pins); in patch_simple_hdmi()
3334 per_cvt = snd_array_new(&spec->cvts); in patch_simple_hdmi()
3337 return -ENOMEM; in patch_simple_hdmi()
3339 per_cvt->cvt_nid = cvt_nid; in patch_simple_hdmi()
3340 per_pin->pin_nid = pin_nid; in patch_simple_hdmi()
3341 spec->pcm_playback = simple_pcm_playback; in patch_simple_hdmi()
3343 codec->patch_ops = simple_hdmi_patch_ops; in patch_simple_hdmi()
3352 int chan = channels ? (channels - 1) : 1; in nvhdmi_8ch_7x_set_info_frame_parameters()
3378 (0x71 - chan - chanmask)); in nvhdmi_8ch_7x_set_info_frame_parameters()
3385 struct hdmi_spec *spec = codec->spec; in nvhdmi_8ch_7x_pcm_close()
3403 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in nvhdmi_8ch_7x_pcm_close()
3415 struct hdmi_spec *spec = codec->spec; in nvhdmi_8ch_7x_pcm_prepare()
3419 mutex_lock(&codec->spdif_mutex); in nvhdmi_8ch_7x_pcm_prepare()
3421 spdif = snd_hda_spdif_out_of_nid(codec, per_cvt->cvt_nid); in nvhdmi_8ch_7x_pcm_prepare()
3423 chs = substream->runtime->channels; in nvhdmi_8ch_7x_pcm_prepare()
3428 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) in nvhdmi_8ch_7x_pcm_prepare()
3433 spdif->ctls & ~AC_DIG1_ENABLE & 0xff); in nvhdmi_8ch_7x_pcm_prepare()
3445 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) { in nvhdmi_8ch_7x_pcm_prepare()
3450 spdif->ctls & 0xff); in nvhdmi_8ch_7x_pcm_prepare()
3466 if (codec->spdif_status_reset && in nvhdmi_8ch_7x_pcm_prepare()
3467 (spdif->ctls & AC_DIG1_ENABLE)) in nvhdmi_8ch_7x_pcm_prepare()
3472 spdif->ctls & ~AC_DIG1_ENABLE & 0xff); in nvhdmi_8ch_7x_pcm_prepare()
3487 if (codec->spdif_status_reset && in nvhdmi_8ch_7x_pcm_prepare()
3488 (spdif->ctls & AC_DIG1_ENABLE)) { in nvhdmi_8ch_7x_pcm_prepare()
3493 spdif->ctls & 0xff); in nvhdmi_8ch_7x_pcm_prepare()
3503 mutex_unlock(&codec->spdif_mutex); in nvhdmi_8ch_7x_pcm_prepare()
3530 codec->patch_ops.init = nvhdmi_7x_init_2ch; in patch_nvhdmi_2ch()
3532 spec = codec->spec; in patch_nvhdmi_2ch()
3533 spec->pcm_playback.rates = SUPPORTED_RATES; in patch_nvhdmi_2ch()
3534 spec->pcm_playback.maxbps = SUPPORTED_MAXBPS; in patch_nvhdmi_2ch()
3535 spec->pcm_playback.formats = SUPPORTED_FORMATS; in patch_nvhdmi_2ch()
3536 spec->nv_dp_workaround = true; in patch_nvhdmi_2ch()
3542 struct hdmi_spec *spec = codec->spec; in nvhdmi_7x_8ch_build_pcms()
3546 info->own_chmap = true; in nvhdmi_7x_8ch_build_pcms()
3553 struct hdmi_spec *spec = codec->spec; in nvhdmi_7x_8ch_build_controls()
3564 err = snd_pcm_add_chmap_ctls(info->pcm, in nvhdmi_7x_8ch_build_controls()
3569 switch (codec->preset->vendor_id) { in nvhdmi_7x_8ch_build_controls()
3574 chmap->channel_mask = (1U << 2) | (1U << 8); in nvhdmi_7x_8ch_build_controls()
3577 chmap->channel_mask = (1U << 2) | (1U << 6) | (1U << 8); in nvhdmi_7x_8ch_build_controls()
3588 spec = codec->spec; in patch_nvhdmi_8ch_7x()
3589 spec->multiout.max_channels = 8; in patch_nvhdmi_8ch_7x()
3590 spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x; in patch_nvhdmi_8ch_7x()
3591 codec->patch_ops.init = nvhdmi_7x_init_8ch; in patch_nvhdmi_8ch_7x()
3592 codec->patch_ops.build_pcms = nvhdmi_7x_8ch_build_pcms; in patch_nvhdmi_8ch_7x()
3593 codec->patch_ops.build_controls = nvhdmi_7x_8ch_build_controls; in patch_nvhdmi_8ch_7x()
3603 * NVIDIA codecs ignore ASP mapping for 2ch - confirmed on:
3604 * - 0x10de0015
3605 * - 0x10de0040
3610 if (cap->ca_index == 0x00 && channels == 2) in nvhdmi_chmap_cea_alloc_validate_get_type()
3614 if (cap->channels != channels) in nvhdmi_chmap_cea_alloc_validate_get_type()
3615 return -1; in nvhdmi_chmap_cea_alloc_validate_get_type()
3625 return -EINVAL; in nvhdmi_chmap_validate()
3630 /* map from pin NID to port; port is 0-based */
3634 return pin_nid - 4; in nvhdmi_pin2port()
3637 /* reverse-map from port to pin NID: see above */
3658 codec->dp_mst = true; in patch_nvhdmi()
3660 spec = codec->spec; in patch_nvhdmi()
3670 spec->dyn_pin_out = true; in patch_nvhdmi()
3672 spec->chmap.ops.chmap_cea_alloc_validate_get_type = in patch_nvhdmi()
3674 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; in patch_nvhdmi()
3675 spec->nv_dp_workaround = true; in patch_nvhdmi()
3677 codec->link_down_at_suspend = 1; in patch_nvhdmi()
3693 spec = codec->spec; in patch_nvhdmi_legacy()
3694 spec->dyn_pin_out = true; in patch_nvhdmi_legacy()
3696 spec->chmap.ops.chmap_cea_alloc_validate_get_type = in patch_nvhdmi_legacy()
3698 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; in patch_nvhdmi_legacy()
3699 spec->nv_dp_workaround = true; in patch_nvhdmi_legacy()
3701 codec->link_down_at_suspend = 1; in patch_nvhdmi_legacy()
3708 * accessed using vendor-defined verbs. These registers can be used for
3709 * interoperability between the HDA and HDMI drivers.
3716 * The SCRATCH0 register is used to notify the HDMI codec of changes in audio
3718 * be raised in the HDMI codec. The remainder of the bits is arbitrary. This
3723 * +---------+-------+--------+--------+
3725 * +-----------------------------------|
3730 * trigger to hdmi.
3749 * the format is invalidated so that the HDMI codec can be disabled.
3757 struct hdmi_spec *spec = codec->spec; in tegra_hdmi_set_format()
3765 if (codec->dp_mst) in tegra_hdmi_set_format()
3786 * Bit 30 signals that the data is valid and hence that HDMI audio can in tegra_hdmi_set_format()
3794 if (spec->hdmi_intr_trig_ctrl) { in tegra_hdmi_set_format()
3797 * Interrupt to hdmi driver is triggered by writing in tegra_hdmi_set_format()
3798 * non-zero values to verb 0xF80 instead of 31st bit of in tegra_hdmi_set_format()
3808 * in the HDMI codec. The HDMI driver will use that as trigger in tegra_hdmi_set_format()
3831 /* notify the HDMI codec of the format change */ in tegra_hdmi_pcm_prepare()
3832 tegra_hdmi_set_format(codec, hinfo->nid, format); in tegra_hdmi_pcm_prepare()
3841 /* invalidate the format in the HDMI codec */ in tegra_hdmi_pcm_cleanup()
3842 tegra_hdmi_set_format(codec, hinfo->nid, 0); in tegra_hdmi_pcm_cleanup()
3849 struct hdmi_spec *spec = codec->spec; in hda_find_pcm_by_type()
3852 for (i = 0; i < spec->num_pins; i++) { in hda_find_pcm_by_type()
3855 if (pcm->pcm_type == type) in hda_find_pcm_by_type()
3874 return -ENODEV; in tegra_hdmi_build_pcms()
3877 * Override ->prepare() and ->cleanup() operations to notify the HDMI in tegra_hdmi_build_pcms()
3880 stream = &pcm->stream[SNDRV_PCM_STREAM_PLAYBACK]; in tegra_hdmi_build_pcms()
3881 stream->ops.prepare = tegra_hdmi_pcm_prepare; in tegra_hdmi_build_pcms()
3882 stream->ops.cleanup = tegra_hdmi_pcm_cleanup; in tegra_hdmi_build_pcms()
3889 struct hdmi_spec *spec = codec->spec; in tegra_hdmi_init()
3898 for (i = 0; i < spec->num_cvts; i++) in tegra_hdmi_init()
3899 snd_hda_codec_write(codec, spec->cvt_nids[i], 0, in tegra_hdmi_init()
3905 codec->depop_delay = 10; in tegra_hdmi_init()
3906 codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; in tegra_hdmi_init()
3907 spec->chmap.ops.chmap_cea_alloc_validate_get_type = in tegra_hdmi_init()
3909 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; in tegra_hdmi_init()
3911 spec->chmap.ops.chmap_cea_alloc_validate_get_type = in tegra_hdmi_init()
3913 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; in tegra_hdmi_init()
3914 spec->nv_dp_workaround = true; in tegra_hdmi_init()
3939 codec->dp_mst = true; in patch_tegra234_hdmi()
3940 spec = codec->spec; in patch_tegra234_hdmi()
3941 spec->dyn_pin_out = true; in patch_tegra234_hdmi()
3942 spec->hdmi_intr_trig_ctrl = true; in patch_tegra234_hdmi()
3948 * ATI/AMD-specific implementations
3952 ((codec)->core.vendor_id == 0x1002aa01 && \
3953 ((codec)->core.revision_id & 0xff00) >= 0x0300)
3998 /* call hda_eld.c ATI/AMD-specific function */ in atihdmi_pin_get_eld()
4014 * ATI/AMD have automatic FC/LFE swap built-in in atihdmi_paired_swap_fc_lfe()
4034 /* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */ in atihdmi_paired_chmap_validate()
4046 int chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j); in atihdmi_paired_chmap_validate()
4047 if (cap->speakers[chan_idx] == mask) { in atihdmi_paired_chmap_validate()
4053 int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1); in atihdmi_paired_chmap_validate()
4055 int comp_mask_act = cap->speakers[comp_chan_idx]; in atihdmi_paired_chmap_validate()
4060 return -EINVAL; in atihdmi_paired_chmap_validate()
4067 return -EINVAL; in atihdmi_paired_chmap_validate()
4084 return -EINVAL; in atihdmi_pin_set_slot_channel()
4096 hdmi_slot -= hdmi_slot % 2; in atihdmi_pin_set_slot_channel()
4099 stream_channel -= stream_channel % 2; in atihdmi_pin_set_slot_channel()
4122 return -EINVAL; in atihdmi_pin_get_slot_channel()
4127 ati_asp_slot -= 1; in atihdmi_pin_get_slot_channel()
4150 * Pre-rev3 ATI/AMD codecs operate in a paired channel mode, so in atihdmi_paired_chmap_cea_alloc_validate_get_type()
4157 /* We only produce even-numbered channel count TLVs */ in atihdmi_paired_chmap_cea_alloc_validate_get_type()
4159 return -1; in atihdmi_paired_chmap_cea_alloc_validate_get_type()
4162 if (cap->speakers[c] || cap->speakers[c+1]) in atihdmi_paired_chmap_cea_alloc_validate_get_type()
4167 return -1; in atihdmi_paired_chmap_cea_alloc_validate_get_type()
4176 /* produce paired maps for pre-rev3 ATI/AMD codecs */ in atihdmi_paired_cea_alloc_to_tlv_chmap()
4180 for (c = 7; c >= 0; c--) { in atihdmi_paired_cea_alloc_to_tlv_chmap()
4181 int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c); in atihdmi_paired_cea_alloc_to_tlv_chmap()
4182 int spk = cap->speakers[chan]; in atihdmi_paired_cea_alloc_to_tlv_chmap()
4185 if (cap->speakers[chan + (chan % 2 ? -1 : 1)]) in atihdmi_paired_cea_alloc_to_tlv_chmap()
4212 "atihdmi_pin_hbr_setup: NID=0x%x, %shbr-ctl=0x%x\n", in atihdmi_pin_hbr_setup()
4214 hbr_ctl == hbr_ctl_new ? "" : "new-", in atihdmi_pin_hbr_setup()
4223 return -EINVAL; in atihdmi_pin_hbr_setup()
4234 /* disable ramp-up/down for non-pcm as per AMD spec */ in atihdmi_setup_stream()
4248 struct hdmi_spec *spec = codec->spec; in atihdmi_init()
4256 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { in atihdmi_init()
4260 snd_hda_codec_write(codec, per_pin->pin_nid, 0, ATI_VERB_SET_DOWNMIX_INFO, 0); in atihdmi_init()
4262 /* enable channel-wise remap mode if supported */ in atihdmi_init()
4264 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in atihdmi_init()
4268 codec->auto_runtime_pm = 1; in atihdmi_init()
4273 /* map from pin NID to port; port is 0-based */
4277 return pin_nid / 2 - 1; in atihdmi_pin2port()
4280 /* reverse-map from port to pin NID: see above */
4304 codec->patch_ops.init = atihdmi_init; in patch_atihdmi()
4306 spec = codec->spec; in patch_atihdmi()
4308 spec->ops.pin_get_eld = atihdmi_pin_get_eld; in patch_atihdmi()
4309 spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe; in patch_atihdmi()
4310 spec->ops.pin_hbr_setup = atihdmi_pin_hbr_setup; in patch_atihdmi()
4311 spec->ops.setup_stream = atihdmi_setup_stream; in patch_atihdmi()
4313 spec->chmap.ops.pin_get_slot_channel = atihdmi_pin_get_slot_channel; in patch_atihdmi()
4314 spec->chmap.ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel; in patch_atihdmi()
4317 /* override to ATI/AMD-specific versions with pairwise mapping */ in patch_atihdmi()
4318 spec->chmap.ops.chmap_cea_alloc_validate_get_type = in patch_atihdmi()
4320 spec->chmap.ops.cea_alloc_to_tlv_chmap = in patch_atihdmi()
4322 spec->chmap.ops.chmap_validate = atihdmi_paired_chmap_validate; in patch_atihdmi()
4326 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { in patch_atihdmi()
4328 per_cvt->channels_max = max(per_cvt->channels_max, 8u); in patch_atihdmi()
4329 per_cvt->rates |= SUPPORTED_RATES; in patch_atihdmi()
4330 per_cvt->formats |= SUPPORTED_FORMATS; in patch_atihdmi()
4331 per_cvt->maxbps = max(per_cvt->maxbps, 24u); in patch_atihdmi()
4334 spec->chmap.channels_max = max(spec->chmap.channels_max, 8u); in patch_atihdmi()
4337 * the link-down as is. Tell the core to allow it. in patch_atihdmi()
4339 codec->link_down_at_suspend = 1; in patch_atihdmi()
4346 /* VIA HDMI Implementation */
4348 #define VIAHDMI_PIN_NID 0x03 /* HDMI output pin1 */
4359 HDA_CODEC_ENTRY(0x1002793c, "RS600 HDMI", patch_atihdmi),
4360 HDA_CODEC_ENTRY(0x10027919, "RS600 HDMI", patch_atihdmi),
4361 HDA_CODEC_ENTRY(0x1002791a, "RS690/780 HDMI", patch_atihdmi),
4362 HDA_CODEC_ENTRY(0x1002aa01, "R6xx HDMI", patch_atihdmi),
4363 HDA_CODEC_ENTRY(0x10951390, "SiI1390 HDMI", patch_generic_hdmi),
4364 HDA_CODEC_ENTRY(0x10951392, "SiI1392 HDMI", patch_generic_hdmi),
4365 HDA_CODEC_ENTRY(0x17e80047, "Chrontel HDMI", patch_generic_hdmi),
4366 HDA_CODEC_ENTRY(0x10de0001, "MCP73 HDMI", patch_nvhdmi_2ch),
4367 HDA_CODEC_ENTRY(0x10de0002, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
4368 HDA_CODEC_ENTRY(0x10de0003, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
4369 HDA_CODEC_ENTRY(0x10de0004, "GPU 04 HDMI", patch_nvhdmi_8ch_7x),
4370 HDA_CODEC_ENTRY(0x10de0005, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
4371 HDA_CODEC_ENTRY(0x10de0006, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
4372 HDA_CODEC_ENTRY(0x10de0007, "MCP79/7A HDMI", patch_nvhdmi_8ch_7x),
4373 HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi_legacy),
4374 HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi_legacy),
4375 HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi_legacy),
4376 HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi_legacy),
4377 HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi_legacy),
4378 HDA_CODEC_ENTRY(0x10de000d, "GPU 0d HDMI/DP", patch_nvhdmi_legacy),
4379 HDA_CODEC_ENTRY(0x10de0010, "GPU 10 HDMI/DP", patch_nvhdmi_legacy),
4380 HDA_CODEC_ENTRY(0x10de0011, "GPU 11 HDMI/DP", patch_nvhdmi_legacy),
4381 HDA_CODEC_ENTRY(0x10de0012, "GPU 12 HDMI/DP", patch_nvhdmi_legacy),
4382 HDA_CODEC_ENTRY(0x10de0013, "GPU 13 HDMI/DP", patch_nvhdmi_legacy),
4383 HDA_CODEC_ENTRY(0x10de0014, "GPU 14 HDMI/DP", patch_nvhdmi_legacy),
4384 HDA_CODEC_ENTRY(0x10de0015, "GPU 15 HDMI/DP", patch_nvhdmi_legacy),
4385 HDA_CODEC_ENTRY(0x10de0016, "GPU 16 HDMI/DP", patch_nvhdmi_legacy),
4387 HDA_CODEC_ENTRY(0x10de0018, "GPU 18 HDMI/DP", patch_nvhdmi_legacy),
4388 HDA_CODEC_ENTRY(0x10de0019, "GPU 19 HDMI/DP", patch_nvhdmi_legacy),
4389 HDA_CODEC_ENTRY(0x10de001a, "GPU 1a HDMI/DP", patch_nvhdmi_legacy),
4390 HDA_CODEC_ENTRY(0x10de001b, "GPU 1b HDMI/DP", patch_nvhdmi_legacy),
4391 HDA_CODEC_ENTRY(0x10de001c, "GPU 1c HDMI/DP", patch_nvhdmi_legacy),
4392 HDA_CODEC_ENTRY(0x10de0020, "Tegra30 HDMI", patch_tegra_hdmi),
4393 HDA_CODEC_ENTRY(0x10de0022, "Tegra114 HDMI", patch_tegra_hdmi),
4394 HDA_CODEC_ENTRY(0x10de0028, "Tegra124 HDMI", patch_tegra_hdmi),
4395 HDA_CODEC_ENTRY(0x10de0029, "Tegra210 HDMI/DP", patch_tegra_hdmi),
4396 HDA_CODEC_ENTRY(0x10de002d, "Tegra186 HDMI/DP0", patch_tegra_hdmi),
4397 HDA_CODEC_ENTRY(0x10de002e, "Tegra186 HDMI/DP1", patch_tegra_hdmi),
4398 HDA_CODEC_ENTRY(0x10de002f, "Tegra194 HDMI/DP2", patch_tegra_hdmi),
4399 HDA_CODEC_ENTRY(0x10de0030, "Tegra194 HDMI/DP3", patch_tegra_hdmi),
4400 HDA_CODEC_ENTRY(0x10de0031, "Tegra234 HDMI/DP", patch_tegra234_hdmi),
4401 HDA_CODEC_ENTRY(0x10de0040, "GPU 40 HDMI/DP", patch_nvhdmi),
4402 HDA_CODEC_ENTRY(0x10de0041, "GPU 41 HDMI/DP", patch_nvhdmi),
4403 HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi),
4404 HDA_CODEC_ENTRY(0x10de0043, "GPU 43 HDMI/DP", patch_nvhdmi),
4405 HDA_CODEC_ENTRY(0x10de0044, "GPU 44 HDMI/DP", patch_nvhdmi),
4406 HDA_CODEC_ENTRY(0x10de0045, "GPU 45 HDMI/DP", patch_nvhdmi),
4407 HDA_CODEC_ENTRY(0x10de0050, "GPU 50 HDMI/DP", patch_nvhdmi),
4408 HDA_CODEC_ENTRY(0x10de0051, "GPU 51 HDMI/DP", patch_nvhdmi),
4409 HDA_CODEC_ENTRY(0x10de0052, "GPU 52 HDMI/DP", patch_nvhdmi),
4410 HDA_CODEC_ENTRY(0x10de0060, "GPU 60 HDMI/DP", patch_nvhdmi),
4411 HDA_CODEC_ENTRY(0x10de0061, "GPU 61 HDMI/DP", patch_nvhdmi),
4412 HDA_CODEC_ENTRY(0x10de0062, "GPU 62 HDMI/DP", patch_nvhdmi),
4413 HDA_CODEC_ENTRY(0x10de0067, "MCP67 HDMI", patch_nvhdmi_2ch),
4414 HDA_CODEC_ENTRY(0x10de0070, "GPU 70 HDMI/DP", patch_nvhdmi),
4415 HDA_CODEC_ENTRY(0x10de0071, "GPU 71 HDMI/DP", patch_nvhdmi),
4416 HDA_CODEC_ENTRY(0x10de0072, "GPU 72 HDMI/DP", patch_nvhdmi),
4417 HDA_CODEC_ENTRY(0x10de0073, "GPU 73 HDMI/DP", patch_nvhdmi),
4418 HDA_CODEC_ENTRY(0x10de0074, "GPU 74 HDMI/DP", patch_nvhdmi),
4419 HDA_CODEC_ENTRY(0x10de0076, "GPU 76 HDMI/DP", patch_nvhdmi),
4420 HDA_CODEC_ENTRY(0x10de007b, "GPU 7b HDMI/DP", patch_nvhdmi),
4421 HDA_CODEC_ENTRY(0x10de007c, "GPU 7c HDMI/DP", patch_nvhdmi),
4422 HDA_CODEC_ENTRY(0x10de007d, "GPU 7d HDMI/DP", patch_nvhdmi),
4423 HDA_CODEC_ENTRY(0x10de007e, "GPU 7e HDMI/DP", patch_nvhdmi),
4424 HDA_CODEC_ENTRY(0x10de0080, "GPU 80 HDMI/DP", patch_nvhdmi),
4425 HDA_CODEC_ENTRY(0x10de0081, "GPU 81 HDMI/DP", patch_nvhdmi),
4426 HDA_CODEC_ENTRY(0x10de0082, "GPU 82 HDMI/DP", patch_nvhdmi),
4427 HDA_CODEC_ENTRY(0x10de0083, "GPU 83 HDMI/DP", patch_nvhdmi),
4428 HDA_CODEC_ENTRY(0x10de0084, "GPU 84 HDMI/DP", patch_nvhdmi),
4429 HDA_CODEC_ENTRY(0x10de0090, "GPU 90 HDMI/DP", patch_nvhdmi),
4430 HDA_CODEC_ENTRY(0x10de0091, "GPU 91 HDMI/DP", patch_nvhdmi),
4431 HDA_CODEC_ENTRY(0x10de0092, "GPU 92 HDMI/DP", patch_nvhdmi),
4432 HDA_CODEC_ENTRY(0x10de0093, "GPU 93 HDMI/DP", patch_nvhdmi),
4433 HDA_CODEC_ENTRY(0x10de0094, "GPU 94 HDMI/DP", patch_nvhdmi),
4434 HDA_CODEC_ENTRY(0x10de0095, "GPU 95 HDMI/DP", patch_nvhdmi),
4435 HDA_CODEC_ENTRY(0x10de0097, "GPU 97 HDMI/DP", patch_nvhdmi),
4436 HDA_CODEC_ENTRY(0x10de0098, "GPU 98 HDMI/DP", patch_nvhdmi),
4437 HDA_CODEC_ENTRY(0x10de0099, "GPU 99 HDMI/DP", patch_nvhdmi),
4438 HDA_CODEC_ENTRY(0x10de009a, "GPU 9a HDMI/DP", patch_nvhdmi),
4439 HDA_CODEC_ENTRY(0x10de009d, "GPU 9d HDMI/DP", patch_nvhdmi),
4440 HDA_CODEC_ENTRY(0x10de009e, "GPU 9e HDMI/DP", patch_nvhdmi),
4441 HDA_CODEC_ENTRY(0x10de009f, "GPU 9f HDMI/DP", patch_nvhdmi),
4442 HDA_CODEC_ENTRY(0x10de00a0, "GPU a0 HDMI/DP", patch_nvhdmi),
4443 HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI", patch_nvhdmi_2ch),
4444 HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI", patch_nvhdmi_2ch),
4445 HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP", patch_via_hdmi),
4446 HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP", patch_via_hdmi),
4447 HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi),
4448 HDA_CODEC_ENTRY(0x11069f85, "VX11 HDMI/DP", patch_generic_hdmi),
4449 HDA_CODEC_ENTRY(0x80860054, "IbexPeak HDMI", patch_i915_cpt_hdmi),
4450 HDA_CODEC_ENTRY(0x80862800, "Geminilake HDMI", patch_i915_glk_hdmi),
4451 HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi),
4452 HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi),
4453 HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi),
4454 HDA_CODEC_ENTRY(0x80862804, "IbexPeak HDMI", patch_i915_cpt_hdmi),
4455 HDA_CODEC_ENTRY(0x80862805, "CougarPoint HDMI", patch_i915_cpt_hdmi),
4456 HDA_CODEC_ENTRY(0x80862806, "PantherPoint HDMI", patch_i915_cpt_hdmi),
4457 HDA_CODEC_ENTRY(0x80862807, "Haswell HDMI", patch_i915_hsw_hdmi),
4458 HDA_CODEC_ENTRY(0x80862808, "Broadwell HDMI", patch_i915_hsw_hdmi),
4459 HDA_CODEC_ENTRY(0x80862809, "Skylake HDMI", patch_i915_hsw_hdmi),
4460 HDA_CODEC_ENTRY(0x8086280a, "Broxton HDMI", patch_i915_hsw_hdmi),
4461 HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi),
4462 HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi),
4463 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
4464 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),
4465 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),
4466 HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi),
4467 HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI", patch_i915_tgl_hdmi),
4468 HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi),
4469 HDA_CODEC_ENTRY(0x80862818, "Raptorlake HDMI", patch_i915_tgl_hdmi),
4470 HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_adlp_hdmi),
4471 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),
4472 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi),
4473 HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_adlp_hdmi),
4474 HDA_CODEC_ENTRY(0x8086281f, "Raptorlake-P HDMI", patch_i915_adlp_hdmi),
4475 HDA_CODEC_ENTRY(0x8086281d, "Meteorlake HDMI", patch_i915_adlp_hdmi),
4476 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
4477 HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
4478 HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
4479 HDA_CODEC_ENTRY(0x808629fb, "Crestline HDMI", patch_generic_hdmi),
4480 /* special ID for generic HDMI */
4481 HDA_CODEC_ENTRY(HDA_CODEC_ID_GENERIC_HDMI, "Generic HDMI", patch_generic_hdmi),
4487 MODULE_DESCRIPTION("HDMI HD-audio codec");
4488 MODULE_ALIAS("snd-hda-codec-intelhdmi");
4489 MODULE_ALIAS("snd-hda-codec-nvhdmi");
4490 MODULE_ALIAS("snd-hda-codec-atihdmi");