Merge patch series "video: display: refactor display_read_timing to avoid code duplication"
Julien Stephan <jstephan@baylibre.com> says:
Commit 2dcf143398 ("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
This commit is contained in:
@@ -1692,6 +1692,12 @@ config CMD_READ
|
||||
help
|
||||
Provides low-level access to the data in a partition.
|
||||
|
||||
config CMD_READ_EDID
|
||||
bool "read_edid - Read display EDID"
|
||||
depends on DISPLAY
|
||||
help
|
||||
Read and parse edid from connected display device.
|
||||
|
||||
config CMD_REMOTEPROC
|
||||
bool "remoteproc"
|
||||
depends on REMOTEPROC
|
||||
|
||||
@@ -157,6 +157,7 @@ obj-$(CONFIG_CMD_WOL) += wol.o
|
||||
obj-$(CONFIG_CMD_QFW) += qfw.o
|
||||
obj-$(CONFIG_CMD_READ) += read.o
|
||||
obj-$(CONFIG_CMD_WRITE) += read.o
|
||||
obj-$(CONFIG_CMD_READ_EDID) += read_edid.o
|
||||
obj-$(CONFIG_CMD_REGINFO) += reginfo.o
|
||||
obj-$(CONFIG_CMD_REMOTEPROC) += remoteproc.o
|
||||
obj-$(CONFIG_CMD_RNG) += rng.o
|
||||
|
||||
38
cmd/read_edid.c
Normal file
38
cmd/read_edid.c
Normal file
@@ -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",
|
||||
""
|
||||
);
|
||||
Reference in New Issue
Block a user