[PATCH v2 06/10] sysfb: Move edid_info into sysfb_primary_display

Thomas Zimmermann
2025-11-24T16:52:19Z

Move x86's edid_info into sysfb_primary_display as a new field named
edid. Adapt all users.

An instance of edid_info has only been defined on x86. With the move
into sysfb_primary_display, it becomes available on all architectures.
Therefore remove this contraint from CONFIG_FIRMWARE_EDID.

x86 fills the EDID data from boot_params.edid_info. DRM drivers pick
up the raw data and make it available to DRM clients. Replace the
drivers' references to edid_info and instead use the sysfb_display_info
as passed from sysfb.

v2:
- drop changes to CONFIG_FIRMWARE_EDID

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/kernel/setup.c | 6 +-----
drivers/gpu/drm/sysfb/efidrm.c | 5 ++---
drivers/gpu/drm/sysfb/vesadrm.c | 5 ++---
drivers/video/fbdev/core/fbmon.c | 8 +++++---
include/linux/sysfb.h | 6 ++++++
include/video/edid.h | 4 ----
6 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 675e4b9deb1f..d9bfe2032cd9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -215,10 +215,6 @@ arch_initcall(init_x86_sysctl);

struct sysfb_display_info sysfb_primary_display;
EXPORT_SYMBOL(sysfb_primary_display);
-#if defined(CONFIG_FIRMWARE_EDID)
-struct edid_info edid_info;
-EXPORT_SYMBOL_GPL(edid_info);
-#endif

extern int root_mountflags;

@@ -530,7 +526,7 @@ static void __init parse_boot_params(void)
ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
sysfb_primary_display.screen = boot_params.screen_info;
#if defined(CONFIG_FIRMWARE_EDID)
- edid_info = boot_params.edid_info;
+ sysfb_primary_display.edid = boot_params.edid_info;
#endif
#ifdef CONFIG_X86_32
apm_info.bios = boot_params.apm_bios_info;
diff --git a/drivers/gpu/drm/sysfb/efidrm.c b/drivers/gpu/drm/sysfb/efidrm.c
index 29533ae8fbbf..50e0aeef709c 100644
--- a/drivers/gpu/drm/sysfb/efidrm.c
+++ b/drivers/gpu/drm/sysfb/efidrm.c
@@ -24,7 +24,6 @@
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>

-#include <video/edid.h>
#include <video/pixel_format.h>

#include "drm_sysfb_helper.h"
@@ -207,8 +206,8 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,
&format->format, width, height, stride);

#if defined(CONFIG_FIRMWARE_EDID)
- if (drm_edid_header_is_valid(edid_info.dummy) == 8)
- sysfb->edid = edid_info.dummy;
+ if (drm_edid_header_is_valid(dpy->edid.dummy) == 8)
+ sysfb->edid = dpy->edid.dummy;
#endif
sysfb->fb_mode = drm_sysfb_mode(width, height, 0, 0);
sysfb->fb_format = format;
diff --git a/drivers/gpu/drm/sysfb/vesadrm.c b/drivers/gpu/drm/sysfb/vesadrm.c
index 16fc223f8c5b..0680638b8131 100644
--- a/drivers/gpu/drm/sysfb/vesadrm.c
+++ b/drivers/gpu/drm/sysfb/vesadrm.c
@@ -25,7 +25,6 @@
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>

-#include <video/edid.h>
#include <video/pixel_format.h>
#include <video/vga.h>

@@ -474,8 +473,8 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,
}

#if defined(CONFIG_FIRMWARE_EDID)
- if (drm_edid_header_is_valid(edid_info.dummy) == 8)
- sysfb->edid = edid_info.dummy;
+ if (drm_edid_header_is_valid(dpy->edid.dummy) == 8)
+ sysfb->edid = dpy->edid.dummy;
#endif
sysfb->fb_mode = drm_sysfb_mode(width, height, 0, 0);
sysfb->fb_format = format;
diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 0a65bef01e3c..07df7e98f8a3 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -32,11 +32,13 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
-#include <video/edid.h>
+#include <linux/string_choices.h>
+#include <linux/sysfb.h>
+
#include <video/of_videomode.h>
#include <video/videomode.h>
+
#include "../edid.h"
-#include <linux/string_choices.h>

/*
* EDID parser
@@ -1504,7 +1506,7 @@ const unsigned char *fb_firmware_edid(struct device *device)
res = &dev->resource[PCI_ROM_RESOURCE];

if (res && res->flags & IORESOURCE_ROM_SHADOW)
- edid = edid_info.dummy;
+ edid = sysfb_primary_display.edid.dummy;

return edid;
}
diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
index e8bde392c690..5226efde9ad4 100644
--- a/include/linux/sysfb.h
+++ b/include/linux/sysfb.h
@@ -12,6 +12,8 @@
#include <linux/screen_info.h>
#include <linux/types.h>

+#include <video/edid.h>
+
struct device;
struct platform_device;
struct screen_info;
@@ -62,6 +64,10 @@ struct efifb_dmi_info {

struct sysfb_display_info {
struct screen_info screen;
+
+#if defined(CONFIG_FIRMWARE_EDID)
+ struct edid_info edid;
+#endif
};

extern struct sysfb_display_info sysfb_primary_display;
diff --git a/include/video/edid.h b/include/video/edid.h
index c2b186b1933a..52aabb706032 100644
--- a/include/video/edid.h
+++ b/include/video/edid.h
@@ -4,8 +4,4 @@

#include <uapi/video/edid.h>

-#if defined(CONFIG_FIRMWARE_EDID)
-extern struct edid_info edid_info;
-#endif
-
#endif /* __linux_video_edid_h__ */
--
2.51.1