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

Stefano Babic sbabic at denx.de
Wed Nov 3 12:30:39 CET 2010


On 11/03/2010 03:56 AM, Renato Frias wrote:
> From: Renato Frias <renato.frias at 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: office at denx.de
=====================================================================


More information about the U-Boot mailing list