Lines Matching refs:codec
50 int snd_hda_hdmi_pin_id_to_pin_index(struct hda_codec *codec, in snd_hda_hdmi_pin_id_to_pin_index() argument
53 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_pin_id_to_pin_index()
71 codec_warn(codec, "HDMI: pin NID 0x%x not registered\n", pin_nid); in snd_hda_hdmi_pin_id_to_pin_index()
76 static int hinfo_to_pcm_index(struct hda_codec *codec, in hinfo_to_pcm_index() argument
79 struct hdmi_spec *spec = codec->spec; in hinfo_to_pcm_index()
86 codec_warn(codec, "HDMI: hinfo %p not tied to a PCM\n", hinfo); in hinfo_to_pcm_index()
90 static int hinfo_to_pin_index(struct hda_codec *codec, in hinfo_to_pin_index() argument
93 struct hdmi_spec *spec = codec->spec; in hinfo_to_pin_index()
104 codec_dbg(codec, "HDMI: hinfo %p (pcm %d) not registered\n", hinfo, in hinfo_to_pin_index()
105 hinfo_to_pcm_index(codec, hinfo)); in hinfo_to_pin_index()
123 static int cvt_nid_to_cvt_index(struct hda_codec *codec, hda_nid_t cvt_nid) in cvt_nid_to_cvt_index() argument
125 struct hdmi_spec *spec = codec->spec; in cvt_nid_to_cvt_index()
132 codec_warn(codec, "HDMI: cvt NID 0x%x not registered\n", cvt_nid); in cvt_nid_to_cvt_index()
139 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hdmi_eld_ctl_info() local
140 struct hdmi_spec *spec = codec->spec; in hdmi_eld_ctl_info()
166 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hdmi_eld_ctl_get() local
167 struct hdmi_spec *spec = codec->spec; in hdmi_eld_ctl_get()
211 static int hdmi_create_eld_ctl(struct hda_codec *codec, int pcm_idx, in hdmi_create_eld_ctl() argument
215 struct hdmi_spec *spec = codec->spec; in hdmi_create_eld_ctl()
218 kctl = snd_ctl_new1(&eld_bytes_ctl, codec); in hdmi_create_eld_ctl()
227 err = snd_hda_ctl_add(codec, 0, kctl); in hdmi_create_eld_ctl()
236 static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_get_dip_index() argument
241 val = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_get_dip_index()
249 static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_set_dip_index() argument
256 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); in hdmi_set_dip_index()
259 static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_write_dip_byte() argument
262 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); in hdmi_write_dip_byte()
265 static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_init_pin() argument
267 struct hdmi_spec *spec = codec->spec; in hdmi_init_pin()
271 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) in hdmi_init_pin()
272 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_init_pin()
284 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_init_pin()
317 struct hda_codec *codec = per_pin->codec; in eld_proc_new() local
321 snprintf(name, sizeof(name), "eld#%d.%d", codec->addr, index); in eld_proc_new()
322 err = snd_card_proc_new(codec->card, name, &entry); in eld_proc_new()
336 if (!per_pin->codec->bus->shutdown) { in eld_proc_free()
359 static void hdmi_start_infoframe_trans(struct hda_codec *codec, in hdmi_start_infoframe_trans() argument
362 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_start_infoframe_trans()
363 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, in hdmi_start_infoframe_trans()
370 static void hdmi_stop_infoframe_trans(struct hda_codec *codec, in hdmi_stop_infoframe_trans() argument
373 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_stop_infoframe_trans()
374 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, in hdmi_stop_infoframe_trans()
378 static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_debug_dip_size() argument
384 size = snd_hdmi_get_eld_size(codec, pin_nid); in hdmi_debug_dip_size()
385 codec_dbg(codec, "HDMI: ELD buf size is %d\n", size); in hdmi_debug_dip_size()
388 size = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_debug_dip_size()
390 codec_dbg(codec, "HDMI: DIP GP[%d] buf size is %d\n", i, size); in hdmi_debug_dip_size()
395 static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_clear_dip_buffers() argument
402 size = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_clear_dip_buffers()
407 hdmi_set_dip_index(codec, pin_nid, i, 0x0); in hdmi_clear_dip_buffers()
409 hdmi_write_dip_byte(codec, pin_nid, 0x0); in hdmi_clear_dip_buffers()
410 hdmi_get_dip_index(codec, pin_nid, &pi, &bi); in hdmi_clear_dip_buffers()
412 codec_dbg(codec, "dip index %d: %d != %d\n", in hdmi_clear_dip_buffers()
417 codec_dbg(codec, in hdmi_clear_dip_buffers()
438 static void hdmi_fill_audio_infoframe(struct hda_codec *codec, in hdmi_fill_audio_infoframe() argument
444 hdmi_debug_dip_size(codec, pin_nid); in hdmi_fill_audio_infoframe()
445 hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ in hdmi_fill_audio_infoframe()
447 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_fill_audio_infoframe()
449 hdmi_write_dip_byte(codec, pin_nid, dip[i]); in hdmi_fill_audio_infoframe()
452 static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_infoframe_uptodate() argument
458 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_infoframe_uptodate()
459 if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) in hdmi_infoframe_uptodate()
464 val = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_infoframe_uptodate()
473 static int hdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid, in hdmi_pin_get_eld() argument
476 snd_hda_set_dev_select(codec, nid, dev_id); in hdmi_pin_get_eld()
478 return snd_hdmi_get_eld(codec, nid, buf, eld_size); in hdmi_pin_get_eld()
481 static void hdmi_pin_setup_infoframe(struct hda_codec *codec, in hdmi_pin_setup_infoframe() argument
486 struct hdmi_spec *spec = codec->spec; in hdmi_pin_setup_infoframe()
516 codec_dbg(codec, "HDMI: unknown connection type at pin NID 0x%x\n", pin_nid); in hdmi_pin_setup_infoframe()
520 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_pin_setup_infoframe()
527 if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes, in hdmi_pin_setup_infoframe()
529 codec_dbg(codec, "%s: pin NID=0x%x channels=%d ca=0x%02x\n", in hdmi_pin_setup_infoframe()
531 hdmi_stop_infoframe_trans(codec, pin_nid); in hdmi_pin_setup_infoframe()
532 hdmi_fill_audio_infoframe(codec, pin_nid, in hdmi_pin_setup_infoframe()
534 hdmi_start_infoframe_trans(codec, pin_nid); in hdmi_pin_setup_infoframe()
538 void snd_hda_hdmi_setup_audio_infoframe(struct hda_codec *codec, in snd_hda_hdmi_setup_audio_infoframe() argument
542 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_audio_infoframe()
554 snd_hda_set_dev_select(codec, pin_nid, dev_id); in snd_hda_hdmi_setup_audio_infoframe()
557 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) in snd_hda_hdmi_setup_audio_infoframe()
558 snd_hda_codec_write(codec, pin_nid, 0, in snd_hda_hdmi_setup_audio_infoframe()
564 ca = snd_hdac_channel_allocation(&codec->core, in snd_hda_hdmi_setup_audio_infoframe()
570 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid, in snd_hda_hdmi_setup_audio_infoframe()
581 spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id, in snd_hda_hdmi_setup_audio_infoframe()
594 void snd_hda_hdmi_check_presence_and_report(struct hda_codec *codec, in snd_hda_hdmi_check_presence_and_report() argument
597 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_check_presence_and_report()
598 int pin_idx = pin_id_to_pin_index(codec, nid, dev_id); in snd_hda_hdmi_check_presence_and_report()
609 static void jack_callback(struct hda_codec *codec, in jack_callback() argument
613 if (codec_has_acomp(codec)) in jack_callback()
616 snd_hda_hdmi_check_presence_and_report(codec, jack->nid, jack->dev_id); in jack_callback()
619 static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res, in hdmi_intrinsic_event() argument
624 codec_dbg(codec, in hdmi_intrinsic_event()
626 codec->addr, jack->nid, jack->dev_id, !!(res & AC_UNSOL_RES_IA), in hdmi_intrinsic_event()
629 snd_hda_hdmi_check_presence_and_report(codec, jack->nid, jack->dev_id); in hdmi_intrinsic_event()
632 static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) in hdmi_non_intrinsic_event() argument
639 codec_info(codec, in hdmi_non_intrinsic_event()
641 codec->addr, in hdmi_non_intrinsic_event()
656 void snd_hda_hdmi_generic_unsol_event(struct hda_codec *codec, unsigned int res) in snd_hda_hdmi_generic_unsol_event() argument
662 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_unsol_event()
665 if (codec->dp_mst) { in snd_hda_hdmi_generic_unsol_event()
669 jack = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry); in snd_hda_hdmi_generic_unsol_event()
671 jack = snd_hda_jack_tbl_get_from_tag(codec, tag, 0); in snd_hda_hdmi_generic_unsol_event()
675 codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag); in snd_hda_hdmi_generic_unsol_event()
680 hdmi_intrinsic_event(codec, res, jack); in snd_hda_hdmi_generic_unsol_event()
682 hdmi_non_intrinsic_event(codec, res); in snd_hda_hdmi_generic_unsol_event()
694 static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_pin_hbr_setup() argument
699 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { in hdmi_pin_hbr_setup()
700 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_pin_hbr_setup()
701 pinctl = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_pin_hbr_setup()
713 codec_dbg(codec, in hdmi_pin_hbr_setup()
720 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_pin_hbr_setup()
729 int snd_hda_hdmi_setup_stream(struct hda_codec *codec, in snd_hda_hdmi_setup_stream() argument
734 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_stream()
738 err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id, in snd_hda_hdmi_setup_stream()
742 codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n"); in snd_hda_hdmi_setup_stream()
753 param = snd_hda_codec_read(codec, cvt_nid, 0, in snd_hda_hdmi_setup_stream()
762 snd_hda_codec_write(codec, cvt_nid, 0, in snd_hda_hdmi_setup_stream()
766 snd_hda_codec_setup_stream(codec, cvt_nid, stream_tag, 0, format); in snd_hda_hdmi_setup_stream()
776 static int hdmi_choose_cvt(struct hda_codec *codec, in hdmi_choose_cvt() argument
780 struct hdmi_spec *spec = codec->spec; in hdmi_choose_cvt()
792 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in hdmi_choose_cvt()
834 static void pin_cvt_fixup(struct hda_codec *codec, in pin_cvt_fixup() argument
838 struct hdmi_spec *spec = codec->spec; in pin_cvt_fixup()
841 spec->ops.pin_cvt_fixup(codec, per_pin, cvt_nid); in pin_cvt_fixup()
846 struct hda_codec *codec, in hdmi_pcm_open_no_pin() argument
849 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open_no_pin()
855 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_open_no_pin()
859 err = hdmi_choose_cvt(codec, -1, &cvt_idx, false); in hdmi_pcm_open_no_pin()
867 pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid); in hdmi_pcm_open_no_pin()
894 struct hda_codec *codec, in hdmi_pcm_open() argument
897 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open()
906 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_open()
911 pin_idx = hinfo_to_pin_index(codec, hinfo); in hdmi_pcm_open()
916 err = hdmi_pcm_open_no_pin(hinfo, codec, substream); in hdmi_pcm_open()
920 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, false); in hdmi_pcm_open()
934 if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE) in hdmi_pcm_open()
937 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in hdmi_pcm_open()
938 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_open()
943 pin_cvt_fixup(codec, per_pin, 0); in hdmi_pcm_open()
945 snd_hda_spdif_ctls_assign(codec, pcm_idx, per_cvt->cvt_nid); in hdmi_pcm_open()
962 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in hdmi_pcm_open()
984 static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) in hdmi_read_pin_conn() argument
986 struct hdmi_spec *spec = codec->spec; in hdmi_read_pin_conn()
992 if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { in hdmi_read_pin_conn()
993 codec_warn(codec, in hdmi_read_pin_conn()
995 pin_nid, get_wcaps(codec, pin_nid)); in hdmi_read_pin_conn()
999 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_read_pin_conn()
1006 conns = snd_hda_get_raw_connections(codec, pin_nid, in hdmi_read_pin_conn()
1080 static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid);
1085 struct hda_codec *codec = per_pin->codec; in hdmi_pcm_setup_pin() local
1108 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_setup_pin()
1110 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_setup_pin()
1114 snd_hda_spdif_ctls_assign(codec, per_pin->pcm_idx, hinfo->nid); in hdmi_pcm_setup_pin()
1116 non_pcm = check_non_pcm_per_cvt(codec, hinfo->nid); in hdmi_pcm_setup_pin()
1122 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); in hdmi_pcm_setup_pin()
1129 snd_hda_spdif_ctls_unassign(per_pin->codec, per_pin->pcm_idx); in hdmi_pcm_reset_pin()
1138 static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec, in pin_idx_to_pcm_jack() argument
1141 struct hdmi_spec *spec = codec->spec; in pin_idx_to_pcm_jack()
1153 static void update_eld(struct hda_codec *codec, in update_eld() argument
1159 struct hdmi_spec *spec = codec->spec; in update_eld()
1167 snd_parse_eld(hda_codec_dev(codec), &eld->info, in update_eld()
1190 pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); in update_eld()
1208 pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); in update_eld()
1211 snd_show_eld(hda_codec_dev(codec), &eld->info); in update_eld()
1238 pin_cvt_fixup(codec, per_pin, 0); in update_eld()
1239 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in update_eld()
1243 snd_ctl_notify(codec->card, in update_eld()
1258 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense_via_verbs() local
1259 struct hdmi_spec *spec = codec->spec; in hdmi_present_sense_via_verbs()
1261 struct device *dev = hda_codec_dev(codec); in hdmi_present_sense_via_verbs()
1280 ret = snd_hda_power_up_pm(codec); in hdmi_present_sense_via_verbs()
1284 present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id); in hdmi_present_sense_via_verbs()
1293 codec_dbg(codec, in hdmi_present_sense_via_verbs()
1295 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); in hdmi_present_sense_via_verbs()
1298 if (spec->ops.pin_get_eld(codec, pin_nid, dev_id, in hdmi_present_sense_via_verbs()
1303 update_eld(codec, per_pin, eld, repoll); in hdmi_present_sense_via_verbs()
1306 snd_hda_power_down_pm(codec); in hdmi_present_sense_via_verbs()
1309 static void silent_stream_enable(struct hda_codec *codec, in silent_stream_enable() argument
1312 struct hdmi_spec *spec = codec->spec; in silent_stream_enable()
1321 err = snd_hda_power_up_pm(codec); in silent_stream_enable()
1323 codec_err(codec, in silent_stream_enable()
1325 snd_hda_power_down_pm(codec); in silent_stream_enable()
1332 codec_dbg(codec, "hdmi: PCM already open, no silent stream\n"); in silent_stream_enable()
1337 pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1338 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, true); in silent_stream_enable()
1340 codec_err(codec, "hdmi: no free converter to enable silent mode\n"); in silent_stream_enable()
1349 codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_enable()
1352 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1353 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in silent_stream_enable()
1358 pin_cvt_fixup(codec, per_pin, 0); in silent_stream_enable()
1360 spec->ops.silent_stream(codec, per_pin, true); in silent_stream_enable()
1365 snd_hda_power_down_pm(codec); in silent_stream_enable()
1368 static void silent_stream_disable(struct hda_codec *codec, in silent_stream_disable() argument
1371 struct hdmi_spec *spec = codec->spec; in silent_stream_disable()
1375 err = snd_hda_power_up_pm(codec); in silent_stream_disable()
1377 codec_err(codec, in silent_stream_disable()
1380 snd_hda_power_down_pm(codec); in silent_stream_disable()
1388 codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_disable()
1391 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in silent_stream_disable()
1397 spec->ops.silent_stream(codec, per_pin, false); in silent_stream_disable()
1405 snd_hda_power_down_pm(codec); in silent_stream_disable()
1409 static void sync_eld_via_acomp(struct hda_codec *codec, in sync_eld_via_acomp() argument
1412 struct hdmi_spec *spec = codec->spec; in sync_eld_via_acomp()
1419 eld->eld_size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, in sync_eld_via_acomp()
1423 update_eld(codec, per_pin, eld, 0); in sync_eld_via_acomp()
1429 silent_stream_enable(codec, per_pin); in sync_eld_via_acomp()
1431 silent_stream_disable(codec, per_pin); in sync_eld_via_acomp()
1437 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense() local
1439 if (!codec_has_acomp(codec)) in hdmi_present_sense()
1442 sync_eld_via_acomp(codec, per_pin); in hdmi_present_sense()
1449 struct hda_codec *codec = per_pin->codec; in hdmi_repoll_eld() local
1450 struct hdmi_spec *spec = codec->spec; in hdmi_repoll_eld()
1453 jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, in hdmi_repoll_eld()
1466 static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_add_pin() argument
1468 struct hdmi_spec *spec = codec->spec; in hdmi_add_pin()
1475 caps = snd_hda_query_pin_caps(codec, pin_nid); in hdmi_add_pin()
1483 config = snd_hda_codec_get_pincfg(codec, pin_nid); in hdmi_add_pin()
1500 } else if (codec->dp_mst) { in hdmi_add_pin()
1501 dev_num = snd_hda_get_num_devices(codec, pin_nid) + 1; in hdmi_add_pin()
1532 snd_hda_set_dev_select(codec, pin_nid, i); in hdmi_add_pin()
1533 err = hdmi_read_pin_conn(codec, pin_idx); in hdmi_add_pin()
1536 if (!is_jack_detectable(codec, pin_nid)) in hdmi_add_pin()
1537 codec_warn(codec, "HDMI: pin NID 0x%x - jack not detectable\n", pin_nid); in hdmi_add_pin()
1545 static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) in hdmi_add_cvt() argument
1547 struct hdmi_spec *spec = codec->spec; in hdmi_add_cvt()
1552 chans = get_wcaps(codec, cvt_nid); in hdmi_add_cvt()
1567 err = snd_hda_query_supported_pcm(codec, cvt_nid, in hdmi_add_cvt()
1597 int snd_hda_hdmi_parse_codec(struct hda_codec *codec) in snd_hda_hdmi_parse_codec() argument
1599 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_parse_codec()
1605 nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); in snd_hda_hdmi_parse_codec()
1607 codec_warn(codec, "HDMI: failed to get afg sub nodes\n"); in snd_hda_hdmi_parse_codec()
1614 q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); in snd_hda_hdmi_parse_codec()
1626 caps = get_wcaps(codec, nid); in snd_hda_hdmi_parse_codec()
1632 hdmi_add_cvt(codec, nid); in snd_hda_hdmi_parse_codec()
1639 caps = get_wcaps(codec, nid); in snd_hda_hdmi_parse_codec()
1645 hdmi_add_pin(codec, nid); in snd_hda_hdmi_parse_codec()
1654 static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) in check_non_pcm_per_cvt() argument
1659 mutex_lock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
1660 spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid); in check_non_pcm_per_cvt()
1665 mutex_unlock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
1669 mutex_unlock(&codec->spdif_mutex); in check_non_pcm_per_cvt()
1678 struct hda_codec *codec, in snd_hda_hdmi_generic_pcm_prepare() argument
1684 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_pcm_prepare()
1693 pin_idx = hinfo_to_pin_index(codec, hinfo); in snd_hda_hdmi_generic_pcm_prepare()
1698 pin_cvt_fixup(codec, NULL, cvt_nid); in snd_hda_hdmi_generic_pcm_prepare()
1699 snd_hda_codec_setup_stream(codec, cvt_nid, in snd_hda_hdmi_generic_pcm_prepare()
1714 pin_cvt_fixup(codec, per_pin, 0); in snd_hda_hdmi_generic_pcm_prepare()
1718 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_pcm_prepare()
1719 snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1722 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); in snd_hda_hdmi_generic_pcm_prepare()
1727 if (get_wcaps(codec, cvt_nid) & AC_WCAP_STRIPE) { in snd_hda_hdmi_generic_pcm_prepare()
1728 stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core, in snd_hda_hdmi_generic_pcm_prepare()
1730 snd_hda_codec_write(codec, cvt_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1735 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); in snd_hda_hdmi_generic_pcm_prepare()
1738 snd_hda_set_dev_select(codec, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1740 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1742 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1748 err = spec->ops.setup_stream(codec, cvt_nid, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1757 struct hda_codec *codec, in snd_hda_hdmi_generic_pcm_cleanup() argument
1760 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in snd_hda_hdmi_generic_pcm_cleanup()
1766 struct hda_codec *codec, in hdmi_pcm_close() argument
1769 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_close()
1778 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_close()
1783 cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); in hdmi_pcm_close()
1794 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in hdmi_pcm_close()
1796 pin_idx = hinfo_to_pin_index(codec, hinfo); in hdmi_pcm_close()
1807 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_close()
1809 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
1811 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
1840 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_get_spk_alloc() local
1841 struct hdmi_spec *spec = codec->spec; in hdmi_get_spk_alloc()
1853 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_get_chmap() local
1854 struct hdmi_spec *spec = codec->spec; in hdmi_get_chmap()
1867 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_set_chmap() local
1868 struct hdmi_spec *spec = codec->spec; in hdmi_set_chmap()
1877 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in hdmi_set_chmap()
1883 struct hda_codec *codec = hdac_to_hda_codec(hdac); in is_hdmi_pcm_attached() local
1884 struct hdmi_spec *spec = codec->spec; in is_hdmi_pcm_attached()
1890 int snd_hda_hdmi_generic_build_pcms(struct hda_codec *codec) in snd_hda_hdmi_generic_build_pcms() argument
1892 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_build_pcms()
1897 codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); in snd_hda_hdmi_generic_build_pcms()
1904 info = snd_hda_codec_pcm_new(codec, "HDMI %d", idx); in snd_hda_hdmi_generic_build_pcms()
1938 static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx) in generic_hdmi_build_jack() argument
1941 struct hdmi_spec *spec = codec->spec; in generic_hdmi_build_jack()
1949 err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack, in generic_hdmi_build_jack()
1960 int snd_hda_hdmi_generic_build_controls(struct hda_codec *codec) in snd_hda_hdmi_generic_build_controls() argument
1962 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_build_controls()
1973 err = generic_hdmi_build_jack(codec, pcm_idx); in snd_hda_hdmi_generic_build_controls()
1980 err = snd_hda_create_dig_out_ctls(codec, in snd_hda_hdmi_generic_build_controls()
1985 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in snd_hda_hdmi_generic_build_controls()
1990 err = hdmi_create_eld_ctl(codec, pcm_idx, dev); in snd_hda_hdmi_generic_build_controls()
2025 int snd_hda_hdmi_generic_init_per_pins(struct hda_codec *codec) in snd_hda_hdmi_generic_init_per_pins() argument
2027 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_init_per_pins()
2033 per_pin->codec = codec; in snd_hda_hdmi_generic_init_per_pins()
2042 int snd_hda_hdmi_generic_init(struct hda_codec *codec) in snd_hda_hdmi_generic_init() argument
2044 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_init()
2053 snd_hda_set_dev_select(codec, pin_nid, dev_id); in snd_hda_hdmi_generic_init()
2054 hdmi_init_pin(codec, pin_nid); in snd_hda_hdmi_generic_init()
2055 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_init()
2057 snd_hda_jack_detect_enable_callback_mst(codec, pin_nid, dev_id, in snd_hda_hdmi_generic_init()
2077 void snd_hda_hdmi_generic_spec_free(struct hda_codec *codec) in snd_hda_hdmi_generic_spec_free() argument
2079 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_spec_free()
2084 codec->spec = NULL; in snd_hda_hdmi_generic_spec_free()
2086 codec->dp_mst = false; in snd_hda_hdmi_generic_spec_free()
2090 void snd_hda_hdmi_generic_remove(struct hda_codec *codec) in snd_hda_hdmi_generic_remove() argument
2092 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_remove()
2096 snd_hdac_acomp_exit(&codec->bus->core); in snd_hda_hdmi_generic_remove()
2097 } else if (codec_has_acomp(codec)) { in snd_hda_hdmi_generic_remove()
2098 snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); in snd_hda_hdmi_generic_remove()
2100 codec->relaxed_resume = 0; in snd_hda_hdmi_generic_remove()
2111 snd_device_free(codec->card, spec->pcm_rec[pcm_idx].jack); in snd_hda_hdmi_generic_remove()
2114 snd_hda_hdmi_generic_spec_free(codec); in snd_hda_hdmi_generic_remove()
2118 int snd_hda_hdmi_generic_suspend(struct hda_codec *codec) in snd_hda_hdmi_generic_suspend() argument
2120 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_suspend()
2131 int snd_hda_hdmi_generic_resume(struct hda_codec *codec) in snd_hda_hdmi_generic_resume() argument
2133 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_resume()
2136 snd_hda_codec_init(codec); in snd_hda_hdmi_generic_resume()
2137 snd_hda_regmap_sync(codec); in snd_hda_hdmi_generic_resume()
2155 int snd_hda_hdmi_generic_alloc(struct hda_codec *codec) in snd_hda_hdmi_generic_alloc() argument
2163 spec->codec = codec; in snd_hda_hdmi_generic_alloc()
2168 snd_hdac_register_chmap_ops(&codec->core, &spec->chmap); in snd_hda_hdmi_generic_alloc()
2175 codec->spec = spec; in snd_hda_hdmi_generic_alloc()
2183 int snd_hda_hdmi_generic_probe(struct hda_codec *codec) in snd_hda_hdmi_generic_probe() argument
2187 err = snd_hda_hdmi_generic_alloc(codec); in snd_hda_hdmi_generic_probe()
2191 err = snd_hda_hdmi_parse_codec(codec); in snd_hda_hdmi_generic_probe()
2193 snd_hda_hdmi_generic_spec_free(codec); in snd_hda_hdmi_generic_probe()
2197 snd_hda_hdmi_generic_init_per_pins(codec); in snd_hda_hdmi_generic_probe()
2207 static void reprogram_jack_detect(struct hda_codec *codec, hda_nid_t nid, in reprogram_jack_detect() argument
2212 tbl = snd_hda_jack_tbl_get_mst(codec, nid, dev_id); in reprogram_jack_detect()
2218 snd_hda_codec_write_cache(codec, nid, 0, in reprogram_jack_detect()
2233 spec->codec->relaxed_resume = use_acomp; in generic_acomp_notifier_set()
2234 spec->codec->bus->keep_power = 0; in generic_acomp_notifier_set()
2237 reprogram_jack_detect(spec->codec, in generic_acomp_notifier_set()
2276 struct hda_codec *codec = audio_ptr; in snd_hda_hdmi_acomp_pin_eld_notify() local
2277 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_acomp_pin_eld_notify()
2278 hda_nid_t pin_nid = spec->port2pin(codec, port); in snd_hda_hdmi_acomp_pin_eld_notify()
2282 if (get_wcaps_type(get_wcaps(codec, pin_nid)) != AC_WID_PIN) in snd_hda_hdmi_acomp_pin_eld_notify()
2287 if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) in snd_hda_hdmi_acomp_pin_eld_notify()
2290 snd_hda_hdmi_check_presence_and_report(codec, pin_nid, dev_id); in snd_hda_hdmi_acomp_pin_eld_notify()
2295 void snd_hda_hdmi_setup_drm_audio_ops(struct hda_codec *codec, in snd_hda_hdmi_setup_drm_audio_ops() argument
2298 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_drm_audio_ops()
2300 spec->drm_audio_ops.audio_ptr = codec; in snd_hda_hdmi_setup_drm_audio_ops()
2314 void snd_hda_hdmi_acomp_init(struct hda_codec *codec, in snd_hda_hdmi_acomp_init() argument
2318 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_acomp_init()
2321 codec_info(codec, "audio component disabled by module option\n"); in snd_hda_hdmi_acomp_init()
2326 snd_hda_hdmi_setup_drm_audio_ops(codec, ops); in snd_hda_hdmi_acomp_init()
2327 if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, in snd_hda_hdmi_acomp_init()
2342 static int generichdmi_probe(struct hda_codec *codec, in generichdmi_probe() argument
2347 err = snd_hda_hdmi_generic_probe(codec); in generichdmi_probe()
2355 codec->no_sticky_stream = 1; in generichdmi_probe()