2 * Copyright (c) 2013 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/u-boot-sandbox.h>
15 DECLARE_GLOBAL_DATA_PTR
;
18 /* Default LCD size we support */
23 static int sandbox_sdl_probe(struct udevice
*dev
)
25 struct sandbox_sdl_plat
*plat
= dev_get_platdata(dev
);
26 struct video_priv
*uc_priv
= dev_get_uclass_priv(dev
);
29 ret
= sandbox_sdl_init_display(plat
->xres
, plat
->yres
, plat
->bpix
);
31 puts("LCD init failed\n");
34 uc_priv
->xsize
= plat
->xres
;
35 uc_priv
->ysize
= plat
->yres
;
36 uc_priv
->bpix
= plat
->bpix
;
37 uc_priv
->rot
= plat
->rot
;
42 static int sandbox_sdl_bind(struct udevice
*dev
)
44 struct video_uc_platdata
*uc_plat
= dev_get_uclass_platdata(dev
);
45 struct sandbox_sdl_plat
*plat
= dev_get_platdata(dev
);
46 const void *blob
= gd
->fdt_blob
;
47 int node
= dev
->of_offset
;
50 plat
->xres
= fdtdec_get_int(blob
, node
, "xres", LCD_MAX_WIDTH
);
51 plat
->yres
= fdtdec_get_int(blob
, node
, "yres", LCD_MAX_HEIGHT
);
52 plat
->bpix
= VIDEO_BPP16
;
53 uc_plat
->size
= plat
->xres
* plat
->yres
* (1 << plat
->bpix
) / 8;
54 debug("%s: Frame buffer size %x\n", __func__
, uc_plat
->size
);
59 static const struct udevice_id sandbox_sdl_ids
[] = {
60 { .compatible
= "sandbox,lcd-sdl" },
64 U_BOOT_DRIVER(sdl_sandbox
) = {
65 .name
= "sdl_sandbox",
67 .of_match
= sandbox_sdl_ids
,
68 .bind
= sandbox_sdl_bind
,
69 .probe
= sandbox_sdl_probe
,
70 .platdata_auto_alloc_size
= sizeof(struct sandbox_sdl_plat
),