1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 00:32:04 +02:00

dm: video: Refactor lcd_simplefb to prepare for driver model

Adjust this function so that we can convert it to support CONFIG_DM_VIDEO
without a lot of code duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
Simon Glass
2017-04-05 16:23:42 -06:00
committed by Tom Rini
parent 7cac2fced7
commit 452614556c

View File

@@ -16,17 +16,28 @@ DECLARE_GLOBAL_DATA_PTR;
static int lcd_dt_simplefb_configure_node(void *blob, int off) static int lcd_dt_simplefb_configure_node(void *blob, int off)
{ {
int vl_col = lcd_get_pixel_width(); int xsize, ysize;
int vl_row = lcd_get_pixel_height(); int bpix; /* log2 of bits per pixel */
#if LCD_BPP == LCD_COLOR16 const char *name;
return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row, ulong fb_base;
vl_col * 2, "r5g6b5");
#elif LCD_BPP == LCD_COLOR32 xsize = lcd_get_pixel_width();
return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row, ysize = lcd_get_pixel_height();
vl_col * 4, "a8r8g8b8"); bpix = LCD_BPP;
#else fb_base = gd->fb_base;
return -1; switch (bpix) {
#endif case 4: /* VIDEO_BPP16 */
name = "r5g6b5";
break;
case 5: /* VIDEO_BPP32 */
name = "a8r8g8b8";
break;
default:
return -EINVAL;
}
return fdt_setup_simplefb_node(blob, off, fb_base, xsize, ysize,
xsize * (1 << bpix) / 8, name);
} }
int lcd_dt_simplefb_add_node(void *blob) int lcd_dt_simplefb_add_node(void *blob)