]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sysfb: Pass sysfb_primary_display to devices
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 26 Nov 2025 16:03:22 +0000 (17:03 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 16 Dec 2025 13:12:44 +0000 (14:12 +0100)
Instead of screen_info, store a copy of sysfb_primary_display as
device data. Pick it up in drivers. Later changes will add additional
data to the display info, such as EDID information.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Richard Lyu <richard.lyu@suse.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/sysfb.c
drivers/gpu/drm/sysfb/efidrm.c
drivers/gpu/drm/sysfb/vesadrm.c
drivers/video/fbdev/efifb.c
drivers/video/fbdev/vesafb.c
drivers/video/fbdev/vga16fb.c

index 1f671f9219b0726b1b8fe559e6519669edaa7a19..8833582c188301afb4a9c9dbdf969828ab9449f6 100644 (file)
@@ -141,7 +141,8 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)
 
 static __init int sysfb_init(void)
 {
-       struct screen_info *si = &sysfb_primary_display.screen;
+       struct sysfb_display_info *dpy = &sysfb_primary_display;
+       struct screen_info *si = &dpy->screen;
        struct device *parent;
        unsigned int type;
        struct simplefb_platform_data mode;
@@ -202,7 +203,7 @@ static __init int sysfb_init(void)
 
        sysfb_set_efifb_fwnode(si, pd);
 
-       ret = platform_device_add_data(pd, si, sizeof(*si));
+       ret = platform_device_add_data(pd, dpy, sizeof(*dpy));
        if (ret)
                goto err;
 
index 1b683d55d6ea4810840c09b82914a15c53c14b2f..29533ae8fbbf28e5223644e565185040a4e13528 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/efi.h>
 #include <linux/limits.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
+#include <linux/sysfb.h>
 
 #include <drm/clients/drm_client_setup.h>
 #include <drm/drm_atomic.h>
@@ -141,6 +141,7 @@ static const struct drm_mode_config_funcs efidrm_mode_config_funcs = {
 static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,
                                                  struct platform_device *pdev)
 {
+       const struct sysfb_display_info *dpy;
        const struct screen_info *si;
        const struct drm_format_info *format;
        int width, height, stride;
@@ -160,9 +161,11 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,
        size_t nformats;
        int ret;
 
-       si = dev_get_platdata(&pdev->dev);
-       if (!si)
+       dpy = dev_get_platdata(&pdev->dev);
+       if (!dpy)
                return ERR_PTR(-ENODEV);
+       si = &dpy->screen;
+
        if (screen_info_video_type(si) != VIDEO_TYPE_EFI)
                return ERR_PTR(-ENODEV);
 
index 7b7b5ba26317d468267fea5c8d1540edafddbb5d..16fc223f8c5bc465ed215b79fbcd5ad6f4af2a99 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/ioport.h>
 #include <linux/limits.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
+#include <linux/sysfb.h>
 
 #include <drm/clients/drm_client_setup.h>
 #include <drm/drm_atomic.h>
@@ -391,6 +391,7 @@ static const struct drm_mode_config_funcs vesadrm_mode_config_funcs = {
 static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,
                                                    struct platform_device *pdev)
 {
+       const struct sysfb_display_info *dpy;
        const struct screen_info *si;
        const struct drm_format_info *format;
        int width, height, stride;
@@ -410,9 +411,11 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,
        size_t nformats;
        int ret;
 
-       si = dev_get_platdata(&pdev->dev);
-       if (!si)
+       dpy = dev_get_platdata(&pdev->dev);
+       if (!dpy)
                return ERR_PTR(-ENODEV);
+       si = &dpy->screen;
+
        if (screen_info_video_type(si) != VIDEO_TYPE_VLFB)
                return ERR_PTR(-ENODEV);
 
index 0e1bd3dba25549abeaf06ed41c8c06193c6579e4..47ebc0107209eec28c1c523e54b1618fb8435c30 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/fb.h>
 #include <linux/platform_device.h>
 #include <linux/printk.h>
-#include <linux/screen_info.h>
+#include <linux/sysfb.h>
 #include <video/vga.h>
 #include <asm/efi.h>
 #include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
@@ -345,6 +345,7 @@ ATTRIBUTE_GROUPS(efifb);
 
 static int efifb_probe(struct platform_device *dev)
 {
+       struct sysfb_display_info *dpy;
        struct screen_info *si;
        struct fb_info *info;
        struct efifb_par *par;
@@ -360,10 +361,11 @@ static int efifb_probe(struct platform_device *dev)
         * driver. We get a copy of the attached screen_info, so that we can
         * modify its values without affecting later drivers.
         */
-       si = dev_get_platdata(&dev->dev);
-       if (!si)
+       dpy = dev_get_platdata(&dev->dev);
+       if (!dpy)
                return -ENODEV;
-       si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL);
+
+       si = devm_kmemdup(&dev->dev, &dpy->screen, sizeof(*si), GFP_KERNEL);
        if (!si)
                return -ENOMEM;
 
index f135033c22fb37128a840e29fc02cfbf55797984..f84f4db244bfe628c665324a15602e58fc3de8ea 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/ioport.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
+#include <linux/sysfb.h>
 #include <linux/io.h>
 
 #include <video/vga.h>
@@ -243,6 +243,7 @@ static int vesafb_setup(char *options)
 
 static int vesafb_probe(struct platform_device *dev)
 {
+       struct sysfb_display_info *dpy;
        struct screen_info *si;
        struct fb_info *info;
        struct vesafb_par *par;
@@ -257,10 +258,11 @@ static int vesafb_probe(struct platform_device *dev)
         * driver. We get a copy of the attached screen_info, so that we can
         * modify its values without affecting later drivers.
         */
-       si = dev_get_platdata(&dev->dev);
-       if (!si)
+       dpy = dev_get_platdata(&dev->dev);
+       if (!dpy)
                return -ENODEV;
-       si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL);
+
+       si = devm_kmemdup(&dev->dev, &dpy->screen, sizeof(*si), GFP_KERNEL);
        if (!si)
                return -ENOMEM;
 
index 6b81337a49092d5d750d6026815b94e8741327b3..22085d3668e87cd9031294f9ede5ff495bb06c99 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/ioport.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
+#include <linux/sysfb.h>
 
 #include <asm/io.h>
 #include <video/vga.h>
@@ -1305,15 +1305,17 @@ static const struct fb_ops vga16fb_ops = {
 
 static int vga16fb_probe(struct platform_device *dev)
 {
+       struct sysfb_display_info *dpy;
        struct screen_info *si;
        struct fb_info *info;
        struct vga16fb_par *par;
        int i;
        int ret = 0;
 
-       si = dev_get_platdata(&dev->dev);
-       if (!si)
+       dpy = dev_get_platdata(&dev->dev);
+       if (!dpy)
                return -ENODEV;
+       si = &dpy->screen;
 
        ret = check_mode_supported(si);
        if (ret)