Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_eld: Accept the ASoC hdmi-codec ELD format
@ 2026-11-26 10:53 Roy
  2026-11-27  3:29 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Roy @ 2026-11-26 10:53 UTC (permalink / raw)
  To: igt-dev; +Cc: Roy

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.

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

Signed-off-by: Roy <rongh7426@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-01  0:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH i-g-t v2] " Lin Tzu Yang
2026-12-01  0:54 ` ✗ LGCI.VerificationFailed: failure for lib/igt_eld: Accept the ASoC hdmi-codec ELD format (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox