Add dynamic video initialization to barebox
Subsystems (6)
PATCH v2 1/1 Add dynamic video initialization to barebox
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
On my hardware I can connect a regular monitor, which supports more than one videomode. The runtime setup sequence looks like that:
tx28:/ devinfo framebuffer0
base : 0x00000000
size : 0x00000000
driver: framebuffer
Video/Mode info:
Video output not enabled
Current video mode:
No video mode selected yet
Supported video mode(s):
'VGA'
'SVGA'
'XGA'
'SXGA'
Parameters:
cdepth = 16
mode = <NULL>
enable = <NULL>
tx28:/ framebuffer0.mode=SVGA
tx28:/ bmp splash.bmp
tx28:/ framebuffer0.enable=1
After the last command the monitor shows the splash screen.
This is revision 2 of this patch stack.
- enabling the video output is now always required to get a picture
- driver specific data can now be added on a per videomode base
- documentation is adapted to the new behaviour
jbe
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/12 Separate framebuffer platformdata and the videomode
This patch separates the imx platformdata and its videomode in two structures, in order to support more than one defined videomode in the boardfile. This is intended to support runtime videomode selection later on. It also uses now the same videomode setup style than the imx-fpu based systems (like the i.MX35).
--- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 28 +++++++++-------- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 28 +++++++++-------- arch/arm/boards/guf-neso/board.c | 28 +++++++++-------- arch/arm/boards/imx21ads/imx21ads.c | 34 +++++++++++---------- arch/arm/boards/pcm038/pcm038.c | 28 +++++++++-------- arch/arm/mach-imx/include/mach/imxfb.h | 2 +- drivers/video/imx.c | 6 ++-- 7 files changed, 82 insertions(+), 72 deletions(-)
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +15 -13
@@ -120,20 +120,22 @@ static struct device_d nand_dev = { .platform_data = &nand_info, }; +static struct fb_videomode cmo_display = { + .name ="CMO-QVGA" , + .refresh =60 , + .xres =320 , + .yres =240 , + .pixclock =KHZ2PICOS (6500 ), + .hsync_len =30 , + .left_margin =38 , + .right_margin =20 , + .vsync_len =3 , + .upper_margin =15 , + .lower_margin =4 , +}; +static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name ="CMO-QVGA" , - .refresh =60 , - .xres =320 , - .yres =240 , - .pixclock =KHZ2PICOS (6500 ), - .hsync_len =30 , - .left_margin =38 , - .right_margin =20 , - .vsync_len =3 , - .upper_margin =15 , - .lower_margin =4 , - }, + .mode = &cmo_display, .pcr =0xCAD08B80 , .bpp =16 , };
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +15 -13
@@ -186,20 +186,22 @@ static void eukrea_cpuimx27_mmu_init(void)#endif #ifdef CONFIG_DRIVER_VIDEO_IMX +static struct fb_videomode cmo_display = { + .name ="CMO-QVGA" , + .refresh =60 , + .xres =320 , + .yres =240 , + .pixclock =156000 , + .hsync_len =30 , + .left_margin =38 , + .right_margin =20 , + .vsync_len =3 , + .upper_margin =15 , + .lower_margin =4 , +}; +static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name ="CMO-QVGA" , - .refresh =60 , - .xres =320 , - .yres =240 , - .pixclock =156000 , - .hsync_len =30 , - .left_margin =38 , - .right_margin =20 , - .vsync_len =3 , - .upper_margin =15 , - .lower_margin =4 , - }, + .mode = &cmo_display, .pcr =0xFAD08B80 , .bpp =16 ,};
arch/arm/boards/guf-neso/board.c +15 -13
@@ -91,20 +91,22 @@ static struct device_d nand_dev = { .platform_data = &nand_info, }; +static struct fb_videomode cpt_display = { + .name ="CPT CLAA070LC0JCT" , + .refresh =60 , + .xres =800 , + .yres =480 , + .pixclock =KHZ2PICOS (27000 ), + .hsync_len =1 ,/* DE only sync */ + .left_margin =50 , + .right_margin =50 , + .vsync_len =1 ,/* DE only sync */ + .upper_margin =10 , + .lower_margin =10 , +}; +static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name ="CPT CLAA070LC0JCT" , - .refresh =60 , - .xres =800 , - .yres =480 , - .pixclock =KHZ2PICOS (27000 ), - .hsync_len =1 ,/* DE only sync */ - .left_margin =50 , - .right_margin =50 , - .vsync_len =1 ,/* DE only sync */ - .upper_margin =10 , - .lower_margin =10 , - }, + .mode = &cpt_display,/* * - TFT style panel * - clk enabled while idle
arch/arm/boards/imx21ads/imx21ads.c +18 -16
@@ -79,24 +79,26 @@ static struct device_d cs8900_dev = {// IRQ is connected to UART3_RTS }; +static struct fb_videomode sharp_display = { + .name ="Sharp-LQ035Q7" , + .refresh =60 , + .xres =240 , + .yres =320 , + .pixclock =188679 , + .left_margin =6 , + .right_margin =16 , + .upper_margin =8 , + .lower_margin =10 , + .hsync_len =2 , + .vsync_len =1 , + .sync =0 , + .vmode =FB_VMODE_NONINTERLACED , + .flag =0 , +}; +/* Sharp LQ035Q7DB02 QVGA display */ static struct imx_fb_videomode imx_fb_modedata = { - .mode = { - .name ="Sharp-LQ035Q7" , - .refresh =60 , - .xres =240 , - .yres =320 , - .pixclock =188679 , - .left_margin =6 , - .right_margin =16 , - .upper_margin =8 , - .lower_margin =10 , - .hsync_len =2 , - .vsync_len =1 , - .sync =0 , - .vmode =FB_VMODE_NONINTERLACED , - .flag =0 , - }, + .mode = &sharp_display, .pcr =0xfb108bc7 , .bpp =16 , };
arch/arm/boards/pcm038/pcm038.c +15 -13
@@ -127,20 +127,22 @@ static struct device_d nand_dev = { .platform_data = &nand_info, }; +static struct fb_videomode sharp_display = { + .name ="Sharp-LQ035Q7" , + .refresh =60 , + .xres =240 , + .yres =320 , + .pixclock =188679 ,/* in ps (5.3MHz) */ + .hsync_len =7 , + .left_margin =5 , + .right_margin =16 , + .vsync_len =1 , + .upper_margin =7 , + .lower_margin =9 , +}; +static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name ="Sharp-LQ035Q7" , - .refresh =60 , - .xres =240 , - .yres =320 , - .pixclock =188679 ,/* in ps (5.3MHz) */ - .hsync_len =7 , - .left_margin =5 , - .right_margin =16 , - .vsync_len =1 , - .upper_margin =7 , - .lower_margin =9 , - }, + .mode = &sharp_display,/* * - HSYNC active high * - VSYNC active high
arch/arm/mach-imx/include/mach/imxfb.h +1 -1
@@ -50,7 +50,7 @@#define DMACR_TM (x) ((x) & 0xf)struct imx_fb_videomode { -struct fb_videomode mode; +struct fb_videomode *mode;u32 pcr;unsigned char bpp; };
drivers/video/imx.c +3 -3
@@ -555,9 +555,9 @@ static int imxfb_probe(struct device_d *dev) fbi->enable = pdata->enable; fbi->dev = dev; info->priv = fbi; - info->mode = &pdata->mode->mode; - info->xres = pdata->mode->mode.xres; - info->yres = pdata->mode->mode.yres; + info->mode = pdata->mode->mode; + info->xres = pdata->mode->mode->xres; + info->yres = pdata->mode->mode->yres; info->bits_per_pixel = pdata->mode->bpp; info->fbops = &imxfb_ops;
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/12 Add more flags for sync control
In reply to Juergen BeisertIn order to make video mode setup and initializing a runtime job (currently it is a compile time job) this patch tries to make the 'fb_videomode' structure more generic. It should also carry special settings required only for some LC displays. So, I add some additional sync flags to control the DE and CLCK to the display (something a regular CRT do not know). Also the possibility to stop the clock when outside active display data (required for (C)STN).
Further suggestions for flags?
What about the special settings for some kind of Sharp displays the i.MX processor family supports?
--- include/fb.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
include/fb.h +10 -0
@@ -17,11 +17,21 @@/* vtotal = 144d/288n/576i => PAL */ /* vtotal = 121d/242n/484i => NTSC */ #define FB_SYNC_ON_GREEN 32/* sync on green */ +/* LC display related settings */ +#define FB_SYNC_DE_HIGH_ACT (1 << 6) +#define FB_SYNC_CLK_INVERT (1 << 7) +#define FB_SYNC_DATA_INVERT (1 << 8) +#define FB_SYNC_CLK_IDLE_EN (1 << 9) +#define FB_SYNC_SWAP_RGB (1 << 10) +#define FB_SYNC_CLK_SEL_EN (1 << 11) +#define FB_SYNC_SHARP_MODE (1 << 31)#define FB_VMODE_NONINTERLACED 0/* non interlaced */ #define FB_VMODE_INTERLACED 1/* interlaced */ #define FB_VMODE_DOUBLE 2/* double scan */ #define FB_VMODE_ODD_FLD_FIRST 4/* interlaced: top line first */ +/* LC display related settings */ +#define FB_VMODE_DUAL_SCAN 8#define FB_VMODE_MASK 255#define FB_VMODE_YWRAP 256/* ywrap instead of panning */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/12 Bring in dynamic videomode selection at runtime
In reply to Juergen BeisertThis patch mostly rewrites all parts of /drivers/video/fb.c. As it changes the API to the drivers, it must be done in one step to keep the repository bisectable. But to do it in one step makes the patches itself unreadable.
So, I decided to do it in a few steps, only for the review. All patches marked with a "step n" should be merged, prior the final commit onto the repository.
This step brings in the required function for dynamic videomode selection at runtime but keep the old functions untouched (the new one are commented out).
This is patch 1 of 7 to keep the repository bisectable.
--- drivers/video/Kconfig | 13 +++ drivers/video/fb.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 296 insertions(+), 0 deletions(-)
drivers/video/Kconfig +13 -0
@@ -5,6 +5,19 @@ menuconfig VIDEO if VIDEO +comment "runtime options" + +config VIDEO_DELAY_INIT + bool "Delayed initialization" + help + If the platform supports more than one video mode say 'y' her to delay + the initialization of the video device until any kind of barebox's + shell code sets up the correct mode at runtime. + This entry adds the "mode" parameter to the video device, to setup + the desired videomode prior enabling it at runtime. + +comment "drivers" + config DRIVER_VIDEO_IMX bool "i.MX framebuffer driver" depends on ARCH_IMX1 || ARCH_IMX21 || ARCH_IMX25 || ARCH_IMX27
drivers/video/fb.c +243 -0
264 lines not on this page · raw message
include/fb.h +40 -0
@@ -85,6 +85,46 @@ struct fb_ops {void (*fb_disable)(struct fb_info *info); }; +#if 0 +struct fb_host { +const struct fb_videomode *mode; +unsigned mode_cnt; + +struct device_d *hw_dev; + +/* callbacks into the video hardware driver */ +int (*fb_setcolreg)(struct fb_info *,unsigned ,unsigned ,unsigned ,unsigned ,unsigned ); +int (*fb_mode)(struct fb_info *,const struct fb_videomode *); +void (*fb_enable)(struct fb_info *); +void (*fb_disable)(struct fb_info *); + +unsigned bits_per_pixel; +}; + +struct fb_info { +struct fb_host *host; +struct device_d *fb_dev; +const struct fb_videomode *active_mode; + +u32 xres;/* visible resolution */ +u32 yres; +u32 bits_per_pixel;/* guess what */ + +u32 grayscale;/* != 0 Graylevels instead of colors */ + +struct fb_bitfield red;/* bitfield in fb mem if true color, */ +struct fb_bitfield green;/* else only length is significant */ +struct fb_bitfield blue; +struct fb_bitfield transp;/* transparency */ + +#ifdef CONFIG_VIDEO_DELAY_ENABLING +int enabled; +#endif +}; + +struct device_d *register_framebuffer (struct fb_host *,void *,unsigned ); +#endif +struct fb_info {struct fb_videomode *mode;
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 03/12] Bring in dynamic videomode selection at runtime
Quoted 39 lines · Juergen Beisert
This patch mostly rewrites all parts of /drivers/video/fb.c. As it changes the API to the drivers, it must be done in one step to keep the repository bisectable. But to do it in one step makes the patches itself unreadable.
So, I decided to do it in a few steps, only for the review. All patches marked with a "step n" should be merged, prior the final commit onto the repository.
This step brings in the required function for dynamic videomode selection at runtime but keep the old functions untouched (the new one are commented out).
This is patch 1 of 7 to keep the repository bisectable.
Signed-off-by Juergen Beisert <[email protected]>--- drivers/video/Kconfig | 13 +++ drivers/video/fb.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 296 insertions(+), 0 deletions(-)drivers/video/fb.c +3
-0@@ -1,3 +1,4 @@ +#include <init.h> #include <common.h> #include <fb.h> #include <errno.h> @@ -5,6 +6,8 @@#include <getopt.h> #include <fcntl.h> #include <fs.h> +#include <malloc.h> +#include <xfuncs.h> static int fb_ioctl (struct cdev * cdev,int req,void *data) {@@ -57,6 +60,139 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,return 0 ; }
drivers/video/fb.c static int fb_enable_set(struct device_d *dev, struct param_d *param, · line 71
Quoted 10 lines
drivers/video/fb.c +9
-0+#if 0 +#ifdef CONFIG_VIDEO_DELAY_INIT +static int fb_check_if_already_initialized(struct device_d *fb_dev) +{ + struct cdev *cdev = fb_dev->priv; + struct fb_info *info = cdev->priv; + + if (info->active_mode != NULL) { + pr_err("Video mode '%s' is already set. Cannot change colour depth anymore.\n", info->active_mode->name);
We have dev_err, also this line is really long.
drivers/video/fb.c static int fb_enable_set(struct device_d *dev, struct param_d *param, · line 116
Quoted 3 lines
drivers/video/fb.c +3
-0+ +if (enable) { + (host->fb_enable)(info);
Please do not add these unnecessary braces around function pointers.
Quoted 7 lines
drivers/video/fb.c +7
-0+ new ="1" ; + }else { + (host->fb_disable)(info); + new ="0" ; + } + + info->enabled = !!enable;
drivers/video/fb.c static int fb_enable_set(struct device_d *dev, struct param_d *param, · line 133
Quoted 10 lines
drivers/video/fb.c +10
-0+ +return dev_param_set_generic (fb_dev, param, new); +} + +static void fb_list_modes (struct fb_host *host) +{ +unsigned u; + +if (host->mode_cnt ==0 ) +return ;
This is not needed.
Quoted 99 lines
drivers/video/fb.c +92
-0+ +printf (" Supported video mode(s):\n" ); +for (u =0 ; u < host->mode_cnt; u++) +printf (" '%s'\n" , host->mode[u].name); +} + +static int fb_activate_mode (struct device_d *fb_dev,const struct fb_videomode *mode) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +struct fb_host *host = fb_dev->platform_data; +int rc; + + rc = (host->fb_mode)(info, mode); +if (rc !=0 ) +return rc; + + info->active_mode = mode; +/* +* At this point of time we know the remaining information we need +* for the cdev and fb_info structure. +*/ + cdev->size = fb_dev->size; + info->xres = mode->xres; + info->yres = mode->yres; + +return 0 ; +} + +#ifdef CONFIG_VIDEO_DELAY_INIT +static int fb_mode_set (struct device_d *fb_dev,struct param_d *param,const char *name) +{ +struct fb_host *host = fb_dev->platform_data; +unsigned u; +int rc; + +pr_debug ("%s called\n" , __func__); + + rc =fb_check_if_already_initialized (fb_dev); +if (rc !=0 ) +return rc; + +/* Search for the requested video mode by name */ +for (u =0 ; u < host->mode_cnt; u++) { +if (!strcmp (host->mode[u].name, name)) +break ; + } +if (u >= host->mode_cnt) { +fb_list_modes (host);/* no mode with 'name' found */ +return -ENODEV ; + }else { + rc =fb_activate_mode (fb_dev, &host->mode[u]); + } + +if (rc ==0 ) +dev_param_set_generic (fb_dev, param, name); + +return rc; +} +#endif +#endif +static struct file_operations fb_ops = { .read = mem_read, .write = mem_write,@@ -65,6 +201,113 @@ static struct file_operations fb_ops = { .ioctl = fb_ioctl, }; +#if 0 +static int add_fb_parameter (struct device_d *fb_dev) +{ +#ifdef CONFIG_VIDEO_DELAY_INIT +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +char cd[10 ]; + +/** @todo provide base address parameter for the user */ + +dev_add_param (fb_dev,"cdepth" , fb_cdepth_set,NULL ,0 ); +if (info->bits_per_pixel ==0 ) { +dev_set_param (fb_dev,"cdepth" ,"16" ); + info->bits_per_pixel =16 ; + }else { +sprintf (cd,"%u" , info->bits_per_pixel); +dev_set_param (fb_dev,"cdepth" , cd); + } +dev_add_param (fb_dev,"mode" , fb_mode_set,NULL ,0 ); +/* default is 'none' for delayed video mode setup */ +#endif +dev_add_param (fb_dev,"enable" , fb_enable_set,NULL ,0 ); +/* default is 'off' for delayed video output */ +return 0 ; +} + +struct framebuffer_desc { +struct cdev cdev; +struct fb_info info; +};
drivers/video/fb.c static struct file_operations fb_ops = { · line 243
Quoted 10 lines
drivers/video/fb.c +10
-0+ +static int fb_probe (struct device_d *fb_dev) +{ +int id =get_free_deviceid ("fb" ); +struct cdev *cdev; +struct fb_info *info; +struct fb_host *host = fb_dev->platform_data; + + cdev =xzalloc (sizeof (struct framebuffer_desc )); + info = (struct fb_info *)&cdev[1 ];
Why this? struct fb_info contains a struct cdev which is probably removed in a later patch in this series. The current implementation is clearly easier to read than this &cdev[1] construct.
Quoted 8 lines
drivers/video/fb.c +8
-0+ + fb_dev->priv = cdev;/* pointer forward */ + cdev->dev = fb_dev;/* pointer backward */ + + cdev->ops = &fb_ops; + cdev->name =asprintf ("fb%d" , id); + + cdev->size = fb_dev->size;/* use the default if any */
drivers/video/fb.c static struct file_operations fb_ops = { · line 261
Quoted 10 lines
drivers/video/fb.c +10
-0+ cdev->priv = info; + + info->host = host; + info->fb_dev = fb_dev; + +/* setup defaults */ +if (host->bits_per_pixel !=0 ) + info->bits_per_pixel = host->bits_per_pixel; +else + info->bits_per_pixel =16 ;/* means RGB565 */
No, this does not mean RGB565. It could also mean BGR or even something else.
drivers/video/fb.c static struct file_operations fb_ops = { · line 263
Quoted 2 lines
drivers/video/fb.c +2
-0+ +/* add params on demand */
There is no information in this comment.
Quoted 79 lines
drivers/video/fb.c +47
-0+add_fb_parameter (fb_dev); + +devfs_create (cdev); +#ifndef CONFIG_VIDEO_DELAY_INIT +/* initialize video mode immediately (the first one) */ +fb_activate_mode (fb_dev, &host->mode[0 ]); +#endif +return 0 ; +} + +static struct driver_d fb_driver = { + .name ="framebuffer" , + .probe = fb_probe, +}; + +static int framebuffer_init (void ) +{ +return register_driver (&fb_driver); +} + +device_initcall (framebuffer_init); + +struct device_d *register_framebuffer (struct fb_host *host,void *base,unsigned size) +{ +struct device_d *fb_dev; +int rc; + + fb_dev =xzalloc (sizeof (struct device_d )); + +strcpy (fb_dev->name, fb_driver.name); + fb_dev->platform_data = (void *)host; + +/* setup the defaults for this framebuffer if given */ + fb_dev->size = size; + fb_dev->map_base = (unsigned long )base; + + rc =register_device (fb_dev); +if (rc !=0 ) { +pr_debug ("Cannot register framebuffer device\n" ); +free (fb_dev); +return NULL ; + } + +return fb_dev; +} +#endif +int register_framebuffer (struct fb_info *info) {int id =get_free_deviceid ("fb" );include/fb.h +21
-0@@ -85,6 +85,46 @@ struct fb_ops {void (*fb_disable)(struct fb_info *info); }; +#if 0 +struct fb_host { + const struct fb_videomode *mode; + unsigned mode_cnt; + + struct device_d *hw_dev; + + /* callbacks into the video hardware driver */ + int (*fb_setcolreg)(struct fb_info*, unsigned, unsigned, unsigned, unsigned, unsigned); + int (*fb_mode)(struct fb_info*, const struct fb_videomode*); + void (*fb_enable)(struct fb_info*); + void (*fb_disable)(struct fb_info*); + + unsigned bits_per_pixel; +}; + +struct fb_info { + struct fb_host *host; + struct device_d *fb_dev; + const struct fb_videomode *active_mode; +
include/fb.h struct fb_ops { · line 118
Quoted 10 lines
include/fb.h +10
-0+u32 xres;/* visible resolution */ +u32 yres; +u32 bits_per_pixel;/* guess what */ + +u32 grayscale;/* != 0 Graylevels instead of colors */ + +struct fb_bitfield red;/* bitfield in fb mem if true color, */ +struct fb_bitfield green;/* else only length is significant */ +struct fb_bitfield blue; +struct fb_bitfield transp;/* transparency */
If you go the way of duplicating the code and removing the old code afterwards I would assume that you add the code in the right way and start to add doxygen from the beginning instead of fixing it later.
include/fb.h struct fb_ops { · line 123
Quoted 5 lines
include/fb.h +5
-0+ +#ifdef CONFIG_VIDEO_DELAY_ENABLING +int enabled; +#endif +};
This is unused and removed in a later patch.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 03/12] Bring in dynamic videomode selection at runtime
Quoted 13 lines · Sascha Hauer
[...]
Quoted 12 lines
drivers/video/fb.c +12
-0+ fb_dev->priv = cdev;/* pointer forward */ + cdev->dev = fb_dev;/* pointer backward */ + + cdev->ops = &fb_ops; + cdev->name =asprintf ("fb%d" , id); + + cdev->size = fb_dev->size;/* use the default if any */ + cdev->priv = info; + + info->host = host; + info->fb_dev = fb_dev; +
Quoted 8 lines
drivers/video/fb.c static struct file_operations fb_ops = { · line 261
Quoted 5 lines
drivers/video/fb.c +5
-0+/* setup defaults */ +if (host->bits_per_pixel !=0 ) + info->bits_per_pixel = host->bits_per_pixel; +else + info->bits_per_pixel =16 ;/* means RGB565 */ No, this does not mean RGB565. It could also mean BGR or even something else.
You are right. But currently it means exactly what I wrote. All drivers currently using RGB565 for 16 bpp. To make it as you stated, we need more information about the bits per colour and their layout. Currently the graphics drivers do it in their own way. No way to intervent from the platform file.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + /* add params on demand */There is no information in this comment.
Yes and no ;-) But when "CONFIG_VIDEO_DELAY_INIT" is gone also this feature is gone.
Quoted 86 lines
Quoted 86 lines
drivers/video/fb.c +23
-0+add_fb_parameter (fb_dev); + +devfs_create (cdev); +#ifndef CONFIG_VIDEO_DELAY_INIT +/* initialize video mode immediately (the first one) */ +fb_activate_mode (fb_dev, &host->mode[0 ]); +#endif +return 0 ; +} + +static struct driver_d fb_driver = { + .name ="framebuffer" , + .probe = fb_probe, +}; + +static int framebuffer_init (void ) +{ +return register_driver (&fb_driver); +} + +device_initcall (framebuffer_init); + +struct device_d *register_framebuffer(struct fb_host *host, void *base,unsigned size) +{
drivers/video/fb.c +23
-0+struct device_d *fb_dev; +int rc; + + fb_dev =xzalloc (sizeof (struct device_d )); + +strcpy (fb_dev->name, fb_driver.name); + fb_dev->platform_data = (void *)host; + +/* setup the defaults for this framebuffer if given */ + fb_dev->size = size; + fb_dev->map_base = (unsigned long )base; + + rc =register_device (fb_dev); +if (rc !=0 ) { +pr_debug ("Cannot register framebuffer device\n" ); +free (fb_dev); +return NULL ; + } + + return fb_dev; +} +#endif +int register_framebuffer (struct fb_info *info) {int id =get_free_deviceid ("fb" );include/fb.h +9
-0@@ -85,6 +85,46 @@ struct fb_ops {void (*fb_disable)(struct fb_info *info); }; +#if 0 +struct fb_host { + const struct fb_videomode *mode; + unsigned mode_cnt; + + struct device_d *hw_dev; + + /* callbacks into the video hardware driver */ + int (*fb_setcolreg)(struct fb_info*, unsigned, unsigned, unsigned,unsigned, unsigned); + int (*fb_mode)(struct fb_info*, const struct
fb_videomode*);include/fb.h +17
-0+void (*fb_enable)(struct fb_info *); +void (*fb_disable)(struct fb_info *); + +unsigned bits_per_pixel; +}; + +struct fb_info { +struct fb_host *host; +struct device_d *fb_dev; +const struct fb_videomode *active_mode; + +u32 xres;/* visible resolution */ +u32 yres; +u32 bits_per_pixel;/* guess what */ + +u32 grayscale;/* != 0 Graylevels instead of colors */ +
Quoted 8 lines
include/fb.h struct fb_ops { · line 118
Quoted 4 lines
include/fb.h +4
-0+struct fb_bitfield red;/* bitfield in fb mem if true color, */ +struct fb_bitfield green;/* else only length is significant */ +struct fb_bitfield blue; +struct fb_bitfield transp;/* transparency */ If you go the way of duplicating the code and removing the old code afterwards I would assume that you add the code in the right way and start to add doxygen from the beginning instead of fixing it later.
I tried. But it makes the patch unreadable due to the fact it touches more lines than required for the code itself. And I know you don't like patches with too many '+' and '-' lines in...
jbe
Signature · 9 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 03/12] Bring in dynamic videomode selection at runtime
Quoted 23 lines · Juergen Beisert
Quoted 13 lines · Sascha Hauer
[...]
Quoted 12 lines
drivers/video/fb.c +12
-0+ fb_dev->priv = cdev;/* pointer forward */ + cdev->dev = fb_dev;/* pointer backward */ + + cdev->ops = &fb_ops; + cdev->name =asprintf ("fb%d" , id); + + cdev->size = fb_dev->size;/* use the default if any */ + cdev->priv = info; + + info->host = host; + info->fb_dev = fb_dev; +Quoted 8 lines
drivers/video/fb.c static struct file_operations fb_ops = { · line 261
Quoted 5 lines
drivers/video/fb.c +5
-0+/* setup defaults */ +if (host->bits_per_pixel !=0 ) + info->bits_per_pixel = host->bits_per_pixel; +else + info->bits_per_pixel =16 ;/* means RGB565 */ No, this does not mean RGB565. It could also mean BGR or even something else.
Quoted 5 lines
You are right. But currently it means exactly what I wrote. All drivers currently using RGB565 for 16 bpp. To make it as you stated, we need more information about the bits per colour and their layout. Currently the graphics drivers do it in their own way. No way to intervent from the platform file.
No, the drivers are free to pass an arbitrary layout to the framework using fb_bitfields. So you can't state in the framework that 16bit is RGB565.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 03/12] Bring in dynamic videomode selection at runtime
In reply to Juergen BeisertQuoted 279 lines · Juergen Beisert
This patch mostly rewrites all parts of /drivers/video/fb.c. As it changes the API to the drivers, it must be done in one step to keep the repository bisectable. But to do it in one step makes the patches itself unreadable.
So, I decided to do it in a few steps, only for the review. All patches marked with a "step n" should be merged, prior the final commit onto the repository.
This step brings in the required function for dynamic videomode selection at runtime but keep the old functions untouched (the new one are commented out).
This is patch 1 of 7 to keep the repository bisectable.
Signed-off-by Juergen Beisert <[email protected]>--- drivers/video/Kconfig | 13 +++ drivers/video/fb.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 296 insertions(+), 0 deletions(-)drivers/video/Kconfig +13
-0@@ -5,6 +5,19 @@ menuconfig VIDEO if VIDEO +comment "runtime options" + +config VIDEO_DELAY_INIT + bool "Delayed initialization" + help + If the platform supports more than one video mode say 'y' her to delay + the initialization of the video device until any kind of barebox's + shell code sets up the correct mode at runtime. + This entry adds the "mode" parameter to the video device, to setup + the desired videomode prior enabling it at runtime. + +comment "drivers" + config DRIVER_VIDEO_IMX bool "i.MX framebuffer driver" depends on ARCH_IMX1 || ARCH_IMX21 || ARCH_IMX25 || ARCH_IMX27drivers/video/fb.c +210
-0@@ -1,3 +1,4 @@ +#include <init.h> #include <common.h> #include <fb.h> #include <errno.h> @@ -5,6 +6,8 @@#include <getopt.h> #include <fcntl.h> #include <fs.h> +#include <malloc.h> +#include <xfuncs.h> static int fb_ioctl (struct cdev * cdev,int req,void *data) {@@ -57,6 +60,139 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,return 0 ; } +#if 0 +#ifdef CONFIG_VIDEO_DELAY_INIT +static int fb_check_if_already_initialized (struct device_d *fb_dev) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; + +if (info->active_mode !=NULL ) { +pr_err ("Video mode '%s' is already set. Cannot change colour depth anymore.\n" , info->active_mode->name); +return -EPERM ; + } + +return 0 ; +} + +static int fb_cdepth_set (struct device_d *fb_dev,struct param_d *param,const char *val) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +unsigned cdepth; +int rc; + + rc =fb_check_if_already_initialized (fb_dev); +if (rc !=0 ) +return rc; + + cdepth =simple_strtoul (val,NULL ,0 ); +if (cdepth !=0 ) + info->bits_per_pixel = cdepth; +else +return -EINVAL ; + +return dev_param_set_generic (fb_dev, param, val); +} +#endif + +static int fb_enable_set (struct device_d *fb_dev,struct param_d *param,const char *val) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +struct fb_host *host = fb_dev->platform_data; +int enable; +char *new; + +if (!val) +return dev_param_set_generic (fb_dev, param,NULL ); + + enable =simple_strtoul (val,NULL ,0 ); + +if (info->enabled == !!enable) +return 0 ; + +if (enable) { + (host->fb_enable)(info); + new ="1" ; + }else { + (host->fb_disable)(info); + new ="0" ; + } + + info->enabled = !!enable; + +return dev_param_set_generic (fb_dev, param, new); +} + +static void fb_list_modes (struct fb_host *host) +{ +unsigned u; + +if (host->mode_cnt ==0 ) +return ; + +printf (" Supported video mode(s):\n" ); +for (u =0 ; u < host->mode_cnt; u++) +printf (" '%s'\n" , host->mode[u].name); +} + +static int fb_activate_mode (struct device_d *fb_dev,const struct fb_videomode *mode) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +struct fb_host *host = fb_dev->platform_data; +int rc; + + rc = (host->fb_mode)(info, mode); +if (rc !=0 ) +return rc; + + info->active_mode = mode; +/* +* At this point of time we know the remaining information we need +* for the cdev and fb_info structure. +*/ + cdev->size = fb_dev->size; + info->xres = mode->xres; + info->yres = mode->yres; + +return 0 ; +} + +#ifdef CONFIG_VIDEO_DELAY_INIT +static int fb_mode_set (struct device_d *fb_dev,struct param_d *param,const char *name) +{ +struct fb_host *host = fb_dev->platform_data; +unsigned u; +int rc; + +pr_debug ("%s called\n" , __func__); + + rc =fb_check_if_already_initialized (fb_dev); +if (rc !=0 ) +return rc; + +/* Search for the requested video mode by name */ +for (u =0 ; u < host->mode_cnt; u++) { +if (!strcmp (host->mode[u].name, name)) +break ; + } +if (u >= host->mode_cnt) { +fb_list_modes (host);/* no mode with 'name' found */ +return -ENODEV ; + }else { + rc =fb_activate_mode (fb_dev, &host->mode[u]); + } + +if (rc ==0 ) +dev_param_set_generic (fb_dev, param, name); + +return rc; +} +#endif +#endif +static struct file_operations fb_ops = { .read = mem_read, .write = mem_write,@@ -65,6 +201,113 @@ static struct file_operations fb_ops = { .ioctl = fb_ioctl, }; +#if 0 +static int add_fb_parameter (struct device_d *fb_dev) +{ +#ifdef CONFIG_VIDEO_DELAY_INIT +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; +char cd[10 ]; + +/** @todo provide base address parameter for the user */ + +dev_add_param (fb_dev,"cdepth" , fb_cdepth_set,NULL ,0 ); +if (info->bits_per_pixel ==0 ) { +dev_set_param (fb_dev,"cdepth" ,"16" ); + info->bits_per_pixel =16 ; + }else { +sprintf (cd,"%u" , info->bits_per_pixel); +dev_set_param (fb_dev,"cdepth" , cd); + } +dev_add_param (fb_dev,"mode" , fb_mode_set,NULL ,0 ); +/* default is 'none' for delayed video mode setup */ +#endif +dev_add_param (fb_dev,"enable" , fb_enable_set,NULL ,0 ); +/* default is 'off' for delayed video output */ +return 0 ; +} + +struct framebuffer_desc { +struct cdev cdev; +struct fb_info info; +}; + +static int fb_probe (struct device_d *fb_dev) +{ +int id =get_free_deviceid ("fb" ); +struct cdev *cdev; +struct fb_info *info; +struct fb_host *host = fb_dev->platform_data; + + cdev =xzalloc (sizeof (struct framebuffer_desc )); + info = (struct fb_info *)&cdev[1 ]; + + fb_dev->priv = cdev;/* pointer forward */ + cdev->dev = fb_dev;/* pointer backward */ + + cdev->ops = &fb_ops; + cdev->name =asprintf ("fb%d" , id); + + cdev->size = fb_dev->size;/* use the default if any */ + cdev->priv = info; + + info->host = host; + info->fb_dev = fb_dev; + +/* setup defaults */ +if (host->bits_per_pixel !=0 ) + info->bits_per_pixel = host->bits_per_pixel; +else + info->bits_per_pixel =16 ;/* means RGB565 */ + +/* add params on demand */ +add_fb_parameter (fb_dev); + +devfs_create (cdev); +#ifndef CONFIG_VIDEO_DELAY_INIT +/* initialize video mode immediately (the first one) */ +fb_activate_mode (fb_dev, &host->mode[0 ]); +#endif +return 0 ; +} + +static struct driver_d fb_driver = { + .name ="framebuffer" , + .probe = fb_probe, +};
drivers/video/fb.c static struct file_operations fb_ops = { · line 287
Quoted 10 lines
drivers/video/fb.c +10
-0+ +static int framebuffer_init (void ) +{ +return register_driver (&fb_driver); +} + +device_initcall (framebuffer_init); + +struct device_d *register_framebuffer (struct fb_host *host,void *base,unsigned size) +{
Why are base and size passed to register_framebuffer? The framebuffer core should not be interested in this at this point.
drivers/video/fb.c static struct file_operations fb_ops = { · line 291
Quoted 4 lines
drivers/video/fb.c +4
-0+struct device_d *fb_dev; +int rc; + + fb_dev =xzalloc (sizeof (struct device_d ));
Why is the device not a member of fb_info (or now fb_host) anymore like it used to be? There was no malloc necessary for that.
drivers/video/fb.c static struct file_operations fb_ops = { · line 294
Quoted 3 lines
drivers/video/fb.c +3
-0+ +strcpy (fb_dev->name, fb_driver.name); + fb_dev->platform_data = (void *)host;
unnecessary cast.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 03/12] Bring in dynamic videomode selection at runtime
Hi Sascha,
Quoted 14 lines · Sascha Hauer
[...]
Quoted 10 lines
drivers/video/fb.c +9
-0+ +static int framebuffer_init (void ) +{ +return register_driver (&fb_driver); +} + +device_initcall (framebuffer_init); + +struct device_d *register_framebuffer(struct fb_host *host, void *base,unsigned size) +{
Why are base and size passed to
register_framebuffer? The framebuffer core should not be interested in this at this point.
Intended for convenience only.
Quoted 7 lines
drivers/video/fb.c static struct file_operations fb_ops = { · line 291
Quoted 4 lines
drivers/video/fb.c +4
-0+struct device_d *fb_dev; +int rc; + + fb_dev =xzalloc (sizeof (struct device_d ));Why is the device not a member of
fb_info(or nowfb_host) anymore like it used to be? There was no malloc necessary for that.
Glue things from different frameworks together is IMHO a bad idea. But as I stated in another mail, I will recombine them.
jbe
Signature · 9 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/12 Remove the old videomode functions
In reply to Juergen BeisertRemove the old functions from the framebuffer framework. This patch is kept separate for review only. Should be merged with the previous one patch prior commit.
This is patch 2 of 7 to keep the repository bisectable.
--- drivers/video/fb.c | 67 ++------------------------------------------------- include/fb.h | 40 ------------------------------- 2 files changed, 3 insertions(+), 104 deletions(-)
drivers/video/fb.c +3 -64
@@ -11,6 +11,7 @@static int fb_ioctl (struct cdev * cdev,int req,void *data) { +struct fb_host *host = cdev->dev->platform_data;struct fb_info *info = cdev->priv;switch (req) {
@@ -18,10 +19,10 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)memcpy (data, info,sizeof (*info));break ;case FBIO_ENABLE : - info->fbops->fb_enable (info); + (host->fb_enable)(cdev->priv);break ;case FBIO_DISABLE : - info->fbops->fb_disable (info); + (host->fb_disable)(cdev->priv);break ;default :return -ENOSYS ;
@@ -30,37 +31,6 @@ static int fb_ioctl(struct cdev* cdev, int req, void *data)return 0 ; } -static int fb_enable_set (struct device_d *dev,struct param_d *param, -const char *val) -{ -struct fb_info *info = dev->priv; -int enable; -char *new; - -if (!val) -return dev_param_set_generic (dev, param,NULL ); - - enable =simple_strtoul (val,NULL ,0 ); - -if (info->enabled == !!enable) -return 0 ; - -if (enable) { - info->fbops->fb_enable (info); - new ="1" ; - }else { - info->fbops->fb_disable (info); - new ="0" ; - } - -dev_param_set_generic (dev, param, new); - - info->enabled = !!enable; - -return 0 ; -} - -#if 0#ifdef CONFIG_VIDEO_DELAY_INIT static int fb_check_if_already_initialized (struct device_d *fb_dev) {
@@ -191,7 +161,6 @@ static int fb_mode_set(struct device_d *fb_dev, struct param_d *param, const chareturn rc; }#endif -#endif static struct file_operations fb_ops = { .read = mem_read,
@@ -201,7 +170,6 @@ static struct file_operations fb_ops = { .ioctl = fb_ioctl, }; -#if 0 static int add_fb_parameter (struct device_d *fb_dev) {#ifdef CONFIG_VIDEO_DELAY_INIT
@@ -306,32 +274,3 @@ struct device_d *register_framebuffer(struct fb_host *host, void *base, unsignedreturn fb_dev; } -#endif - -int register_framebuffer (struct fb_info *info) -{ -int id =get_free_deviceid ("fb" ); -struct device_d *dev; - - info->cdev.ops = &fb_ops; - info->cdev.name =asprintf ("fb%d" , id); - info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >>3 ); - info->cdev.dev = &info->dev; - info->cdev.priv = info; - info->cdev.dev->map_base = (unsigned long )info->screen_base; - info->cdev.dev->size = info->cdev.size; - - dev = &info->dev; - dev->priv = info; - -sprintf (dev->name,"fb" ); - -register_device (&info->dev); -dev_add_param (dev,"enable" , fb_enable_set,NULL ,0 ); -dev_set_param (dev,"enable" ,"0" ); - -devfs_create (&info->cdev); - -return 0 ; -} -
include/fb.h +0 -40
@@ -77,15 +77,6 @@ struct fb_bitfield {struct fb_info ; -struct fb_ops { -/* set color register */ -int (*fb_setcolreg)(unsigned regno,unsigned red,unsigned green, -unsigned blue,unsigned transp,struct fb_info *info); -void (*fb_enable)(struct fb_info *info); -void (*fb_disable)(struct fb_info *info); -}; - -#if 0struct fb_host {const struct fb_videomode *mode;unsigned mode_cnt;
@@ -117,41 +108,10 @@ struct fb_info {struct fb_bitfield blue;struct fb_bitfield transp;/* transparency */ -#ifdef CONFIG_VIDEO_DELAY_ENABLING int enabled; -#endif };struct device_d *register_framebuffer (struct fb_host *,void *,unsigned ); -#endif - -struct fb_info { -struct fb_videomode *mode; - -struct fb_ops *fbops; -struct device_d dev;/* This is this fb device */ - -void *screen_base; - -void *priv; - -struct cdev cdev; - -u32 xres;/* visible resolution */ -u32 yres; -u32 bits_per_pixel;/* guess what */ - -u32 grayscale;/* != 0 Graylevels instead of colors */ - -struct fb_bitfield red;/* bitfield in fb mem if true color, */ -struct fb_bitfield green;/* else only length is significant */ -struct fb_bitfield blue; -struct fb_bitfield transp;/* transparency */ - -int enabled; -}; - -int register_framebuffer (struct fb_info *info);#define FBIOGET_SCREENINFO _IOR('F', 1, loff_t)#define FBIO_ENABLE _IO('F', 2)
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/12 Add verbose framebuffer device info
In reply to Juergen BeisertThis is patch 3 of 7 to keep the repository bisectable.
--- drivers/video/Kconfig | 6 ++++++ drivers/video/fb.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-)
drivers/video/Kconfig +6 -0
@@ -16,6 +16,12 @@ config VIDEO_DELAY_INIT This entry adds the "mode" parameter to the video device, to setup the desired videomode prior enabling it at runtime. +config VIDEO_INFO_VERBOSE + bool "Verbose video info" + help + Say 'y' here to be more verbose when running the 'devinfo' command + on the framebuffer device. + comment "drivers" config DRIVER_VIDEO_IMX
drivers/video/fb.c +38 -0
@@ -170,6 +170,43 @@ static struct file_operations fb_ops = { .ioctl = fb_ioctl, }; +static void fb_info (struct device_d *fb_dev) +{ +struct cdev *cdev = fb_dev->priv; +struct fb_info *info = cdev->priv; + +printf (" Video/Mode info:\n" ); +printf (" Video output %senabled\n" , info->enabled !=0 ?"" :"not " ); +printf (" Current video mode:\n" ); +if (info->active_mode !=NULL ) { +printf (" Name: %s\n" , info->active_mode->name); +#ifdef CONFIG_VIDEO_INFO_VERBOSE +if (info->active_mode->refresh ==0 ) +printf (" Refresh rate: undefined\n" ); +else +printf (" Refresh rate: %u Hz\n" , info->active_mode->refresh); +printf (" Horizontal active pixel: %u\n" , info->active_mode->xres); +printf (" Vertical active lines: %u\n" , info->active_mode->yres); +printf (" Pixel clock: %u kHz\n" ,PICOS2KHZ (info->active_mode->pixclock)); +printf (" Left/Right margin (pixel): %u/%u\n" , info->active_mode->left_margin, + info->active_mode->right_margin); +printf (" Upper/Lower margin (lines): %u/%u\n" , info->active_mode->upper_margin, + info->active_mode->lower_margin); +printf (" HSYNC length in pixel: %u, polarity: %s\n" , info->active_mode->hsync_len, + (info->active_mode->sync &FB_SYNC_HOR_HIGH_ACT ) ?"high" :"low" ); +printf (" VSYNC length in lines: %u, polarity: %s\n" , info->active_mode->vsync_len, + (info->active_mode->sync &FB_SYNC_VERT_HIGH_ACT ) ?"high" :"low" ); +printf (" Colour depth: %u bpp\n" , info->bits_per_pixel); +printf (" Framebuffer size is: %u bytes\n" , cdev->size); +/* TODO add the remaining information from fb_videomode. How valuable are they? */ +#endif + }else { +printf (" No video mode selected yet\n" ); + } + +fb_list_modes (fb_dev->platform_data); +} +static int add_fb_parameter (struct device_d *fb_dev) {#ifdef CONFIG_VIDEO_DELAY_INIT
@@ -242,6 +279,7 @@ static int fb_probe(struct device_d *fb_dev)static struct driver_d fb_driver = { .name ="framebuffer" , .probe = fb_probe, + .info = fb_info, };static int framebuffer_init (void )
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/12 Adapt the existing imx fb driver to support runtime videomode selection
In reply to Juergen BeisertAdapt the API to the new framebuffer videomode selection at runtime. If the new feature is not used, there is no visible change at runtime for platforms using this driver.
NOTE: Due to the lack of hardware, this is compile time tested only.
This is patch 4 of 7 to keep the repository bisectable.
--- arch/arm/mach-imx/include/mach/imxfb.h | 1 + drivers/video/imx.c | 211 ++++++++++++++++++-------------- 2 files changed, 120 insertions(+), 92 deletions(-)
arch/arm/mach-imx/include/mach/imxfb.h +1 -0
@@ -60,6 +60,7 @@ struct imx_fb_videomode {*/ struct imx_fb_platform_data {struct imx_fb_videomode *mode; +unsigned mode_cnt;/**< number of entries in 'mode' */ u_int cmap_greyscale:1 , cmap_inverse:1,
drivers/video/imx.c +119 -92
338 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/12 Adapt the existing imx-ipu fb driver to support runtime videomode selection
In reply to Juergen BeisertAdapt the API to the new framebuffer videomode selection at runtime. If the new feature is not used, there is no visible change at runtime for platforms using this driver.
NOTE: Due to the lack of hardware, this is compile time tested only.
This is patch 5 of 7 to keep the repository bisectable.
--- arch/arm/boards/freescale-mx35-3-stack/3stack.c | 2 +- arch/arm/boards/pcm043/pcm043.c | 2 +- arch/arm/mach-imx/include/mach/imx-ipu-fb.h | 12 +- drivers/video/imx-ipu-fb.c | 216 +++++++++++++---------- 4 files changed, 124 insertions(+), 108 deletions(-)
arch/arm/boards/freescale-mx35-3-stack/3stack.c +1 -1
@@ -139,7 +139,7 @@ static struct fb_videomode CTP_CLAA070LC0ACW = { .lower_margin = 10, /* whole frame should have 500 lines */ .hsync_len = 1, /* note: DE only display */ .vsync_len = 1, /* note: DE only display */ - .sync = FB_SYNC_CLK_IDLE_EN | FB_SYNC_OE_ACT_HIGH, + .sync = FB_SYNC_CLK_IDLE_EN | FB_SYNC_DE_HIGH_ACT, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, };
arch/arm/boards/pcm043/pcm043.c +1 -1
@@ -124,7 +124,7 @@ static struct fb_videomode pcm043_fb_mode = { .lower_margin = 40, .hsync_len = 96, .vsync_len = 1, - .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH, + .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_DE_HIGH_ACT, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, };
arch/arm/mach-imx/include/mach/imx-ipu-fb.h +2 -10
@@ -12,20 +12,12 @@#include <fb.h> -/* Proprietary FB_SYNC_ flags */ -#define FB_SYNC_OE_ACT_HIGH 0x80000000 -#define FB_SYNC_CLK_INVERT 0x40000000 -#define FB_SYNC_DATA_INVERT 0x20000000 -#define FB_SYNC_CLK_IDLE_EN 0x10000000 -#define FB_SYNC_SHARP_MODE 0x08000000 -#define FB_SYNC_SWAP_RGB 0x04000000 -#define FB_SYNC_CLK_SEL_EN 0x02000000 -/* -* struct mx3fb_platform_data - mx3fb platform data +* struct imx_ipu_fb_platform_data - imx-ipu-fb's platform data */ struct imx_ipu_fb_platform_data {struct fb_videomode *mode; +unsigned mode_cnt;/**< number of entries in 'mode' */ unsigned char bpp;void __iomem *framebuffer;/** hook to enable backlight and stuff */
drivers/video/imx-ipu-fb.c +120 -96
382 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/12 Add a video driver for S3C2440 bases platforms
In reply to Juergen BeisertFrom: Juergen Beisert <[email protected]>
--- arch/arm/mach-s3c24xx/include/mach/fb.h | 40 +++ drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/s3c.c | 452 +++++++++++++++++++++++++++++++ 4 files changed, 499 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.c
arch/arm/mach-s3c24xx/include/mach/fb.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2010 Juergen Beisert +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#ifndef __MACH_FB_H_ +# define __MACH_FB_H_ + +#include <fb.h> + +struct s3c_fb_platform_data { + +const struct fb_videomode *mode_list; +unsigned mode_cnt; + +int passive_display;/**< enable support for STN or CSTN displays */ + +void *framebuffer;/**< force framebuffer base address */ +unsigned size;/**< force framebuffer size */ + +/** hook to enable backlight and stuff */ +void (*enable)(int ); +}; + +#endif /* __MACH_FB_H_ */
drivers/video/Kconfig +6 -0
@@ -39,4 +39,10 @@ config DRIVER_VIDEO_IMX_IPU Add support for the IPU framebuffer device found on i.MX31 and i.MX35 CPUs. +config S3C_VIDEO + bool "S3C244x framebuffer driver" + depends on ARCH_S3C24xx + help + Add support for the S3C244x LCD controller. + endif
drivers/video/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_VIDEO) += fb.o obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o +obj-$(CONFIG_S3C_VIDEO) += s3c.o
drivers/video/s3c.c new file +452 -0
452 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 08/12] Add a video driver for S3C2440 bases platforms
Quoted 199 lines · Juergen Beisert
From: Juergen Beisert <[email protected]>
Signed-off-by Juergen Beisert <[email protected]>--- arch/arm/mach-s3c24xx/include/mach/fb.h | 40 +++ drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/s3c.c | 452 +++++++++++++++++++++++++++++++ 4 files changed, 499 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.carch/arm/mach-s3c24xx/include/mach/fb.h new file +40
-0@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2010 Juergen Beisert +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#ifndef __MACH_FB_H_ +# define __MACH_FB_H_ + +#include <fb.h> + +struct s3c_fb_platform_data { + +const struct fb_videomode *mode_list; +unsigned mode_cnt; + +int passive_display;/**< enable support for STN or CSTN displays */ + +void *framebuffer;/**< force framebuffer base address */ +unsigned size;/**< force framebuffer size */ + +/** hook to enable backlight and stuff */ +void (*enable)(int ); +}; + +#endif /* __MACH_FB_H_ */ drivers/video/Kconfig +6
-0@@ -39,4 +39,10 @@ config DRIVER_VIDEO_IMX_IPU Add support for the IPU framebuffer device found on i.MX31 and i.MX35 CPUs. +config S3C_VIDEO + bool "S3C244x framebuffer driver" + depends on ARCH_S3C24xx + help + Add support for the S3C244x LCD controller. + endifdrivers/video/Makefile +1
-0@@ -2,3 +2,4 @@ obj-$(CONFIG_VIDEO) += fb.o obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o +obj-$(CONFIG_S3C_VIDEO) += s3c.odrivers/video/s3c.c new file +111
-0@@ -0,0 +1,452 @@ +/* +* Copyright (C) 2010 Juergen Beisert +* +* This driver is based on a patch found in the web: +* (C) Copyright 2006 by OpenMoko, Inc. +* Author: Harald Welte <laforge at openmoko.org> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +/* #define DEBUG */ + +#include <common.h> +#include <init.h> +#include <fb.h> +#include <driver.h> +#include <malloc.h> +#include <errno.h> +#include <asm/io.h> +#include <mach/gpio.h> +#include <mach/s3c24xx-generic.h> +#include <mach/s3c24x0-clocks.h> +#include <mach/fb.h> + +#define LCDCON1 0x00 +# define PNRMODE (x) (((x) & 3) << 5) +# define BPPMODE (x) (((x) & 0xf) << 1) +# define SET_CLKVAL (x) (((x) & 0x3ff) << 8) +# define GET_CLKVAL (x) (((x) >> 8) & 0x3ff) +# define ENVID (1 << 0) + +#define LCDCON2 0x04 +# define SET_VBPD (x) (((x) & 0xff) << 24) +# define SET_LINEVAL (x) (((x) & 0x3ff) << 14) +# define SET_VFPD (x) (((x) & 0xff) << 6) +# define SET_VSPW (x) ((x) & 0x3f) + +#define LCDCON3 0x08 +# define SET_HBPD (x) (((x) & 0x7f) << 19) +# define SET_HOZVAL (x) (((x) & 0x7ff) << 8) +# define SET_HFPD (x) ((x) & 0xff) + +#define LCDCON4 0x0c +# define SET_HSPW (x) ((x) & 0xff) + +#define LCDCON5 0x10 +# define BPP24BL (1 << 12) +# define FRM565 (1 << 11) +# define INV_CLK (1 << 10) +# define INV_HS (1 << 9) +# define INV_VS (1 << 8) +# define INV_DTA (1 << 7) +# define INV_DE (1 << 6) +# define INV_PWREN (1 << 5) +# define INV_LEND (1 << 4)/* FIXME */ +# define ENA_PWREN (1 << 3) +# define ENA_LEND (1 << 2)/* FIXME */ +# define BSWP (1 << 1) +# define HWSWP (1 << 0) + +#define LCDSADDR1 0x14 +# define SET_LCDBANK (x) (((x) & 0x1ff) << 21) +# define GET_LCDBANK (x) (((x) >> 21) & 0x1ff) +# define SET_LCDBASEU (x) ((x) & 0x1fffff) +# define GET_LCDBASEU (x) ((x) & 0x1fffff) + +#define LCDSADDR2 0x18 +# define SET_LCDBASEL (x) ((x) & 0x1fffff) +# define GET_LCDBASEL (x) ((x) & 0x1fffff) + +#define LCDSADDR3 0x1c +# define SET_OFFSIZE (x) (((x) & 0x7ff) << 11) +# define GET_OFFSIZE (x) (((x) >> 11) & 0x7ff) +# define SET_PAGE_WIDTH (x) ((x) & 0x3ff) +# define GET_PAGE_WIDTH (x) ((x) & 0x3ff) + +#define RED_LUT 0x20 +#define GREEN_LUT 0x24 +#define BLUE_LUT 0x28 + +#define DITHMODE 0x4c + +#define TPAL 0x50 + +#define LCDINTPND 0x54 + +#define LCDSRCPND 0x58 + +#define LCDINTMSK 0x5c +# define FIWSEL (1 << 2) + +#define TCONSEL 0x60 + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define TRANSP 3
drivers/video/s3c.c line 120
Quoted 10 lines
drivers/video/s3c.c new file +9
-0+ +struct s3cfb_host { +struct fb_host fb_data; +struct device_d *hw_dev; +void __iomem *base; +}; + +#define fb_info_to_s3cfb_host (x) ((struct s3cfb_host*)((x)->host)) +#define s3cfb_host_to_s3c_fb_platform_data (x) ((struct s3c_fb_platform_data*)((x)->hw_dev->platform_data))
Please add a pointer to 3c_fb_platform_data to s3cfb_host and get rid of this define.
Quoted 111 lines
drivers/video/s3c.c new file +111
-0+ +/* the RGB565 true colour mode */ +static const struct fb_bitfield def_rgb565[] = { + [RED ] = { + .offset =11 , + .length =5 , + }, + [GREEN ] = { + .offset =5 , + .length =6 , + }, + [BLUE ] = { + .offset =0 , + .length =5 , + }, + [TRANSP ] = {/* no support for transparency */ + .length =0 , + } +}; + +/* the RGB888 true colour mode */ +static const struct fb_bitfield def_rgb888[] = { + [RED ] = { + .offset =16 , + .length =8 , + }, + [GREEN ] = { + .offset =8 , + .length =8 , + }, + [BLUE ] = { + .offset =0 , + .length =8 , + }, + [TRANSP ] = {/* no support for transparency */ + .length =0 , + } +}; + +/** +* @param fb_info Framebuffer information +*/ +static void s3cfb_enable_controller (struct fb_info *fb_info) +{ +struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); +struct s3c_fb_platform_data *pdata =s3cfb_host_to_s3c_fb_platform_data (fbh); +uint32_t con1; + +pr_debug ("%s called\n" , __func__); + + con1 =readl (fbh->base +LCDCON1 ); + + con1 |=ENVID ; + +writel (con1, fbh->base +LCDCON1 ); + +if (pdata->enable) + (pdata->enable)(1 ); +} + +/** +* @param fb_info Framebuffer information +*/ +static void s3cfb_disable_controller (struct fb_info *fb_info) +{ +struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); +struct s3c_fb_platform_data *pdata =s3cfb_host_to_s3c_fb_platform_data (fbh); +uint32_t con1; + +pr_debug ("%s called\n" , __func__); + +if (pdata->enable) + (pdata->enable)(0 ); + + con1 =readl (fbh->base +LCDCON1 ); + + con1 &= ~ENVID ; + +writel (con1, fbh->base +LCDCON1 ); +} + +/** +* Prepare the video hardware for a specified video mode +* @param fb_info Framebuffer information +* @param mode The video mode description to initialize +* @return 0 on success +*/ +static int s3cfb_initialize_mode (struct fb_info *fb_info,const struct fb_videomode *mode) +{ +struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); +struct s3c_fb_platform_data *pdata =s3cfb_host_to_s3c_fb_platform_data (fbh); +unsigned size, hclk, div; +uint32_t con1, con2, con3, con4, con5 =0 ; + +pr_debug ("%s called\n" , __func__); + +if (pdata->passive_display !=0 ) { +pr_err ("Passive displays are currently not supported\n" ); +return -EINVAL ; + } + +/* +* we need at least this amount of memory for the framebuffer +*/ + size = mode->xres * mode->yres * (fb_info->bits_per_pixel >>3 ); +if (fb_info->fb_dev->size !=0 ) { +if (size > fb_info->fb_dev->size) { +pr_err ("Cannot initialize video mode '%s': Its too large. " +"Required bytes are %u, available only %u\n" , + mode->name, size, fb_info->fb_dev->size); +return -EINVAL ;
drivers/video/s3c.c line 241
Quoted 10 lines
drivers/video/s3c.c new file +10
-0+ } + }else + fb_info->fb_dev->size = size; + +/* +* if no framebuffer memory was specified yet, allocate one, +* and allocate more memory, on user request +*/ +if (fb_info->fb_dev->map_base ==0U ) + fb_info->fb_dev->map_base = (resource_size_t )xzalloc (fb_info->fb_dev->size);
Honestly I don't understand what the two blocks above do. I hope this gets simpler once we remove the base/size arguments from register_framebuffer.
Quoted 35 lines
drivers/video/s3c.c new file +35
-0+ +/* its useful to enable the unit's clock */ +s3c244x_mod_clock (CLK_LCDC ,1 ); + +/* ensure video output is _off_ */ +writel (0x00000000 , fbh->base +LCDCON1 ); + + hclk =s3c24xx_get_hclk () /1000U ;/* hclk in kHz */ + div = hclk /PICOS2KHZ (mode->pixclock); +if (div <3 ) + div =3 ; +/* pixel clock is: (hclk) / ((div + 1) * 2) */ + div +=1 ; + div >>=1 ; + div -=1 ; + + con1 =PNRMODE (3 ) |SET_CLKVAL (div);/* PNRMODE=3 is TFT */ + +switch (fb_info->bits_per_pixel) { +#if 0 +/* TODO add CLUT based modes */ +case 1 : + con1 |=BPPMODE (8 ); +break ; +case 2 : + con1 |=BPPMODE (9 ); +break ; +case 4 : + con1 |=BPPMODE (10 ); +break ; +case 8 : + con1 |=BPPMODE (11 ); +break ; +#endif +case 16 :
drivers/video/s3c.c line 286
Quoted 10 lines
drivers/video/s3c.c new file +10
-0+ con1 |=BPPMODE (12 ); + con5 |=FRM565 ; + fb_info->red = def_rgb565[RED ]; + fb_info->green = def_rgb565[GREEN ]; + fb_info->blue = def_rgb565[BLUE ]; + fb_info->transp = def_rgb565[TRANSP ]; +break ; +case 24 : + con1 |=BPPMODE (13 ); + con5 |=BPP24BL ;/* FIXME */
Please either remove the FIXME or explain what we have to fix here.
Quoted 43 lines
drivers/video/s3c.c new file +43
-0+ fb_info->red = def_rgb888[RED ]; + fb_info->green = def_rgb888[GREEN ]; + fb_info->blue = def_rgb888[BLUE ]; + fb_info->transp = def_rgb888[TRANSP ]; +break ; +default : +pr_err ("Invalid bits per pixel value: %u\n" , fb_info->bits_per_pixel); +return -EINVAL ; + } + +/* 'normal' in register description means positive logic */ +if (!(mode->sync &FB_SYNC_HOR_HIGH_ACT )) + con5 |=INV_HS ; +if (!(mode->sync &FB_SYNC_VERT_HIGH_ACT )) + con5 |=INV_VS ; +if (!(mode->sync &FB_SYNC_DE_HIGH_ACT )) + con5 |=INV_DE ; +if (mode->sync &FB_SYNC_CLK_INVERT ) + con5 |=INV_CLK ;/* display should latch at the rising edge */ +if (mode->sync &FB_SYNC_SWAP_RGB ) + con5 |=HWSWP ; + +/* TODO power enable config via platform data */ + +/* vertical timing */ + con2 =SET_VBPD (mode->upper_margin -1 ) | +SET_LINEVAL (mode->yres -1 ) | +SET_VFPD (mode->lower_margin -1 ) | +SET_VSPW (mode->vsync_len -1 ); + +/* horizontal timing */ + con3 =SET_HBPD (mode->left_margin -1 ) | +SET_HOZVAL (mode->xres -1 ) | +SET_HFPD (mode->right_margin -1 ); + con4 =SET_HSPW (mode->hsync_len -1 ); + +/* basic timing setup */ +writel (con1, fbh->base +LCDCON1 ); +pr_debug (" Writing %08X into %08X (con1)\n" , con1, fbh->base +LCDCON1 ); +writel (con2, fbh->base +LCDCON2 ); +pr_debug (" Writing %08X into %08X (con2)\n" , con2, fbh->base +LCDCON2 ); +writel (con3, fbh->base +LCDCON3 ); +pr_debug (" Writing %08X into %08X (con3)\n" , con3, fbh->base +LCDCON3 );
drivers/video/s3c.c line 339
Quoted 10 lines
drivers/video/s3c.c new file +10
-0+writel (con4, fbh->base +LCDCON4 ); +pr_debug (" Writing %08X into %08X (con4)\n" , con4, fbh->base +LCDCON4 ); +writel (con5, fbh->base +LCDCON5 ); +pr_debug (" Writing %08X into %08X (con5)\n" , con5, fbh->base +LCDCON5 ); + +pr_debug ("Setting up the fb baseadress to %08X\n" , fb_info->fb_dev->map_base); + +/* framebuffer memory setup */ +writel (fb_info->fb_dev->map_base >>1 , fbh->base +LCDSADDR1 ); + size = mode->xres * (fb_info->bits_per_pixel >>3 ) * (mode->yres);
You already calculated this value.
Quoted 122 lines
drivers/video/s3c.c new file +113
-0+writel (SET_LCDBASEL ((fb_info->fb_dev->map_base + size) >>1 ), fbh->base +LCDSADDR2 ); + +writel (SET_OFFSIZE (0 ) | +SET_PAGE_WIDTH ((mode->xres * fb_info->bits_per_pixel) >>4 ), + fbh->base +LCDSADDR3 ); + +writel (FIWSEL , fbh->base +LCDINTMSK ); + +return 0 ; +} + +/** +* Print some information about the current hardware state +* @param hw_dev S3C video device +*/ +#ifdef CONFIG_VIDEO_INFO_VERBOSE +static void s3cfb_info (struct device_d *hw_dev) +{ +uint32_t con1, addr1, addr2, addr3; + + con1 =readl (hw_dev->map_base +LCDCON1 ); + addr1 =readl (hw_dev->map_base +LCDSADDR1 ); + addr2 =readl (hw_dev->map_base +LCDSADDR2 ); + addr3 =readl (hw_dev->map_base +LCDSADDR3 ); + +printf (" Video hardware info:\n" ); +printf (" Video clock is running at %u Hz\n" ,s3c24xx_get_hclk () / ((GET_CLKVAL (con1) +1 ) *2 )); +printf (" Video memory bank starts at 0x%08X\n" ,GET_LCDBANK (addr1) <<22 ); +printf (" Video memory bank offset: 0x%08X\n" ,GET_LCDBASEU (addr1)); +printf (" Video memory end: 0x%08X\n" ,GET_LCDBASEU (addr2)); +printf (" Virtual screen offset size: %u half words\n" ,GET_OFFSIZE (addr3)); +printf (" Virtual screen page width: %u half words\n" ,GET_PAGE_WIDTH (addr3)); +} +#endif + +/* +* There is only one video hardware instance available. +* It makes no sense to dynamically allocate this data +*/ +static struct s3cfb_host host_data = { + .fb_data.fb_mode = s3cfb_initialize_mode, + .fb_data.fb_enable = s3cfb_enable_controller, + .fb_data.fb_disable = s3cfb_disable_controller, +}; + +static int s3cfb_probe (struct device_d *hw_dev) +{ +struct s3c_fb_platform_data *pdata = hw_dev->platform_data; +struct device_d *fb_dev; + +pr_debug ("%s called\n" , __func__); + +if (pdata ==NULL ) { +pr_debug ("Framebuffer driver missing platform data" ); +return -ENODEV ; + } + +/* enable unit's clock */ +s3c244x_mod_clock (CLK_LCDC ,1 ); + +writel (0 , hw_dev->map_base +LCDCON1 ); +/* off may be means high level (FIXME itlp specific) */ +writel (0 , hw_dev->map_base +LCDCON5 ); + +/* disable it again until user request */ +s3c244x_mod_clock (CLK_LCDC ,0 ); + +/* add runtime hardware info */ + host_data.hw_dev = hw_dev; + host_data.base = (void *)hw_dev->map_base; + +/* add runtime video info */ + host_data.fb_data.mode = pdata->mode_list; + host_data.fb_data.mode_cnt = pdata->mode_cnt; + + fb_dev =register_framebuffer (&host_data.fb_data, pdata->framebuffer, pdata->size); +if (fb_dev ==NULL ) { +pr_err ("Failed to register framebuffer\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static struct driver_d s3cfb_driver = { + .name ="s3cfb" , + .probe = s3cfb_probe, +#ifdef CONFIG_VIDEO_INFO_VERBOSE + .info = s3cfb_info, +#endif +}; + +static int s3cfb_init (void ) +{ +return register_driver (&s3cfb_driver); +} + +device_initcall (s3cfb_init); + +/** +* The S3C244x LCD controller supports passive (CSTN/STN) and active (TFT) LC displays +* +* The driver itself currently supports only active TFT LC displays in the follwing manner: +* +* * Palletized colours +* - 1 bpp +* - 2 bpp +* - 4 bpp +* - 8 bpp +* * True colours +* - 16 bpp +* - 24 bpp +*/ Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 08/12] Add a video driver for S3C2440 bases platforms
Quoted 210 lines · Sascha Hauer
Quoted 209 lines · Juergen Beisert
From: Juergen Beisert <[email protected]>
Signed-off-by Juergen Beisert <[email protected]>--- arch/arm/mach-s3c24xx/include/mach/fb.h | 40 +++ drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/s3c.c | 452 +++++++++++++++++++++++++++++++ 4 files changed, 499 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.c(quoted diff) +0
-0
b/arch/arm/mach-s3c24xx/include/mach/fb.hnew file mode 100644 index 0000000..eec6164arch/arm/mach-s3c24xx/include/mach/fb.h new file +40
-0@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2010 Juergen Beisert +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#ifndef __MACH_FB_H_ +# define __MACH_FB_H_ + +#include <fb.h> + +struct s3c_fb_platform_data { + +const struct fb_videomode *mode_list; +unsigned mode_cnt; + +int passive_display;/**< enable support for STN or CSTN displays */ + +void *framebuffer;/**< force framebuffer base address */ +unsigned size;/**< force framebuffer size */ + +/** hook to enable backlight and stuff */ +void (*enable)(int ); +}; + +#endif /* __MACH_FB_H_ */ drivers/video/Kconfig +6
-0@@ -39,4 +39,10 @@ config DRIVER_VIDEO_IMX_IPU Add support for the IPU framebuffer device found on i.MX31 and i.MX35 CPUs. +config S3C_VIDEO + bool "S3C244x framebuffer driver" + depends on ARCH_S3C24xx + help + Add support for the S3C244x LCD controller. + endifdrivers/video/Makefile +1
-0@@ -2,3 +2,4 @@ obj-$(CONFIG_VIDEO) += fb.o obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o +obj-$(CONFIG_S3C_VIDEO) += s3c.odrivers/video/s3c.c new file +119
-0@@ -0,0 +1,452 @@ +/* +* Copyright (C) 2010 Juergen Beisert +* +* This driver is based on a patch found in the web: +* (C) Copyright 2006 by OpenMoko, Inc. +* Author: Harald Welte <laforge at openmoko.org> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +/* #define DEBUG */ + +#include <common.h> +#include <init.h> +#include <fb.h> +#include <driver.h> +#include <malloc.h> +#include <errno.h> +#include <asm/io.h> +#include <mach/gpio.h> +#include <mach/s3c24xx-generic.h> +#include <mach/s3c24x0-clocks.h> +#include <mach/fb.h> + +#define LCDCON1 0x00 +# define PNRMODE (x) (((x) & 3) << 5) +# define BPPMODE (x) (((x) & 0xf) << 1) +# define SET_CLKVAL (x) (((x) & 0x3ff) << 8) +# define GET_CLKVAL (x) (((x) >> 8) & 0x3ff) +# define ENVID (1 << 0) + +#define LCDCON2 0x04 +# define SET_VBPD (x) (((x) & 0xff) << 24) +# define SET_LINEVAL (x) (((x) & 0x3ff) << 14) +# define SET_VFPD (x) (((x) & 0xff) << 6) +# define SET_VSPW (x) ((x) & 0x3f) + +#define LCDCON3 0x08 +# define SET_HBPD (x) (((x) & 0x7f) << 19) +# define SET_HOZVAL (x) (((x) & 0x7ff) << 8) +# define SET_HFPD (x) ((x) & 0xff) + +#define LCDCON4 0x0c +# define SET_HSPW (x) ((x) & 0xff) + +#define LCDCON5 0x10 +# define BPP24BL (1 << 12) +# define FRM565 (1 << 11) +# define INV_CLK (1 << 10) +# define INV_HS (1 << 9) +# define INV_VS (1 << 8) +# define INV_DTA (1 << 7) +# define INV_DE (1 << 6) +# define INV_PWREN (1 << 5) +# define INV_LEND (1 << 4)/* FIXME */ +# define ENA_PWREN (1 << 3) +# define ENA_LEND (1 << 2)/* FIXME */ +# define BSWP (1 << 1) +# define HWSWP (1 << 0) + +#define LCDSADDR1 0x14 +# define SET_LCDBANK (x) (((x) & 0x1ff) << 21) +# define GET_LCDBANK (x) (((x) >> 21) & 0x1ff) +# define SET_LCDBASEU (x) ((x) & 0x1fffff) +# define GET_LCDBASEU (x) ((x) & 0x1fffff) + +#define LCDSADDR2 0x18 +# define SET_LCDBASEL (x) ((x) & 0x1fffff) +# define GET_LCDBASEL (x) ((x) & 0x1fffff) + +#define LCDSADDR3 0x1c +# define SET_OFFSIZE (x) (((x) & 0x7ff) << 11) +# define GET_OFFSIZE (x) (((x) >> 11) & 0x7ff) +# define SET_PAGE_WIDTH (x) ((x) & 0x3ff) +# define GET_PAGE_WIDTH (x) ((x) & 0x3ff) + +#define RED_LUT 0x20 +#define GREEN_LUT 0x24 +#define BLUE_LUT 0x28 + +#define DITHMODE 0x4c + +#define TPAL 0x50 + +#define LCDINTPND 0x54 + +#define LCDSRCPND 0x58 + +#define LCDINTMSK 0x5c +# define FIWSEL (1 << 2) + +#define TCONSEL 0x60 + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define TRANSP 3 + +struct s3cfb_host { +struct fb_host fb_data; +struct device_d *hw_dev; +void __iomem *base; +}; + +#define fb_info_to_s3cfb_host (x) ((struct s3cfb_host*)((x)->host))
Quoted 5 lines
Quoted 2 lines
drivers/video/s3c.c new file +1
-0+#define s3cfb_host_to_s3c_fb_platform_data (x) ((structs3c_fb_platform_data*)((x)->hw_dev->platform_data))
Please add a pointer to 3c_fb_platform_data to
s3cfb_hostand get rid of this define.
But this pointer would only provide redundant information, as this pointer is already part of the hw_dev member.
Quoted 118 lines
Quoted 118 lines
drivers/video/s3c.c new file +46
-0+ +/* the RGB565 true colour mode */ +static const struct fb_bitfield def_rgb565[] = { + [RED ] = { + .offset =11 , + .length =5 , + }, + [GREEN ] = { + .offset =5 , + .length =6 , + }, + [BLUE ] = { + .offset =0 , + .length =5 , + }, + [TRANSP ] = {/* no support for transparency */ + .length =0 , + } +}; + +/* the RGB888 true colour mode */ +static const struct fb_bitfield def_rgb888[] = { + [RED ] = { + .offset =16 , + .length =8 , + }, + [GREEN ] = { + .offset =8 , + .length =8 , + }, + [BLUE ] = { + .offset =0 , + .length =8 , + }, + [TRANSP ] = {/* no support for transparency */ + .length =0 , + } +}; + +/** +* @param fb_info Framebuffer information +*/ +static void s3cfb_enable_controller (struct fb_info *fb_info) +{ +struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); + struct s3c_fb_platform_data *pdata =
s3cfb_host_to_s3c_fb_platform_data(fbh); +uint32_tcon1;drivers/video/s3c.c new file +20
-0+ +pr_debug ("%s called\n" , __func__); + + con1 =readl (fbh->base +LCDCON1 ); + + con1 |=ENVID ; + +writel (con1, fbh->base +LCDCON1 ); + +if (pdata->enable) + (pdata->enable)(1 ); +} + +/** +* @param fb_info Framebuffer information +*/ +static void s3cfb_disable_controller (struct fb_info *fb_info) +{ +struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); + struct s3c_fb_platform_data *pdata =
s3cfb_host_to_s3c_fb_platform_data(fbh); +uint32_tcon1;drivers/video/s3c.c new file +20
-0+ +pr_debug ("%s called\n" , __func__); + +if (pdata->enable) + (pdata->enable)(0 ); + + con1 =readl (fbh->base +LCDCON1 ); + + con1 &= ~ENVID ; + +writel (con1, fbh->base +LCDCON1 ); +} + +/** +* Prepare the video hardware for a specified video mode +* @param fb_info Framebuffer information +* @param mode The video mode description to initialize +* @return 0 on success +*/ +static int s3cfb_initialize_mode(struct fb_info *fb_info, const struct
fb_videomode*mode) +{drivers/video/s3c.c new file +2
-0+struct s3cfb_host *fbh =fb_info_to_s3cfb_host (fb_info); + struct s3c_fb_platform_data *pdata =
s3cfb_host_to_s3c_fb_platform_data(fbh); + unsigned size, hclk, div;drivers/video/s3c.c new file +26
-0+uint32_t con1, con2, con3, con4, con5 =0 ; + +pr_debug ("%s called\n" , __func__); + +if (pdata->passive_display !=0 ) { +pr_err ("Passive displays are currently not supported\n" ); +return -EINVAL ; + } + +/* +* we need at least this amount of memory for the framebuffer +*/ + size = mode->xres * mode->yres * (fb_info->bits_per_pixel >>3 ); +if (fb_info->fb_dev->size !=0 ) { +if (size > fb_info->fb_dev->size) { +pr_err ("Cannot initialize video mode '%s': Its too large. " +"Required bytes are %u, available only %u\n" , + mode->name, size, fb_info->fb_dev->size); +return -EINVAL ; + } + }else + fb_info->fb_dev->size = size; + +/* +* if no framebuffer memory was specified yet, allocate one, +* and allocate more memory, on user request
Quoted 8 lines
Quoted 4 lines
drivers/video/s3c.c new file +3
-0+*/ +if (fb_info->fb_dev->map_base ==0U ) + fb_info->fb_dev->map_base =(resource_size_t)xzalloc(fb_info->fb_dev->size);
Honestly I don't understand what the two blocks above do. I hope this gets simpler once we remove the base/size arguments from
register_framebuffer.
These blocks distinguish between dynamic and a fixed framebuffer. And register_framebuffer's base/size parameters only allow to define a fixed framebuffer. So, how to define a fixed framebuffer when the base and size parameter are gone?
Quoted 39 lines
Quoted 39 lines
drivers/video/s3c.c new file +39
-0+ +/* its useful to enable the unit's clock */ +s3c244x_mod_clock (CLK_LCDC ,1 ); + +/* ensure video output is _off_ */ +writel (0x00000000 , fbh->base +LCDCON1 ); + + hclk =s3c24xx_get_hclk () /1000U ;/* hclk in kHz */ + div = hclk /PICOS2KHZ (mode->pixclock); +if (div <3 ) + div =3 ; +/* pixel clock is: (hclk) / ((div + 1) * 2) */ + div +=1 ; + div >>=1 ; + div -=1 ; + + con1 =PNRMODE (3 ) |SET_CLKVAL (div);/* PNRMODE=3 is TFT */ + +switch (fb_info->bits_per_pixel) { +#if 0 +/* TODO add CLUT based modes */ +case 1 : + con1 |=BPPMODE (8 ); +break ; +case 2 : + con1 |=BPPMODE (9 ); +break ; +case 4 : + con1 |=BPPMODE (10 ); +break ; +case 8 : + con1 |=BPPMODE (11 ); +break ; +#endif +case 16 : + con1 |=BPPMODE (12 ); + con5 |=FRM565 ; + fb_info->red = def_rgb565[RED ]; + fb_info->green = def_rgb565[GREEN ];
Quoted 8 lines
drivers/video/s3c.c line 286
Quoted 6 lines
drivers/video/s3c.c new file +6
-0+ fb_info->blue = def_rgb565[BLUE ]; + fb_info->transp = def_rgb565[TRANSP ]; +break ; +case 24 : + con1 |=BPPMODE (13 ); + con5 |=BPP24BL ;/* FIXME */ Please either remove the FIXME or explain what we have to fix here.
Sure.
Quoted 47 lines
Quoted 47 lines
drivers/video/s3c.c new file +39
-0+ fb_info->red = def_rgb888[RED ]; + fb_info->green = def_rgb888[GREEN ]; + fb_info->blue = def_rgb888[BLUE ]; + fb_info->transp = def_rgb888[TRANSP ]; +break ; +default : +pr_err ("Invalid bits per pixel value: %u\n" , fb_info->bits_per_pixel); +return -EINVAL ; + } + +/* 'normal' in register description means positive logic */ +if (!(mode->sync &FB_SYNC_HOR_HIGH_ACT )) + con5 |=INV_HS ; +if (!(mode->sync &FB_SYNC_VERT_HIGH_ACT )) + con5 |=INV_VS ; +if (!(mode->sync &FB_SYNC_DE_HIGH_ACT )) + con5 |=INV_DE ; +if (mode->sync &FB_SYNC_CLK_INVERT ) + con5 |=INV_CLK ;/* display should latch at the rising edge */ +if (mode->sync &FB_SYNC_SWAP_RGB ) + con5 |=HWSWP ; + +/* TODO power enable config via platform data */ + +/* vertical timing */ + con2 =SET_VBPD (mode->upper_margin -1 ) | +SET_LINEVAL (mode->yres -1 ) | +SET_VFPD (mode->lower_margin -1 ) | +SET_VSPW (mode->vsync_len -1 ); + +/* horizontal timing */ + con3 =SET_HBPD (mode->left_margin -1 ) | +SET_HOZVAL (mode->xres -1 ) | +SET_HFPD (mode->right_margin -1 ); + con4 =SET_HSPW (mode->hsync_len -1 ); + +/* basic timing setup */ +writel (con1, fbh->base +LCDCON1 ); + pr_debug(" Writing %08X into %08X (con1)\n", con1, fbh->base +LCDCON1); +
writel(con2, fbh->base + LCDCON2);drivers/video/s3c.c new file +1
-0+ pr_debug(" Writing %08X into %08X (con2)\n", con2, fbh->base +LCDCON2); +
writel(con3, fbh->base + LCDCON3);drivers/video/s3c.c new file +1
-0+ pr_debug(" Writing %08X into %08X (con3)\n", con3, fbh->base +LCDCON3); +
writel(con4, fbh->base + LCDCON4);drivers/video/s3c.c new file +1
-0+ pr_debug(" Writing %08X into %08X (con4)\n", con4, fbh->base +LCDCON4); +
writel(con5, fbh->base + LCDCON5);drivers/video/s3c.c new file +1
-0+ pr_debug(" Writing %08X into %08X (con5)\n", con5, fbh->base +
Quoted 8 lines
drivers/video/s3c.c line 339
Quoted 6 lines
LCDCON5); +
drivers/video/s3c.c new file +1
-0+ pr_debug("Setting up the fb baseadress to %08X\n",
fb_info->fb_dev->map_base); +drivers/video/s3c.c new file +3
-0+/* framebuffer memory setup */ +writel (fb_info->fb_dev->map_base >>1 , fbh->base +LCDSADDR1 ); + size = mode->xres * (fb_info->bits_per_pixel >>3 ) * (mode->yres);You already calculated this value.
Ups, yes. Thanks.
Quoted 1 line
[...]
jbe
Signature · 9 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 08/12] Add a video driver for S3C2440 bases platforms
Quoted 19 lines · Juergen Beisert
Quoted 18 lines · Sascha Hauer
Quoted 17 lines · Juergen Beisert
From: Juergen Beisert <[email protected]>
Signed-off-by Juergen Beisert <[email protected]>--- arch/arm/mach-s3c24xx/include/mach/fb.h | 40 +++ drivers/video/Kconfig | 6 + drivers/video/Makefile | 1 + drivers/video/s3c.c | 452 +++++++++++++++++++++++++++++++ 4 files changed, 499 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.c(quoted diff) +2
-0+ +#define fb_info_to_s3cfb_host(x) ((struct s3cfb_host*)((x)->host))
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
+#define
s3cfb_host_to_s3c_fb_platform_data(x)((struct s3c_fb_platform_data*)((x)->hw_dev->platform_data))Please add a pointer to 3c_fb_platform_data to
s3cfb_hostand get rid of this define.But this pointer would only provide redundant information, as this pointer is already part of the
hw_devmember.
As said before it's a bad idea to dereference this platform_data pointer in too many functions. We loose type safety and when multiple devices are involved it gets to easy to pick the wrong device. Also, it's unreadable.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/video/s3c.c new file +4
-0+ +/* +* if no framebuffer memory was specified yet, allocate one, +* and allocate more memory, on user request Quoted 8 lines
Quoted 4 lines
drivers/video/s3c.c new file +3
-0+*/ +if (fb_info->fb_dev->map_base ==0U ) + fb_info->fb_dev->map_base =(resource_size_t)xzalloc(fb_info->fb_dev->size);
Honestly I don't understand what the two blocks above do. I hope this gets simpler once we remove the base/size arguments from
register_framebuffer.
Quoted 4 lines
These blocks distinguish between dynamic and a fixed framebuffer. And register_framebuffer's base/size parameters only allow to define a fixed framebuffer. So, how to define a fixed framebuffer when the base and size parameter are gone?
At some point you either allocate a framebuffer or use the memory provided by the platform data. There is no need to pass the memory through the framework beforehand.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 9/12 STM378x: Add video driver for this platform
In reply to Juergen Beisert--- arch/arm/mach-stm/include/mach/fb.h | 38 +++ drivers/video/Kconfig | 7 + drivers/video/Makefile | 1 + drivers/video/stm.c | 561 +++++++++++++++++++++++++++++++++++ 4 files changed, 607 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-stm/include/mach/fb.h create mode 100644 drivers/video/stm.c
arch/arm/mach-stm/include/mach/fb.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +* MA 02110-1301, USA. +*/ + +#ifndef __MACH_FB_H +# define __MACH_FB_H + +#include <fb.h> + +#define STMLCDIF_8BIT 1/** pixel data bus to the display is of 8 bit width */ +#define STMLCDIF_16BIT 0/** pixel data bus to the display is of 16 bit width */ +#define STMLCDIF_18BIT 2/** pixel data bus to the display is of 18 bit width */ +#define STMLCDIF_24BIT 3/** pixel data bus to the display is of 24 bit width */ + +struct imx_fb_videomode { +struct fb_videomode *mode_list; +unsigned mode_count; +void *framebuffer;/**< force fixed framebuffer address if != NULL */ +unsigned size;/**< force fixed size if != NULL */ + +unsigned dotclk_delay;/**< refer manual HW_LCDIF_VDCTRL4 register */ +unsigned ld_intf_width;/**< refer STMLCDIF_* macros */ +}; + +#endif /* __MACH_FB_H */ +
drivers/video/Kconfig +7 -0
@@ -45,4 +45,11 @@ config S3C_VIDEO help Add support for the S3C244x LCD controller. +config DRIVER_VIDEO_STM + bool "i.MX23/28 framebuffer driver" + depends on ARCH_STM + help + Say 'Y' here to enable framebuffer and spash screen support for + i.MX23 and i.MX28 based systems. + endif
drivers/video/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_VIDEO) += fb.o +obj-$(CONFIG_DRIVER_VIDEO_STM) += stm.o obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o obj-$(CONFIG_S3C_VIDEO) += s3c.o
drivers/video/stm.c new file +561 -0
561 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/12 Remove variable size restrictions
In reply to Juergen BeisertThere is no really need for special variable types in these structures. Replace them by standard C types with the same behaviour.
--- include/fb.h | 41 ++++++++++++++++++++--------------------- 1 files changed, 20 insertions(+), 21 deletions(-)
include/fb.h +20 -21
@@ -43,19 +43,19 @@struct fb_videomode {const char *name;/* optional */ -u32 refresh;/* optional */ -u32 xres; -u32 yres; -u32 pixclock; -u32 left_margin; -u32 right_margin; -u32 upper_margin; -u32 lower_margin; -u32 hsync_len; -u32 vsync_len; -u32 sync; -u32 vmode; -u32 flag; +unsigned refresh;/* optional */ +unsigned xres; +unsigned yres; +unsigned pixclock; +unsigned left_margin; +unsigned right_margin; +unsigned upper_margin; +unsigned lower_margin; +unsigned hsync_len; +unsigned vsync_len; +unsigned sync; +unsigned vmode; +unsigned flag; };/* Interpretation of offset for color fields: All offsets are from the right,
@@ -69,10 +69,9 @@ struct fb_videomode {* of available palette entries (i.e. # of entries = 1 << length). */ struct fb_bitfield { -u32 offset;/* beginning of bitfield */ -u32 length;/* length of bitfield */ -u32 msb_right;/* != 0 : Most significant bit is */ -/* right */ +unsigned offset;/* beginning of bitfield */ +unsigned length;/* length of bitfield */ +int msb_right;/* != 0 : Most significant bit is right */ };struct fb_info ;
@@ -97,11 +96,11 @@ struct fb_info {struct device_d *fb_dev;const struct fb_videomode *active_mode; -u32 xres;/* visible resolution */ -u32 yres; -u32 bits_per_pixel;/* guess what */ +unsigned xres;/* visible resolution */ +unsigned yres; +unsigned bits_per_pixel;/* guess what */ -u32 grayscale;/* != 0 Graylevels instead of colors */ +int grayscale;/* != 0 Graylevels instead of colors */ struct fb_bitfield red;/* bitfield in fb mem if true color, */ struct fb_bitfield green;/* else only length is significant */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 11/12 Add doxygen documentation to the framebfuffer code
In reply to Juergen BeisertAdd some (hopefully) helpful documentation to the source code.
--- Documentation/developers_manual.dox | 1 + Documentation/users_manual.dox | 1 + drivers/video/fb.c | 234 +++++++++++++++++++++++++++++++++++ include/fb.h | 98 ++++++++++----- 4 files changed, 301 insertions(+), 33 deletions(-)
Documentation/developers_manual.dox +1 -0
@@ -20,5 +20,6 @@ This part of the documentation is intended for developers of @a barebox. @li @subpage barebox_simul @li @subpage io_access_functions @li @subpage mcfv4e_MCDlib +@li @subpage fb_for_developers */
Documentation/users_manual.dox +1 -0
@@ -11,5 +11,6 @@ work easier. @li @subpage command_reference @li @subpage x86_bootloader @li @subpage net_netconsole +@li @subpage fb_for_users */
drivers/video/fb.c +234 -0
285 lines not on this page · raw message
include/fb.h +65 -33
145 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 12/12 Provide more driver specific data in a videomode
In reply to Juergen BeisertIn order to support more than one videomode in a binary barebox, some drivers need more specific data to setup the requested video mode in a correct manner. This patch adds the 'priv' field to the generic videomode description to give any platform a chance to forward some video hardware specific information on a per videomode base.
This is currently i.MX21/i.MX25/i.MX27 specific.
BTW: At least the 'pcr' value could be generated at runtime from the 'sync' field in 'struct fb_videomode'.
--- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 22 +++++------ arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 21 +++++----- arch/arm/boards/guf-neso/board.c | 45 +++++++++++---------- arch/arm/boards/imx21ads/imx21ads.c | 24 ++++++------ arch/arm/boards/pcm038/pcm038.c | 40 +++++++++--------- arch/arm/mach-imx/include/mach/imxfb.h | 20 +++++---- drivers/video/imx.c | 19 +++++---- include/fb.h | 2 + 8 files changed, 99 insertions(+), 94 deletions(-)
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +10 -12
@@ -120,7 +120,14 @@ static struct device_d nand_dev = { .platform_data = &nand_info, }; -static struct fb_videomode cmo_display = { +static const struct imx_fb_driver_data driver_data = { + .pwmr =0x00A903FF , + .lscr1 =0x00120300 , + .dmacr =0x80040060 , + .pcr =0xCAD08B80 , +}; + +static const struct fb_videomode cmo_display = { .name ="CMO-QVGA" , .refresh =60 , .xres =320 ,
@@ -134,20 +141,11 @@ static struct fb_videomode cmo_display = { .lower_margin = 4, }; -static struct imx_fb_videomode imxfb_mode = { - .mode = &cmo_display, - .pcr =0xCAD08B80 , - .bpp =16 , -}; -static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = { - .mode = &imxfb_mode, - .pwmr =0x00A903FF , - .lscr1 =0x00120300 , - .dmacr =0x80040060 , + .mode = &cmo_display, + .mode_cnt =1 , }; -static struct device_d imxfb_dev = { .id =-1 , .name ="imxfb" ,
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +11 -10
@@ -186,7 +186,14 @@ static void eukrea_cpuimx27_mmu_init(void)#endif #ifdef CONFIG_DRIVER_VIDEO_IMX -static struct fb_videomode cmo_display = { +static const struct imx_fb_driver_data driver_data = { + .pwmr =0x00A903FF , + .lscr1 =0x00120300 , + .dmacr =0x00020010 , + .pcr =0xFAD08B80 , +}; + +static const struct fb_videomode cmo_display = { .name ="CMO-QVGA" , .refresh =60 , .xres = 320,
@@ -198,18 +205,12 @@ static struct fb_videomode cmo_display = { .vsync_len = 3, .upper_margin = 15, .lower_margin = 4, + .priv = &driver_data, }; -static struct imx_fb_videomode imxfb_mode = { - .mode = &cmo_display, - .pcr =0xFAD08B80 , - .bpp =16 ,}; -static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = { - .mode = &imxfb_mode, - .pwmr =0x00A903FF , - .lscr1 =0x00120300 , - .dmacr =0x00020010 , + .mode = &cmo_display, + .mode_cnt =1 , };static struct device_d imxfb_dev = {
arch/arm/boards/guf-neso/board.c +23 -22
64 lines not on this page · raw message
arch/arm/boards/imx21ads/imx21ads.c +12 -12
@@ -79,7 +79,14 @@ static struct device_d cs8900_dev = {// IRQ is connected to UART3_RTS }; -static struct fb_videomode sharp_display = { +static const struct imx_fb_driver_data driver_data = { + .pwmr =0x00a903ff , + .lscr1 =0x00120300 , + .dmacr =0x00020008 , + .pcr =0xfb108bc7 , +}; + +static const struct fb_videomode sharp_display = { .name ="Sharp-LQ035Q7" , .refresh =60 , .xres =240 ,
@@ -94,23 +101,16 @@ static struct fb_videomode sharp_display = { .sync = 0, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, -}; - -/* Sharp LQ035Q7DB02 QVGA display */ -static struct imx_fb_videomode imx_fb_modedata = { - .mode = &sharp_display, - .pcr =0xfb108bc7 , - .bpp =16 , + .priv = &driver_data, };static struct imx_fb_platform_data imx_fb_data = { - .mode = &imx_fb_modedata, +/* Sharp LQ035Q7DB02 QVGA display */ + .mode = &sharp_display, + .mode_cnt =1 , .cmap_greyscale =0 , .cmap_inverse =0 , .cmap_static =0 , - .pwmr =0x00a903ff , - .lscr1 =0x00120300 , - .dmacr =0x00020008 , };static struct device_d imxfb_dev = {
arch/arm/boards/pcm038/pcm038.c +20 -20
@@ -127,7 +127,23 @@ static struct device_d nand_dev = { .platform_data = &nand_info, }; -static struct fb_videomode sharp_display = { +static const struct imx_fb_driver_data driver_data = { +/* +* - HSYNC active high +* - VSYNC active high +* - clk notenabled while idle +* - clock not inverted +* - data not inverted +* - data enable low active +* - enable sharp mode +*/ + .pwmr =0x00A903FF , + .lscr1 =0x00120300 , + .dmacr =0x00020010 , + .pcr =0xF00080C0 , +}; + +static const struct fb_videomode sharp_display = { .name ="Sharp-LQ035Q7" , .refresh =60 , .xres =240 ,
@@ -139,28 +155,12 @@ static struct fb_videomode sharp_display = { .vsync_len = 1, .upper_margin = 7, .lower_margin = 9, -}; - -static struct imx_fb_videomode imxfb_mode = { - .mode = &sharp_display, -/* -* - HSYNC active high -* - VSYNC active high -* - clk notenabled while idle -* - clock not inverted -* - data not inverted -* - data enable low active -* - enable sharp mode -*/ - .pcr =0xF00080C0 , - .bpp =16 , + .priv = &driver_data, };static struct imx_fb_platform_data pcm038_fb_data = { - .mode = &imxfb_mode, - .pwmr =0x00A903FF , - .lscr1 =0x00120300 , - .dmacr =0x00020010 , + .mode = &sharp_display, + .mode_cnt =1 , };static struct device_d imxfb_dev = {
arch/arm/mach-imx/include/mach/imxfb.h +11 -9
@@ -49,28 +49,30 @@#define DMACR_HM (x) (((x) & 0xf) << 16)#define DMACR_TM (x) ((x) & 0xf) -struct imx_fb_videomode { -struct fb_videomode *mode; -u32 pcr; -unsigned char bpp; +/** +* Videomode dependent, but driver specific data +*/ +struct imx_fb_driver_data { +uint32_t pwmr;/**< refer datasheet: LPCCR register */ +uint32_t lscr1;/**< refer datasheet: LSCR register */ +uint32_t dmacr;/**< refer datasheet: LDCR register */ +uint32_t pcr;/**< refer datasheet: LPCR register */ };/** * Define relevant framebuffer information */ struct imx_fb_platform_data { -struct imx_fb_videomode *mode; +const struct fb_videomode *mode;unsigned mode_cnt;/**< number of entries in 'mode' */ +unsigned char bpp;/**< preferred colour depth for this device */ +u_int cmap_greyscale:1 , cmap_inverse:1 , cmap_static:1 , unused:29 ; -u_int pwmr; -u_int lscr1; -u_int dmacr; -/** force a memory area to be used, else NULL for dynamic allocation */ void *framebuffer;/** force a memory area to be used, else NULL for dynamic allocation */
drivers/video/imx.c +10 -9
@@ -300,6 +300,7 @@ static int imxfb_initialize_mode(struct fb_info *info, const struct fb_videomodeunsigned long lcd_clk;unsigned long long tmp;struct imxfb_info *fbi =fb_info_to_imxfb_info (info); +const struct imx_fb_driver_data *drv_data = mode->priv;u32 pcr;unsigned size;
@@ -324,6 +325,11 @@ static int imxfb_initialize_mode(struct fb_info *info, const struct fb_videomodeif (info->fb_dev->map_base ==0U /* FIXME should be 'NULL'*/ ) info->fb_dev->map_base = (unsigned long )xzalloc (info->fb_dev->size); + fbi->pcr = drv_data->pcr; + fbi->pwmr = drv_data->pwmr; + fbi->lscr1 = drv_data->lscr1; + fbi->dmacr = drv_data->dmacr; +/* physical screen start address */ writel (VPW_VPW (mode->xres * info->bits_per_pixel /8 /4 ), fbi->regs +LCDC_VPW );
@@ -535,7 +541,7 @@ static int imxfb_register_overlay(struct imxfb_info *fbi, struct device_d *hw_de overlay->fb_setcolreg = imxfb_overlay_setcolreg;/* add runtime video info */ - overlay->mode = pdata->mode->mode; + overlay->mode = pdata->mode; overlay->mode_cnt =1 ;/* no choice */ overlay_dev =register_framebuffer (overlay, pdata->framebuffer_ovl,0 );
@@ -585,17 +591,12 @@ static int imxfb_probe(struct device_d *dev) fbi->fb_host.fb_setcolreg = imxfb_setcolreg; fbi->regs = (void *)dev->map_base; - fbi->pcr = pdata->mode->pcr; - fbi->pwmr = pdata->pwmr; - fbi->lscr1 = pdata->lscr1; - fbi->dmacr = pdata->dmacr; fbi->enable = pdata->enable;/* add runtime video info */ - fbi->fb_host.mode = pdata->mode->mode; -/* to be backward compatible */ - fbi->fb_host.mode_cnt = pdata->mode_cnt ==0 ?1 : pdata->mode_cnt; - fbi->fb_host.bits_per_pixel =16 ;/* RGB565, the default */ + fbi->fb_host.mode = pdata->mode; + fbi->fb_host.mode_cnt = pdata->mode_cnt; + fbi->fb_host.bits_per_pixel = pdata->bpp; fb_dev =register_framebuffer (&fbi->fb_host, pdata->framebuffer,0 );if (dev ==NULL ) {
include/fb.h +2 -0
@@ -69,6 +69,8 @@ struct fb_videomode {unsigned sync;/**< sync information, refer FB_SYNC_* macros */ unsigned vmode;/**< video mode information, refer FB_VMODE_* macros */ unsigned flag; + +const void *priv;/**< video driver related information */ };/* Interpretation of offset for color fields: All offsets are from the right,
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerHi Jürgen,
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
- Please refrain from basing your internal functions around 'struct device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code. The framebuffer code should be based around struct fb_info.
- Please keep the line lengths within sensible limits.
- Get rid of CONFIG_VIDEO_DELAY_INIT and make the mode runtime changeable. All this requires is a
host->fb_disable(info); host->fb_mode(info, newmode); host->fb_enable(mode);
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Jürgen,
Quoted 14 lines · Sascha Hauer
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
- Please refrain from basing your internal functions around 'structdevice_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code. The framebuffer code should be based around structfb_info.
- Please keep the line lengths within sensible limits.
- Get rid ofCONFIG_VIDEO_DELAY_INITand make the mode runtime changeable. All this requires is a
host->fb_disable(info);host->fb_mode(info, newmode);host->fb_enable(mode);
and pcr in imxfb_mode which describes polarity of signals and thus can change from a screen to another.
Eric
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerHi Eric,
Quoted 17 lines · Eric Bénard
Hi Jürgen,
Quoted 14 lines · Sascha Hauer
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
- Please refrain from basing your internal functions around 'structdevice_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code. The framebuffer code should be based around structfb_info.
- Please keep the line lengths within sensible limits.
- Get rid ofCONFIG_VIDEO_DELAY_INITand make the mode runtime changeable. All this requires is a
host->fb_disable(info);host->fb_mode(info, newmode);host->fb_enable(mode);
Quoted 2 lines
and pcr in
imxfb_modewhich describes polarity of signals and thus can change from a screen to another.
This is handled in a later patch.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.
But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.
Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
Quoted 1 line
The framebuffer code should be based around struct
fb_info.
I do not like this idea, but okay. In the next series I will do it in this way.
Quoted 1 line
- Please keep the line lengths within sensible limits.
Sorry, I checked it the last time, but some lines are slipped through.
Quoted 4 lines
- Get rid of
CONFIG_VIDEO_DELAY_INITand make the mode runtime changeable. All this requires is ahost->fb_disable(info);host->fb_mode(info, newmode);host->fb_enable(mode);
Hmm, you want to be able to change the videomode more than one times in barebox? So, I need more effort in memory management. Okay.
Juergen
Signature · 9 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi,
Quoted 37 lines · Juergen Beisert
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
Quoted 8 lines
Quoted 1 line
The framebuffer code should be based around struct
fb_info.I do not like this idea, but okay. In the next series I will do it in this way.
Quoted 1 line
- Please keep the line lengths within sensible limits.
Sorry, I checked it the last time, but some lines are slipped through.
Couldn't be included in barebox scripts also checkpatch.pl script from kernel? Would be nice to have proper patches with kernel coding style.
Quoted 17 lines
Quoted 5 lines
- Get rid of
CONFIG_VIDEO_DELAY_INITand make the mode runtime changeable. All this requires is ahost->fb_disable(info);host->fb_mode(info, newmode);host->fb_enable(mode);Hmm, you want to be able to change the videomode more than one times in barebox? So, I need more effort in memory management. Okay.
Juergen
--
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |
Quoted 5 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
thanks,
marek
Signature · 15 lines
as simple and primitive as possible ------------------------------------------------- Marek Belisko - OPEN-NANDRA Freelance Developer Ruska Nova Ves 219 | Presov, 08005 Slovak Republic Tel: +421 915 052 184 skype: marekwhite icq: 290551086 web: http://open-nandra.com _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerQuoted 42 lines · Belisko Marek
Hi,
Quoted 39 lines · Juergen Beisert
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
Quoted 1 line
The framebuffer code should be based around struct
fb_info.
Quoted 8 lines
Quoted 6 lines
I do not like this idea, but okay. In the next series I will do it in this way.
Quoted 1 line
- Please keep the line lengths within sensible limits.
Sorry, I checked it the last time, but some lines are slipped through.
Couldn't be included in barebox scripts also checkpatch.pl script from kernel? Would be nice to have proper patches with kernel coding style.
Sure, send a patch ;)
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi,
Quoted 46 lines · Sascha Hauer
Quoted 45 lines · Belisko Marek
Hi,
Quoted 42 lines · Juergen Beisert
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
Quoted 1 line
The framebuffer code should be based around struct
fb_info.I do not like this idea, but okay. In the next series I will do it in this way.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
- Please keep the line lengths within sensible limits.
Sorry, I checked it the last time, but some lines are slipped through.
Couldn't be included in barebox scripts also checkpatch.pl script from kernel? Would be nice to have proper patches with kernel coding style.
Sure, send a patch ;)
Just checkpatch.pl from kernel or invent some less restrictive tool ;) in e.g .python?
Quoted 10 lines
Sascha
--
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
marek
Signature · 15 lines
as simple and primitive as possible ------------------------------------------------- Marek Belisko - OPEN-NANDRA Freelance Developer Ruska Nova Ves 219 | Presov, 08005 Slovak Republic Tel: +421 915 052 184 skype: marekwhite icq: 290551086 web: http://open-nandra.com _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerQuoted 51 lines · Belisko Marek
Hi,
Quoted 48 lines · Sascha Hauer
Quoted 47 lines · Belisko Marek
Hi,
Quoted 44 lines · Juergen Beisert
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
Quoted 1 line
The framebuffer code should be based around struct
fb_info.I do not like this idea, but okay. In the next series I will do it in this way.
Quoted 1 line
- Please keep the line lengths within sensible limits.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Sorry, I checked it the last time, but some lines are slipped through.
Couldn't be included in barebox scripts also checkpatch.pl script from kernel? Would be nice to have proper patches with kernel coding style.
Sure, send a patch ;)
Just checkpatch.pl from kernel or invent some less restrictive tool ;) in e.g .python?
checkpatch.pl should be fine. I won't require a patch to be checkpatch clean, but sometimes it's nice to be able to tell people 'go fix these checkpatch warnings' when there are obvious style problems in it.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerQuoted 32 lines · Juergen Beisert
Hi Sascha,
Quoted 11 lines · Sascha Hauer
Quoted 9 lines · Juergen Beisert
Currently barebox uses a fixed videomode setup. Everything is compiled in. This change adds the possibility to select a videomode according to a connected display at runtime. The current behaviour is still present if not otherwise configured. If configured for runtime setup, initialization of the video hardware will be delayed until the required videomode will be selected from the shell code. If more than one videomode is supported by the platform, running the 'devinfo' command on the framebuffer device shows the supported videomode list. After selecting the videomode, the output can be enabled.
Quoted 4 lines
General remarks about this series:
- Please do not add code with '#if 0' and activate it later. This shows the series has the wrong order.
This was for review only. If I would change the code in one step, the patch is unreadable.
Quoted 4 lines
- Please refrain from basing your internal functions around 'struct
device_d'. By doing so we completey lose type safety and at least in case of the mci framework where three different devices are involved this leads to unreadable and error prone code.But IMHO in the case of the MCI there _are_ three devices!
- The one that knows how to handle disk drives
- The one that knows what a SD card is
- the one that knows how to transfer data from an to an attached device.
Quoted 4 lines
Why this is unreadable or error prone? If you combine all these different functions into one I would say: Yes, the result is unreadable and error prone. And if you would say for a bootloader this separate approach is over-engineered, I would say: Maybe.
I'm not at all against the presence of three devices. It's only a bad idea to use the struct device_d * as a reference between functions. In the MCI framework all functions take some device and then the platform_data is derefenced to three different struct types. How do I know which of the three devices is passed there? I have to look at the calling function figure this out. We can simply let the compiler barf when somebody passes a wrong pointer type when we do it like we always
did: Just pass a struct mci_host or whatever around.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox