Lines Matching defs:hdev
81 struct hdac_device *hdev;
125 struct hdac_device *hdev;
160 struct hdac_device *hdev = port->pin->hdev;
170 dev_dbg(&hdev->dev,
218 static int hdac_hdmi_get_port_len(struct hdac_device *hdev, hda_nid_t nid)
223 caps = get_wcaps(hdev, nid);
229 param = snd_hdac_read_parm_uncached(hdev, nid, AC_PAR_DEVLIST_LEN);
241 static int hdac_hdmi_port_select_get(struct hdac_device *hdev,
244 return snd_hdac_codec_read(hdev, port->pin->nid,
252 static int hdac_hdmi_port_select_set(struct hdac_device *hdev,
261 num_ports = hdac_hdmi_get_port_len(hdev, port->pin->nid);
271 snd_hdac_codec_write(hdev, port->pin->nid, 0,
274 if (port->id != hdac_hdmi_port_select_get(hdev, port))
277 dev_dbg(&hdev->dev, "Selected the port=%d\n", port->id);
335 hdac_hdmi_set_dip_index(struct hdac_device *hdev, hda_nid_t pin_nid,
341 snd_hdac_codec_write(hdev, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val);
356 static int hdac_hdmi_setup_audio_infoframe(struct hdac_device *hdev,
363 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
372 ca = snd_hdac_channel_allocation(hdev, port->eld.info.spk_alloc,
376 hdmi->chmap.ops.set_channel_count(hdev, cvt->nid, channels);
409 dev_err(&hdev->dev, "Invalid connection type: %d\n", conn_type);
414 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0);
415 snd_hdac_codec_write(hdev, pin->nid, 0,
420 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0);
423 snd_hdac_codec_write(hdev, pin->nid, 0,
427 snd_hdac_codec_write(hdev, pin->nid, 0,
432 hdac_hdmi_set_dip_index(hdev, pin->nid, 0x0, 0x0);
433 snd_hdac_codec_write(hdev, pin->nid, 0,
443 struct hdac_device *hdev = hdmi->hdev;
453 dev_dbg(&hdev->dev, "%s: strm_tag: %d\n", __func__, hstream->stream_tag);
489 static int hdac_hdmi_query_port_connlist(struct hdac_device *hdev,
493 if (!(get_wcaps(hdev, pin->nid) & AC_WCAP_CONN_LIST)) {
494 dev_warn(&hdev->dev,
496 pin->nid, get_wcaps(hdev, pin->nid));
500 if (hdac_hdmi_port_select_set(hdev, port) < 0)
503 port->num_mux_nids = snd_hdac_get_connections(hdev, pin->nid,
506 dev_warn(&hdev->dev,
510 dev_dbg(&hdev->dev, "num_mux_nids %d for pin:port %d:%d\n",
526 struct hdac_device *hdev,
541 ret = hdac_hdmi_query_port_connlist(hdev,
564 static void hdac_hdmi_verify_connect_sel_all_pins(struct hdac_device *hdev)
566 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
572 port = hdac_hdmi_get_port_from_cvt(hdev, hdmi, cvt);
574 snd_hdac_codec_write(hdev, port->pin->nid, 0,
576 dev_dbg(&hdev->dev, "%s: %s set connect %d -> %d\n",
592 struct hdac_device *hdev = hdmi->hdev;
601 port = hdac_hdmi_get_port_from_cvt(hdev, hdmi, cvt);
612 dev_warn(&hdev->dev,
655 hdac_hdmi_query_cvt_params(struct hdac_device *hdev, struct hdac_hdmi_cvt *cvt)
658 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
661 chans = get_wcaps(hdev, cvt->nid);
670 err = snd_hdac_query_supported_pcm(hdev, cvt->nid,
675 dev_err(&hdev->dev,
717 static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_device *hdev,
720 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
737 static void hdac_hdmi_set_power_state(struct hdac_device *hdev,
743 if (get_wcaps(hdev, nid) & AC_WCAP_POWER) {
744 if (!snd_hdac_check_power_state(hdev, nid, pwr_state)) {
746 snd_hdac_codec_read(hdev, nid, 0,
749 state = snd_hdac_sync_power_state(hdev,
758 static void hdac_hdmi_set_amp(struct hdac_device *hdev,
761 if (get_wcaps(hdev, nid) & AC_WCAP_OUT_AMP)
762 snd_hdac_codec_write(hdev, nid, 0,
771 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
774 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n",
777 pcm = hdac_hdmi_get_pcm(hdev, port);
782 if (hdac_hdmi_port_select_set(hdev, port) < 0)
787 hdac_hdmi_set_power_state(hdev, port->pin->nid, AC_PWRST_D0);
790 snd_hdac_codec_write(hdev, port->pin->nid, 0,
793 hdac_hdmi_set_amp(hdev, port->pin->nid, AMP_OUT_UNMUTE);
795 return hdac_hdmi_setup_audio_infoframe(hdev, pcm, port);
798 hdac_hdmi_set_amp(hdev, port->pin->nid, AMP_OUT_MUTE);
801 snd_hdac_codec_write(hdev, port->pin->nid, 0,
804 hdac_hdmi_set_power_state(hdev, port->pin->nid, AC_PWRST_D3);
816 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
817 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
820 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n",
829 hdac_hdmi_set_power_state(hdev, cvt->nid, AC_PWRST_D0);
832 snd_hdac_codec_write(hdev, cvt->nid, 0,
836 snd_hdac_codec_write(hdev, cvt->nid, 0,
839 snd_hdac_codec_write(hdev, cvt->nid, 0,
841 snd_hdac_codec_write(hdev, cvt->nid, 0,
849 hdac_hdmi_verify_connect_sel_all_pins(hdev);
854 snd_hdac_codec_write(hdev, cvt->nid, 0,
856 snd_hdac_codec_write(hdev, cvt->nid, 0,
859 hdac_hdmi_set_power_state(hdev, cvt->nid, AC_PWRST_D3);
871 struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev);
874 dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n",
883 if (hdac_hdmi_port_select_set(hdev, port) < 0)
887 snd_hdac_codec_write(hdev, port->pin->nid, 0,
906 struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev);
907 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
960 static int hdac_hdmi_create_pin_port_muxs(struct hdac_device *hdev,
965 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
977 kc = devm_kzalloc(&hdev->dev, sizeof(*kc), GFP_KERNEL);
981 se = devm_kzalloc(&hdev->dev, sizeof(*se), GFP_KERNEL);
987 kc->name = devm_kstrdup(&hdev->dev, kc_name, GFP_KERNEL);
1005 items[i] = devm_kstrdup(&hdev->dev, mux_items, GFP_KERNEL);
1012 items[i] = devm_kstrdup(&hdev->dev, mux_items, GFP_KERNEL);
1017 se->texts = devm_kmemdup(&hdev->dev, items,
1022 return hdac_hdmi_fill_widget_info(&hdev->dev, widget,
1029 static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_device *hdev,
1033 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1075 struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev);
1076 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1128 ret = hdac_hdmi_create_pin_port_muxs(hdev,
1163 hdac_hdmi_add_pinmux_cvt_route(hdev, widgets, route, i);
1175 static int hdac_hdmi_init_dai_map(struct hdac_device *hdev)
1177 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1193 dev_warn(&hdev->dev,
1202 static int hdac_hdmi_add_cvt(struct hdac_device *hdev, hda_nid_t nid)
1204 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1208 cvt = devm_kzalloc(&hdev->dev, sizeof(*cvt), GFP_KERNEL);
1214 cvt->name = devm_kstrdup(&hdev->dev, name, GFP_KERNEL);
1221 return hdac_hdmi_query_cvt_params(hdev, cvt);
1224 static int hdac_hdmi_parse_eld(struct hdac_device *hdev,
1233 dev_err(&hdev->dev, "HDMI: Unknown ELD version %d\n", ver);
1241 dev_err(&hdev->dev, "HDMI: MNL Invalid %d\n", mnl);
1253 struct hdac_device *hdev = pin->hdev;
1254 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1273 size = snd_hdac_acomp_get_eld(hdev, pin->nid, port_id,
1280 if (hdac_hdmi_parse_eld(hdev, port) < 0)
1296 pcm = hdac_hdmi_get_pcm(hdev, port);
1300 dev_err(&hdev->dev, "%s: disconnect for pin:port %d:%d\n",
1336 static int hdac_hdmi_add_ports(struct hdac_device *hdev,
1349 ports = devm_kcalloc(&hdev->dev, max_ports, sizeof(*ports), GFP_KERNEL);
1363 static int hdac_hdmi_add_pin(struct hdac_device *hdev, hda_nid_t nid)
1365 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1369 pin = devm_kzalloc(&hdev->dev, sizeof(*pin), GFP_KERNEL);
1375 pin->hdev = hdev;
1376 ret = hdac_hdmi_add_ports(hdev, pin);
1394 static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdev)
1397 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1400 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1406 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1412 static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
1415 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1418 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1425 vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
1559 static int hdac_hdmi_create_dais(struct hdac_device *hdev,
1572 hdmi_dais = devm_kzalloc(&hdev->dev,
1579 ret = snd_hdac_query_supported_pcm(hdev, cvt->nid,
1591 hdmi_dais[i].name = devm_kstrdup(&hdev->dev,
1599 devm_kstrdup(&hdev->dev, name, GFP_KERNEL);
1628 static int hdac_hdmi_parse_and_map_nid(struct hdac_device *hdev,
1633 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1636 hdac_hdmi_skl_enable_all_pins(hdev);
1637 hdac_hdmi_skl_enable_dp12(hdev);
1639 num_nodes = snd_hdac_get_sub_nodes(hdev, hdev->afg, &nid);
1641 dev_warn(&hdev->dev, "HDMI: failed to get afg sub nodes\n");
1649 caps = get_wcaps(hdev, nid);
1658 ret = hdac_hdmi_add_cvt(hdev, nid);
1664 ret = hdac_hdmi_add_pin(hdev, nid);
1673 dev_err(&hdev->dev, "Bad pin/cvt setup in %s\n", __func__);
1677 ret = hdac_hdmi_create_dais(hdev, dais, hdmi, hdmi->num_cvt);
1679 dev_err(&hdev->dev, "Failed to create dais with err: %d\n",
1685 ret = hdac_hdmi_init_dai_map(hdev);
1687 dev_err(&hdev->dev, "Failed to init DAI map with err: %d\n",
1699 struct hdac_device *hdev = aptr;
1700 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1709 dev_dbg(&hdev->dev, "%s: for pin:%d port=%d\n", __func__,
1722 if (atomic_read(&hdev->in_pm))
1770 struct hdac_device *hdev)
1777 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
1816 struct hdac_device *hdev = hdmi->hdev;
1871 ret = create_fill_jack_kcontrols(dapm->card, hdev);
1892 struct hdac_device *hdev = hdmi->hdev;
1901 pcm = devm_kzalloc(&hdev->dev, sizeof(*pcm), GFP_KERNEL);
1914 dev_err(&hdev->dev,
1924 dev_err(&hdev->dev,
1936 static void hdac_hdmi_present_sense_all_pins(struct hdac_device *hdev,
1945 if (hdac_hdmi_get_port_len(hdev, pin->nid) == 0)
1963 struct hdac_device *hdev = hdmi->hdev;
1975 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
1977 dev_err(&hdev->dev, "hdac link not found\n");
1981 snd_hdac_ext_bus_link_get(hdev->bus, hlink);
1987 aops.audio_ptr = hdev;
1988 ret = snd_hdac_acomp_register_notifier(hdev->bus, &aops);
1990 dev_err(&hdev->dev, "notifier register failed: err: %d\n", ret);
1994 hdac_hdmi_present_sense_all_pins(hdev, hdmi, true);
2007 device_link_add(component->card->dev, &hdev->dev, DL_FLAG_RPM_ACTIVE |
2013 pm_runtime_enable(&hdev->dev);
2014 pm_runtime_put(&hdev->dev);
2015 pm_runtime_suspend(&hdev->dev);
2023 struct hdac_device *hdev = hdmi->hdev;
2026 ret = snd_hdac_acomp_register_notifier(hdev->bus, NULL);
2028 dev_err(&hdev->dev, "notifier unregister failed: err: %d\n",
2031 pm_runtime_disable(&hdev->dev);
2037 struct hdac_device *hdev = dev_to_hdac_dev(dev);
2038 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2054 hdac_hdmi_present_sense_all_pins(hdev, hdmi, false);
2068 static void hdac_hdmi_get_chmap(struct hdac_device *hdev, int pcm_idx,
2071 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2077 static void hdac_hdmi_set_chmap(struct hdac_device *hdev, int pcm_idx,
2080 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2095 hdac_hdmi_setup_audio_infoframe(hdev, pcm, port);
2099 static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdev, int pcm_idx)
2101 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2113 static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdev, int pcm_idx)
2115 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2141 static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
2148 struct hdac_driver *hdrv = drv_to_hdac_driver(hdev->dev.driver);
2149 const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
2152 hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
2154 dev_err(&hdev->dev, "hdac link not found\n");
2158 snd_hdac_ext_bus_link_get(hdev->bus, hlink);
2160 hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL);
2164 snd_hdac_register_chmap_ops(hdev, &hdmi_priv->chmap);
2169 hdmi_priv->hdev = hdev;
2180 dev_set_drvdata(&hdev->dev, hdmi_priv);
2191 snd_hdac_display_power(hdev->bus, hdev->addr, true);
2193 ret = hdac_hdmi_parse_and_map_nid(hdev, &hdmi_dais, &num_dais);
2195 dev_err(&hdev->dev,
2199 snd_hdac_refresh_widgets(hdev);
2202 ret = devm_snd_soc_register_component(&hdev->dev, &hdmi_hda_codec,
2205 snd_hdac_ext_bus_link_put(hdev->bus, hlink);
2210 static void clear_dapm_works(struct hdac_device *hdev)
2212 struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
2221 static int hdac_hdmi_dev_remove(struct hdac_device *hdev)
2223 clear_dapm_works(hdev);
2224 snd_hdac_display_power(hdev->bus, hdev->addr, false);
2232 struct hdac_device *hdev = dev_to_hdac_dev(dev);
2233 struct hdac_bus *bus = hdev->bus;
2249 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
2258 snd_hdac_codec_link_down(hdev);
2261 snd_hdac_display_power(bus, hdev->addr, false);
2268 struct hdac_device *hdev = dev_to_hdac_dev(dev);
2269 struct hdac_bus *bus = hdev->bus;
2285 snd_hdac_codec_link_up(hdev);
2287 snd_hdac_display_power(bus, hdev->addr, true);
2289 hdac_hdmi_skl_enable_all_pins(hdev);
2290 hdac_hdmi_skl_enable_dp12(hdev);
2293 snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,