blob: 0121cd78f27694629b49f50890642a0500a3d27e [file] [log] [blame]
Eric Benard4c94fa12014-04-04 19:05:52 +02001/*
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
9extern struct display_info_t const displays[];
10extern size_t display_count;
11
12int board_video_skip(void)
13{
14 int i;
15 int ret;
16 char const *panel = getenv("panel");
17 if (!panel) {
18 for (i = 0; i < display_count; i++) {
19 struct display_info_t const *dev = displays+i;
20 if (dev->detect && dev->detect(dev)) {
21 panel = dev->mode.name;
22 printf("auto-detected panel %s\n", panel);
23 break;
24 }
25 }
26 if (!panel) {
27 panel = displays[0].mode.name;
28 printf("No panel detected: default to %s\n", panel);
29 i = 0;
30 }
31 } else {
32 for (i = 0; i < display_count; i++) {
33 if (!strcmp(panel, displays[i].mode.name))
34 break;
35 }
36 }
37 if (i < display_count) {
38 ret = ipuv3_fb_init(&displays[i].mode, 0,
39 displays[i].pixfmt);
40 if (!ret) {
41 displays[i].enable(displays+i);
42 printf("Display: %s (%ux%u)\n",
43 displays[i].mode.name,
44 displays[i].mode.xres,
45 displays[i].mode.yres);
46 } else
47 printf("LCD %s cannot be configured: %d\n",
48 displays[i].mode.name, ret);
49 } else {
50 printf("unsupported panel %s\n", panel);
51 return -EINVAL;
52 }
53
54 return 0;
55}
Eric Benardad0f1d52014-04-04 19:05:56 +020056
57#ifdef CONFIG_IMX_HDMI
58#include <asm/arch/mxc_hdmi.h>
59#include <asm/io.h>
60int detect_hdmi(struct display_info_t const *dev)
61{
62 struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
63 return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
64}
65#endif