1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Google, Inc
12 #include <asm/state.h>
13 #include <asm/u-boot-sandbox.h>
16 DECLARE_GLOBAL_DATA_PTR;
19 /* Default LCD size we support */
24 static int sandbox_sdl_probe(struct udevice *dev)
26 struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
27 struct video_priv *uc_priv = dev_get_uclass_priv(dev);
28 struct sandbox_state *state = state_get_current();
31 ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix,
34 puts("LCD init failed\n");
37 uc_priv->xsize = plat->xres;
38 uc_priv->ysize = plat->yres;
39 uc_priv->bpix = plat->bpix;
40 uc_priv->rot = plat->rot;
41 uc_priv->vidconsole_drv_name = plat->vidconsole_drv_name;
42 uc_priv->font_size = plat->font_size;
47 static int sandbox_sdl_bind(struct udevice *dev)
49 struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
50 struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
53 plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH);
54 plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT);
55 plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16);
56 uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8;
57 debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
62 static const struct udevice_id sandbox_sdl_ids[] = {
63 { .compatible = "sandbox,lcd-sdl" },
67 U_BOOT_DRIVER(sdl_sandbox) = {
68 .name = "sdl_sandbox",
70 .of_match = sandbox_sdl_ids,
71 .bind = sandbox_sdl_bind,
72 .probe = sandbox_sdl_probe,
73 .platdata_auto_alloc_size = sizeof(struct sandbox_sdl_plat),