dm: video: Add a uclass for the text console
The existing LCD/video interface suffers from conflating the bitmap display
with text output on that display. As a result the implementation is more
complex than it needs to me.
We can support multiple text console drivers. Create a separate uclass to
support this, with its own API.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 1615889..63d0d9d 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -189,6 +189,27 @@
#endif
video_clear(dev);
+ /*
+ * Create a text console devices. For now we always do this, although
+ * it might be useful to support only bitmap drawing on the device
+ * for boards that don't need to display text.
+ */
+ snprintf(name, sizeof(name), "%s.vidconsole", dev->name);
+ str = strdup(name);
+ if (!str)
+ return -ENOMEM;
+ snprintf(drv, sizeof(drv), "vidconsole%d", priv->rot);
+ ret = device_bind_driver(dev, drv, str, &cons);
+ if (ret) {
+ debug("%s: Cannot bind console driver\n", __func__);
+ return ret;
+ }
+ ret = device_probe(cons);
+ if (ret) {
+ debug("%s: Cannot probe console driver\n", __func__);
+ return ret;
+ }
+
return 0;
};