diff mbox

[U-Boot,v2,09/14] dm: stdio: video: Plumb the video uclass into stdio

Message ID 1453171948-16022-10-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Simon Glass Jan. 19, 2016, 2:52 a.m. UTC
Register video drivers with stdio so that they can be used for text output.
This needs to be done explicitly for now. At some point we should be able to
convert stdio itself to driver model and avoid this step.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---

Changes in v2: None

 common/stdio.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

Simon Glass Jan. 21, 2016, 3:19 p.m. UTC | #1
On 18 January 2016 at 19:52, Simon Glass <sjg@chromium.org> wrote:
> Register video drivers with stdio so that they can be used for text output.
> This needs to be done explicitly for now. At some point we should be able to
> convert stdio itself to driver model and avoid this step.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Anatolij Gustschin <agust@denx.de>
> ---
>
> Changes in v2: None
>
>  common/stdio.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)

Applied to u-boot-dm
diff mbox

Patch

diff --git a/common/stdio.c b/common/stdio.c
index 8311ac7..7252bab 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -281,12 +281,23 @@  int stdio_add_devices(void)
 	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 #endif
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+	struct udevice *vdev;
+
+	for (ret = uclass_first_device(UCLASS_VIDEO, &vdev);
+	     vdev;
+	     ret = uclass_next_device(&vdev))
+		;
+	if (ret)
+		printf("%s: Video device failed (ret=%d)\n", __func__, ret);
+#else
+# if defined(CONFIG_LCD)
 	drv_lcd_init ();
-#endif
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+# endif
+# if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
 	drv_video_init ();
-#endif
+# endif
+#endif /* CONFIG_DM_VIDEO */
 #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
 	drv_keyboard_init ();
 #endif