X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=common%2Flcd_simplefb.c;h=d7e9fc9f65cdd705c0572cd9987d580db6fd4436;hb=9493d05a4156cddac3d257fea9e33c877d4bb10b;hp=8db2adde016f9396b5a7794a2de1453de711c057;hpb=0dac731d1932027f4f813ec7aede35d5e30dec0e;p=oweals%2Fu-boot.git diff --git a/common/lcd_simplefb.c b/common/lcd_simplefb.c index 8db2adde01..d7e9fc9f65 100644 --- a/common/lcd_simplefb.c +++ b/common/lcd_simplefb.c @@ -8,22 +8,54 @@ */ #include +#include #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; static int lcd_dt_simplefb_configure_node(void *blob, int off) { -#if LCD_BPP == LCD_COLOR16 - int vl_col = lcd_get_pixel_width(); - int vl_row = lcd_get_pixel_height(); - return fdt_setup_simplefb_node(blob, off, gd->fb_base, vl_col, vl_row, - vl_col * 2, "r5g6b5"); + int xsize, ysize; + int bpix; /* log2 of bits per pixel */ + const char *name; + ulong fb_base; +#ifdef CONFIG_DM_VIDEO + struct video_uc_platdata *plat; + struct video_priv *uc_priv; + struct udevice *dev; + int ret; + + ret = uclass_first_device_err(UCLASS_VIDEO, &dev); + if (ret) + return ret; + uc_priv = dev_get_uclass_priv(dev); + plat = dev_get_uclass_platdata(dev); + xsize = uc_priv->xsize; + ysize = uc_priv->ysize; + bpix = uc_priv->bpix; + fb_base = plat->base; #else - return -1; + xsize = lcd_get_pixel_width(); + ysize = lcd_get_pixel_height(); + bpix = LCD_BPP; + fb_base = gd->fb_base; #endif + switch (bpix) { + 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)