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>
This commit is contained in:
parent
fed63e249d
commit
30aa4efb57
|
@ -56,6 +56,35 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
|
||||||
return 0;
|
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 = {
|
static struct file_operations fb_ops = {
|
||||||
.read = mem_read,
|
.read = mem_read,
|
||||||
.write = mem_write,
|
.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_add_param(dev, "enable", fb_enable_set, NULL, 0);
|
||||||
dev_set_param(dev, "enable", "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);
|
devfs_create(&info->cdev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -73,10 +73,13 @@ struct fb_ops {
|
||||||
unsigned blue, unsigned transp, struct fb_info *info);
|
unsigned blue, unsigned transp, struct fb_info *info);
|
||||||
void (*fb_enable)(struct fb_info *info);
|
void (*fb_enable)(struct fb_info *info);
|
||||||
void (*fb_disable)(struct fb_info *info);
|
void (*fb_disable)(struct fb_info *info);
|
||||||
|
int (*fb_activate_var)(struct fb_info *info);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fb_info {
|
struct fb_info {
|
||||||
struct fb_videomode *mode;
|
struct fb_videomode *mode;
|
||||||
|
struct fb_videomode *mode_list;
|
||||||
|
unsigned num_modes;
|
||||||
|
|
||||||
struct fb_ops *fbops;
|
struct fb_ops *fbops;
|
||||||
struct device_d dev; /* This is this fb device */
|
struct device_d dev; /* This is this fb device */
|
||||||
|
|
Loading…
Reference in New Issue