blob: b40ce53405ae2af765549cd02c85540199781d61 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Eric Benard93ad66c2014-04-04 19:05:52 +02002
3#include <common.h>
Masahiro Yamada1221ce42016-09-21 11:28:55 +09004#include <linux/errno.h>
Stefano Babic552a8482017-06-29 10:16:06 +02005#include <asm/mach-imx/video.h>
Eric Benard93ad66c2014-04-04 19:05:52 +02006
Eric Benard93ad66c2014-04-04 19:05:52 +02007int board_video_skip(void)
8{
9 int i;
10 int ret;
Simon Glass00caae62017-08-03 12:22:12 -060011 char const *panel = env_get("panel");
Nikolay Dimitrov11076f02014-11-05 10:55:33 +020012
Eric Benard93ad66c2014-04-04 19:05:52 +020013 if (!panel) {
14 for (i = 0; i < display_count; i++) {
15 struct display_info_t const *dev = displays+i;
16 if (dev->detect && dev->detect(dev)) {
17 panel = dev->mode.name;
18 printf("auto-detected panel %s\n", panel);
19 break;
20 }
21 }
22 if (!panel) {
23 panel = displays[0].mode.name;
24 printf("No panel detected: default to %s\n", panel);
25 i = 0;
26 }
27 } else {
28 for (i = 0; i < display_count; i++) {
29 if (!strcmp(panel, displays[i].mode.name))
30 break;
31 }
32 }
Nikolay Dimitrov11076f02014-11-05 10:55:33 +020033
Eric Benard93ad66c2014-04-04 19:05:52 +020034 if (i < display_count) {
Max Krummenacher15fde0f2016-11-01 15:04:21 +010035 ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0,
Eric Benard93ad66c2014-04-04 19:05:52 +020036 displays[i].pixfmt);
37 if (!ret) {
Nikolay Dimitrov11076f02014-11-05 10:55:33 +020038 if (displays[i].enable)
39 displays[i].enable(displays + i);
40
Eric Benard93ad66c2014-04-04 19:05:52 +020041 printf("Display: %s (%ux%u)\n",
42 displays[i].mode.name,
43 displays[i].mode.xres,
44 displays[i].mode.yres);
45 } else
46 printf("LCD %s cannot be configured: %d\n",
47 displays[i].mode.name, ret);
48 } else {
49 printf("unsupported panel %s\n", panel);
50 return -EINVAL;
51 }
52
53 return 0;
54}
Eric Benarde688a992014-04-04 19:05:56 +020055
56#ifdef CONFIG_IMX_HDMI
57#include <asm/arch/mxc_hdmi.h>
58#include <asm/io.h>
59int detect_hdmi(struct display_info_t const *dev)
60{
61 struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
62 return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
63}
64#endif