Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 2 | |
| 3 | #include <common.h> |
Masahiro Yamada | 1221ce4 | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 4 | #include <linux/errno.h> |
Stefano Babic | 552a848 | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 5 | #include <asm/mach-imx/video.h> |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 6 | |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 7 | int board_video_skip(void) |
| 8 | { |
| 9 | int i; |
| 10 | int ret; |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 11 | char const *panel = env_get("panel"); |
Nikolay Dimitrov | 11076f0 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 12 | |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 13 | 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 Dimitrov | 11076f0 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 33 | |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 34 | if (i < display_count) { |
Max Krummenacher | 15fde0f | 2016-11-01 15:04:21 +0100 | [diff] [blame] | 35 | ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0, |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 36 | displays[i].pixfmt); |
| 37 | if (!ret) { |
Nikolay Dimitrov | 11076f0 | 2014-11-05 10:55:33 +0200 | [diff] [blame] | 38 | if (displays[i].enable) |
| 39 | displays[i].enable(displays + i); |
| 40 | |
Eric Benard | 93ad66c | 2014-04-04 19:05:52 +0200 | [diff] [blame] | 41 | 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 Benard | e688a99 | 2014-04-04 19:05:56 +0200 | [diff] [blame] | 55 | |
| 56 | #ifdef CONFIG_IMX_HDMI |
| 57 | #include <asm/arch/mxc_hdmi.h> |
| 58 | #include <asm/io.h> |
| 59 | int 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 |