summaryrefslogtreecommitdiff
path: root/cmd/read_edid.c
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2025-06-30 12:08:16 +0200
committerTom Rini <[email protected]>2025-12-30 11:22:57 -0600
commit5e9b0b56ad8c2a4289b2b506ad3d0f3acd0d20ba (patch)
tree6a39e7d920a1089506083bb62e794cceca259c66 /cmd/read_edid.c
parent5b2ee2c4a200961fa92ab1f2f2502ee41905257e (diff)
cmd: add new command to read edid
Add a new command to read EDID info from connected display. When applicable EDID can also be retrieved by commands such as: i2c dev x i2c edid 0x50 but the new read_edid function relies on the implementation of the read_edid callback from DISPLAY driver. Signed-off-by: Julien Stephan <[email protected]>
Diffstat (limited to 'cmd/read_edid.c')
-rw-r--r--cmd/read_edid.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/cmd/read_edid.c b/cmd/read_edid.c
new file mode 100644
index 00000000000..428dddca8bb
--- /dev/null
+++ b/cmd/read_edid.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2025 BayLibre, SAS
+ */
+
+#include <command.h>
+#include <dm.h>
+#include <display.h>
+#include <edid.h>
+
+static int do_read_edid(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ struct udevice *dev;
+ int ret;
+ u8 edid[EDID_EXT_SIZE];
+
+ /* Get the first display device (UCLASS_DISPLAY) */
+ ret = uclass_first_device_err(UCLASS_DISPLAY, &dev);
+ if (ret) {
+ printf("Cannot get display device: %d\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ ret = display_read_edid(dev, edid, EDID_EXT_SIZE);
+ if (ret) {
+ printf("Cannot read edid: %d\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ edid_print_info((struct edid1_info *)edid);
+
+ return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(read_edid, 1, 0, do_read_edid,
+ "Read and print EDID from display",
+ ""
+);