]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/imx-common/video.c
Merge branch 'master' of git://git.denx.de/u-boot-imx
[karo-tx-uboot.git] / arch / arm / imx-common / video.c
1 /*
2  * SPDX-License-Identifier:     GPL-2.0+
3  */
4
5 #include <common.h>
6 #include <asm/errno.h>
7 #include <asm/imx-common/video.h>
8
9 int board_video_skip(void)
10 {
11         int i;
12         int ret;
13         char const *panel = getenv("panel");
14         if (!panel) {
15                 for (i = 0; i < display_count; i++) {
16                         struct display_info_t const *dev = displays+i;
17                         if (dev->detect && dev->detect(dev)) {
18                                 panel = dev->mode.name;
19                                 printf("auto-detected panel %s\n", panel);
20                                 break;
21                         }
22                 }
23                 if (!panel) {
24                         panel = displays[0].mode.name;
25                         printf("No panel detected: default to %s\n", panel);
26                         i = 0;
27                 }
28         } else {
29                 for (i = 0; i < display_count; i++) {
30                         if (!strcmp(panel, displays[i].mode.name))
31                                 break;
32                 }
33         }
34         if (i < display_count) {
35                 ret = ipuv3_fb_init(&displays[i].mode, 0,
36                                     displays[i].pixfmt);
37                 if (!ret) {
38                         displays[i].enable(displays+i);
39                         printf("Display: %s (%ux%u)\n",
40                                displays[i].mode.name,
41                                displays[i].mode.xres,
42                                displays[i].mode.yres);
43                 } else
44                         printf("LCD %s cannot be configured: %d\n",
45                                displays[i].mode.name, ret);
46         } else {
47                 printf("unsupported panel %s\n", panel);
48                 return -EINVAL;
49         }
50
51         return 0;
52 }
53
54 #ifdef CONFIG_IMX_HDMI
55 #include <asm/arch/mxc_hdmi.h>
56 #include <asm/io.h>
57 int detect_hdmi(struct display_info_t const *dev)
58 {
59         struct hdmi_regs *hdmi  = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
60         return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
61 }
62 #endif