Merge git://git.denx.de/u-boot-usb
[oweals/u-boot.git] / drivers / video / sandbox_sdl.c
index 18afe2f3fd356b557175e3266bac8f696b2daec7..1196e6c671771d849b35b041da71a4ea574412af 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2013 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -9,6 +8,7 @@
 #include <fdtdec.h>
 #include <video.h>
 #include <asm/sdl.h>
+#include <asm/state.h>
 #include <asm/u-boot-sandbox.h>
 #include <dm/test.h>
 
@@ -24,9 +24,11 @@ static int sandbox_sdl_probe(struct udevice *dev)
 {
        struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
        struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+       struct sandbox_state *state = state_get_current();
        int ret;
 
-       ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix);
+       ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix,
+                                      state->double_lcd);
        if (ret) {
                puts("LCD init failed\n");
                return ret;
@@ -45,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);