Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: GPL-2.0+ |
| 3 | */ |
| 4 | |
| 5 | #include <common.h> |
Masahiro Yamada | 56a931c | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 6 | #include <linux/errno.h> |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 7 | #include <asm/imx-common/video.h> |
| 8 | |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 9 | int board_video_skip(void) |
| 10 | { |
| 11 | int i; |
| 12 | int ret; |
| 13 | char const *panel = getenv("panel"); |
Nikolay Dimitrov | 84c6af8 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 14 | |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 15 | if (!panel) { |
| 16 | for (i = 0; i < display_count; i++) { |
| 17 | struct display_info_t const *dev = displays+i; |
| 18 | if (dev->detect && dev->detect(dev)) { |
| 19 | panel = dev->mode.name; |
| 20 | printf("auto-detected panel %s\n", panel); |
| 21 | break; |
| 22 | } |
| 23 | } |
| 24 | if (!panel) { |
| 25 | panel = displays[0].mode.name; |
| 26 | printf("No panel detected: default to %s\n", panel); |
| 27 | i = 0; |
| 28 | } |
| 29 | } else { |
| 30 | for (i = 0; i < display_count; i++) { |
| 31 | if (!strcmp(panel, displays[i].mode.name)) |
| 32 | break; |
| 33 | } |
| 34 | } |
Nikolay Dimitrov | 84c6af8 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 35 | |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 36 | if (i < display_count) { |
Max Krummenacher | 27c01b9 | 2016-11-01 15:04:21 +0100 | [diff] [blame] | 37 | ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0, |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 38 | displays[i].pixfmt); |
| 39 | if (!ret) { |
Nikolay Dimitrov | 84c6af8 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 40 | if (displays[i].enable) |
| 41 | displays[i].enable(displays + i); |
| 42 | |
Eric Benard | 4c94fa1 | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 43 | printf("Display: %s (%ux%u)\n", |
| 44 | displays[i].mode.name, |
| 45 | displays[i].mode.xres, |
| 46 | displays[i].mode.yres); |
| 47 | } else |
| 48 | printf("LCD %s cannot be configured: %d\n", |
| 49 | displays[i].mode.name, ret); |
| 50 | } else { |
| 51 | printf("unsupported panel %s\n", panel); |
| 52 | return -EINVAL; |
| 53 | } |
| 54 | |
| 55 | return 0; |
| 56 | } |
Eric Benard | ad0f1d5 | 2014-04-04 19:05:56 +0200 | [diff] [blame] | 57 | |
| 58 | #ifdef CONFIG_IMX_HDMI |
| 59 | #include <asm/arch/mxc_hdmi.h> |
| 60 | #include <asm/io.h> |
| 61 | int detect_hdmi(struct display_info_t const *dev) |
| 62 | { |
| 63 | struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR; |
| 64 | return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT; |
| 65 | } |
| 66 | #endif |