From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Wed, 03 Nov 2010 12:30:39 +0100 Subject: [U-Boot] [PATCH v2 1/3] Add flexibility to mx51 video support In-Reply-To: <1288752995-31121-1-git-send-email-renato.frias@gmail.com> References: <1288752995-31121-1-git-send-email-renato.frias@gmail.com> Message-ID: <4CD147DF.609@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/03/2010 03:56 AM, Renato Frias wrote: > From: Renato Frias > > -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: office at denx.de =====================================================================