* [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later
@ 2020-07-03 15:38 Kai Vehmanen
2020-07-03 15:38 ` [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups Kai Vehmanen
2020-07-07 8:13 ` [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Takashi Iwai
0 siblings, 2 replies; 4+ messages in thread
From: Kai Vehmanen @ 2020-07-03 15:38 UTC (permalink / raw)
To: alsa-devel, tiwai
Cc: libin.yang, Ranjani Sridharan, kai.vehmanen, Pierre-Louis Bossart
When HDMI PCM devices are opened in a specific order, with at least one
HDMI/DP receiver connected, ALSA PCM open fails to -EBUSY on the
connected monitor, on recent Intel platforms (ICL/JSL and newer). While
this is not a typical sequence, at least Pulseaudio does this every time
when it is started, to discover the available PCMs.
The rootcause is an invalid assumption in hdmi_add_pin(), where the
total number of converters is assumed to be known at the time the
function is called. On older Intel platforms this held true, but after
ICL/JSL, the order how pins and converters are in the subnode list as
returned by snd_hda_get_sub_nodes(), was changed. As a result,
information for some converters was not stored to per_pin->mux_nids.
And this means some pins cannot be connected to all converters, and
application instead gets -EBUSY instead at open.
The assumption that converters are always before pins in the subnode
list, is not really a valid one. Fix the problem in hdmi_parse_codec()
by introducing separate loops for discovering converters and pins.
BugLink: https://github.com/thesofproject/linux/issues/1978
BugLink: https://github.com/thesofproject/linux/issues/2216
BugLink: https://github.com/thesofproject/linux/issues/2217
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
sound/pci/hda/patch_hdmi.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index e2b21ef5d7d1..295cc5a989d5 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1804,33 +1804,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;
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups
2020-07-03 15:38 [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Kai Vehmanen
@ 2020-07-03 15:38 ` Kai Vehmanen
2020-07-07 8:14 ` Takashi Iwai
2020-07-07 8:13 ` [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Takashi Iwai
1 sibling, 1 reply; 4+ messages in thread
From: Kai Vehmanen @ 2020-07-03 15:38 UTC (permalink / raw)
To: alsa-devel, tiwai
Cc: libin.yang, Ranjani Sridharan, kai.vehmanen, Pierre-Louis Bossart
The HDMI codec driver has two debug traces printed from different
functions but with identical message content:
"HDMI: hinfo 000000006a6b84d9 not registered"
Fix this duplication and also add a bit more context in addition to raw
object pointer, to help analysis of kernel logs.
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
sound/pci/hda/patch_hdmi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 295cc5a989d5..41eaa89660c3 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -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;
}
@@ -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;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups
2020-07-03 15:38 ` [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups Kai Vehmanen
@ 2020-07-07 8:14 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-07-07 8:14 UTC (permalink / raw)
To: Kai Vehmanen
Cc: Pierre-Louis Bossart, alsa-devel, libin.yang, Ranjani Sridharan
On Fri, 03 Jul 2020 17:38:18 +0200,
Kai Vehmanen wrote:
>
> The HDMI codec driver has two debug traces printed from different
> functions but with identical message content:
>
> "HDMI: hinfo 000000006a6b84d9 not registered"
>
> Fix this duplication and also add a bit more context in addition to raw
> object pointer, to help analysis of kernel logs.
>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Thanks, applied now.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later
2020-07-03 15:38 [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Kai Vehmanen
2020-07-03 15:38 ` [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups Kai Vehmanen
@ 2020-07-07 8:13 ` Takashi Iwai
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-07-07 8:13 UTC (permalink / raw)
To: Kai Vehmanen
Cc: Pierre-Louis Bossart, alsa-devel, libin.yang, Ranjani Sridharan
On Fri, 03 Jul 2020 17:38:17 +0200,
Kai Vehmanen wrote:
>
> When HDMI PCM devices are opened in a specific order, with at least one
> HDMI/DP receiver connected, ALSA PCM open fails to -EBUSY on the
> connected monitor, on recent Intel platforms (ICL/JSL and newer). While
> this is not a typical sequence, at least Pulseaudio does this every time
> when it is started, to discover the available PCMs.
>
> The rootcause is an invalid assumption in hdmi_add_pin(), where the
> total number of converters is assumed to be known at the time the
> function is called. On older Intel platforms this held true, but after
> ICL/JSL, the order how pins and converters are in the subnode list as
> returned by snd_hda_get_sub_nodes(), was changed. As a result,
> information for some converters was not stored to per_pin->mux_nids.
> And this means some pins cannot be connected to all converters, and
> application instead gets -EBUSY instead at open.
>
> The assumption that converters are always before pins in the subnode
> list, is not really a valid one. Fix the problem in hdmi_parse_codec()
> by introducing separate loops for discovering converters and pins.
>
> BugLink: https://github.com/thesofproject/linux/issues/1978
> BugLink: https://github.com/thesofproject/linux/issues/2216
> BugLink: https://github.com/thesofproject/linux/issues/2217
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-07 8:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-03 15:38 [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Kai Vehmanen
2020-07-03 15:38 ` [PATCH 2/2] ALSA: hda/hdmi: improve debug traces for stream lookups Kai Vehmanen
2020-07-07 8:14 ` Takashi Iwai
2020-07-07 8:13 ` [PATCH 1/2] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox