summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-18 19:52:22 -0700
committerSimon Glass <sjg@chromium.org>2016-01-20 19:10:15 -0700
commitb01c7923e3923680d9389bcd7cf5ad2e5f083e30 (patch)
treed451f873d2293677c04d160c2dfd7cbbda158a70 /common
parent5a54194515caa4f4183dc9086938456612749573 (diff)
downloadu-boot-imx-b01c7923e3923680d9389bcd7cf5ad2e5f083e30.zip
u-boot-imx-b01c7923e3923680d9389bcd7cf5ad2e5f083e30.tar.gz
u-boot-imx-b01c7923e3923680d9389bcd7cf5ad2e5f083e30.tar.bz2
dm: video: Implement the bmp command for driver model
This command can use the bitmap display code in the uclass. This is similar to the code in lcd.c and cfb_console.c. These other copies will go away when all boards are converted to use driver model for video. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bmp.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index f04b7d4..fd5b7db 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -10,7 +10,9 @@
*/
#include <common.h>
+#include <dm.h>
#include <lcd.h>
+#include <mapmem.h>
#include <bmp_layout.h>
#include <command.h>
#include <asm/byteorder.h>
@@ -225,6 +227,9 @@ static int bmp_info(ulong addr)
*/
int bmp_display(ulong addr, int x, int y)
{
+#ifdef CONFIG_DM_VIDEO
+ struct udevice *dev;
+#endif
int ret;
struct bmp_image *bmp = map_sysmem(addr, 0);
void *bmp_alloc_addr = NULL;
@@ -240,7 +245,22 @@ int bmp_display(ulong addr, int x, int y)
}
addr = map_to_sysmem(bmp);
-#if defined(CONFIG_LCD)
+#ifdef CONFIG_DM_VIDEO
+ ret = uclass_first_device(UCLASS_VIDEO, &dev);
+ if (!ret) {
+ if (!dev)
+ ret = -ENODEV;
+ if (!ret) {
+ bool align = false;
+
+# ifdef CONFIG_SPLASH_SCREEN_ALIGN
+ align = true;
+# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+ ret = video_bmp_display(dev, addr, x, y, align);
+ }
+ }
+ return ret ? CMD_RET_FAILURE : 0;
+#elif defined(CONFIG_LCD)
ret = lcd_display_bitmap(addr, x, y);
#elif defined(CONFIG_VIDEO)
ret = video_display_bitmap(addr, x, y);