summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-01-27 08:53:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-02-07 22:08:09 +0100
commitdd18f45e0f992acea57e081c29856ce38aab16b9 (patch)
tree3ca3b32f3b9a3f1454912685d1d0f9a2d1f8a4c1
parent96df48516da930ed3a0ef9e35f60b5b5820d6272 (diff)
downloadbarebox-dd18f45e0f992acea57e081c29856ce38aab16b9.tar.gz
barebox-dd18f45e0f992acea57e081c29856ce38aab16b9.tar.xz
fb: For multiple video modes print the available modes in devinfo
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/video/fb.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index cf21c4bba3..85db9044c8 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);