mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] fb: For multiple video modes print the available modes in devinfo
Date: Thu,  3 Feb 2011 10:57:13 +0100	[thread overview]
Message-ID: <1296727034-19693-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1296727034-19693-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index cf21c4b..85db904 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -5,6 +5,7 @@
 #include <getopt.h>
 #include <fcntl.h>
 #include <fs.h>
+#include <init.h>
 
 static int fb_ioctl(struct cdev* cdev, int req, void *data)
 {
@@ -135,3 +136,40 @@ int register_framebuffer(struct fb_info *info)
 	return 0;
 }
 
+static void fb_info(struct device_d *dev)
+{
+	struct fb_info *info = dev->priv;
+	int i;
+
+	if (!info->num_modes)
+		return;
+
+	printf("available modes:\n");
+
+	for (i = 0; i < info->num_modes; i++) {
+		struct fb_videomode *mode = &info->mode_list[i];
+
+		printf("%-10s %dx%d@%d\n", mode->name,
+				mode->xres, mode->yres, mode->refresh);
+	}
+
+	printf("\n");
+}
+
+static int fb_probe(struct device_d *hw_dev)
+{
+	return 0;
+}
+
+static struct driver_d fb_driver = {
+	.name  = "fb",
+	.probe = fb_probe,
+	.info = fb_info,
+};
+
+static int fb_init_driver(void)
+{
+	register_driver(&fb_driver);
+	return 0;
+}
+device_initcall(fb_init_driver);
-- 
1.7.2.3


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

  reply	other threads:[~2011-02-03  9:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  9:57 fb patches Sascha Hauer
2011-02-03  9:57 ` Sascha Hauer [this message]
2011-02-03  9:57 ` [PATCH 2/2] ARM tx28: Add hook for enabling the display Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296727034-19693-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox