sandbox: Support changing the LCD colour depth
authorSimon Glass <sjg@chromium.org>
Mon, 3 Feb 2020 14:36:14 +0000 (07:36 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 6 Feb 2020 02:33:46 +0000 (19:33 -0700)
Add a new device-tree property to control the colour depth. At present we
support 16bpp and 32bpp.

While we are here, update the code to use livetree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
arch/sandbox/dts/sandbox.dtsi
doc/device-tree-bindings/video/sandbox-fb.txt
drivers/video/sandbox_sdl.c

index 7bf144f53265a0be85932f0dfe820355ddc3e128..7cd56c14f289207ebf1de3c46d8aae835b158bd2 100644 (file)
@@ -83,6 +83,7 @@
                compatible = "sandbox,lcd-sdl";
                xres = <1366>;
                yres = <768>;
+               log2-depth = <5>;
        };
 
        leds {
index eb91b30e3f8e5717a855ecfcc74c346b982ed86c..230d25c23bb969ce3cb22f197b31c090ef245249 100644 (file)
@@ -2,7 +2,10 @@ Sandbox LCD
 ===========
 
 This uses the displaymode.txt binding except that only xres and yres are
-required properties.
+required properties. Also an additional optional property is defined:
+
+log2-depth: Log base 2 of the U-Boot display buffer depth (4=16bpp, 5=32bpp).
+       If not provided, a value of 4 is used.
 
 Example:
 
@@ -10,4 +13,5 @@ Example:
                compatible = "sandbox,lcd-sdl";
                xres = <800>;
                yres = <600>;
+               log2-depth = <5>;
        };
index d1272d09181c733575c9a8cb1cbb0cddb3ecdf06..1196e6c671771d849b35b041da71a4ea574412af 100644 (file)
@@ -47,13 +47,11 @@ static int sandbox_sdl_bind(struct udevice *dev)
 {
        struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
        struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
-       const void *blob = gd->fdt_blob;
-       int node = dev_of_offset(dev);
        int ret = 0;
 
-       plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
-       plat->yres = fdtdec_get_int(blob, node, "yres", LCD_MAX_HEIGHT);
-       plat->bpix = VIDEO_BPP16;
+       plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH);
+       plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT);
+       plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16);
        uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8;
        debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);