"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge patch series "video: display: refactor display_read_timing to avoid code duplication"

Julien Stephan <jstephan@baylibre.com> says:

Commit 2dcf143398ad ("dm: video: Repurpose the 'displayport' uclass to 'display'")
left the display_read_edid() function unused by mistake.

This series addresses that oversight and introduces a new useful cmd.

Patch 1:
- Refactors display_read_timing() to use the existing
display_read_edid() function, eliminating redundant code.
- Marks display_read_edid() as static since it is not used outside of
the file.

Patch 2:
- Adds a new read_edid command, which can be very useful for debugging
or developing new display drivers.
- As this command uses display_read_edid(), the function is made
non-static again.

Link: https://lore.kernel.org/r/20250630-read_edid_cleanup-v1-0-ec7d425472c7@baylibre.com

Tom Rini 5652ccc8 4df43f44

+56 -3
+6
cmd/Kconfig
··· 1692 1692 help 1693 1693 Provides low-level access to the data in a partition. 1694 1694 1695 + config CMD_READ_EDID 1696 + bool "read_edid - Read display EDID" 1697 + depends on DISPLAY 1698 + help 1699 + Read and parse edid from connected display device. 1700 + 1695 1701 config CMD_REMOTEPROC 1696 1702 bool "remoteproc" 1697 1703 depends on REMOTEPROC
+1
cmd/Makefile
··· 157 157 obj-$(CONFIG_CMD_QFW) += qfw.o 158 158 obj-$(CONFIG_CMD_READ) += read.o 159 159 obj-$(CONFIG_CMD_WRITE) += read.o 160 + obj-$(CONFIG_CMD_READ_EDID) += read_edid.o 160 161 obj-$(CONFIG_CMD_REGINFO) += reginfo.o 161 162 obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o 162 163 obj-$(CONFIG_CMD_RNG) += rng.o
+38
cmd/read_edid.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Copyright (c) 2025 BayLibre, SAS 4 + */ 5 + 6 + #include <command.h> 7 + #include <dm.h> 8 + #include <display.h> 9 + #include <edid.h> 10 + 11 + static int do_read_edid(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) 12 + { 13 + struct udevice *dev; 14 + int ret; 15 + u8 edid[EDID_EXT_SIZE]; 16 + 17 + /* Get the first display device (UCLASS_DISPLAY) */ 18 + ret = uclass_first_device_err(UCLASS_DISPLAY, &dev); 19 + if (ret) { 20 + printf("Cannot get display device: %d\n", ret); 21 + return CMD_RET_FAILURE; 22 + } 23 + 24 + ret = display_read_edid(dev, edid, EDID_EXT_SIZE); 25 + if (ret) { 26 + printf("Cannot read edid: %d\n", ret); 27 + return CMD_RET_FAILURE; 28 + } 29 + 30 + edid_print_info((struct edid1_info *)edid); 31 + 32 + return CMD_RET_SUCCESS; 33 + } 34 + 35 + U_BOOT_CMD(read_edid, 1, 0, do_read_edid, 36 + "Read and print EDID from display", 37 + "" 38 + );
+1 -3
drivers/video/display-uclass.c
··· 59 59 if (ops && ops->read_timing) 60 60 return ops->read_timing(dev, timing); 61 61 62 - if (!ops || !ops->read_edid) 63 - return -ENOSYS; 64 - ret = ops->read_edid(dev, buf, sizeof(buf)); 62 + ret = display_read_edid(dev, buf, sizeof(buf)); 65 63 if (ret < 0) 66 64 return ret; 67 65
+10
include/display.h
··· 26 26 }; 27 27 28 28 /** 29 + * display_read_edid() - Read edid from display 30 + * 31 + * @dev: Device to read from 32 + * @buf: Buffer to read into (should be EDID_SIZE bytes) 33 + * @buf_size: Buffer size (should be EDID_SIZE) 34 + * Return number of bytes read, <= 0 for error 35 + */ 36 + int display_read_edid(struct udevice *dev, u8 *buf, int buf_size); 37 + 38 + /** 29 39 * display_read_timing() - Read timing information 30 40 * 31 41 * @dev: Device to read from