[PATCH 1/2] video: simplefb-client: populate video mode field
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Aug 24 02:51:18 PDT 2021
Video drivers should initialize fb_info->mode, so device parameters for
mode and enable/disable can function as expected. This wasn't done in
the simplefb driver so far, fix this.
This also lets us drop some initialization of the fb_info, because it
can be calculated from the mode. The very verbose mode info print
can be dropped as well, because it's now available in devinfo.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/video/simplefb-client.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/video/simplefb-client.c b/drivers/video/simplefb-client.c
index 1f26ac506741..e1f241d4d874 100644
--- a/drivers/video/simplefb-client.c
+++ b/drivers/video/simplefb-client.c
@@ -30,6 +30,11 @@ struct simplefb_params {
struct simplefb_format *format;
};
+struct simplefb {
+ struct fb_info info;
+ struct fb_videomode mode;
+};
+
static int simplefb_parse_dt(struct device_d *dev,
struct simplefb_params *params)
{
@@ -80,6 +85,7 @@ static int simplefb_probe(struct device_d *dev)
{
int ret;
struct simplefb_params params;
+ struct simplefb *simplefb;
struct fb_info *info;
struct resource *mem;
@@ -96,17 +102,19 @@ static int simplefb_probe(struct device_d *dev)
return PTR_ERR(mem);
}
- info = xzalloc(sizeof(*info));
- dev->priv = info;
+ simplefb = xzalloc(sizeof(*simplefb));
+
+ simplefb->mode.name = params.format->name;
+ simplefb->mode.xres = params.width;
+ simplefb->mode.yres = params.height;
- info->xres = params.width;
- info->yres = params.height;
+ info = &simplefb->info;
+ info->mode = &simplefb->mode;
info->bits_per_pixel = params.format->bits_per_pixel;
info->red = params.format->red;
info->green = params.format->green;
info->blue = params.format->blue;
info->transp = params.format->transp;
- info->line_length = params.stride;
info->screen_base = (void *)mem->start;
info->screen_size = resource_size(mem);
@@ -116,10 +124,6 @@ static int simplefb_probe(struct device_d *dev)
dev_info(dev, "framebuffer at 0x%p, 0x%lx bytes\n",
info->screen_base, info->screen_size);
- dev_info(dev, "format=%s, mode=%dx%dx%d, linelength=%d\n",
- params.format->name,
- info->xres, info->yres,
- info->bits_per_pixel, info->line_length);
info->dev.parent = dev;
ret = register_framebuffer(info);
--
2.30.2
More information about the barebox
mailing list