Re: [U-Boot] [PATCH v2 1/3] Add flexibility to mx51 video support

2010-11-03 Thread Stefano Babic
On 11/03/2010 03:56 AM, Renato Frias wrote:
 From: Renato Frias renato.fr...@freescale.com
 
 -int mx51_fb_init(struct fb_videomode *mode)
 +int mx51_fb_init(struct fb_videomode *mode, u32 ipu_di, u32 bppix)
  {
   int ret;
 + uint32_t pixfmt = 0;
  
   ret = ipu_probe();
   if (ret)
 @@ -635,8 +635,23 @@ int mx51_fb_init(struct fb_videomode *mode)
  
   lcd_base += 56;
  
 + switch (bppix) {
 + case 32:
 + pixfmt = IPU_PIX_FMT_BGR32;
 + break;
 + case 24:
 + pixfmt = IPU_PIX_FMT_BGR24;
 + break;
 + case 18:
 + pixfmt = IPU_PIX_FMT_RGB666;
 + break;
 + case 16:
 + pixfmt = IPU_PIX_FMT_RGB565;
 + break;
 + }
 +

This is a code duplication of bpp_to_pixfmt() in the same file, adding
only an additional case. If you prefer to have a function passing an
integer as a fb_info structure, rearrange both functions to factorize
code and avoid duplications.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/3] Add flexibility to mx51 video support

2010-11-02 Thread Renato Frias
From: Renato Frias renato.fr...@freescale.com

This patch adds flexibility to mxc_ipuv3_fb.c by allowing the display
interface and pixel format to be passed to mx51_fb_init.

Signed-off-by: Renato Frias renato.fr...@freescale.com
---
Changes for v2:
- Removed fix.id string
- Removed NBITS calculation from debug message

 drivers/video/mxc_ipuv3_fb.c |   25 -
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c
index a66981c..b660d22 100644
--- a/drivers/video/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc_ipuv3_fb.c
@@ -526,7 +526,7 @@ static struct fb_info *mxcfb_init_fbinfo(void)
  *
  * @return  Appropriate error code to the kernel common code
  */
-static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode)
+static int mxcfb_probe(u32 interface_pix_fmt, struct fb_videomode *mode, u32 
ipu_di)
 {
struct fb_info *fbi;
struct mxcfb_info *mxcfbi;
@@ -550,11 +550,10 @@ static int mxcfb_probe(u32 interface_pix_fmt, struct 
fb_videomode *mode)
mxcfbi-blank = FB_BLANK_POWERDOWN;
}
 
-   mxcfbi-ipu_di = 0;
+   mxcfbi-ipu_di = ipu_di;
 
ipu_disp_set_global_alpha(mxcfbi-ipu_ch, 1, 0x80);
ipu_disp_set_color_key(mxcfbi-ipu_ch, 0, 0);
-   strcpy(fbi-fix.id, DISP3 BG);
 
g_dp_in_use = 1;
 
@@ -625,9 +624,10 @@ void lcd_ctrl_init(void *lcdbase)
memset(lcdbase, 0, mem_len);
 }
 
-int mx51_fb_init(struct fb_videomode *mode)
+int mx51_fb_init(struct fb_videomode *mode, u32 ipu_di, u32 bppix)
 {
int ret;
+   uint32_t pixfmt = 0;
 
ret = ipu_probe();
if (ret)
@@ -635,8 +635,23 @@ int mx51_fb_init(struct fb_videomode *mode)
 
lcd_base += 56;
 
+   switch (bppix) {
+   case 32:
+   pixfmt = IPU_PIX_FMT_BGR32;
+   break;
+   case 24:
+   pixfmt = IPU_PIX_FMT_BGR24;
+   break;
+   case 18:
+   pixfmt = IPU_PIX_FMT_RGB666;
+   break;
+   case 16:
+   pixfmt = IPU_PIX_FMT_RGB565;
+   break;
+   }
+
debug(Framebuffer at 0x%x\n, (unsigned int)lcd_base);
-   ret = mxcfb_probe(IPU_PIX_FMT_RGB666, mode);
+   ret = mxcfb_probe(pixfmt, mode, ipu_di);
 
return ret;
 }
-- 
1.6.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot