From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] video: simplefb
Date: Sat, 24 Jun 2017 19:05:21 -0400 [thread overview]
Message-ID: <20170624230523.2327-4-robdclark@gmail.com> (raw)
In-Reply-To: <20170624230523.2327-1-robdclark@gmail.com>
Not really qcom specific, but for now qcom/lk is the one firmware that
is (afaiu) setting up the appropriate dt node for pre-configured
display. Uses the generic simple-framebuffer DT bindings so this should
be useful on other platforms.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
drivers/video/Kconfig | 10 +++++++
drivers/video/Makefile | 2 +-
drivers/video/simplefb.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 79 insertions(+), 1 deletion(-)
create mode 100644 drivers/video/simplefb.c
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 61dfed8..8eb0359 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -628,4 +628,14 @@ config VIDEO_DW_HDMI
rather requires a SoC-specific glue driver to call it), it
can not be enabled from the configuration menu.
+config VIDEO_SIMPLE
+ bool "Simple display driver for preconfigured display"
+ help
+ Enables a simple generic display driver which utilizes the
+ simple-framebuffer devicetree bindings.
+
+ This driver assumes that the display hardware has been initialized
+ before u-boot starts, and u-boot will simply render to the pre-
+ allocated frame buffer surface.
+
endmenu
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ac5371f..52f50f6 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_FORMIKE) += formike.o
obj-$(CONFIG_LG4573) += lg4573.o
obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
-
+obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
obj-${CONFIG_EXYNOS_FB} += exynos/
obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
new file mode 100644
index 0000000..7c3e8e5
--- /dev/null
+++ b/drivers/video/simplefb.c
@@ -0,0 +1,68 @@
+/*
+ * (C) Copyright 2017 Rob Clark
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <fdt_support.h>
+#include <video.h>
+
+static int simple_video_probe(struct udevice *dev)
+{
+ struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+ struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+ const void *blob = gd->fdt_blob;
+ const int node = dev_of_offset(dev);
+ const char *format;
+ fdt_addr_t base, size;
+
+ if (fdtdec_decode_region(blob, node, "reg", &base, &size)) {
+ debug("%s: Failed to decode memory region\n", __func__);
+ return -EINVAL;
+ }
+
+ debug("%s: base=%llx, size=%llu\n", __func__, base, size);
+
+ // TODO is there some way to reserve the framebuffer
+ // region so it isn't clobbered?
+ plat->base = base;
+ plat->size = size;
+
+ video_set_flush_dcache(dev, true);
+
+ debug("%s: Query resolution...\n", __func__);
+
+ uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
+ uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
+ uc_priv->rot = 0;
+
+ format = fdt_getprop(blob, node, "format", NULL);
+ debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format);
+
+ if (strcmp(format, "r5g6b5") == 0) {
+ uc_priv->bpix = VIDEO_BPP16;
+ } else if (strcmp(format, "a8b8g8r8") == 0) {
+ uc_priv->bpix = VIDEO_BPP32;
+ } else {
+ printf("%s: invalid format: %s\n", __func__, format);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static const struct udevice_id simple_video_ids[] = {
+ { .compatible = "simple-framebuffer" },
+ { }
+};
+
+U_BOOT_DRIVER(simple_video) = {
+ .name = "simple_video",
+ .id = UCLASS_VIDEO,
+ .of_match = simple_video_ids,
+ .probe = simple_video_probe,
+ .flags = DM_FLAG_PRE_RELOC,
+};
--
2.9.4
next prev parent reply other threads:[~2017-06-24 23:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-24 23:05 [U-Boot] [PATCH 0/5] db410c: updates for grub + gfxterm Rob Clark
2017-06-24 23:05 ` [U-Boot] [PATCH 1/5] board/db410c: use fdt passed from lk Rob Clark
2017-07-07 15:17 ` Tom Rini
2017-06-24 23:05 ` [U-Boot] [PATCH 2/5] dm: core: also parse chosen node Rob Clark
2017-06-24 23:05 ` Rob Clark [this message]
2017-06-24 23:05 ` [U-Boot] [PATCH 4/5] efi_loader: gop: fixes for CONFIG_DM_VIDEO without CONFIG_LCD Rob Clark
2017-07-12 12:52 ` Alexander Graf
2017-07-18 14:00 ` Simon Glass
2017-07-18 14:47 ` Alexander Graf
2017-07-18 14:54 ` Simon Glass
2017-07-18 15:06 ` Alexander Graf
2017-07-18 17:07 ` Tom Rini
2017-07-19 10:02 ` Wenyou.Yang at microchip.com
2017-07-19 16:24 ` Rob Clark
2017-07-21 10:48 ` Simon Glass
2017-07-21 15:58 ` Tom Rini
2017-07-21 17:54 ` Rob Clark
2017-07-21 10:47 ` Rob Clark
2017-06-24 23:05 ` [U-Boot] [PATCH 5/5] configs: db410c: config updates Rob Clark
2017-07-06 12:02 ` [U-Boot] [PATCH 0/5] db410c: updates for grub + gfxterm Mateusz Kulikowski
2017-07-19 16:49 ` Rob Clark
2017-07-19 17:54 ` Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170624230523.2327-4-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox