Commit a466db5adb58e486fbd8ae63536b03a70d69f68d

Authored by Simon Glass
1 parent 6be88c7282

sandbox: Support changing the LCD colour depth

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>

Showing 3 changed files with 9 additions and 6 deletions Side-by-side Diff

arch/sandbox/dts/sandbox.dtsi
... ... @@ -83,6 +83,7 @@
83 83 compatible = "sandbox,lcd-sdl";
84 84 xres = <1366>;
85 85 yres = <768>;
  86 + log2-depth = <5>;
86 87 };
87 88  
88 89 leds {
doc/device-tree-bindings/video/sandbox-fb.txt
... ... @@ -2,13 +2,17 @@
2 2 ===========
3 3  
4 4 This uses the displaymode.txt binding except that only xres and yres are
5   -required properties.
  5 +required properties. Also an additional optional property is defined:
6 6  
  7 +log2-depth: Log base 2 of the U-Boot display buffer depth (4=16bpp, 5=32bpp).
  8 + If not provided, a value of 4 is used.
  9 +
7 10 Example:
8 11  
9 12 lcd {
10 13 compatible = "sandbox,lcd-sdl";
11 14 xres = <800>;
12 15 yres = <600>;
  16 + log2-depth = <5>;
13 17 };
drivers/video/sandbox_sdl.c
... ... @@ -47,13 +47,11 @@
47 47 {
48 48 struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
49 49 struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
50   - const void *blob = gd->fdt_blob;
51   - int node = dev_of_offset(dev);
52 50 int ret = 0;
53 51  
54   - plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
55   - plat->yres = fdtdec_get_int(blob, node, "yres", LCD_MAX_HEIGHT);
56   - plat->bpix = VIDEO_BPP16;
  52 + plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH);
  53 + plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT);
  54 + plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16);
57 55 uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8;
58 56 debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
59 57