mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] video: simplefb-client: populate video mode field
@ 2021-08-24  9:51 Ahmad Fatoum
  2021-08-24  9:51 ` [PATCH 2/2] video: simplefb-client: make probe less verbose Ahmad Fatoum
  2021-10-04 12:00 ` [PATCH 1/2] video: simplefb-client: populate video mode field Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-08-24  9:51 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] video: simplefb-client: make probe less verbose
  2021-08-24  9:51 [PATCH 1/2] video: simplefb-client: populate video mode field Ahmad Fatoum
@ 2021-08-24  9:51 ` Ahmad Fatoum
  2021-10-04 12:00 ` [PATCH 1/2] video: simplefb-client: populate video mode field Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-08-24  9:51 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Printing the framebuffer base is unnecessary because it's already
contained in the dev_printf prefix. Make the message shorter
and only print it on success.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/video/simplefb-client.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/video/simplefb-client.c b/drivers/video/simplefb-client.c
index e1f241d4d874..2367713ba4ae 100644
--- a/drivers/video/simplefb-client.c
+++ b/drivers/video/simplefb-client.c
@@ -122,9 +122,6 @@ static int simplefb_probe(struct device_d *dev)
 
 	info->fbops = &simplefb_ops;
 
-	dev_info(dev, "framebuffer at 0x%p, 0x%lx bytes\n",
-		 info->screen_base, info->screen_size);
-
 	info->dev.parent = dev;
 	ret = register_framebuffer(info);
 	if (ret < 0) {
@@ -132,7 +129,7 @@ static int simplefb_probe(struct device_d *dev)
 		return ret;
 	}
 
-	dev_info(dev, "simplefb registered!\n");
+	dev_info(dev, "size %s registered\n", size_human_readable(info->screen_size));
 
 	return 0;
 }
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] video: simplefb-client: populate video mode field
  2021-08-24  9:51 [PATCH 1/2] video: simplefb-client: populate video mode field Ahmad Fatoum
  2021-08-24  9:51 ` [PATCH 2/2] video: simplefb-client: make probe less verbose Ahmad Fatoum
@ 2021-10-04 12:00 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-10-04 12:00 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Aug 24, 2021 at 11:51:18AM +0200, Ahmad Fatoum wrote:
> 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@pengutronix.de>
> ---
>  drivers/video/simplefb-client.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-04 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  9:51 [PATCH 1/2] video: simplefb-client: populate video mode field Ahmad Fatoum
2021-08-24  9:51 ` [PATCH 2/2] video: simplefb-client: make probe less verbose Ahmad Fatoum
2021-10-04 12:00 ` [PATCH 1/2] video: simplefb-client: populate video mode field Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git