Lines Matching full: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()
163 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hdmi_eld_ctl_get() local
164 struct hdmi_spec *spec = codec->spec; in hdmi_eld_ctl_get()
203 static int hdmi_create_eld_ctl(struct hda_codec *codec, int pcm_idx, in hdmi_create_eld_ctl() argument
207 struct hdmi_spec *spec = codec->spec; in hdmi_create_eld_ctl()
210 kctl = snd_ctl_new1(&eld_bytes_ctl, codec); in hdmi_create_eld_ctl()
219 err = snd_hda_ctl_add(codec, 0, kctl); in hdmi_create_eld_ctl()
228 static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_get_dip_index() argument
233 val = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_get_dip_index()
241 static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_set_dip_index() argument
248 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); in hdmi_set_dip_index()
251 static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_write_dip_byte() argument
254 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); in hdmi_write_dip_byte()
257 static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_init_pin() argument
259 struct hdmi_spec *spec = codec->spec; in hdmi_init_pin()
263 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) in hdmi_init_pin()
264 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_init_pin()
276 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_init_pin()
307 struct hda_codec *codec = per_pin->codec; in eld_proc_new() local
311 snprintf(name, sizeof(name), "eld#%d.%d", codec->addr, index); in eld_proc_new()
312 err = snd_card_proc_new(codec->card, name, &entry); in eld_proc_new()
326 if (!per_pin->codec->bus->shutdown) { in eld_proc_free()
349 static void hdmi_start_infoframe_trans(struct hda_codec *codec, in hdmi_start_infoframe_trans() argument
352 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_start_infoframe_trans()
353 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, in hdmi_start_infoframe_trans()
360 static void hdmi_stop_infoframe_trans(struct hda_codec *codec, in hdmi_stop_infoframe_trans() argument
363 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_stop_infoframe_trans()
364 snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, in hdmi_stop_infoframe_trans()
368 static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_debug_dip_size() argument
374 size = snd_hdmi_get_eld_size(codec, pin_nid); in hdmi_debug_dip_size()
375 codec_dbg(codec, "HDMI: ELD buf size is %d\n", size); in hdmi_debug_dip_size()
378 size = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_debug_dip_size()
380 codec_dbg(codec, "HDMI: DIP GP[%d] buf size is %d\n", i, size); in hdmi_debug_dip_size()
385 static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_clear_dip_buffers() argument
392 size = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_clear_dip_buffers()
397 hdmi_set_dip_index(codec, pin_nid, i, 0x0); in hdmi_clear_dip_buffers()
399 hdmi_write_dip_byte(codec, pin_nid, 0x0); in hdmi_clear_dip_buffers()
400 hdmi_get_dip_index(codec, pin_nid, &pi, &bi); in hdmi_clear_dip_buffers()
402 codec_dbg(codec, "dip index %d: %d != %d\n", in hdmi_clear_dip_buffers()
407 codec_dbg(codec, in hdmi_clear_dip_buffers()
428 static void hdmi_fill_audio_infoframe(struct hda_codec *codec, in hdmi_fill_audio_infoframe() argument
434 hdmi_debug_dip_size(codec, pin_nid); in hdmi_fill_audio_infoframe()
435 hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ in hdmi_fill_audio_infoframe()
437 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_fill_audio_infoframe()
439 hdmi_write_dip_byte(codec, pin_nid, dip[i]); in hdmi_fill_audio_infoframe()
442 static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_infoframe_uptodate() argument
448 hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); in hdmi_infoframe_uptodate()
449 if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) in hdmi_infoframe_uptodate()
454 val = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_infoframe_uptodate()
463 static int hdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid, in hdmi_pin_get_eld() argument
466 snd_hda_set_dev_select(codec, nid, dev_id); in hdmi_pin_get_eld()
468 return snd_hdmi_get_eld(codec, nid, buf, eld_size); in hdmi_pin_get_eld()
471 static void hdmi_pin_setup_infoframe(struct hda_codec *codec, in hdmi_pin_setup_infoframe() argument
476 struct hdmi_spec *spec = codec->spec; in hdmi_pin_setup_infoframe()
506 codec_dbg(codec, "HDMI: unknown connection type at pin NID 0x%x\n", pin_nid); in hdmi_pin_setup_infoframe()
510 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_pin_setup_infoframe()
517 if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes, in hdmi_pin_setup_infoframe()
519 codec_dbg(codec, "%s: pin NID=0x%x channels=%d ca=0x%02x\n", in hdmi_pin_setup_infoframe()
521 hdmi_stop_infoframe_trans(codec, pin_nid); in hdmi_pin_setup_infoframe()
522 hdmi_fill_audio_infoframe(codec, pin_nid, in hdmi_pin_setup_infoframe()
524 hdmi_start_infoframe_trans(codec, pin_nid); in hdmi_pin_setup_infoframe()
528 void snd_hda_hdmi_setup_audio_infoframe(struct hda_codec *codec, in snd_hda_hdmi_setup_audio_infoframe() argument
532 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_audio_infoframe()
544 snd_hda_set_dev_select(codec, pin_nid, dev_id); in snd_hda_hdmi_setup_audio_infoframe()
547 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) in snd_hda_hdmi_setup_audio_infoframe()
548 snd_hda_codec_write(codec, pin_nid, 0, in snd_hda_hdmi_setup_audio_infoframe()
554 ca = snd_hdac_channel_allocation(&codec->core, in snd_hda_hdmi_setup_audio_infoframe()
560 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid, in snd_hda_hdmi_setup_audio_infoframe()
571 spec->ops.pin_setup_infoframe(codec, pin_nid, dev_id, in snd_hda_hdmi_setup_audio_infoframe()
584 void snd_hda_hdmi_check_presence_and_report(struct hda_codec *codec, in snd_hda_hdmi_check_presence_and_report() argument
587 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_check_presence_and_report()
588 int pin_idx = pin_id_to_pin_index(codec, nid, dev_id); in snd_hda_hdmi_check_presence_and_report()
598 static void jack_callback(struct hda_codec *codec, in jack_callback() argument
602 if (codec_has_acomp(codec)) in jack_callback()
605 snd_hda_hdmi_check_presence_and_report(codec, jack->nid, jack->dev_id); in jack_callback()
608 static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res, in hdmi_intrinsic_event() argument
613 codec_dbg(codec, in hdmi_intrinsic_event()
614 "HDMI hot plug event: Codec=%d NID=0x%x Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", in hdmi_intrinsic_event()
615 codec->addr, jack->nid, jack->dev_id, !!(res & AC_UNSOL_RES_IA), in hdmi_intrinsic_event()
618 snd_hda_hdmi_check_presence_and_report(codec, jack->nid, jack->dev_id); in hdmi_intrinsic_event()
621 static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) in hdmi_non_intrinsic_event() argument
628 codec_info(codec, in hdmi_non_intrinsic_event()
629 "HDMI CP event: CODEC=%d TAG=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", in hdmi_non_intrinsic_event()
630 codec->addr, in hdmi_non_intrinsic_event()
645 void snd_hda_hdmi_generic_unsol_event(struct hda_codec *codec, unsigned int res) in snd_hda_hdmi_generic_unsol_event() argument
651 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_unsol_event()
654 if (codec->dp_mst) { in snd_hda_hdmi_generic_unsol_event()
658 jack = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry); in snd_hda_hdmi_generic_unsol_event()
660 jack = snd_hda_jack_tbl_get_from_tag(codec, tag, 0); in snd_hda_hdmi_generic_unsol_event()
664 codec_dbg(codec, "Unexpected HDMI event tag 0x%x\n", tag); in snd_hda_hdmi_generic_unsol_event()
669 hdmi_intrinsic_event(codec, res, jack); in snd_hda_hdmi_generic_unsol_event()
671 hdmi_non_intrinsic_event(codec, res); in snd_hda_hdmi_generic_unsol_event()
683 static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid, in hdmi_pin_hbr_setup() argument
688 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { in hdmi_pin_hbr_setup()
689 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_pin_hbr_setup()
690 pinctl = snd_hda_codec_read(codec, pin_nid, 0, in hdmi_pin_hbr_setup()
702 codec_dbg(codec, in hdmi_pin_hbr_setup()
709 snd_hda_codec_write(codec, pin_nid, 0, in hdmi_pin_hbr_setup()
718 int snd_hda_hdmi_setup_stream(struct hda_codec *codec, in snd_hda_hdmi_setup_stream() argument
723 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_stream()
727 err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id, in snd_hda_hdmi_setup_stream()
731 codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n"); in snd_hda_hdmi_setup_stream()
742 param = snd_hda_codec_read(codec, cvt_nid, 0, in snd_hda_hdmi_setup_stream()
751 snd_hda_codec_write(codec, cvt_nid, 0, in snd_hda_hdmi_setup_stream()
755 snd_hda_codec_setup_stream(codec, cvt_nid, stream_tag, 0, format); in snd_hda_hdmi_setup_stream()
765 static int hdmi_choose_cvt(struct hda_codec *codec, in hdmi_choose_cvt() argument
769 struct hdmi_spec *spec = codec->spec; in hdmi_choose_cvt()
781 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in hdmi_choose_cvt()
823 static void pin_cvt_fixup(struct hda_codec *codec, in pin_cvt_fixup() argument
827 struct hdmi_spec *spec = codec->spec; in pin_cvt_fixup()
830 spec->ops.pin_cvt_fixup(codec, per_pin, cvt_nid); in pin_cvt_fixup()
835 struct hda_codec *codec, in hdmi_pcm_open_no_pin() argument
838 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open_no_pin()
844 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_open_no_pin()
848 err = hdmi_choose_cvt(codec, -1, &cvt_idx, false); in hdmi_pcm_open_no_pin()
856 pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid); in hdmi_pcm_open_no_pin()
883 struct hda_codec *codec, in hdmi_pcm_open() argument
886 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_open()
895 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_open()
900 pin_idx = hinfo_to_pin_index(codec, hinfo); in hdmi_pcm_open()
905 return hdmi_pcm_open_no_pin(hinfo, codec, substream); in hdmi_pcm_open()
907 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, false); in hdmi_pcm_open()
921 if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE) in hdmi_pcm_open()
924 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in hdmi_pcm_open()
925 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_open()
930 pin_cvt_fixup(codec, per_pin, 0); in hdmi_pcm_open()
932 snd_hda_spdif_ctls_assign(codec, pcm_idx, per_cvt->cvt_nid); in hdmi_pcm_open()
949 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in hdmi_pcm_open()
968 static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) in hdmi_read_pin_conn() argument
970 struct hdmi_spec *spec = codec->spec; in hdmi_read_pin_conn()
976 if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { in hdmi_read_pin_conn()
977 codec_warn(codec, in hdmi_read_pin_conn()
979 pin_nid, get_wcaps(codec, pin_nid)); in hdmi_read_pin_conn()
983 snd_hda_set_dev_select(codec, pin_nid, dev_id); in hdmi_read_pin_conn()
990 conns = snd_hda_get_raw_connections(codec, pin_nid, in hdmi_read_pin_conn()
1064 static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid);
1069 struct hda_codec *codec = per_pin->codec; in hdmi_pcm_setup_pin() local
1092 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_setup_pin()
1094 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in hdmi_pcm_setup_pin()
1098 snd_hda_spdif_ctls_assign(codec, per_pin->pcm_idx, hinfo->nid); in hdmi_pcm_setup_pin()
1100 non_pcm = check_non_pcm_per_cvt(codec, hinfo->nid); in hdmi_pcm_setup_pin()
1106 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); in hdmi_pcm_setup_pin()
1113 snd_hda_spdif_ctls_unassign(per_pin->codec, per_pin->pcm_idx); in hdmi_pcm_reset_pin()
1122 static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec, in pin_idx_to_pcm_jack() argument
1125 struct hdmi_spec *spec = codec->spec; in pin_idx_to_pcm_jack()
1137 static void update_eld(struct hda_codec *codec, in update_eld() argument
1143 struct hdmi_spec *spec = codec->spec; in update_eld()
1151 snd_parse_eld(hda_codec_dev(codec), &eld->info, in update_eld()
1174 pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); in update_eld()
1192 pcm_jack = pin_idx_to_pcm_jack(codec, per_pin); in update_eld()
1195 snd_show_eld(hda_codec_dev(codec), &eld->info); in update_eld()
1222 pin_cvt_fixup(codec, per_pin, 0); in update_eld()
1223 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in update_eld()
1227 snd_ctl_notify(codec->card, in update_eld()
1242 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense_via_verbs() local
1243 struct hdmi_spec *spec = codec->spec; in hdmi_present_sense_via_verbs()
1245 struct device *dev = hda_codec_dev(codec); in hdmi_present_sense_via_verbs()
1263 CLASS(snd_hda_power_pm, pm)(codec); in hdmi_present_sense_via_verbs()
1267 present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id); in hdmi_present_sense_via_verbs()
1276 codec_dbg(codec, in hdmi_present_sense_via_verbs()
1277 "HDMI status: Codec=%d NID=0x%x Presence_Detect=%d ELD_Valid=%d\n", in hdmi_present_sense_via_verbs()
1278 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); in hdmi_present_sense_via_verbs()
1281 if (spec->ops.pin_get_eld(codec, pin_nid, dev_id, in hdmi_present_sense_via_verbs()
1286 update_eld(codec, per_pin, eld, repoll); in hdmi_present_sense_via_verbs()
1289 static void silent_stream_enable(struct hda_codec *codec, in silent_stream_enable() argument
1292 struct hdmi_spec *spec = codec->spec; in silent_stream_enable()
1301 CLASS(snd_hda_power_pm, pm)(codec); in silent_stream_enable()
1303 codec_err(codec, in silent_stream_enable()
1304 "Failed to power up codec for silent stream enable ret=[%d]\n", pm.err); in silent_stream_enable()
1311 codec_dbg(codec, "hdmi: PCM already open, no silent stream\n"); in silent_stream_enable()
1315 pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1316 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, true); in silent_stream_enable()
1318 codec_err(codec, "hdmi: no free converter to enable silent mode\n"); in silent_stream_enable()
1327 codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_enable()
1330 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); in silent_stream_enable()
1331 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, in silent_stream_enable()
1336 pin_cvt_fixup(codec, per_pin, 0); in silent_stream_enable()
1338 spec->ops.silent_stream(codec, per_pin, true); in silent_stream_enable()
1341 static void silent_stream_disable(struct hda_codec *codec, in silent_stream_disable() argument
1344 struct hdmi_spec *spec = codec->spec; in silent_stream_disable()
1348 CLASS(snd_hda_power_pm, pm)(codec); in silent_stream_disable()
1350 codec_err(codec, in silent_stream_disable()
1351 "Failed to power up codec for silent stream disable ret=[%d]\n", in silent_stream_disable()
1360 codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n", in silent_stream_disable()
1363 cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); in silent_stream_disable()
1369 spec->ops.silent_stream(codec, per_pin, false); in silent_stream_disable()
1376 static void sync_eld_via_acomp(struct hda_codec *codec, in sync_eld_via_acomp() argument
1379 struct hdmi_spec *spec = codec->spec; in sync_eld_via_acomp()
1386 eld->eld_size = snd_hdac_acomp_get_eld(&codec->core, per_pin->pin_nid, in sync_eld_via_acomp()
1390 update_eld(codec, per_pin, eld, 0); in sync_eld_via_acomp()
1396 silent_stream_enable(codec, per_pin); in sync_eld_via_acomp()
1398 silent_stream_disable(codec, per_pin); in sync_eld_via_acomp()
1404 struct hda_codec *codec = per_pin->codec; in hdmi_present_sense() local
1406 if (!codec_has_acomp(codec)) in hdmi_present_sense()
1409 sync_eld_via_acomp(codec, per_pin); in hdmi_present_sense()
1416 struct hda_codec *codec = per_pin->codec; in hdmi_repoll_eld() local
1417 struct hdmi_spec *spec = codec->spec; in hdmi_repoll_eld()
1420 jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid, in hdmi_repoll_eld()
1432 static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) in hdmi_add_pin() argument
1434 struct hdmi_spec *spec = codec->spec; in hdmi_add_pin()
1441 caps = snd_hda_query_pin_caps(codec, pin_nid); in hdmi_add_pin()
1449 config = snd_hda_codec_get_pincfg(codec, pin_nid); in hdmi_add_pin()
1466 } else if (codec->dp_mst) { in hdmi_add_pin()
1467 dev_num = snd_hda_get_num_devices(codec, pin_nid) + 1; in hdmi_add_pin()
1498 snd_hda_set_dev_select(codec, pin_nid, i); in hdmi_add_pin()
1499 err = hdmi_read_pin_conn(codec, pin_idx); in hdmi_add_pin()
1502 if (!is_jack_detectable(codec, pin_nid)) in hdmi_add_pin()
1503 codec_warn(codec, "HDMI: pin NID 0x%x - jack not detectable\n", pin_nid); in hdmi_add_pin()
1511 static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) in hdmi_add_cvt() argument
1513 struct hdmi_spec *spec = codec->spec; in hdmi_add_cvt()
1518 chans = get_wcaps(codec, cvt_nid); in hdmi_add_cvt()
1533 err = snd_hda_query_supported_pcm(codec, cvt_nid, in hdmi_add_cvt()
1565 int snd_hda_hdmi_parse_codec(struct hda_codec *codec) in snd_hda_hdmi_parse_codec() argument
1567 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_parse_codec()
1573 nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); in snd_hda_hdmi_parse_codec()
1575 codec_warn(codec, "HDMI: failed to get afg sub nodes\n"); in snd_hda_hdmi_parse_codec()
1582 q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); in snd_hda_hdmi_parse_codec()
1594 caps = get_wcaps(codec, nid); in snd_hda_hdmi_parse_codec()
1600 hdmi_add_cvt(codec, nid); in snd_hda_hdmi_parse_codec()
1607 caps = get_wcaps(codec, nid); in snd_hda_hdmi_parse_codec()
1613 hdmi_add_pin(codec, nid); in snd_hda_hdmi_parse_codec()
1622 static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) in check_non_pcm_per_cvt() argument
1626 guard(mutex)(&codec->spdif_mutex); in check_non_pcm_per_cvt()
1627 spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid); in check_non_pcm_per_cvt()
1641 struct hda_codec *codec, in snd_hda_hdmi_generic_pcm_prepare() argument
1647 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_pcm_prepare()
1655 pin_idx = hinfo_to_pin_index(codec, hinfo); in snd_hda_hdmi_generic_pcm_prepare()
1660 pin_cvt_fixup(codec, NULL, cvt_nid); in snd_hda_hdmi_generic_pcm_prepare()
1661 snd_hda_codec_setup_stream(codec, cvt_nid, in snd_hda_hdmi_generic_pcm_prepare()
1676 pin_cvt_fixup(codec, per_pin, 0); in snd_hda_hdmi_generic_pcm_prepare()
1680 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_pcm_prepare()
1681 snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1684 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); in snd_hda_hdmi_generic_pcm_prepare()
1689 if (get_wcaps(codec, cvt_nid) & AC_WCAP_STRIPE) { in snd_hda_hdmi_generic_pcm_prepare()
1690 stripe = snd_hdac_get_stream_stripe_ctl(&codec->bus->core, in snd_hda_hdmi_generic_pcm_prepare()
1692 snd_hda_codec_write(codec, cvt_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1697 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); in snd_hda_hdmi_generic_pcm_prepare()
1700 snd_hda_set_dev_select(codec, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1702 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1704 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in snd_hda_hdmi_generic_pcm_prepare()
1710 return spec->ops.setup_stream(codec, cvt_nid, per_pin->pin_nid, in snd_hda_hdmi_generic_pcm_prepare()
1716 struct hda_codec *codec, in snd_hda_hdmi_generic_pcm_cleanup() argument
1719 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in snd_hda_hdmi_generic_pcm_cleanup()
1725 struct hda_codec *codec, in hdmi_pcm_close() argument
1728 struct hdmi_spec *spec = codec->spec; in hdmi_pcm_close()
1736 pcm_idx = hinfo_to_pcm_index(codec, hinfo); in hdmi_pcm_close()
1739 cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); in hdmi_pcm_close()
1748 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in hdmi_pcm_close()
1750 pin_idx = hinfo_to_pin_index(codec, hinfo); in hdmi_pcm_close()
1761 snd_hda_set_dev_select(codec, per_pin->pin_nid, in hdmi_pcm_close()
1763 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
1765 snd_hda_codec_write(codec, per_pin->pin_nid, 0, in hdmi_pcm_close()
1790 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_get_spk_alloc() local
1791 struct hdmi_spec *spec = codec->spec; in hdmi_get_spk_alloc()
1803 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_get_chmap() local
1804 struct hdmi_spec *spec = codec->spec; in hdmi_get_chmap()
1817 struct hda_codec *codec = hdac_to_hda_codec(hdac); in hdmi_set_chmap() local
1818 struct hdmi_spec *spec = codec->spec; in hdmi_set_chmap()
1827 snd_hda_hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); in hdmi_set_chmap()
1832 struct hda_codec *codec = hdac_to_hda_codec(hdac); in is_hdmi_pcm_attached() local
1833 struct hdmi_spec *spec = codec->spec; in is_hdmi_pcm_attached()
1839 int snd_hda_hdmi_generic_build_pcms(struct hda_codec *codec) in snd_hda_hdmi_generic_build_pcms() argument
1841 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_build_pcms()
1844 /* limit the PCM devices to the codec converters or available PINs */ in snd_hda_hdmi_generic_build_pcms()
1846 codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); in snd_hda_hdmi_generic_build_pcms()
1853 info = snd_hda_codec_pcm_new(codec, "HDMI %d", idx); in snd_hda_hdmi_generic_build_pcms()
1887 static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx) in generic_hdmi_build_jack() argument
1890 struct hdmi_spec *spec = codec->spec; in generic_hdmi_build_jack()
1898 err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack, in generic_hdmi_build_jack()
1909 int snd_hda_hdmi_generic_build_controls(struct hda_codec *codec) in snd_hda_hdmi_generic_build_controls() argument
1911 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_build_controls()
1922 err = generic_hdmi_build_jack(codec, pcm_idx); in snd_hda_hdmi_generic_build_controls()
1929 err = snd_hda_create_dig_out_ctls(codec, in snd_hda_hdmi_generic_build_controls()
1934 snd_hda_spdif_ctls_unassign(codec, pcm_idx); in snd_hda_hdmi_generic_build_controls()
1939 err = hdmi_create_eld_ctl(codec, pcm_idx, dev); in snd_hda_hdmi_generic_build_controls()
1974 int snd_hda_hdmi_generic_init_per_pins(struct hda_codec *codec) in snd_hda_hdmi_generic_init_per_pins() argument
1976 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_init_per_pins()
1982 per_pin->codec = codec; in snd_hda_hdmi_generic_init_per_pins()
1991 int snd_hda_hdmi_generic_init(struct hda_codec *codec) in snd_hda_hdmi_generic_init() argument
1993 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_init()
2002 snd_hda_set_dev_select(codec, pin_nid, dev_id); in snd_hda_hdmi_generic_init()
2003 hdmi_init_pin(codec, pin_nid); in snd_hda_hdmi_generic_init()
2004 if (codec_has_acomp(codec)) in snd_hda_hdmi_generic_init()
2006 snd_hda_jack_detect_enable_callback_mst(codec, pin_nid, dev_id, in snd_hda_hdmi_generic_init()
2025 void snd_hda_hdmi_generic_spec_free(struct hda_codec *codec) in snd_hda_hdmi_generic_spec_free() argument
2027 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_spec_free()
2032 codec->spec = NULL; in snd_hda_hdmi_generic_spec_free()
2034 codec->dp_mst = false; in snd_hda_hdmi_generic_spec_free()
2038 void snd_hda_hdmi_generic_remove(struct hda_codec *codec) in snd_hda_hdmi_generic_remove() argument
2040 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_remove()
2044 snd_hdac_acomp_exit(&codec->bus->core); in snd_hda_hdmi_generic_remove()
2045 } else if (codec_has_acomp(codec)) { in snd_hda_hdmi_generic_remove()
2046 snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); in snd_hda_hdmi_generic_remove()
2048 codec->relaxed_resume = 0; in snd_hda_hdmi_generic_remove()
2059 snd_device_free(codec->card, spec->pcm_rec[pcm_idx].jack); in snd_hda_hdmi_generic_remove()
2062 snd_hda_hdmi_generic_spec_free(codec); in snd_hda_hdmi_generic_remove()
2066 int snd_hda_hdmi_generic_suspend(struct hda_codec *codec) in snd_hda_hdmi_generic_suspend() argument
2068 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_suspend()
2079 int snd_hda_hdmi_generic_resume(struct hda_codec *codec) in snd_hda_hdmi_generic_resume() argument
2081 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_generic_resume()
2084 snd_hda_codec_init(codec); in snd_hda_hdmi_generic_resume()
2085 snd_hda_regmap_sync(codec); in snd_hda_hdmi_generic_resume()
2102 /* allocate codec->spec and assign/initialize generic parser ops */
2103 int snd_hda_hdmi_generic_alloc(struct hda_codec *codec) in snd_hda_hdmi_generic_alloc() argument
2111 spec->codec = codec; in snd_hda_hdmi_generic_alloc()
2116 snd_hdac_register_chmap_ops(&codec->core, &spec->chmap); in snd_hda_hdmi_generic_alloc()
2123 codec->spec = spec; in snd_hda_hdmi_generic_alloc()
2131 int snd_hda_hdmi_generic_probe(struct hda_codec *codec) in snd_hda_hdmi_generic_probe() argument
2135 err = snd_hda_hdmi_generic_alloc(codec); in snd_hda_hdmi_generic_probe()
2139 err = snd_hda_hdmi_parse_codec(codec); in snd_hda_hdmi_generic_probe()
2141 snd_hda_hdmi_generic_spec_free(codec); in snd_hda_hdmi_generic_probe()
2145 snd_hda_hdmi_generic_init_per_pins(codec); in snd_hda_hdmi_generic_probe()
2155 static void reprogram_jack_detect(struct hda_codec *codec, hda_nid_t nid, in reprogram_jack_detect() argument
2160 tbl = snd_hda_jack_tbl_get_mst(codec, nid, dev_id); in reprogram_jack_detect()
2166 snd_hda_codec_write_cache(codec, nid, 0, in reprogram_jack_detect()
2181 spec->codec->relaxed_resume = use_acomp; in generic_acomp_notifier_set()
2182 spec->codec->bus->keep_power = 0; in generic_acomp_notifier_set()
2185 reprogram_jack_detect(spec->codec, in generic_acomp_notifier_set()
2223 struct hda_codec *codec = audio_ptr; in snd_hda_hdmi_acomp_pin_eld_notify() local
2224 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_acomp_pin_eld_notify()
2225 hda_nid_t pin_nid = spec->port2pin(codec, port); in snd_hda_hdmi_acomp_pin_eld_notify()
2229 if (get_wcaps_type(get_wcaps(codec, pin_nid)) != AC_WID_PIN) in snd_hda_hdmi_acomp_pin_eld_notify()
2234 if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) in snd_hda_hdmi_acomp_pin_eld_notify()
2237 snd_hda_hdmi_check_presence_and_report(codec, pin_nid, dev_id); in snd_hda_hdmi_acomp_pin_eld_notify()
2242 void snd_hda_hdmi_setup_drm_audio_ops(struct hda_codec *codec, in snd_hda_hdmi_setup_drm_audio_ops() argument
2245 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_setup_drm_audio_ops()
2247 spec->drm_audio_ops.audio_ptr = codec; in snd_hda_hdmi_setup_drm_audio_ops()
2261 void snd_hda_hdmi_acomp_init(struct hda_codec *codec, in snd_hda_hdmi_acomp_init() argument
2265 struct hdmi_spec *spec = codec->spec; in snd_hda_hdmi_acomp_init()
2268 codec_info(codec, "audio component disabled by module option\n"); in snd_hda_hdmi_acomp_init()
2273 snd_hda_hdmi_setup_drm_audio_ops(codec, ops); in snd_hda_hdmi_acomp_init()
2274 if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, in snd_hda_hdmi_acomp_init()
2289 static int generichdmi_probe(struct hda_codec *codec, in generichdmi_probe() argument
2294 err = snd_hda_hdmi_generic_probe(codec); in generichdmi_probe()
2298 * Glenfly GPUs have two codecs, stream switches from one codec to in generichdmi_probe()
2302 codec->no_sticky_stream = 1; in generichdmi_probe()
2356 MODULE_DESCRIPTION("Generic HDMI HD-audio codec");