diff options
author | Eric Benard <eric@eukrea.com> | 2014-04-04 19:05:52 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2014-04-15 12:23:56 +0200 |
commit | 93ad66ced3fde36114aa2d521668d2cd2141fee6 (patch) | |
tree | 72367f59125793527f90f4de88d8f0440f4eb5a9 /arch/arm/imx-common/video.c | |
parent | 1b82491ee6ee1e986e5521b33692a00e1f38fe75 (diff) | |
download | u-boot-93ad66ced3fde36114aa2d521668d2cd2141fee6.tar.gz u-boot-93ad66ced3fde36114aa2d521668d2cd2141fee6.tar.xz u-boot-93ad66ced3fde36114aa2d521668d2cd2141fee6.zip |
imx-common: add board_video_skip
this function is shared by several boards and thus can be factorized
Signed-off-by: Eric BĂ©nard <eric@eukrea.com>
Acked-by: Eric Nelson <eric.nelson@boundarydevices.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch/arm/imx-common/video.c')
-rw-r--r-- | arch/arm/imx-common/video.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c new file mode 100644 index 0000000000..098239a716 --- /dev/null +++ b/arch/arm/imx-common/video.c @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <asm/errno.h> +#include <asm/imx-common/video.h> + +extern struct display_info_t const displays[]; +extern size_t display_count; + +int board_video_skip(void) +{ + int i; + int ret; + char const *panel = getenv("panel"); + if (!panel) { + for (i = 0; i < display_count; i++) { + struct display_info_t const *dev = displays+i; + if (dev->detect && dev->detect(dev)) { + panel = dev->mode.name; + printf("auto-detected panel %s\n", panel); + break; + } + } + if (!panel) { + panel = displays[0].mode.name; + printf("No panel detected: default to %s\n", panel); + i = 0; + } + } else { + for (i = 0; i < display_count; i++) { + if (!strcmp(panel, displays[i].mode.name)) + break; + } + } + if (i < display_count) { + ret = ipuv3_fb_init(&displays[i].mode, 0, + displays[i].pixfmt); + if (!ret) { + displays[i].enable(displays+i); + printf("Display: %s (%ux%u)\n", + displays[i].mode.name, + displays[i].mode.xres, + displays[i].mode.yres); + } else + printf("LCD %s cannot be configured: %d\n", + displays[i].mode.name, ret); + } else { + printf("unsupported panel %s\n", panel); + return -EINVAL; + } + + return 0; +} |