1 // SPDX-License-Identifier: GPL-2.0+ 2 3 #include <common.h> 4 #include <linux/errno.h> 5 #include <asm/mach-imx/video.h> 6 7 int board_video_skip(void) 8 { 9 int i; 10 int ret; 11 char const *panel = env_get("panel"); 12 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 } 33 34 if (i < display_count) { 35 ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0, 36 displays[i].pixfmt); 37 if (!ret) { 38 if (displays[i].enable) 39 displays[i].enable(displays + i); 40 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 } 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 65