2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-04-04 17:05:52 +00:00
|
|
|
|
|
|
|
#include <common.h>
|
2019-08-01 15:46:52 +00:00
|
|
|
#include <env.h>
|
2016-09-21 02:28:55 +00:00
|
|
|
#include <linux/errno.h>
|
2017-06-29 08:16:06 +00:00
|
|
|
#include <asm/mach-imx/video.h>
|
2014-04-04 17:05:52 +00:00
|
|
|
|
2019-03-18 22:29:31 +00:00
|
|
|
#ifdef CONFIG_IMX_HDMI
|
|
|
|
#include <asm/arch/mxc_hdmi.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
int detect_hdmi(struct display_info_t const *dev)
|
|
|
|
{
|
|
|
|
struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
|
|
|
|
return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-04-04 17:05:52 +00:00
|
|
|
int board_video_skip(void)
|
|
|
|
{
|
|
|
|
int i;
|
2019-01-04 09:11:05 +00:00
|
|
|
int ret = 0;
|
2017-08-03 18:22:12 +00:00
|
|
|
char const *panel = env_get("panel");
|
2014-11-05 08:55:33 +00:00
|
|
|
|
2014-04-04 17:05:52 +00:00
|
|
|
if (!panel) {
|
|
|
|
for (i = 0; i < display_count; i++) {
|
|
|
|
struct display_info_t const *dev = displays+i;
|
|
|
|
if (dev->detect && dev->detect(dev)) {
|
|
|
|
panel = dev->mode.name;
|
|
|
|
printf("auto-detected panel %s\n", panel);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!panel) {
|
|
|
|
panel = displays[0].mode.name;
|
|
|
|
printf("No panel detected: default to %s\n", panel);
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < display_count; i++) {
|
|
|
|
if (!strcmp(panel, displays[i].mode.name))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 08:55:33 +00:00
|
|
|
|
2014-04-04 17:05:52 +00:00
|
|
|
if (i < display_count) {
|
2016-11-01 14:04:21 +00:00
|
|
|
ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0,
|
2014-04-04 17:05:52 +00:00
|
|
|
displays[i].pixfmt);
|
|
|
|
if (!ret) {
|
2014-11-05 08:55:33 +00:00
|
|
|
if (displays[i].enable)
|
|
|
|
displays[i].enable(displays + i);
|
|
|
|
|
2014-04-04 17:05:52 +00:00
|
|
|
printf("Display: %s (%ux%u)\n",
|
|
|
|
displays[i].mode.name,
|
|
|
|
displays[i].mode.xres,
|
|
|
|
displays[i].mode.yres);
|
2019-03-18 22:29:31 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_IMX_HDMI
|
|
|
|
if (!strcmp(displays[i].mode.name, "HDMI"))
|
|
|
|
imx_enable_hdmi_phy();
|
|
|
|
#endif
|
2014-04-04 17:05:52 +00:00
|
|
|
} else
|
|
|
|
printf("LCD %s cannot be configured: %d\n",
|
|
|
|
displays[i].mode.name, ret);
|
|
|
|
} else {
|
|
|
|
printf("unsupported panel %s\n", panel);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2019-01-04 09:11:05 +00:00
|
|
|
return ret;
|
2014-04-04 17:05:52 +00:00
|
|
|
}
|
2014-04-04 17:05:56 +00:00
|
|
|
|
2019-03-18 22:29:31 +00:00
|
|
|
int ipu_displays_init(void)
|
2014-04-04 17:05:56 +00:00
|
|
|
{
|
2019-03-18 22:29:31 +00:00
|
|
|
return board_video_skip();
|
2014-04-04 17:05:56 +00:00
|
|
|
}
|