Add dynamic video initialization to barebox
Subsystems (6)
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.
jbe
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/11 imx: 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/11 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 does not know). Also the possibility to stop the clock when outside active display data (required for (C)STN display).
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/11 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 of m" should be merged, prior the final commit into the repository.
This step brings in the required functions for dynamic videomode selection at runtime, but keep the old functions untouched (the new ones are commented out).
This is patch 1 of 7 to keep the repository bisectable.
--- drivers/video/Kconfig | 23 +++++ drivers/video/fb.c | 251 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 314 insertions(+), 0 deletions(-)
drivers/video/Kconfig +23 -0
@@ -5,6 +5,29 @@ menuconfig VIDEO if VIDEO +comment "runtime options" + +config VIDEO_DELAY_ENABLING + bool "Delayed enabling" + help + Say 'y' here to delay enabling video output. This is useful to first + fill the framebuffer (splash screen for example) prior enabling the + video device. + This entry adds the "enable" parameter to the video device, to enable + or disable video output at runtime. + +config VIDEO_DELAY_INIT + bool "Delayed initialization" + select VIDEO_DELAY_ENABLING + 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 +251 -0
272 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
PATCH 5/11 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 | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-)
drivers/video/Kconfig +6 -0
@@ -26,6 +26,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 +40 -0
@@ -172,6 +172,45 @@ 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" ); +#ifdef CONFIG_VIDEO_DELAY_ENABLING +printf (" Video output %senabled\n" , info->enabled !=0 ?"" :"not " ); +#endif +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
@@ -250,6 +289,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 4/11 Remove the old videomode functions
In reply to Juergen BeisertRemove the old functions from the framebuffer framework and change API for existing functions.
This patch is kept separately for review only. Should be merged with the other special marked patches.
This is patch 2 of 7 to keep the repository bisectable.
--- drivers/video/fb.c | 67 ++------------------------------------------------- include/fb.h | 38 ----------------------------- 2 files changed, 3 insertions(+), 102 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) {
@@ -193,7 +163,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,
@@ -203,7 +172,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
@@ -314,32 +282,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 -38
@@ -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;
@@ -123,35 +114,6 @@ struct fb_info { };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 6/11 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/11 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 | 156 +++++++++++++--------- 4 files changed, 96 insertions(+), 76 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 +92 -64
330 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 9/11 STM378x: Add video driver for this platform
In reply to Juergen BeisertAs there is currently no user of this driver (but coming soon) it is for reference only.
--- arch/arm/mach-stm/include/mach/fb.h | 38 +++ drivers/video/Kconfig | 7 + drivers/video/Makefile | 1 + drivers/video/stm.c | 556 +++++++++++++++++++++++++++++++++++ 4 files changed, 602 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
@@ -55,4 +55,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 +556 -0
556 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 11/11 Add doxygen documentation to the framebfuffer code
In reply to Juergen BeisertAdd some (hopyfully) helpful documentation to the source code.
--- Documentation/developers_manual.dox | 1 + Documentation/users_manual.dox | 1 + drivers/video/fb.c | 221 +++++++++++++++++++++++++++++++++++ include/fb.h | 98 ++++++++++----- 4 files changed, 288 insertions(+), 33 deletions(-)
Documentation/developers_manual.dox +1 -0
@@ -21,5 +21,6 @@ This part of the documentation is intended for developers of @a barebox. @li @subpage io_access_functions @li @subpage mcfv4e_MCDlib @li @subpage x86_runtime +@li @subpage fb_for_developers */
Documentation/users_manual.dox +1 -0
@@ -12,5 +12,6 @@ work easier. @li @subpage partitions @li @subpage x86_bootloader @li @subpage net_netconsole +@li @subpage fb_for_users */
drivers/video/fb.c +221 -0
272 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 8/11 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 | 454 +++++++++++++++++++++++++++++++ 4 files changed, 501 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
@@ -49,4 +49,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 +454 -0
454 lines not on this page · raw message
Signature · 1 line
1.7.2.3
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/11 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
Sascha Hauer
maintainerRe: [PATCH 03/11] Bring in dynamic videomode selection at runtime
In reply to Juergen BeisertQuoted 38 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 of m" should be merged, prior the final commit into the repository.
This step brings in the required functions for dynamic videomode selection at runtime, but keep the old functions untouched (the new ones are commented out).
This is patch 1 of 7 to keep the repository bisectable.
Signed-off-by Juergen Beisert <[email protected]>--- drivers/video/Kconfig | 23 +++++ drivers/video/fb.c | 251 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 314 insertions(+), 0 deletions(-)drivers/video/Kconfig +10
-0@@ -5,6 +5,29 @@ menuconfig VIDEO if VIDEO +comment "runtime options" + +config VIDEO_DELAY_ENABLING + bool "Delayed enabling" + help + Say 'y' here to delay enabling video output. This is useful to first + fill the framebuffer (splash screen for example) prior enabling the + video device. + This entry adds the "enable" parameter to the video device, to enable + or disable video output at runtime.
drivers/video/Kconfig menuconfig VIDEO · line 27
Quoted 10 lines
drivers/video/Kconfig +10
-0+ +config VIDEO_DELAY_INIT + bool "Delayed initialization" + select VIDEO_DELAY_ENABLING + 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.
I think the framebuffers should *never* be activated by the setup code and should be explicitely initialized by doing a 'fb0.enable=1' on the command line. This way we have the most flexibility. We can enable the framebuffer when we actually need it, we can draw a splash screen before enabling it so that we do not have a black screen before we draw an image. Also, the environment can decide to leave the framebuffer disabled because the kernel will draw another screen a second later. If necessary, the environemt can do a fb0.display="sharp-whatever" before activating it. And we do not need any kconfig options for this.
Sascha
Quoted 346 lines
drivers/video/Kconfig +3
-0+ +comment "drivers" + config DRIVER_VIDEO_IMX bool "i.MX framebuffer driver" depends on ARCH_IMX1 || ARCH_IMX21 || ARCH_IMX25 || ARCH_IMX27drivers/video/fb.c +251
-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,141 @@ 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 + +#ifdef CONFIG_VIDEO_DELAY_ENABLING +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); +} +#endif + +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 +203,119 @@ 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 +#ifdef CONFIG_VIDEO_DELAY_ENABLING +dev_add_param (fb_dev,"enable" , fb_enable_set,NULL ,0 ); +/* default is 'off' for delayed video output */ +#endif +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 +#ifndef CONFIG_VIDEO_DELAY_ENABLING +/* enable video output immediately */ + (host->fb_enable)(info); +#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 +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
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 07/11] Adapt the existing imx-ipu fb driver to support runtime videomode selection
In reply to Juergen BeisertQuoted 3 lines · Juergen Beisert
Adapt 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.
This conflicts with the ipu fb patch I posted today.
Sascha
Quoted 425 lines
NOTE: Due to the lack of hardware, this is compile time tested only.
This is patch 5 of 7 to keep the repository bisectable.
Signed-off-by Juergen Beisert <[email protected]>--- 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 | 156 +++++++++++++--------- 4 files changed, 96 insertions(+), 76 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 +92
-64@@ -34,12 +34,12 @@#include <mach/clock.h> struct ipu_fb_info { +struct fb_host fb_host;/**< myself */ void __iomem *regs;void (*enable)(int enable); -struct fb_info info; -struct device_d *dev; +const struct fb_videomode *mode;/**< requested videomodue */ };/* IPU DMA Controller channel definitions. */ @@ -413,29 +413,30 @@ static inline void reg_write(struct ipu_fb_info *fbi, u32 value,writel (value, fbi->regs + reg); } +#define fb_info_to_imxfb_info (x) ((struct ipu_fb_info*)((x)->host)) +/* * sdc_init_panel() - initialize a synchronous LCD panel. -* @width: width of panel in pixels. -* @height: height of panel in pixels. -* @pixel_fmt: pixel format of buffer as FOURCC ASCII code. +* @param info The framebuffer to work on +* @param pixel_fmt pixel format of buffer as FOURCC ASCII code. * @return: 0 on success or negative error code on failure. */ static int sdc_init_panel (struct fb_info *info,enum pixel_fmt pixel_fmt) { -struct ipu_fb_info *fbi = info->priv; -struct fb_videomode *mode = info->mode; +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info); +const struct fb_videomode *mode = fbi->mode;u32 reg, old_conf, div;enum ipu_panel panel =IPU_PANEL_TFT ;unsigned long pixel_clk;/* Init panel size and blanking periods */ reg = ((mode->hsync_len -1 ) <<26 ) | - ((info->xres + mode->left_margin + mode->right_margin + + ((mode->xres + mode->left_margin + mode->right_margin + mode->hsync_len -1 ) <<16 );reg_write (fbi, reg,SDC_HOR_CONF ); reg = ((mode->vsync_len -1 ) <<26 ) |SDC_V_SYNC_WIDTH_L | - ((info->yres + mode->upper_margin + mode->lower_margin + + ((mode->yres + mode->upper_margin + mode->lower_margin + mode->vsync_len -1 ) <<16 );reg_write (fbi, reg,SDC_VER_CONF );@@ -448,7 +449,7 @@ static int sdc_init_panel(struct fb_info *info, enum pixel_fmt pixel_fmt) old_conf |=DI_D3_CLK_POL ;if (mode->sync &FB_SYNC_DATA_INVERT ) old_conf |=DI_D3_DATA_POL ; -if (mode->sync &FB_SYNC_OE_ACT_HIGH ) +if (mode->sync &FB_SYNC_DE_HIGH_ACT ) old_conf |=DI_D3_DRDY_SHARP_POL ;reg_write (fbi, old_conf,DI_DISP_SIG_POL );@@ -483,12 +484,12 @@ static int sdc_init_panel(struct fb_info *info, enum pixel_fmt pixel_fmt) div =imx_get_lcdclk () *16 / pixel_clk;if (div <0x40 ) {/* Divider less than 4 */ -dev_dbg (&info->dev, +dev_dbg (fbi->fb_host.hw_dev,"InitPanel() - Pixel clock divider less than 4\n" ); div =0x40 ; } -dev_dbg (&info->dev,"pixel clk = %u, divider %u.%u\n" , +dev_dbg (fbi->fb_host.hw_dev,"pixel clk = %u, divider %u.%u\n" , pixel_clk, div >>4 , (div &7 ) *125 );/* @@ -588,19 +589,20 @@ static u32 dma_param_addr(enum ipu_channel channel)return 0x10000 | (channel <<4 ); } -static void ipu_init_channel_buffer (struct ipu_fb_info *fbi, +static void ipu_init_channel_buffer (struct fb_info *info,enum ipu_channel channel,void *fbmem) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);union chan_param_mem params = {};u32 reg;u32 stride_bytes; - stride_bytes = fbi->info.xres * ((fbi->info.bits_per_pixel +7 ) /8 ); + stride_bytes = fbi->mode->xres * ((info->bits_per_pixel +7 ) /8 ); stride_bytes = (stride_bytes +3 ) & ~3 ;/* Build parameter memory data for DMA channel */ -ipu_ch_param_set_size (¶ms,bpp_to_pixfmt (fbi->info.bits_per_pixel), - fbi->info.xres, fbi->info.yres, stride_bytes); +ipu_ch_param_set_size (¶ms,bpp_to_pixfmt (info->bits_per_pixel), + fbi->mode->xres, fbi->mode->yres, stride_bytes);ipu_ch_param_set_buffer (¶ms, fbmem,NULL ); params.pp.bam =0 ;/* Some channels (rotation) have restriction on burst length */ @@ -622,9 +624,10 @@ static void ipu_init_channel_buffer(struct ipu_fb_info *fbi,reg_write (fbi, reg,IPU_CHA_DB_MODE_SEL ); } -static void ipu_channel_set_priority (struct ipu_fb_info *fbi, +static void ipu_channel_set_priority (struct fb_info *fb_info,enum ipu_channel channel,int prio) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (fb_info);u32 reg; reg =reg_read (fbi,IDMAC_CHA_PRI );@@ -639,11 +642,13 @@ static void ipu_channel_set_priority(struct ipu_fb_info *fbi,/* * ipu_enable_channel() - enable an IPU channel. +* @param info The framebuffer to work on * @channel: channel ID. * @return: 0 on success or negative error code on failure. */ -static int ipu_enable_channel (struct ipu_fb_info *fbi,enum ipu_channel channel) +static int ipu_enable_channel (struct fb_info *info,enum ipu_channel channel) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);u32 reg;/* Reset to buffer 0 */ @@ -651,7 +656,7 @@ static int ipu_enable_channel(struct ipu_fb_info *fbi, enum ipu_channel channel)switch (channel) {case IDMAC_SDC_0 : -ipu_channel_set_priority (fbi, channel,1 ); +ipu_channel_set_priority (info, channel,1 );break ;default :break ;@@ -663,9 +668,10 @@ static int ipu_enable_channel(struct ipu_fb_info *fbi, enum ipu_channel channel)return 0 ; } -static int ipu_update_channel_buffer (struct ipu_fb_info *fbi, +static int ipu_update_channel_buffer (struct fb_info *info,enum ipu_channel channel,void *buf) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);u32 reg; reg =reg_read (fbi,IPU_CHA_BUF0_RDY );@@ -679,16 +685,17 @@ static int ipu_update_channel_buffer(struct ipu_fb_info *fbi,return 0 ; } -static int idmac_tx_submit (struct ipu_fb_info *fbi,enum ipu_channel channel, +static int idmac_tx_submit (struct fb_info *info,enum ipu_channel channel,void *buf) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);int ret; -ipu_init_channel_buffer (fbi, channel, buf); +ipu_init_channel_buffer (info, channel, buf);/* ipu_idmac.c::ipu_submit_channel_buffers() */ - ret =ipu_update_channel_buffer (fbi, channel, buf); + ret =ipu_update_channel_buffer (info, channel, buf);if (ret <0 )return ret;@@ -697,16 +704,17 @@ static int idmac_tx_submit(struct ipu_fb_info *fbi, enum ipu_channel channel,reg_write (fbi,1UL << channel,IPU_CHA_BUF0_RDY ); - ret =ipu_enable_channel (fbi, channel); + ret =ipu_enable_channel (info, channel);return ret; } -static void sdc_enable_channel (struct ipu_fb_info *fbi,void *fbmem) +static void sdc_enable_channel (struct fb_info *info,void *fbmem) { +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);int ret;u32 reg; - ret =idmac_tx_submit (fbi,IDMAC_SDC_0 , fbmem); + ret =idmac_tx_submit (info,IDMAC_SDC_0 , fbmem);/* mx3fb.c::sdc_fb_init() */ if (ret >=0 ) {@@ -724,13 +732,14 @@ static void sdc_enable_channel(struct ipu_fb_info *fbi, void *fbmem)/* * mx3fb_set_par() - set framebuffer parameters and change the operating mode. +* @param info The framebuffer to work on * @return: 0 on success or negative error code on failure. */ static int mx3fb_set_par (struct fb_info *info) { -struct ipu_fb_info *fbi = info->priv; +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);struct imx_ipu_fb_rgb *rgb; -struct fb_videomode *mode = info->mode; +const struct fb_videomode *mode = fbi->mode;int ret; ret =sdc_init_panel (info,IPU_PIX_FMT_RGB666 );@@ -766,10 +775,45 @@ static int mx3fb_set_par(struct fb_info *info)return 0 ; } +static int ipu_fb_initialize_mode (struct fb_info *fb_info,const struct fb_videomode *mode) +{ +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (fb_info); +unsigned size; + +/* +* 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 +*/ +if (fb_info->fb_dev->map_base ==0U /* FIXME should be 'NULL'*/ ) + fb_info->fb_dev->map_base = (unsigned long )xzalloc (fb_info->fb_dev->size); + +#if 0 +/* FIXME why here? Its also called in ipu_fb_enable() */ +sdc_enable_channel (fbi, fb_info->fb_dev->map_base); +#endif + fbi->mode = mode; + +return 0 ; +} +/* References in this function refer to respective Linux kernel sources */ static void ipu_fb_enable (struct fb_info *info) { -struct ipu_fb_info *fbi = info->priv; +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);u32 reg;@@ -825,7 +869,7 @@ static void ipu_fb_enable(struct fb_info *info)mx3fb_set_par (info); -sdc_enable_channel (fbi, info->screen_base); +sdc_enable_channel (info, (void *)info->fb_dev->map_base);/* * Linux driver calls sdc_set_brightness() here again, @@ -837,7 +881,7 @@ static void ipu_fb_enable(struct fb_info *info)static void ipu_fb_disable (struct fb_info *info) { -struct ipu_fb_info *fbi = info->priv; +struct ipu_fb_info *fbi =fb_info_to_imxfb_info (info);u32 reg;printf ("%s\n" , __func__);@@ -850,54 +894,38 @@ static void ipu_fb_disable(struct fb_info *info)reg_write (fbi, reg,SDC_COM_CONF ); } -static struct fb_ops imxfb_ops = { - .fb_enable = ipu_fb_enable, - .fb_disable = ipu_fb_disable, -}; -static int imxfb_probe (struct device_d *dev) {struct ipu_fb_info *fbi; -struct fb_info *info; +struct device_d *fb_dev;const struct imx_ipu_fb_platform_data *pdata = dev->platform_data; -int ret;if (!pdata)return -ENODEV ; fbi =xzalloc (sizeof (*fbi)); - info = &fbi->info; + +/* add runtime hardware info */ + fbi->fb_host.hw_dev = dev; + fbi->fb_host.fb_mode = ipu_fb_initialize_mode; + fbi->fb_host.fb_enable = ipu_fb_enable; + fbi->fb_host.fb_disable = ipu_fb_disable; + fbi->fb_host.fb_setcolreg =NULL ; fbi->regs = (void *)dev->map_base; - fbi->dev = dev; - info->priv = fbi; - info->mode = pdata->mode; - info->xres = pdata->mode->xres; - info->yres = pdata->mode->yres; - info->bits_per_pixel = pdata->bpp; - info->fbops = &imxfb_ops; - fbi->enable = pdata->enable; -dev_info (dev,"i.MX Framebuffer driver\n" ); +/* add runtime video info */ + fbi->fb_host.mode = pdata->mode; +/* to be backward compatible */ + fbi->fb_host.mode_cnt = pdata->mode_cnt ==0 ?1 : pdata->mode_cnt; + fbi->fb_host.bits_per_pixel = pdata->bpp; -/* -* Use a given frambuffer or reserve some -* memory for screen usage -*/ - fbi->info.screen_base = pdata->framebuffer; -if (fbi->info.screen_base ==NULL ) { - fbi->info.screen_base =malloc (info->xres * info->yres * - (info->bits_per_pixel >>3 )); -if (!fbi->info.screen_base) -return -ENOMEM ; - } - -sdc_enable_channel (fbi, info->screen_base); +dev_info (dev,"i.MX Framebuffer driver\n" ); - ret =register_framebuffer (&fbi->info); -if (ret <0 ) { + fb_dev =register_framebuffer (&fbi->fb_host, pdata->framebuffer,0 ); +if (fb_dev ==NULL ) {dev_err (dev,"failed to register framebuffer\n" ); -return ret; +return -EINVAL ; }return 0 ;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
Sascha Hauer
maintainerRe: [PATCH 01/11] imx: Separate framebuffer platformdata and the videomode
In reply to Juergen BeisertQuoted 47 lines · Juergen Beisert
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).
Signed-off-by Juergen Beisert <[email protected]>--- 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 +14
-7@@ -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 ,
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c static struct device_d nand_dev = { · line 141
Quoted 10 lines
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +1
-6- .left_margin = 38, - .right_margin = 20, - .vsync_len = 3, - .upper_margin = 15, - .lower_margin = 4, - }, + .mode = &cmo_display, .pcr = 0xCAD08B80, .bpp = 16, };
What are we going to do about the .pcr value? It is display specific. Look for example in pcm970-baseboard.c in the kernel. It has two different possible displays with two different pcr values.
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 08/11] Add a video driver for S3C2440 bases platforms
In reply to Juergen BeisertQuoted 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 | 454 +++++++++++++++++++++++++++++++ 4 files changed, 501 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.cdrivers/video/s3c.c new file +0
-0
drivers/video/s3c.c
Quoted 8 lines
drivers/video/s3c.c new file +8
-0+ +/** +* 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 +* +* FIXME Diese Routine darf die Pinx nach drau?en nicht aktivieren. Zur Zeit macht sie das!
You should at least translate this to english ;)
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 09/11] STM378x: Add video driver for this platform
In reply to Juergen BeisertQuoted 563 lines · Juergen Beisert
As there is currently no user of this driver (but coming soon) it is for reference only.
Signed-off-by Juergen Beisert <[email protected]>--- arch/arm/mach-stm/include/mach/fb.h | 38 +++ drivers/video/Kconfig | 7 + drivers/video/Makefile | 1 + drivers/video/stm.c | 556 +++++++++++++++++++++++++++++++++++ 4 files changed, 602 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-stm/include/mach/fb.h create mode 100644 drivers/video/stm.carch/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@@ -55,4 +55,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. + endifdrivers/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.odrivers/video/stm.c new file +473
-0@@ -0,0 +1,556 @@ +/* +* Copyright (C) 2010 Juergen Beisert, Pengutronix +* +* This code is based on: +* Author: Vitaly Wool <[email protected]> +* +* Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. +* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. +* +* 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. +*/ + +/** +* @file +* @brief LCDIF driver for i.MX23 and i.MX28 (i.MX23 untested yet) +* +* The LCDIF support four modes of operation +* - MPU interface (to drive smart displays) -> not supported yet +* - VSYNC interface (like MPU interface plus Vsync) -> not supported yet +* - Dotclock interface (to drive LC displays with RGB data and sync signals) +* - DVI (to drive ITU-R BT656) -> not supported yet +* +* This driver depends on a correct setup of the pins used for this purpose +* (platform specific). +* +* For the developer: Don't forget to set the data bus width to the display +* in the imx_fb_videomode structure. You will else end up with ugly colours. +* If you fighting against jitter you can vary the clock delay. This is a feature +* of the i.MX28 and you can vary it between 2 ns ... 8 ns in 2 ns steps. Give +* the required value in the imx_fb_videomode structure. +*/ + +/* #define DEBUG */ + +#include <common.h> +#include <init.h> +#include <driver.h> +#include <malloc.h> +#include <errno.h> +#include <xfuncs.h> +#include <asm/io.h> +#include <mach/clock.h> +#include <mach/fb.h> + +#define HW_LCDIF_CTRL 0x00 +# define CTRL_SFTRST (1 << 31) +# define CTRL_CLKGATE (1 << 30) +# define CTRL_BYPASS_COUNT (1 << 19) +# define CTRL_VSYNC_MODE (1 << 18) +# define CTRL_DOTCLK_MODE (1 << 17) +# define CTRL_DATA_SELECT (1 << 16) +# define SET_BUS_WIDTH (x) (((x) & 0x3) << 10) +# define SET_WORD_LENGTH (x) (((x) & 0x3) << 8) +# define GET_WORD_LENGTH (x) (((x) >> 8) & 0x3) +# define CTRL_MASTER (1 << 5) +# define CTRL_DF16 (1 << 3) +# define CTRL_DF18 (1 << 2) +# define CTRL_DF24 (1 << 1) +# define CTRL_RUN (1 << 0) + +#define HW_LCDIF_CTRL1 0x10 +# define SET_BYTE_PACKAGING (x) (((x) & 0xf) << 16) +# define GET_BYTE_PACKAGING (x) (((x) >> 16) & 0xf) + +#define HW_LCDIF_CTRL2 0x20 + +#define HW_LCDIF_TRANSFER_COUNT 0x30 +# define SET_VCOUNT (x) (((x) & 0xffff) << 16) +# define SET_HCOUNT (x) ((x) & 0xffff) + +#define HW_LCDIF_CUR_BUF 0x40 + +#define HW_LCDIF_NEXT_BUF 0x50 + +#define HW_LCDIF_TIMING 0x60 +# define SET_CMD_HOLD (x) (((x) & 0xff) << 24) +# define SET_CMD_SETUP (x) (((x) & 0xff) << 16) +# define SET_DATA_HOLD (x) (((x) & 0xff) << 8) +# define SET_DATA_SETUP (x) ((x) & 0xff)) + +#define HW_LCDIF_VDCTRL0 0x70 +# define VDCTRL0_ENABLE_PRESENT (1 << 28) +# define VDCTRL0_VSYNC_POL (1 << 27)/* 0 = low active, 1 = high active */ +# define VDCTRL0_HSYNC_POL (1 << 26)/* 0 = low active, 1 = high active */ +# define VDCTRL0_DOTCLK_POL (1 << 25)/* 0 = output at falling edge, capturing at rising edge */ +# define VDCTRL0_ENABLE_POL (1 << 24)/* 0 = low active, 1 = high active */ +# define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) +# define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) +# define VDCTRL0_HALF_LINE (1 << 19) +# define VDCTRL0_HALF_LINE_MODE (1 << 18) +# define SET_VSYNC_PULSE_WIDTH (x) ((x) & 0x3ffff) + +#define HW_LCDIF_VDCTRL1 0x80 + +#define HW_LCDIF_VDCTRL2 0x90 +# define SET_HSYNC_PULSE_WIDTH (x) (((x) & 0x3fff) << 18) +# define SET_HSYNC_PERIOD (x) ((x) & 0x3ffff) + +#define HW_LCDIF_VDCTRL3 0xa0 +# define VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) +# define VDCTRL3_VSYNC_ONLY (1 << 28) +# define SET_HOR_WAIT_CNT (x) (((x) & 0xfff) << 16) +# define SET_VERT_WAIT_CNT (x) ((x) & 0xffff) + +#define HW_LCDIF_VDCTRL4 0xb0 +# define SET_DOTCLK_DLY (x) (((x) & 0x7) << 29) +# define VDCTRL4_SYNC_SIGNALS_ON (1 << 18) +# define SET_DOTCLK_H_VALID_DATA_CNT (x) ((x) & 0x3ffff) + +#define HW_LCDIF_DVICTRL0 0xc0 +#define HW_LCDIF_DVICTRL1 0xd0 +#define HW_LCDIF_DVICTRL2 0xe0 +#define HW_LCDIF_DVICTRL3 0xf0 +#define HW_LCDIF_DVICTRL4 0x100 +#define HW_LCDIF_DATA 0x180 + +#define HW_LCDIF_DEBUG0 0x1d0 +# define DEBUG_HSYNC (1 < 26) +# define DEBUG_VSYNC (1 < 25) + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define TRANSP 3 + +struct imxfb_host { +struct fb_host fb_data; +struct device_d *hw_dev; +void __iomem *base; +}; + +#define fb_info_to_imxfb_host (x) ((struct imxfb_host*)((x)->host)) + +/* 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 RGB666 true colour mode */ +static const struct fb_bitfield def_rgb666[] = { + [RED ] = { + .offset =16 , + .length =6 , + }, + [GREEN ] = { + .offset =8 , + .length =6 , + }, + [BLUE ] = { + .offset =0 , + .length =6 , + }, + [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 , + } +}; + +/** +* Just calculate the amount of required bytes per line +* @param ppl Used pixel per line +* @param bpp Bits per pixel +* @return Byte count +*/ +static inline unsigned calc_line_length (unsigned ppl,unsigned bpp) +{ +return (ppl * bpp) >>3 ; +} + +/** +* 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 +* +* Dotclock mode: +* One line of pixels or one frame in the i.MX28 is defined to: +* @verbatim +* |<---------------------- one line period -------------------------------->| +* |<- HSync length ->| +* |<----- Start of line --->| +* |<-------- active line data ------>| +* +* |<------------------------ frame period --------------------------------->| +* |<- VSync length ->| +* |<--- Start of 1. line -->| +* |<---------- active lines -------->| +* @endverbatim +* Based on the values from struct fb_videomode: +* - "one line period" = left_margin + xres + right_margin + hsync_len +* - "HSync length" = hsync_len +* - "Start of line" = hsync_len + left_margin +* - "active line data" = xres +*/ +static int stmfb_initialize_mode (struct fb_info *fb_info,const struct fb_videomode *mode) +{ +struct imxfb_host *fbh =fb_info_to_imxfb_host (fb_info); +struct imx_fb_videomode *pdata = fbh->hw_dev->platform_data; +uint32_t reg; +unsigned size; + +pr_debug ("%s called\n" , __func__); +/* +* we need at least this amount of memory for the framebuffer +*/ + size =calc_line_length (mode->xres, fb_info->bits_per_pixel) * mode->yres; +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 +*/ +if (fb_info->fb_dev->map_base ==0U ) + fb_info->fb_dev->map_base = (resource_size_t )xzalloc (fb_info->fb_dev->size); + +/* TODO HCLK must be active at this point of time! */ + + size =imx_set_lcdifclk (PICOS2KHZ (mode->pixclock)); +if (size ==0 ) { +pr_debug ("Unable to set a valid pixel clock\n" ); +return -EINVAL ; + } + +/* +* bring the controller out of reset and configure it into DOTCLOCK mode +*/ + reg =CTRL_BYPASS_COUNT |/* always in DOTCLOCK mode */ +CTRL_DOTCLK_MODE ; +writel (reg, fbh->base +HW_LCDIF_CTRL ); + +/* master mode only */ + reg |=CTRL_MASTER ; + +/* +* Configure videomode and interface mode +*/ + reg |=SET_BUS_WIDTH (pdata->ld_intf_width); +switch (fb_info->bits_per_pixel) { +case 8 : + reg |=SET_WORD_LENGTH (1 ); +/* TODO refer manual page 2046 */ +pr_warning ("8 bpp mode not supported yet\n" ); +break ; +case 16 : +pr_debug ("Setting up an RGB565 mode\n" ); + reg |=SET_WORD_LENGTH (0 ) |CTRL_DF16 ;/* we assume RGB565 */ +writel (SET_BYTE_PACKAGING (0xf ), fbh->base +HW_LCDIF_CTRL1 ); + 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 : +case 32 : +pr_debug ("Setting up an RGB888/666 mode\n" ); + reg |=SET_WORD_LENGTH (3 ); +switch (pdata->ld_intf_width) { +case STMLCDIF_8BIT : +pr_debug ("Unsupported LCD bus width mapping\n" ); +break ; +case STMLCDIF_16BIT : +case STMLCDIF_18BIT : +/* 24 bit to 18 bit mapping */ + reg |=CTRL_DF24 ;/* ignore the upper 2 bits in each colour component */ + fb_info->red = def_rgb666[RED ]; + fb_info->green = def_rgb666[GREEN ]; + fb_info->blue = def_rgb666[BLUE ]; + fb_info->transp = def_rgb666[TRANSP ]; +break ; +case STMLCDIF_24BIT : +/* real 24 bit */ + 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 ; + } +/* do not use packed pixels = one pixel per word instead */ +writel (SET_BYTE_PACKAGING (0x7 ), fbh->base +HW_LCDIF_CTRL1 ); +break ; +default : +pr_debug ("Unhandled colour depth of %u\n" , fb_info->bits_per_pixel); +return -EINVAL ; + } +writel (reg, fbh->base +HW_LCDIF_CTRL ); +pr_debug ("Setting up CTRL to %08X\n" , reg); + +writel (SET_VCOUNT (mode->yres) | +SET_HCOUNT (mode->xres), fbh->base +HW_LCDIF_TRANSFER_COUNT ); + + reg =VDCTRL0_ENABLE_PRESENT |/* always in DOTCLOCK mode */ +VDCTRL0_VSYNC_PERIOD_UNIT | +VDCTRL0_VSYNC_PULSE_WIDTH_UNIT ; +if (mode->sync &FB_SYNC_HOR_HIGH_ACT ) + reg |=VDCTRL0_HSYNC_POL ; +if (mode->sync &FB_SYNC_VERT_HIGH_ACT ) + reg |=VDCTRL0_VSYNC_POL ; +if (mode->sync &FB_SYNC_DE_HIGH_ACT ) + reg |=VDCTRL0_ENABLE_POL ; +if (mode->sync &FB_SYNC_CLK_INVERT ) + reg |=VDCTRL0_DOTCLK_POL ; + + reg |=SET_VSYNC_PULSE_WIDTH (mode->vsync_len); +writel (reg, fbh->base +HW_LCDIF_VDCTRL0 ); +pr_debug ("Setting up VDCTRL0 to %08X\n" , reg); + +/* frame length in lines */ +writel (mode->upper_margin + mode->vsync_len + mode->lower_margin + mode->yres, + fbh->base +HW_LCDIF_VDCTRL1 ); + +/* line length in units of clocks or pixels */ +writel (SET_HSYNC_PULSE_WIDTH (mode->hsync_len) | +SET_HSYNC_PERIOD (mode->left_margin + mode->hsync_len + mode->right_margin + mode->xres), + fbh->base +HW_LCDIF_VDCTRL2 ); + +writel (SET_HOR_WAIT_CNT (mode->left_margin + mode->hsync_len) | +SET_VERT_WAIT_CNT (mode->upper_margin + mode->vsync_len), + fbh->base +HW_LCDIF_VDCTRL3 ); + +writel (SET_DOTCLK_DLY (pdata->dotclk_delay) | +SET_DOTCLK_H_VALID_DATA_CNT (mode->xres), + fbh->base +HW_LCDIF_VDCTRL4 ); + +writel (fb_info->fb_dev->map_base, fbh->base +HW_LCDIF_CUR_BUF ); +/* always show one framebuffer only */ +writel (fb_info->fb_dev->map_base, fbh->base +HW_LCDIF_NEXT_BUF ); + +return 0 ; +} + +/** +* @param fb_info Framebuffer information +*/ +static void stmfb_enable_controller (struct fb_info *fb_info) +{ +struct imxfb_host *fbh =fb_info_to_imxfb_host (fb_info); +uint32_t reg, last_reg; +unsigned loop, edges; + +pr_debug ("%s called\n" , __func__); + +/* if it was disabled, re-enable the mode again */ + reg =readl (fbh->base +HW_LCDIF_CTRL ); + reg |=CTRL_DOTCLK_MODE ; +writel (reg, fbh->base +HW_LCDIF_CTRL ); + +/* enable the SYNC signals first, then the DMA enginge */ + reg =readl (fbh->base +HW_LCDIF_VDCTRL4 ); + reg |=VDCTRL4_SYNC_SIGNALS_ON ; +writel (reg, fbh->base +HW_LCDIF_VDCTRL4 ); + +/* +* Give the attached LC display or monitor a chance to sync into +* our signals. +* Wait for at least 2 VSYNCs = four VSYNC edges +*/ + edges =4 ; + +while (edges !=0 ) { + loop =800 ; + last_reg =readl (fbh->base +HW_LCDIF_DEBUG0 ) &DEBUG_VSYNC ; +do { + reg =readl (fbh->base +HW_LCDIF_DEBUG0 ) &DEBUG_VSYNC ; +if (reg != last_reg); +break ; + last_reg = reg; + loop--; + }while (loop !=0 ); + edges--; + } + + reg =readl (fbh->base +HW_LCDIF_CTRL ); + reg |=CTRL_RUN ; +writel (reg, fbh->base +HW_LCDIF_CTRL ); +} + +/** +* @param fb_info Framebuffer information +*/ +static void stmfb_disable_controller (struct fb_info *fb_info) +{ +struct imxfb_host *fbh =fb_info_to_imxfb_host (fb_info); +unsigned loop; +uint32_t reg; + +pr_debug ("%s called\n" , __func__); +/* +* Even if we disable the controller here, it will still continue +* until its FIFOs are running out of data +*/ + reg =readl (fbh->base +HW_LCDIF_CTRL ); + reg &= ~CTRL_DOTCLK_MODE ; +writel (reg, fbh->base +HW_LCDIF_CTRL ); + + loop =1000 ; +while (loop) { + reg =readl (fbh->base +HW_LCDIF_CTRL ); +if (!(reg &CTRL_RUN )) +break ; + loop--; + } + + reg =readl (fbh->base +HW_LCDIF_VDCTRL4 ); + reg &= ~VDCTRL4_SYNC_SIGNALS_ON ; +writel (reg, fbh->base +HW_LCDIF_VDCTRL4 ); +} + +/** +* Print some information about the current hardware state +* @param hw_dev STM video device +*/ +static void stmfb_info (struct device_d *hw_dev) +{ +uint32_t reg; + +printf (" STM video hardware:\n" ); +printf (" Pixel clock: %u kHz\n" ,imx_get_lcdifclk ()); + + reg =readl (hw_dev->map_base +HW_LCDIF_CTRL ); +switch (GET_WORD_LENGTH (reg)) { +case 0 :
drivers/video/stm.c line 483
Quoted 10 lines
drivers/video/stm.c new file +10
-0+printf (" 16 bpp mode with %s colour scheme\n" , reg &CTRL_DF16 ?"RGB565" :"ARGB1555" ); +switch (GET_BYTE_PACKAGING (readl (hw_dev->map_base +HW_LCDIF_CTRL1 ))) { +case 0xf : +printf (" One pixel per halfword\n" ); +break ; +case 0x3 : +printf (" One pixel per word\n" ); +break ; +default : +printf ("Unknown pixel packaging: %u\n" ,GET_BYTE_PACKAGING (readl (hw_dev->map_base +HW_LCDIF_CTRL1 )));
Care to spend a line break?
Quoted 7 lines
drivers/video/stm.c new file +7
-0+ } +break ; +case 1 : +case 2 : +printf ("Unsupported bpp mode yet!\n" ); +break ; +case 3 :
drivers/video/stm.c line 500
Quoted 10 lines
drivers/video/stm.c new file +10
-0+printf (" 24 bpp mode with %s colour scheme\n" , reg &CTRL_DF24 ?"RGB888" :"RGB666" ); +switch (GET_BYTE_PACKAGING (readl (hw_dev->map_base +HW_LCDIF_CTRL1 ))) { +case 0x7 : +printf (" One pixel per word (xRGB xRGB xRGB ...)\n" ); +break ; +case 0xf : +printf ("Packed pixel format per word (RGBR GBRG BRGB ...)\n" ); +break ; +default : +printf ("Unknown pixel packaging: %u\n" ,GET_BYTE_PACKAGING (readl (hw_dev->map_base +HW_LCDIF_CTRL1 )));
ditto
Quoted 13 lines
drivers/video/stm.c new file +13
-0+ } +break ; + } +} + +/* +* There is only one video hardware instance available. +* It makes no sense to dynamically allocate this data +*/ +static struct imxfb_host host_data = { + .fb_data.fb_mode = stmfb_initialize_mode, + .fb_data.fb_enable = stmfb_enable_controller, + .fb_data.fb_disable = stmfb_disable_controller,
drivers/video/stm.c line 523
Quoted 10 lines
drivers/video/stm.c new file +10
-0+ .fb_data.bits_per_pixel = 16, +}; + +static int stmfb_probe (struct device_d *hw_dev) +{ +struct imx_fb_videomode *pdata = hw_dev->platform_data; +struct device_d *fb_dev; + +if (pdata ==NULL ) { +pr_debug ("STMFB: No platformdata. Giving up\n" );
We also have dev_dbg and friends for this.
Quoted 42 lines
drivers/video/stm.c new file +33
-0+return -ENODEV ; + } + +/* 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_count; + + fb_dev =register_framebuffer (&host_data.fb_data, pdata->framebuffer, pdata->size); +if (fb_dev ==NULL ) { +pr_err ("STMFB: Failed to register framebuffer\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static struct driver_d stmfb_driver = { + .name ="stmfb" , + .probe = stmfb_probe, + .info = stmfb_info, +}; + +static int stmfb_init (void ) +{ +return register_driver (&stmfb_driver); +} + +device_initcall (stmfb_init); +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 01/11] imx: Separate framebuffer platformdata and the videomode
In reply to Sascha HauerQuoted 56 lines · Sascha Hauer
Quoted 55 lines · Juergen Beisert
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).
Signed-off-by Juergen Beisert <[email protected]>--- 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(-)(quoted diff) +0
-0
b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.cindex 805ffe2..032897a 100644arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +14
-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 , - },
Quoted 8 lines
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c static struct device_d nand_dev = { · line 141
Quoted 4 lines
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +1
-0+ .mode = &cmo_display, .pcr = 0xCAD08B80, .bpp = 16, };What are we going to do about the .pcr value? It is display specific. Look for example in
pcm970-baseboard.cin the kernel. It has two different possible displays with two different pcr values.
I will take a closer look what the meaning of this pcr value is. Maybe we can create it at runtime from other flags given in the imx_fb_videomode.
Otherwise we could add a private pointer to the imx_fb_videomode structure, which can point to platform and videomode specific data in a generic way.
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
Re: [PATCH 03/11] Bring in dynamic videomode selection at runtime
In reply to Sascha HauerQuoted 48 lines · Sascha Hauer
Quoted 47 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 of m" should be merged, prior the final commit into the repository.
This step brings in the required functions for dynamic videomode selection at runtime, but keep the old functions untouched (the new ones are commented out).
This is patch 1 of 7 to keep the repository bisectable.
Signed-off-by Juergen Beisert <[email protected]>--- drivers/video/Kconfig | 23 +++++ drivers/video/fb.c | 251 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fb.h | 40 ++++++++ 3 files changed, 314 insertions(+), 0 deletions(-)drivers/video/Kconfig +9
-0@@ -5,6 +5,29 @@ menuconfig VIDEO if VIDEO +comment "runtime options" + +config VIDEO_DELAY_ENABLING + bool "Delayed enabling" + help + Say 'y' here to delay enabling video output. This is useful to first + fill the framebuffer (splash screen for example) prior enabling the + video device. + This entry adds the "enable" parameter to the video device, toenable + or disable video output at runtime.
drivers/video/Kconfig +6
-0+ +config VIDEO_DELAY_INIT + bool "Delayed initialization" + select VIDEO_DELAY_ENABLING + help + If the platform supports more than one video mode say 'y' her to
Quoted 8 lines
Quoted 4 lines
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.I think the framebuffers should *never* be activated by the setup code and should be explicitely initialized by doing a 'fb0.enable=1' on the command line.
Okay. It "should not" is a new policy to barebox. Currently the framebuffer is activated immediately (except the platforms you changed already). I just wanted to keep this behaviour.
Quoted 7 lines
This way we have the most flexibility. We can enable
the framebuffer when we actually need it, we can draw a splash screen before enabling it so that we do not have a black screen before we draw an image. Also, the environment can decide to leave the framebuffer disabled because the kernel will draw another screen a second later. If necessary, the environemt can do a fb0.display="sharp-whatever" before activating it. And we do not need any kconfig options for this.
Okay. We can change the default behaviour for all platforms using graphic in this way. I will try to include it in the next series.
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
Re: [PATCH 07/11] Adapt the existing imx-ipu fb driver to support runtime videomode selection
In reply to Sascha HauerQuoted 6 lines · Sascha Hauer
Quoted 3 lines · Juergen Beisert
Adapt 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.
This conflicts with the ipu fb patch I posted today.
I see. I generated this list on to of barebox-next. Next try...
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
Re: [PATCH 08/11] Add a video driver for S3C2440 bases platforms
In reply to Sascha HauerQuoted 14 lines · Sascha Hauer
Quoted 13 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 | 454 +++++++++++++++++++++++++++++++ 4 files changed, 501 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s3c24xx/include/mach/fb.h create mode 100644 drivers/video/s3c.c
Quoted 16 lines
Quoted 13 lines
drivers/video/s3c.c new file +8
-0+ +/** +* 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 +* +* FIXME Diese Routine darf die Pinx nach drau?en nicht aktivieren. Zur Quoted 1 line
Zeit macht sie das!
You should at least translate this to english ;)
Sure, I already removed this sentence in my local patch stack... :-)
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
Re: [PATCH 09/11] STM378x: Add video driver for this platform
In reply to Sascha HauerQuoted 9 lines · Sascha Hauer
Review
Quoted 6 lines · Juergen Beisert
As there is currently no user of this driver (but coming soon) it is for reference only.
[...]
(quoted diff) +2
-0+ default: + printf("Unknown pixel packaging: %u\n", GET_BYTE_PACKAGING(readl(hw_dev->map_base + HW_LCDIF_CTRL1)));Care to spend a line break?
I like long lines... ;-)
Yes, I will add a line break the next time.
Quoted 10 lines
drivers/video/stm.c line 523
Quoted 8 lines
[...]
drivers/video/stm.c new file +7
-0+static int stmfb_probe (struct device_d *hw_dev) +{ +struct imx_fb_videomode *pdata = hw_dev->platform_data; +struct device_d *fb_dev; + +if (pdata ==NULL ) { +pr_debug ("STMFB: No platformdata. Giving up\n" );We also have
dev_dbgand friends for this.
Yes.
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