aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorVladimir Murzin <vladimir.murzin@arm.com>2016-08-15 06:10:31 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-09-07 05:06:13 -0400
commit95cc44a04f4c364affbc194820ad4ca5ab88f30c (patch)
tree9759b4fb11fab5e0069e1cb6cf01ce3b6781390c /drivers/video
parentcf957ccc76eeffee9f06d2f8f7c9260015076e92 (diff)
fbdev: vfb: add option for video mode
Make vfb a bit more flexible in sense what it can represent and allow the end user to specify video mode parameters via newly introduced module option "mode". Since it is test module it is still up to the end user to make sure there is enough memory to satisfy video mode settings. Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> [tomi.valkeinen@ti.com: constified vfb_default] Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/vfb.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c
index e9ecae292ba8..ef9aa378abf6 100644
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -37,6 +37,10 @@ static u_long videomemorysize = VIDEOMEMSIZE;
37module_param(videomemorysize, ulong, 0); 37module_param(videomemorysize, ulong, 0);
38MODULE_PARM_DESC(videomemorysize, "RAM available to frame buffer (in bytes)"); 38MODULE_PARM_DESC(videomemorysize, "RAM available to frame buffer (in bytes)");
39 39
40static char *mode_option = NULL;
41module_param(mode_option, charp, 0);
42MODULE_PARM_DESC(mode_option, "Preferred video mode (e.g. 640x480-8@60)");
43
40/********************************************************************** 44/**********************************************************************
41 * 45 *
42 * Memory management 46 * Memory management
@@ -86,26 +90,17 @@ static void rvfree(void *mem, unsigned long size)
86 vfree(mem); 90 vfree(mem);
87} 91}
88 92
89static struct fb_var_screeninfo vfb_default = { 93static const struct fb_videomode vfb_default = {
90 .xres = 640, 94 .xres = 640,
91 .yres = 480, 95 .yres = 480,
92 .xres_virtual = 640, 96 .pixclock = 20000,
93 .yres_virtual = 480, 97 .left_margin = 64,
94 .bits_per_pixel = 8, 98 .right_margin = 64,
95 .red = { 0, 8, 0 }, 99 .upper_margin = 32,
96 .green = { 0, 8, 0 }, 100 .lower_margin = 32,
97 .blue = { 0, 8, 0 }, 101 .hsync_len = 64,
98 .activate = FB_ACTIVATE_TEST, 102 .vsync_len = 2,
99 .height = -1, 103 .vmode = FB_VMODE_NONINTERLACED,
100 .width = -1,
101 .pixclock = 20000,
102 .left_margin = 64,
103 .right_margin = 64,
104 .upper_margin = 32,
105 .lower_margin = 32,
106 .hsync_len = 64,
107 .vsync_len = 2,
108 .vmode = FB_VMODE_NONINTERLACED,
109}; 104};
110 105
111static struct fb_fix_screeninfo vfb_fix = { 106static struct fb_fix_screeninfo vfb_fix = {
@@ -479,6 +474,8 @@ static int __init vfb_setup(char *options)
479 /* Test disable for backwards compatibility */ 474 /* Test disable for backwards compatibility */
480 if (!strcmp(this_opt, "disable")) 475 if (!strcmp(this_opt, "disable"))
481 vfb_enable = 0; 476 vfb_enable = 0;
477 else
478 mode_option = this_opt;
482 } 479 }
483 return 1; 480 return 1;
484} 481}
@@ -506,11 +503,13 @@ static int vfb_probe(struct platform_device *dev)
506 info->screen_base = (char __iomem *)videomemory; 503 info->screen_base = (char __iomem *)videomemory;
507 info->fbops = &vfb_ops; 504 info->fbops = &vfb_ops;
508 505
509 retval = fb_find_mode(&info->var, info, NULL, 506 if (!fb_find_mode(&info->var, info, mode_option,
510 NULL, 0, NULL, 8); 507 NULL, 0, &vfb_default, 8)){
508 fb_err(info, "Unable to find usable video mode.\n");
509 retval = -EINVAL;
510 goto err1;
511 }
511 512
512 if (!retval || (retval == 4))
513 info->var = vfb_default;
514 vfb_fix.smem_start = (unsigned long) videomemory; 513 vfb_fix.smem_start = (unsigned long) videomemory;
515 vfb_fix.smem_len = videomemorysize; 514 vfb_fix.smem_len = videomemorysize;
516 info->fix = vfb_fix; 515 info->fix = vfb_fix;