mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-30 15:03:18 +00:00
e3e2470fdd
When using OF_PLATDATA, the bind process between devices and drivers is performed trying to match compatible string with driver names. However driver names are not strictly defined, and also there are different names used when declaring a driver with U_BOOT_DRIVER, the name of the symbol used in the linker list and the used in the struct driver_info. In order to make things a bit more clear, rename the drivers names. This will also help for further OF_PLATDATA improvements, such as checking for valid driver names. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Add a fix for sandbox of-platdata to avoid using an invalid ANSI colour: Signed-off-by: Simon Glass <sjg@chromium.org>
82 lines
2.2 KiB
C
82 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (c) 2013 Google, Inc
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <fdtdec.h>
|
|
#include <log.h>
|
|
#include <video.h>
|
|
#include <asm/sdl.h>
|
|
#include <asm/state.h>
|
|
#include <asm/u-boot-sandbox.h>
|
|
#include <dm/test.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
enum {
|
|
/* Default LCD size we support */
|
|
LCD_MAX_WIDTH = 1366,
|
|
LCD_MAX_HEIGHT = 768,
|
|
};
|
|
|
|
static int sandbox_sdl_probe(struct udevice *dev)
|
|
{
|
|
struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(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,
|
|
state->double_lcd);
|
|
if (ret) {
|
|
puts("LCD init failed\n");
|
|
return ret;
|
|
}
|
|
uc_priv->xsize = plat->xres;
|
|
uc_priv->ysize = plat->yres;
|
|
uc_priv->bpix = plat->bpix;
|
|
uc_priv->rot = plat->rot;
|
|
uc_priv->vidconsole_drv_name = plat->vidconsole_drv_name;
|
|
uc_priv->font_size = plat->font_size;
|
|
if (IS_ENABLED(CONFIG_VIDEO_COPY))
|
|
uc_plat->copy_base = uc_plat->base - uc_plat->size / 2;
|
|
|
|
return 0;
|
|
}
|
|
|
|
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);
|
|
int ret = 0;
|
|
|
|
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);
|
|
plat->rot = dev_read_u32_default(dev, "rotate", 0);
|
|
uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8;
|
|
|
|
/* Allow space for two buffers, the lower one being the copy buffer */
|
|
log_debug("Frame buffer size %x\n", uc_plat->size);
|
|
if (IS_ENABLED(CONFIG_VIDEO_COPY))
|
|
uc_plat->size *= 2;
|
|
|
|
return ret;
|
|
}
|
|
|
|
static const struct udevice_id sandbox_sdl_ids[] = {
|
|
{ .compatible = "sandbox,lcd-sdl" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(sandbox_lcd_sdl) = {
|
|
.name = "sandbox_lcd_sdl",
|
|
.id = UCLASS_VIDEO,
|
|
.of_match = sandbox_sdl_ids,
|
|
.bind = sandbox_sdl_bind,
|
|
.probe = sandbox_sdl_probe,
|
|
.platdata_auto_alloc_size = sizeof(struct sandbox_sdl_plat),
|
|
};
|