Lines Matching +full:hdmi +full:- +full:dp1
1 // SPDX-License-Identifier: GPL-2.0-only
3 * hdac_hdmi.c - ASoc HDA-HDMI codec driver for Intel platforms
5 * Copyright (C) 2014-2015 Intel Corp
17 #include <linux/hdmi.h>
107 unsigned char chmap[8]; /* ALSA API channel-map */
140 #define hdev_to_hdmi_priv(_hdev) dev_get_drvdata(&(_hdev)->dev)
143 hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi, in hdac_hdmi_get_pcm_from_cvt() argument
148 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in hdac_hdmi_get_pcm_from_cvt()
149 if (pcm->cvt == cvt) in hdac_hdmi_get_pcm_from_cvt()
159 struct hdac_device *hdev = port->pin->hdev; in hdac_hdmi_jack_report()
161 port->is_connect = is_connect; in hdac_hdmi_jack_report()
168 if (pcm->jack_event == 0) { in hdac_hdmi_jack_report()
169 dev_dbg(&hdev->dev, in hdac_hdmi_jack_report()
171 pcm->pcm_id); in hdac_hdmi_jack_report()
172 snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT, in hdac_hdmi_jack_report()
175 pcm->jack_event++; in hdac_hdmi_jack_report()
182 if (pcm->jack_event == 1) in hdac_hdmi_jack_report()
183 snd_soc_jack_report(pcm->jack, 0, SND_JACK_AVOUT); in hdac_hdmi_jack_report()
184 if (pcm->jack_event > 0) in hdac_hdmi_jack_report()
185 pcm->jack_event--; in hdac_hdmi_jack_report()
191 if (port->is_connect) in hdac_hdmi_port_dapm_update()
192 snd_soc_dapm_enable_pin(port->dapm, port->jack_pin); in hdac_hdmi_port_dapm_update()
194 snd_soc_dapm_disable_pin(port->dapm, port->jack_pin); in hdac_hdmi_port_dapm_update()
195 snd_soc_dapm_sync(port->dapm); in hdac_hdmi_port_dapm_update()
229 if (param == -1) in hdac_hdmi_get_port_len()
243 return snd_hdac_codec_read(hdev, port->pin->nid, in hdac_hdmi_port_select_get()
256 if (!port->pin->mst_capable) in hdac_hdmi_port_select_set()
260 num_ports = hdac_hdmi_get_port_len(hdev, port->pin->nid); in hdac_hdmi_port_select_set()
262 return -EIO; in hdac_hdmi_port_select_set()
267 if (num_ports + 1 < port->id) in hdac_hdmi_port_select_set()
270 snd_hdac_codec_write(hdev, port->pin->nid, 0, in hdac_hdmi_port_select_set()
271 AC_VERB_SET_DEVICE_SEL, port->id); in hdac_hdmi_port_select_set()
273 if (port->id != hdac_hdmi_port_select_get(hdev, port)) in hdac_hdmi_port_select_set()
274 return -EIO; in hdac_hdmi_port_select_set()
276 dev_dbg(&hdev->dev, "Selected the port=%d\n", port->id); in hdac_hdmi_port_select_set()
281 static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi, in get_hdmi_pcm_from_id() argument
286 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in get_hdmi_pcm_from_id()
287 if (pcm->pcm_id == pcm_idx) in get_hdmi_pcm_from_id()
315 for (i = drm_eld_sad_count(eld_buf); i > 0; i--, sad += 3) { in hdac_hdmi_eld_limit_formats()
348 u8 CC02_CT47; /* match with HDMI infoframe from this on */
360 struct hdac_hdmi_pin *pin = port->pin; in hdac_hdmi_setup_audio_infoframe()
362 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_setup_audio_infoframe() local
363 struct hdac_hdmi_cvt *cvt = pcm->cvt; in hdac_hdmi_setup_audio_infoframe()
371 ca = snd_hdac_channel_allocation(hdev, port->eld.info.spk_alloc, in hdac_hdmi_setup_audio_infoframe()
372 pcm->channels, pcm->chmap_set, true, pcm->chmap); in hdac_hdmi_setup_audio_infoframe()
375 hdmi->chmap.ops.set_channel_count(hdev, cvt->nid, channels); in hdac_hdmi_setup_audio_infoframe()
377 snd_hdac_setup_channel_mapping(&hdmi->chmap, pin->nid, false, ca, in hdac_hdmi_setup_audio_infoframe()
378 pcm->channels, pcm->chmap, pcm->chmap_set); in hdac_hdmi_setup_audio_infoframe()
380 eld_buf = port->eld.eld_buffer; in hdac_hdmi_setup_audio_infoframe()
401 dp_ai.CC02_CT47 = channels - 1; in hdac_hdmi_setup_audio_infoframe()
408 dev_err(&hdev->dev, "Invalid connection type: %d\n", conn_type); in hdac_hdmi_setup_audio_infoframe()
409 return -EIO; in hdac_hdmi_setup_audio_infoframe()
413 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0); in hdac_hdmi_setup_audio_infoframe()
414 snd_hdac_codec_write(hdev, pin->nid, 0, in hdac_hdmi_setup_audio_infoframe()
418 /* Fill infoframe. Index auto-incremented */ in hdac_hdmi_setup_audio_infoframe()
419 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0); in hdac_hdmi_setup_audio_infoframe()
422 snd_hdac_codec_write(hdev, pin->nid, 0, in hdac_hdmi_setup_audio_infoframe()
426 snd_hdac_codec_write(hdev, pin->nid, 0, in hdac_hdmi_setup_audio_infoframe()
431 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0); in hdac_hdmi_setup_audio_infoframe()
432 snd_hdac_codec_write(hdev, pin->nid, 0, in hdac_hdmi_setup_audio_infoframe()
441 struct hdac_hdmi_priv *hdmi = snd_soc_dai_get_drvdata(dai); in hdac_hdmi_set_stream() local
442 struct hdac_device *hdev = hdmi->hdev; in hdac_hdmi_set_stream()
448 return -EINVAL; in hdac_hdmi_set_stream()
452 dev_dbg(&hdev->dev, "%s: strm_tag: %d\n", __func__, hstream->stream_tag); in hdac_hdmi_set_stream()
454 dai_map = &hdmi->dai_map[dai->id]; in hdac_hdmi_set_stream()
456 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, dai_map->cvt); in hdac_hdmi_set_stream()
459 pcm->stream_tag = (hstream->stream_tag << 4); in hdac_hdmi_set_stream()
467 struct hdac_hdmi_priv *hdmi = snd_soc_dai_get_drvdata(dai); in hdac_hdmi_set_hw_params() local
473 dai_map = &hdmi->dai_map[dai->id]; in hdac_hdmi_set_hw_params()
476 dai->driver->playback.sig_bits); in hdac_hdmi_set_hw_params()
479 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, dai_map->cvt); in hdac_hdmi_set_hw_params()
481 return -EIO; in hdac_hdmi_set_hw_params()
483 pcm->format = format; in hdac_hdmi_set_hw_params()
484 pcm->channels = params_channels(hparams); in hdac_hdmi_set_hw_params()
493 if (!(snd_hdac_get_wcaps(hdev, pin->nid) & AC_WCAP_CONN_LIST)) { in hdac_hdmi_query_port_connlist()
494 dev_warn(&hdev->dev, in hdac_hdmi_query_port_connlist()
495 "HDMI: pin %d wcaps %#x does not support connection list\n", in hdac_hdmi_query_port_connlist()
496 pin->nid, snd_hdac_get_wcaps(hdev, pin->nid)); in hdac_hdmi_query_port_connlist()
497 return -EINVAL; in hdac_hdmi_query_port_connlist()
501 return -EIO; in hdac_hdmi_query_port_connlist()
503 port->num_mux_nids = snd_hdac_get_connections(hdev, pin->nid, in hdac_hdmi_query_port_connlist()
504 port->mux_nids, HDA_MAX_CONNECTIONS); in hdac_hdmi_query_port_connlist()
505 if (port->num_mux_nids == 0) in hdac_hdmi_query_port_connlist()
506 dev_warn(&hdev->dev, in hdac_hdmi_query_port_connlist()
508 pin->nid, port->id); in hdac_hdmi_query_port_connlist()
510 dev_dbg(&hdev->dev, "num_mux_nids %d for pin:port %d:%d\n", in hdac_hdmi_query_port_connlist()
511 port->num_mux_nids, pin->nid, port->id); in hdac_hdmi_query_port_connlist()
513 return port->num_mux_nids; in hdac_hdmi_query_port_connlist()
527 struct hdac_hdmi_priv *hdmi, in hdac_hdmi_get_port_from_cvt() argument
534 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in hdac_hdmi_get_port_from_cvt()
535 if (pcm->cvt == cvt) { in hdac_hdmi_get_port_from_cvt()
536 if (list_empty(&pcm->port_list)) in hdac_hdmi_get_port_from_cvt()
539 list_for_each_entry(port, &pcm->port_list, head) { in hdac_hdmi_get_port_from_cvt()
540 mutex_lock(&pcm->lock); in hdac_hdmi_get_port_from_cvt()
542 port->pin, port); in hdac_hdmi_get_port_from_cvt()
543 mutex_unlock(&pcm->lock); in hdac_hdmi_get_port_from_cvt()
547 for (i = 0; i < port->num_mux_nids; i++) { in hdac_hdmi_get_port_from_cvt()
548 if (port->mux_nids[i] == cvt->nid && in hdac_hdmi_get_port_from_cvt()
549 port->eld.monitor_present && in hdac_hdmi_get_port_from_cvt()
550 port->eld.eld_valid) in hdac_hdmi_get_port_from_cvt()
566 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_verify_connect_sel_all_pins() local
571 list_for_each_entry(cvt, &hdmi->cvt_list, head) { in hdac_hdmi_verify_connect_sel_all_pins()
572 port = hdac_hdmi_get_port_from_cvt(hdev, hdmi, cvt); in hdac_hdmi_verify_connect_sel_all_pins()
573 if (port && port->pin) { in hdac_hdmi_verify_connect_sel_all_pins()
574 snd_hdac_codec_write(hdev, port->pin->nid, 0, in hdac_hdmi_verify_connect_sel_all_pins()
576 dev_dbg(&hdev->dev, "%s: %s set connect %d -> %d\n", in hdac_hdmi_verify_connect_sel_all_pins()
577 __func__, cvt->name, port->pin->nid, cvt_idx); in hdac_hdmi_verify_connect_sel_all_pins()
591 struct hdac_hdmi_priv *hdmi = snd_soc_dai_get_drvdata(dai); in hdac_hdmi_pcm_open() local
592 struct hdac_device *hdev = hdmi->hdev; in hdac_hdmi_pcm_open()
598 dai_map = &hdmi->dai_map[dai->id]; in hdac_hdmi_pcm_open()
600 cvt = dai_map->cvt; in hdac_hdmi_pcm_open()
601 port = hdac_hdmi_get_port_from_cvt(hdev, hdmi, cvt); in hdac_hdmi_pcm_open()
609 if ((!port->eld.monitor_present) || in hdac_hdmi_pcm_open()
610 (!port->eld.eld_valid)) { in hdac_hdmi_pcm_open()
612 dev_warn(&hdev->dev, in hdac_hdmi_pcm_open()
614 port->eld.monitor_present, port->eld.eld_valid, in hdac_hdmi_pcm_open()
615 port->pin->nid, port->id); in hdac_hdmi_pcm_open()
620 dai_map->port = port; in hdac_hdmi_pcm_open()
622 ret = hdac_hdmi_eld_limit_formats(substream->runtime, in hdac_hdmi_pcm_open()
623 port->eld.eld_buffer); in hdac_hdmi_pcm_open()
627 return snd_pcm_hw_constraint_eld(substream->runtime, in hdac_hdmi_pcm_open()
628 port->eld.eld_buffer); in hdac_hdmi_pcm_open()
634 struct hdac_hdmi_priv *hdmi = snd_soc_dai_get_drvdata(dai); in hdac_hdmi_pcm_close() local
638 dai_map = &hdmi->dai_map[dai->id]; in hdac_hdmi_pcm_close()
640 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, dai_map->cvt); in hdac_hdmi_pcm_close()
643 mutex_lock(&pcm->lock); in hdac_hdmi_pcm_close()
644 pcm->chmap_set = false; in hdac_hdmi_pcm_close()
645 memset(pcm->chmap, 0, sizeof(pcm->chmap)); in hdac_hdmi_pcm_close()
646 pcm->channels = 0; in hdac_hdmi_pcm_close()
647 mutex_unlock(&pcm->lock); in hdac_hdmi_pcm_close()
650 if (dai_map->port) in hdac_hdmi_pcm_close()
651 dai_map->port = NULL; in hdac_hdmi_pcm_close()
658 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_query_cvt_params() local
661 chans = snd_hdac_get_wcaps(hdev, cvt->nid); in hdac_hdmi_query_cvt_params()
664 cvt->params.channels_min = 2; in hdac_hdmi_query_cvt_params()
666 cvt->params.channels_max = chans; in hdac_hdmi_query_cvt_params()
667 if (chans > hdmi->chmap.channels_max) in hdac_hdmi_query_cvt_params()
668 hdmi->chmap.channels_max = chans; in hdac_hdmi_query_cvt_params()
670 err = snd_hdac_query_supported_pcm(hdev, cvt->nid, in hdac_hdmi_query_cvt_params()
671 &cvt->params.rates, in hdac_hdmi_query_cvt_params()
672 &cvt->params.formats, in hdac_hdmi_query_cvt_params()
674 &cvt->params.maxbps); in hdac_hdmi_query_cvt_params()
676 dev_err(&hdev->dev, in hdac_hdmi_query_cvt_params()
678 cvt->nid, err); in hdac_hdmi_query_cvt_params()
690 w->id = id; in hdac_hdmi_fill_widget_info()
691 w->name = devm_kstrdup(dev, wname, GFP_KERNEL); in hdac_hdmi_fill_widget_info()
692 if (!w->name) in hdac_hdmi_fill_widget_info()
693 return -ENOMEM; in hdac_hdmi_fill_widget_info()
695 w->sname = stream; in hdac_hdmi_fill_widget_info()
696 w->reg = SND_SOC_NOPM; in hdac_hdmi_fill_widget_info()
697 w->shift = 0; in hdac_hdmi_fill_widget_info()
698 w->kcontrol_news = wc; in hdac_hdmi_fill_widget_info()
699 w->num_kcontrols = numkc; in hdac_hdmi_fill_widget_info()
700 w->priv = priv; in hdac_hdmi_fill_widget_info()
701 w->event = event; in hdac_hdmi_fill_widget_info()
702 w->event_flags = event_flags; in hdac_hdmi_fill_widget_info()
712 route->sink = sink; in hdac_hdmi_fill_route()
713 route->source = src; in hdac_hdmi_fill_route()
714 route->control = control; in hdac_hdmi_fill_route()
715 route->connected = handler; in hdac_hdmi_fill_route()
721 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_get_pcm() local
725 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in hdac_hdmi_get_pcm()
726 if (list_empty(&pcm->port_list)) in hdac_hdmi_get_pcm()
729 list_for_each_entry(p, &pcm->port_list, head) { in hdac_hdmi_get_pcm()
730 if (p->id == port->id && port->pin == p->pin) in hdac_hdmi_get_pcm()
771 struct hdac_hdmi_port *port = w->priv; in hdac_hdmi_pin_output_widget_event()
772 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); in hdac_hdmi_pin_output_widget_event()
775 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", in hdac_hdmi_pin_output_widget_event()
776 __func__, w->name, event); in hdac_hdmi_pin_output_widget_event()
780 return -EIO; in hdac_hdmi_pin_output_widget_event()
784 return -EIO; in hdac_hdmi_pin_output_widget_event()
788 hdac_hdmi_set_power_state(hdev, port->pin->nid, AC_PWRST_D0); in hdac_hdmi_pin_output_widget_event()
791 snd_hdac_codec_write(hdev, port->pin->nid, 0, in hdac_hdmi_pin_output_widget_event()
794 hdac_hdmi_set_amp(hdev, port->pin->nid, AMP_OUT_UNMUTE); in hdac_hdmi_pin_output_widget_event()
799 hdac_hdmi_set_amp(hdev, port->pin->nid, AMP_OUT_MUTE); in hdac_hdmi_pin_output_widget_event()
802 snd_hdac_codec_write(hdev, port->pin->nid, 0, in hdac_hdmi_pin_output_widget_event()
805 hdac_hdmi_set_power_state(hdev, port->pin->nid, AC_PWRST_D3); in hdac_hdmi_pin_output_widget_event()
816 struct hdac_hdmi_cvt *cvt = w->priv; in hdac_hdmi_cvt_output_widget_event()
817 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); in hdac_hdmi_cvt_output_widget_event()
818 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_cvt_output_widget_event() local
821 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", in hdac_hdmi_cvt_output_widget_event()
822 __func__, w->name, event); in hdac_hdmi_cvt_output_widget_event()
824 pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, cvt); in hdac_hdmi_cvt_output_widget_event()
826 return -EIO; in hdac_hdmi_cvt_output_widget_event()
830 hdac_hdmi_set_power_state(hdev, cvt->nid, AC_PWRST_D0); in hdac_hdmi_cvt_output_widget_event()
833 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
837 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
840 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
841 AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag); in hdac_hdmi_cvt_output_widget_event()
842 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
843 AC_VERB_SET_STREAM_FORMAT, pcm->format); in hdac_hdmi_cvt_output_widget_event()
855 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
857 snd_hdac_codec_write(hdev, cvt->nid, 0, in hdac_hdmi_cvt_output_widget_event()
860 hdac_hdmi_set_power_state(hdev, cvt->nid, AC_PWRST_D3); in hdac_hdmi_cvt_output_widget_event()
871 struct hdac_hdmi_port *port = w->priv; in hdac_hdmi_pin_mux_widget_event()
872 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); in hdac_hdmi_pin_mux_widget_event()
875 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", in hdac_hdmi_pin_mux_widget_event()
876 __func__, w->name, event); in hdac_hdmi_pin_mux_widget_event()
879 kc = w->kcontrols[0]; in hdac_hdmi_pin_mux_widget_event()
885 return -EIO; in hdac_hdmi_pin_mux_widget_event()
888 snd_hdac_codec_write(hdev, port->pin->nid, 0, in hdac_hdmi_pin_mux_widget_event()
889 AC_VERB_SET_CONNECT_SEL, (mux_idx - 1)); in hdac_hdmi_pin_mux_widget_event()
903 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in hdac_hdmi_set_pin_port_mux()
905 struct snd_soc_dapm_context *dapm = w->dapm; in hdac_hdmi_set_pin_port_mux()
906 struct hdac_hdmi_port *port = w->priv; in hdac_hdmi_set_pin_port_mux()
907 struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev); in hdac_hdmi_set_pin_port_mux()
908 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_set_pin_port_mux() local
910 const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; in hdac_hdmi_set_pin_port_mux()
917 return -EINVAL; in hdac_hdmi_set_pin_port_mux()
919 mutex_lock(&hdmi->pin_mutex); in hdac_hdmi_set_pin_port_mux()
920 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in hdac_hdmi_set_pin_port_mux()
921 if (list_empty(&pcm->port_list)) in hdac_hdmi_set_pin_port_mux()
924 list_for_each_entry_safe(p, p_next, &pcm->port_list, head) { in hdac_hdmi_set_pin_port_mux()
925 if (p == port && p->id == port->id && in hdac_hdmi_set_pin_port_mux()
926 p->pin == port->pin) { in hdac_hdmi_set_pin_port_mux()
928 list_del(&p->head); in hdac_hdmi_set_pin_port_mux()
937 list_for_each_entry(pcm, &hdmi->pcm_list, head) { in hdac_hdmi_set_pin_port_mux()
938 if (!strcmp(cvt_name, pcm->cvt->name)) { in hdac_hdmi_set_pin_port_mux()
939 list_add_tail(&port->head, &pcm->port_list); in hdac_hdmi_set_pin_port_mux()
940 if (port->eld.monitor_present && port->eld.eld_valid) { in hdac_hdmi_set_pin_port_mux()
942 mutex_unlock(&hdmi->pin_mutex); in hdac_hdmi_set_pin_port_mux()
947 mutex_unlock(&hdmi->pin_mutex); in hdac_hdmi_set_pin_port_mux()
966 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_create_pin_port_muxs() local
967 struct hdac_hdmi_pin *pin = port->pin; in hdac_hdmi_create_pin_port_muxs()
976 int num_items = hdmi->num_cvt + 1; in hdac_hdmi_create_pin_port_muxs()
978 kc = devm_kzalloc(&hdev->dev, sizeof(*kc), GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
980 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
982 se = devm_kzalloc(&hdev->dev, sizeof(*se), GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
984 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
987 pin->nid, port->id); in hdac_hdmi_create_pin_port_muxs()
988 kc->name = devm_kstrdup(&hdev->dev, kc_name, GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
989 if (!kc->name) in hdac_hdmi_create_pin_port_muxs()
990 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
992 kc->private_value = (long)se; in hdac_hdmi_create_pin_port_muxs()
993 kc->iface = SNDRV_CTL_ELEM_IFACE_MIXER; in hdac_hdmi_create_pin_port_muxs()
994 kc->access = 0; in hdac_hdmi_create_pin_port_muxs()
995 kc->info = snd_soc_info_enum_double; in hdac_hdmi_create_pin_port_muxs()
996 kc->put = hdac_hdmi_set_pin_port_mux; in hdac_hdmi_create_pin_port_muxs()
997 kc->get = snd_soc_dapm_get_enum_double; in hdac_hdmi_create_pin_port_muxs()
999 se->reg = SND_SOC_NOPM; in hdac_hdmi_create_pin_port_muxs()
1002 se->items = num_items; in hdac_hdmi_create_pin_port_muxs()
1003 se->mask = roundup_pow_of_two(se->items) - 1; in hdac_hdmi_create_pin_port_muxs()
1006 items[i] = devm_kstrdup(&hdev->dev, mux_items, GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
1008 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
1010 list_for_each_entry(cvt, &hdmi->cvt_list, head) { in hdac_hdmi_create_pin_port_muxs()
1012 sprintf(mux_items, "cvt %d", cvt->nid); in hdac_hdmi_create_pin_port_muxs()
1013 items[i] = devm_kstrdup(&hdev->dev, mux_items, GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
1015 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
1018 se->texts = devm_kmemdup_array(&hdev->dev, items, num_items, sizeof(items[0]), GFP_KERNEL); in hdac_hdmi_create_pin_port_muxs()
1019 if (!se->texts) in hdac_hdmi_create_pin_port_muxs()
1020 return -ENOMEM; in hdac_hdmi_create_pin_port_muxs()
1022 return hdac_hdmi_fill_widget_info(&hdev->dev, widget, in hdac_hdmi_create_pin_port_muxs()
1028 /* Add cvt <- input <- mux route map */
1033 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_add_pinmux_cvt_route() local
1036 int mux_index = hdmi->num_cvt + hdmi->num_ports; in hdac_hdmi_add_pinmux_cvt_route()
1039 for (i = 0; i < hdmi->num_ports; i++) { in hdac_hdmi_add_pinmux_cvt_route()
1041 se = (struct soc_enum *)kc->private_value; in hdac_hdmi_add_pinmux_cvt_route()
1042 for (j = 0; j < hdmi->num_cvt; j++) { in hdac_hdmi_add_pinmux_cvt_route()
1045 se->texts[j + 1], in hdac_hdmi_add_pinmux_cvt_route()
1058 * Pin-port widgets for num ports for Pins enumerated
1059 * Pin-port mux widgets to represent connenction list of pin widget
1065 * pin-port mux -> pin (based on num_ports)
1066 * cvt -> "Input sel control" -> pin-port_mux
1075 struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev); in create_fill_widget_route_map()
1076 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in create_fill_widget_route_map() local
1077 struct snd_soc_dai_driver *dai_drv = hdmi->dai_drv; in create_fill_widget_route_map()
1083 if (list_empty(&hdmi->cvt_list) || list_empty(&hdmi->pin_list)) in create_fill_widget_route_map()
1084 return -EINVAL; in create_fill_widget_route_map()
1086 widgets = devm_kzalloc(dapm->dev, (sizeof(*widgets) * in create_fill_widget_route_map()
1087 ((2 * hdmi->num_ports) + hdmi->num_cvt)), in create_fill_widget_route_map()
1091 return -ENOMEM; in create_fill_widget_route_map()
1094 list_for_each_entry(cvt, &hdmi->cvt_list, head) { in create_fill_widget_route_map()
1095 sprintf(widget_name, "Converter %d", cvt->nid); in create_fill_widget_route_map()
1096 ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i], in create_fill_widget_route_map()
1106 list_for_each_entry(pin, &hdmi->pin_list, head) { in create_fill_widget_route_map()
1107 for (j = 0; j < pin->num_ports; j++) { in create_fill_widget_route_map()
1108 sprintf(widget_name, "hif%d-%d Output", in create_fill_widget_route_map()
1109 pin->nid, pin->ports[j].id); in create_fill_widget_route_map()
1110 ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i], in create_fill_widget_route_map()
1111 snd_soc_dapm_output, &pin->ports[j], in create_fill_widget_route_map()
1118 pin->ports[j].output_pin = widgets[i].name; in create_fill_widget_route_map()
1124 list_for_each_entry(pin, &hdmi->pin_list, head) { in create_fill_widget_route_map()
1125 for (j = 0; j < pin->num_ports; j++) { in create_fill_widget_route_map()
1126 sprintf(widget_name, "Pin%d-Port%d Mux", in create_fill_widget_route_map()
1127 pin->nid, pin->ports[j].id); in create_fill_widget_route_map()
1129 &pin->ports[j], &widgets[i], in create_fill_widget_route_map()
1136 num_routes += hdmi->num_cvt; in create_fill_widget_route_map()
1143 route = devm_kzalloc(dapm->dev, (sizeof(*route) * num_routes), in create_fill_widget_route_map()
1146 return -ENOMEM; in create_fill_widget_route_map()
1149 /* Add pin <- NULL <- mux route map */ in create_fill_widget_route_map()
1150 list_for_each_entry(pin, &hdmi->pin_list, head) { in create_fill_widget_route_map()
1151 for (j = 0; j < pin->num_ports; j++) { in create_fill_widget_route_map()
1152 int sink_index = i + hdmi->num_cvt; in create_fill_widget_route_map()
1153 int src_index = sink_index + pin->num_ports * in create_fill_widget_route_map()
1154 hdmi->num_pin; in create_fill_widget_route_map()
1166 ((2 * hdmi->num_ports) + hdmi->num_cvt)); in create_fill_widget_route_map()
1169 snd_soc_dapm_new_widgets(dapm->card); in create_fill_widget_route_map()
1177 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_init_dai_map() local
1182 if (list_empty(&hdmi->cvt_list)) in hdac_hdmi_init_dai_map()
1183 return -EINVAL; in hdac_hdmi_init_dai_map()
1185 list_for_each_entry(cvt, &hdmi->cvt_list, head) { in hdac_hdmi_init_dai_map()
1186 dai_map = &hdmi->dai_map[dai_id]; in hdac_hdmi_init_dai_map()
1187 dai_map->dai_id = dai_id; in hdac_hdmi_init_dai_map()
1188 dai_map->cvt = cvt; in hdac_hdmi_init_dai_map()
1193 dev_warn(&hdev->dev, in hdac_hdmi_init_dai_map()
1204 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_add_cvt() local
1208 cvt = devm_kzalloc(&hdev->dev, sizeof(*cvt), GFP_KERNEL); in hdac_hdmi_add_cvt()
1210 return -ENOMEM; in hdac_hdmi_add_cvt()
1212 cvt->nid = nid; in hdac_hdmi_add_cvt()
1213 sprintf(name, "cvt %d", cvt->nid); in hdac_hdmi_add_cvt()
1214 cvt->name = devm_kstrdup(&hdev->dev, name, GFP_KERNEL); in hdac_hdmi_add_cvt()
1215 if (!cvt->name) in hdac_hdmi_add_cvt()
1216 return -ENOMEM; in hdac_hdmi_add_cvt()
1218 list_add_tail(&cvt->head, &hdmi->cvt_list); in hdac_hdmi_add_cvt()
1219 hdmi->num_cvt++; in hdac_hdmi_add_cvt()
1229 ver = (port->eld.eld_buffer[DRM_ELD_VER] & DRM_ELD_VER_MASK) in hdac_hdmi_parse_eld()
1233 dev_err_ratelimited(&hdev->dev, in hdac_hdmi_parse_eld()
1234 "HDMI: Unknown ELD version %d\n", ver); in hdac_hdmi_parse_eld()
1235 return -EINVAL; in hdac_hdmi_parse_eld()
1238 mnl = (port->eld.eld_buffer[DRM_ELD_CEA_EDID_VER_MNL] & in hdac_hdmi_parse_eld()
1242 dev_err_ratelimited(&hdev->dev, in hdac_hdmi_parse_eld()
1243 "HDMI: MNL Invalid %d\n", mnl); in hdac_hdmi_parse_eld()
1244 return -EINVAL; in hdac_hdmi_parse_eld()
1247 port->eld.info.spk_alloc = port->eld.eld_buffer[DRM_ELD_SPEAKER]; in hdac_hdmi_parse_eld()
1255 struct hdac_device *hdev = pin->hdev; in hdac_hdmi_present_sense()
1256 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_present_sense() local
1259 int port_id = -1; in hdac_hdmi_present_sense()
1262 if (!hdmi) in hdac_hdmi_present_sense()
1267 * to be -1. in hdac_hdmi_present_sense()
1269 mutex_lock(&hdmi->pin_mutex); in hdac_hdmi_present_sense()
1270 port->eld.monitor_present = false; in hdac_hdmi_present_sense()
1272 if (pin->mst_capable) in hdac_hdmi_present_sense()
1273 port_id = port->id; in hdac_hdmi_present_sense()
1275 size = snd_hdac_acomp_get_eld(hdev, pin->nid, port_id, in hdac_hdmi_present_sense()
1276 &port->eld.monitor_present, in hdac_hdmi_present_sense()
1277 port->eld.eld_buffer, in hdac_hdmi_present_sense()
1283 size = -EINVAL; in hdac_hdmi_present_sense()
1286 eld_valid = port->eld.eld_valid; in hdac_hdmi_present_sense()
1289 port->eld.eld_valid = true; in hdac_hdmi_present_sense()
1290 port->eld.eld_size = size; in hdac_hdmi_present_sense()
1292 port->eld.eld_valid = false; in hdac_hdmi_present_sense()
1293 port->eld.eld_size = 0; in hdac_hdmi_present_sense()
1296 eld_changed = (eld_valid != port->eld.eld_valid); in hdac_hdmi_present_sense()
1300 if (!port->eld.monitor_present || !port->eld.eld_valid) { in hdac_hdmi_present_sense()
1302 dev_dbg(&hdev->dev, "%s: disconnect for pin:port %d:%d\n", in hdac_hdmi_present_sense()
1303 __func__, pin->nid, port->id); in hdac_hdmi_present_sense()
1312 schedule_work(&port->dapm_work); in hdac_hdmi_present_sense()
1315 mutex_unlock(&hdmi->pin_mutex); in hdac_hdmi_present_sense()
1319 if (port->eld.monitor_present && port->eld.eld_valid) { in hdac_hdmi_present_sense()
1322 schedule_work(&port->dapm_work); in hdac_hdmi_present_sense()
1326 port->eld.eld_buffer, port->eld.eld_size, false); in hdac_hdmi_present_sense()
1329 mutex_unlock(&hdmi->pin_mutex); in hdac_hdmi_present_sense()
1332 snd_ctl_notify(hdmi->card, in hdac_hdmi_present_sense()
1335 &pcm->eld_ctl->id); in hdac_hdmi_present_sense()
1351 ports = devm_kcalloc(&hdev->dev, max_ports, sizeof(*ports), GFP_KERNEL); in hdac_hdmi_add_ports()
1353 return -ENOMEM; in hdac_hdmi_add_ports()
1360 pin->ports = ports; in hdac_hdmi_add_ports()
1361 pin->num_ports = max_ports; in hdac_hdmi_add_ports()
1367 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_add_pin() local
1371 pin = devm_kzalloc(&hdev->dev, sizeof(*pin), GFP_KERNEL); in hdac_hdmi_add_pin()
1373 return -ENOMEM; in hdac_hdmi_add_pin()
1375 pin->nid = nid; in hdac_hdmi_add_pin()
1376 pin->mst_capable = false; in hdac_hdmi_add_pin()
1377 pin->hdev = hdev; in hdac_hdmi_add_pin()
1382 list_add_tail(&pin->head, &hdmi->pin_list); in hdac_hdmi_add_pin()
1383 hdmi->num_pin++; in hdac_hdmi_add_pin()
1384 hdmi->num_ports += pin->num_ports; in hdac_hdmi_add_pin()
1399 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_skl_enable_all_pins() local
1400 unsigned int vendor_nid = hdmi->drv_data->vendor_nid; in hdac_hdmi_skl_enable_all_pins()
1404 if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS) in hdac_hdmi_skl_enable_all_pins()
1410 if (vendor_param == -1) in hdac_hdmi_skl_enable_all_pins()
1417 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_skl_enable_dp12() local
1418 unsigned int vendor_nid = hdmi->drv_data->vendor_nid; in hdac_hdmi_skl_enable_dp12()
1422 if (vendor_param == -1 || vendor_param & INTEL_EN_DP12) in hdac_hdmi_skl_enable_dp12()
1425 /* enable DP1.2 mode */ in hdac_hdmi_skl_enable_dp12()
1429 if (vendor_param == -1) in hdac_hdmi_skl_enable_dp12()
1447 struct hdac_hdmi_priv *hdmi, int num_dais) in hdac_hdmi_create_dais() argument
1458 hdmi_dais = devm_kzalloc(&hdev->dev, in hdac_hdmi_create_dais()
1462 return -ENOMEM; in hdac_hdmi_create_dais()
1464 list_for_each_entry(cvt, &hdmi->cvt_list, head) { in hdac_hdmi_create_dais()
1465 ret = snd_hdac_query_supported_pcm(hdev, cvt->nid, in hdac_hdmi_create_dais()
1474 return -EINVAL; in hdac_hdmi_create_dais()
1476 sprintf(dai_name, "intel-hdmi-hifi%d", i+1); in hdac_hdmi_create_dais()
1477 hdmi_dais[i].name = devm_kstrdup(&hdev->dev, in hdac_hdmi_create_dais()
1481 return -ENOMEM; in hdac_hdmi_create_dais()
1485 devm_kstrdup(&hdev->dev, name, GFP_KERNEL); in hdac_hdmi_create_dais()
1487 return -ENOMEM; in hdac_hdmi_create_dais()
1505 hdmi->dai_drv = hdmi_dais; in hdac_hdmi_create_dais()
1519 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_parse_and_map_nid() local
1525 num_nodes = snd_hdac_get_sub_nodes(hdev, hdev->afg, &nid); in hdac_hdmi_parse_and_map_nid()
1527 dev_warn(&hdev->dev, "HDMI: failed to get afg sub nodes\n"); in hdac_hdmi_parse_and_map_nid()
1528 return -EINVAL; in hdac_hdmi_parse_and_map_nid()
1557 if (!hdmi->num_pin || !hdmi->num_cvt) { in hdac_hdmi_parse_and_map_nid()
1558 ret = -EIO; in hdac_hdmi_parse_and_map_nid()
1559 dev_err(&hdev->dev, "Bad pin/cvt setup in %s\n", __func__); in hdac_hdmi_parse_and_map_nid()
1563 ret = hdac_hdmi_create_dais(hdev, dais, hdmi, hdmi->num_cvt); in hdac_hdmi_parse_and_map_nid()
1565 dev_err(&hdev->dev, "Failed to create dais with err: %d\n", in hdac_hdmi_parse_and_map_nid()
1570 *num_dais = hdmi->num_cvt; in hdac_hdmi_parse_and_map_nid()
1573 dev_err(&hdev->dev, "Failed to init DAI map with err: %d\n", in hdac_hdmi_parse_and_map_nid()
1580 return pin - 4; /* map NID 0x05 -> port #1 */ in hdac_hdmi_pin2port()
1586 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_eld_notify_cb() local
1589 struct snd_soc_component *component = hdmi->component; in hdac_hdmi_eld_notify_cb()
1595 dev_dbg(&hdev->dev, "%s: for pin:%d port=%d\n", __func__, in hdac_hdmi_eld_notify_cb()
1604 if (snd_power_get_state(component->card->snd_card) != in hdac_hdmi_eld_notify_cb()
1608 if (atomic_read(&hdev->in_pm)) in hdac_hdmi_eld_notify_cb()
1611 list_for_each_entry(pin, &hdmi->pin_list, head) { in hdac_hdmi_eld_notify_cb()
1612 if (pin->nid != pin_nid) in hdac_hdmi_eld_notify_cb()
1615 /* In case of non MST pin, pipe is -1 */ in hdac_hdmi_eld_notify_cb()
1616 if (pipe == -1) { in hdac_hdmi_eld_notify_cb()
1617 pin->mst_capable = false; in hdac_hdmi_eld_notify_cb()
1619 hport = &pin->ports[0]; in hdac_hdmi_eld_notify_cb()
1621 for (i = 0; i < pin->num_ports; i++) { in hdac_hdmi_eld_notify_cb()
1622 pin->mst_capable = true; in hdac_hdmi_eld_notify_cb()
1623 if (pin->ports[i].id == pipe) { in hdac_hdmi_eld_notify_cb()
1624 hport = &pin->ports[i]; in hdac_hdmi_eld_notify_cb()
1642 struct hdac_hdmi_priv *hdmi, bool detect_pin_caps) in hdac_hdmi_present_sense_all_pins() argument
1647 list_for_each_entry(pin, &hdmi->pin_list, head) { in hdac_hdmi_present_sense_all_pins()
1650 if (hdac_hdmi_get_port_len(hdev, pin->nid) == 0) in hdac_hdmi_present_sense_all_pins()
1651 pin->mst_capable = false; in hdac_hdmi_present_sense_all_pins()
1653 pin->mst_capable = true; in hdac_hdmi_present_sense_all_pins()
1656 for (i = 0; i < pin->num_ports; i++) { in hdac_hdmi_present_sense_all_pins()
1657 if (!pin->mst_capable && i > 0) in hdac_hdmi_present_sense_all_pins()
1660 hdac_hdmi_present_sense(pin, &pin->ports[i]); in hdac_hdmi_present_sense_all_pins()
1667 struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); in hdmi_codec_probe() local
1668 struct hdac_device *hdev = hdmi->hdev; in hdmi_codec_probe()
1674 hdmi->component = component; in hdmi_codec_probe()
1680 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev)); in hdmi_codec_probe()
1682 dev_err(&hdev->dev, "hdac link not found\n"); in hdmi_codec_probe()
1683 return -EIO; in hdmi_codec_probe()
1686 snd_hdac_ext_bus_link_get(hdev->bus, hlink); in hdmi_codec_probe()
1693 ret = snd_hdac_acomp_register_notifier(hdev->bus, &aops); in hdmi_codec_probe()
1695 dev_err(&hdev->dev, "notifier register failed: err: %d\n", ret); in hdmi_codec_probe()
1699 hdac_hdmi_present_sense_all_pins(hdev, hdmi, true); in hdmi_codec_probe()
1701 hdmi->card = dapm->card->snd_card; in hdmi_codec_probe()
1704 * Setup a device_link between card device and HDMI codec device. in hdmi_codec_probe()
1705 * The card device is the consumer and the HDMI codec device is in hdmi_codec_probe()
1708 * on the HDMI audio codec registers. in hdmi_codec_probe()
1712 device_link_add(component->card->dev, &hdev->dev, DL_FLAG_RPM_ACTIVE | in hdmi_codec_probe()
1718 pm_runtime_enable(&hdev->dev); in hdmi_codec_probe()
1719 pm_runtime_put(&hdev->dev); in hdmi_codec_probe()
1720 pm_runtime_suspend(&hdev->dev); in hdmi_codec_probe()
1727 struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); in hdmi_codec_remove() local
1728 struct hdac_device *hdev = hdmi->hdev; in hdmi_codec_remove()
1731 ret = snd_hdac_acomp_register_notifier(hdev->bus, NULL); in hdmi_codec_remove()
1733 dev_err(&hdev->dev, "notifier unregister failed: err: %d\n", in hdmi_codec_remove()
1736 pm_runtime_disable(&hdev->dev); in hdmi_codec_remove()
1742 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdmi_codec_resume() local
1756 * works even if the HD-audio side is still dreaming peacefully. in hdmi_codec_resume()
1758 hdac_hdmi_present_sense_all_pins(hdev, hdmi, false); in hdmi_codec_resume()
1772 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_get_chmap() local
1773 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); in hdac_hdmi_get_chmap()
1775 memcpy(chmap, pcm->chmap, ARRAY_SIZE(pcm->chmap)); in hdac_hdmi_get_chmap()
1781 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_set_chmap() local
1782 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); in hdac_hdmi_set_chmap()
1788 if (list_empty(&pcm->port_list)) in hdac_hdmi_set_chmap()
1791 mutex_lock(&pcm->lock); in hdac_hdmi_set_chmap()
1792 pcm->chmap_set = true; in hdac_hdmi_set_chmap()
1793 memcpy(pcm->chmap, chmap, ARRAY_SIZE(pcm->chmap)); in hdac_hdmi_set_chmap()
1794 list_for_each_entry(port, &pcm->port_list, head) in hdac_hdmi_set_chmap()
1797 mutex_unlock(&pcm->lock); in hdac_hdmi_set_chmap()
1802 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in is_hdac_hdmi_pcm_attached() local
1803 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); in is_hdac_hdmi_pcm_attached()
1808 if (list_empty(&pcm->port_list)) in is_hdac_hdmi_pcm_attached()
1816 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in hdac_hdmi_get_spk_alloc() local
1817 struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); in hdac_hdmi_get_spk_alloc()
1823 if (list_empty(&pcm->port_list)) in hdac_hdmi_get_spk_alloc()
1826 port = list_first_entry(&pcm->port_list, struct hdac_hdmi_port, head); in hdac_hdmi_get_spk_alloc()
1828 if (!port || !port->eld.eld_valid) in hdac_hdmi_get_spk_alloc()
1831 return port->eld.info.spk_alloc; in hdac_hdmi_get_spk_alloc()
1849 struct hdac_driver *hdrv = drv_to_hdac_driver(hdev->dev.driver); in hdac_hdmi_dev_probe()
1853 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev)); in hdac_hdmi_dev_probe()
1855 dev_err(&hdev->dev, "hdac link not found\n"); in hdac_hdmi_dev_probe()
1856 return -EIO; in hdac_hdmi_dev_probe()
1859 snd_hdac_ext_bus_link_get(hdev->bus, hlink); in hdac_hdmi_dev_probe()
1861 hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL); in hdac_hdmi_dev_probe()
1863 return -ENOMEM; in hdac_hdmi_dev_probe()
1865 snd_hdac_register_chmap_ops(hdev, &hdmi_priv->chmap); in hdac_hdmi_dev_probe()
1866 hdmi_priv->chmap.ops.get_chmap = hdac_hdmi_get_chmap; in hdac_hdmi_dev_probe()
1867 hdmi_priv->chmap.ops.set_chmap = hdac_hdmi_set_chmap; in hdac_hdmi_dev_probe()
1868 hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached; in hdac_hdmi_dev_probe()
1869 hdmi_priv->chmap.ops.get_spk_alloc = hdac_hdmi_get_spk_alloc; in hdac_hdmi_dev_probe()
1870 hdmi_priv->hdev = hdev; in hdac_hdmi_dev_probe()
1873 return -ENODEV; in hdac_hdmi_dev_probe()
1875 if (hdac_id->driver_data) in hdac_hdmi_dev_probe()
1876 hdmi_priv->drv_data = in hdac_hdmi_dev_probe()
1877 (struct hdac_hdmi_drv_data *)hdac_id->driver_data; in hdac_hdmi_dev_probe()
1879 hdmi_priv->drv_data = &intel_drv_data; in hdac_hdmi_dev_probe()
1881 dev_set_drvdata(&hdev->dev, hdmi_priv); in hdac_hdmi_dev_probe()
1883 INIT_LIST_HEAD(&hdmi_priv->pin_list); in hdac_hdmi_dev_probe()
1884 INIT_LIST_HEAD(&hdmi_priv->cvt_list); in hdac_hdmi_dev_probe()
1885 INIT_LIST_HEAD(&hdmi_priv->pcm_list); in hdac_hdmi_dev_probe()
1886 mutex_init(&hdmi_priv->pin_mutex); in hdac_hdmi_dev_probe()
1892 snd_hdac_display_power(hdev->bus, hdev->addr, true); in hdac_hdmi_dev_probe()
1896 dev_err(&hdev->dev, in hdac_hdmi_dev_probe()
1903 ret = devm_snd_soc_register_component(&hdev->dev, &hdmi_hda_codec, in hdac_hdmi_dev_probe()
1906 snd_hdac_ext_bus_link_put(hdev->bus, hlink); in hdac_hdmi_dev_probe()
1913 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); in clear_dapm_works() local
1917 list_for_each_entry(pin, &hdmi->pin_list, head) in clear_dapm_works()
1918 for (i = 0; i < pin->num_ports; i++) in clear_dapm_works()
1919 cancel_work_sync(&pin->ports[i].dapm_work); in clear_dapm_works()
1925 snd_hdac_display_power(hdev->bus, hdev->addr, false); in hdac_hdmi_dev_remove()
1933 struct hdac_bus *bus = hdev->bus; in hdac_hdmi_runtime_suspend()
1949 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, in hdac_hdmi_runtime_suspend()
1955 return -EIO; in hdac_hdmi_runtime_suspend()
1961 snd_hdac_display_power(bus, hdev->addr, false); in hdac_hdmi_runtime_suspend()
1969 struct hdac_bus *bus = hdev->bus; in hdac_hdmi_runtime_resume()
1981 return -EIO; in hdac_hdmi_runtime_resume()
1987 snd_hdac_display_power(bus, hdev->addr, true); in hdac_hdmi_runtime_resume()
1993 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, in hdac_hdmi_runtime_resume()
2005 HDA_CODEC_EXT_ENTRY(0x80862809, 0x100000, "Skylake HDMI", 0),
2006 HDA_CODEC_EXT_ENTRY(0x8086280a, 0x100000, "Broxton HDMI", 0),
2007 HDA_CODEC_EXT_ENTRY(0x8086280b, 0x100000, "Kabylake HDMI", 0),
2008 HDA_CODEC_EXT_ENTRY(0x8086280c, 0x100000, "Cannonlake HDMI",
2010 HDA_CODEC_EXT_ENTRY(0x8086280d, 0x100000, "Geminilake HDMI",
2019 .name = "HDMI HDA Codec",
2041 MODULE_DESCRIPTION("HDMI HD codec");