All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lin Tzu Yang <rongh7426@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com, swati2.sharma@intel.com,
	karthik.b.s@intel.com
Subject: [PATCH i-g-t v2] lib/igt_eld: Accept the ASoC hdmi-codec ELD format
Date: Mon, 30 Nov 2026 19:50:59 +0800	[thread overview]
Message-ID: <20261130115059.842838-1-rongh7426@gmail.com> (raw)
In-Reply-To: <20261126105345.656307-1-rongh7426@gmail.com>

eld_parse_entry() only reports a monitor when the ELD file has
"monitor_present 1", and eld_get_igt() also needs "eld_valid 1". Those
two fields are printed by the HDA HDMI codec only. The ELD files of the
ASoC hdmi-codec, used by HDMI audio on Arm boards, start at
monitor_name, so every ELD there is treated as having no monitor.

On a Raspberry Pi 5 (vc4), kms_hdmi_inject's inject-audio fails even
though the ELD shows the injected EDID:

  (kms_hdmi_inject) igt_eld-DEBUG: Monitor not present in ELD: /proc/asound/card0/eld#0
  (kms_hdmi_inject) CRITICAL: HDMI ELD missing after retry

while /proc/asound/card0/eld#0 has:

  monitor_name		IGT
  connection_type	HDMI
  eld_version		[0x2] CEA-861D or below

When the two fields are missing, use the ELD version instead. The
hdmi-codec shows an all-zero ELD, with eld_version [0x0], when no sink
is connected, so a non-zero version means a monitor is present and its
ELD is valid. ELD files that have the fields are handled as before.

Tested on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39):
kms_hdmi_inject inject-audio fails before and passes after; inject-4k
passes both times.

Signed-off-by: Lin Tzu Yang <rongh7426@gmail.com>
---
v2:
- Move the note about AI use below the --- line (Kamil).
- Use my full name in the author and Signed-off-by (Kamil).

This change was written with the help of an AI coding assistant
(Claude); the test runs were done on real hardware.

 lib/igt_eld.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 0d3c668..51d2ee7 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -167,6 +167,11 @@ static bool parse_sad_field(struct eld_sad *sad, const char *key, char *value)
  *
  * Each entry contains one or more SAD blocks. Their contents is exposed in
  * sadN_* fields.
+ *
+ * The monitor_present and eld_valid fields are printed by the HDA HDMI codec
+ * only. The ASoC hdmi-codec starts at monitor_name and shows an all-zero ELD
+ * (eld_version [0x0]) when no sink is connected, so without those fields a
+ * non-zero ELD version means a monitor is present and its ELD is valid.
  */
 static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 {
@@ -175,6 +180,8 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 	char *key, *value, *sad_key;
 	size_t len;
 	bool monitor_present = false;
+	bool has_present = false, has_valid = false;
+	unsigned int eld_version = 0;
 	bool sad_ok;
 	int sad_index;
 
@@ -196,10 +203,15 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 		/* Skip whitespace at the beginning */
 		value += strspn(value, ELD_DELIM);
 
+		has_present |= strcmp(key, "monitor_present") == 0;
+		has_valid |= strcmp(key, "eld_valid") == 0;
+
 		if (strcmp(key, "monitor_present") == 0)
 			monitor_present = strcmp(value, "1") == 0;
 		else if (strcmp(key, "eld_valid") == 0)
 			eld->valid = strcmp(value, "1") == 0;
+		else if (strcmp(key, "eld_version") == 0)
+			sscanf(value, "[0x%x]", &eld_version);
 		else if (strcmp(key, "monitor_name") == 0)
 			snprintf(eld->monitor_name, sizeof(eld->monitor_name),
 				 "%s", value);
@@ -227,6 +239,11 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 
 	fclose(f);
 
+	if (!has_present)
+		monitor_present = eld_version != 0;
+	if (!has_valid)
+		eld->valid = monitor_present;
+
 	if (!monitor_present)
 		igt_debug("Monitor not present in ELD: %s\n", path);
 	return monitor_present;
-- 
2.51.1.windows.1


  parent reply	other threads:[~2026-11-30 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 10:53 [PATCH i-g-t] lib/igt_eld: Accept the ASoC hdmi-codec ELD format Roy
2026-11-27  3:29 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
2026-11-27 12:52 ` [PATCH i-g-t] " Kamil Konieczny
2026-11-30 11:50 ` Lin Tzu Yang [this message]
2026-12-01  0:54 ` ✗ LGCI.VerificationFailed: failure for lib/igt_eld: Accept the ASoC hdmi-codec ELD format (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130115059.842838-1-rongh7426@gmail.com \
    --to=rongh7426@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=karthik.b.s@intel.com \
    --cc=swati2.sharma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.