summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@pengutronix.de>2010-12-20 16:05:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-12-21 08:26:08 +0100
commit30aa4efb57475ff768f6d43051ee78160f32ce0f (patch)
tree9b77249e33e3a859c864ad021857ab9de620cddc /drivers/video
parentfed63e249dfdd6bf4171d407e1fb27cba9db47b1 (diff)
downloadbarebox-30aa4efb57475ff768f6d43051ee78160f32ce0f.tar.gz
barebox-30aa4efb57475ff768f6d43051ee78160f32ce0f.tar.xz
Add the feature to change the video mode at runtime
This patch add the possibility to change the video mode at barebox's runtime if the graphics driver in use supports it. Signed-off-by: <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fb.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index bef41470cb..aad0e1f409 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -56,6 +56,35 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
return 0;
}
+static int fb_setup_mode(struct device_d *dev, struct param_d *param,
+ const char *val)
+{
+ struct fb_info *info = dev->priv;
+ int mode, ret;
+
+ if (info->enabled != 0)
+ return -EPERM;
+
+ if (!val)
+ return dev_param_set_generic(dev, param, NULL);
+
+ for (mode = 0; mode < info->num_modes; mode++) {
+ if (!strcmp(info->mode_list[mode].name, val))
+ break;
+ }
+ if (mode >= info->num_modes)
+ return -EINVAL;
+
+ info->mode = &info->mode_list[mode];
+
+ ret = info->fbops->fb_activate_var(info);
+
+ if (ret == 0)
+ dev_param_set_generic(dev, param, val);
+
+ return ret;
+}
+
static struct file_operations fb_ops = {
.read = mem_read,
.write = mem_write,
@@ -87,6 +116,12 @@ int register_framebuffer(struct fb_info *info)
dev_add_param(dev, "enable", fb_enable_set, NULL, 0);
dev_set_param(dev, "enable", "0");
+ if (info->num_modes && (info->mode_list != NULL) &&
+ (info->fbops->fb_activate_var != NULL)) {
+ dev_add_param(dev, "mode_name", fb_setup_mode, NULL, 0);
+ dev_set_param(dev, "mode_name", info->mode_list[0].name);
+ }
+
devfs_create(&info->cdev);
return 0;