Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions sound/pci/hda/patch_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int hinfo_to_pcm_index(struct hda_codec *codec,
if (get_pcm_rec(spec, pcm_idx)->stream == hinfo)
return pcm_idx;

codec_warn(codec, "HDMI: hinfo %p not registered\n", hinfo);
codec_warn(codec, "HDMI: hinfo %p not tied to a PCM\n", hinfo);
return -EINVAL;
}

Expand All @@ -277,7 +277,8 @@ static int hinfo_to_pin_index(struct hda_codec *codec,
return pin_idx;
}

codec_dbg(codec, "HDMI: hinfo %p not registered\n", hinfo);
codec_dbg(codec, "HDMI: hinfo %p (pcm %d) not registered\n", hinfo,
hinfo_to_pcm_index(codec, hinfo));
return -EINVAL;
}

Expand Down Expand Up @@ -1804,33 +1805,43 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)

static int hdmi_parse_codec(struct hda_codec *codec)
{
hda_nid_t nid;
hda_nid_t start_nid;
unsigned int caps;
int i, nodes;

nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &nid);
if (!nid || nodes < 0) {
nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid);
if (!start_nid || nodes < 0) {
codec_warn(codec, "HDMI: failed to get afg sub nodes\n");
return -EINVAL;
}

for (i = 0; i < nodes; i++, nid++) {
unsigned int caps;
unsigned int type;
/*
* hdmi_add_pin() assumes total amount of converters to
* be known, so first discover all converters
*/
for (i = 0; i < nodes; i++) {
hda_nid_t nid = start_nid + i;

caps = get_wcaps(codec, nid);
type = get_wcaps_type(caps);

if (!(caps & AC_WCAP_DIGITAL))
continue;

switch (type) {
case AC_WID_AUD_OUT:
if (get_wcaps_type(caps) == AC_WID_AUD_OUT)
hdmi_add_cvt(codec, nid);
break;
case AC_WID_PIN:
}

/* discover audio pins */
for (i = 0; i < nodes; i++) {
hda_nid_t nid = start_nid + i;

caps = get_wcaps(codec, nid);

if (!(caps & AC_WCAP_DIGITAL))
continue;

if (get_wcaps_type(caps) == AC_WID_PIN)
hdmi_add_pin(codec, nid);
break;
}
}

return 0;
Expand Down