OKMX8MM-C开发板只有一个MIPI DSI显示接口,这个接口除了可以连接MIPI显示屏,还可以通过MIPI转LVDS模块,连接LVDS显示屏或HDMI显示屏。
其中MIPI显示屏还分为需要配置和不需要配置的。
MIPI接口的显示屏分为需要DSI进入命令模式配置后才能显示的MIPI屏和不需要配置的MIPI屏。不需要配置的MIPI屏比较简单,只要MIPI DSI接口正常输出信号就能正常显示,飞凌嵌入式OKMX8MM-C开发板提供的1024x600分辨率的7寸MIPI屏就是一块不需要配置的MIPI屏,它默认就工作在4lanes高速模式下,只需要将CPU内的显示相关的模块配置好,并让其开始工作,MIPI屏就能够正常显示。
需要配置的MIPI屏,DSI接口在输出显示信号前需要进入命令模式对显示屏进行配置,配置参数一般由屏体厂家提供。NXP i.MX8MM 评估套件使用的OLED屏RM67191,就是一款需要配置的MIPI显示屏。
这个模块能将MIPI信号转换为LVDS或HDMI信号,通过这个模块可以连接LVDS显示屏或者HDMI显示屏。MIPI转LVDS&HDMI模块需要通过I2C配置转接,将包含对应的显示屏的显示参数等信息配置到芯片内,然后MIPI接口输出对应的显示信号。
1024x600的7寸屏(MIPI7);
自定义7MIPI显示(MIPICUSTOM);
MIPI转HDMI的1920x1080 (MIPI2HDMI1920x1080);
1280x720 (MIPI2HDMI1280x720);
640x480 (MIPI2HDMI640x480);
10.1寸1280x800LVDS显示屏(MIPI2HDMI1280x800);
自定义MIPI转LVDS(MIPI2HDMICUSTOM)。
structdisplay_info_tconst displays[] = {
{
.bus = LCDIF_BASE_ADDR,
.addr = 0,
.pixfmt = 24,
.detect = NULL,
.enable = do_enable_mipi_led,
.mode = {
.name = "MIPI7",
.refresh = 60,
.xres = 1024,
.yres = 600,
.pixclock = 22733, /* 43987200 */
.left_margin = 48,
.right_margin = 40,
.upper_margin = 16,
.lower_margin = 13,
.hsync_len = 48,
.vsync_len = 3,
.sync = FB_SYNC_EXT,
.vmode = FB_VMODE_NONINTERLACED
}
},
...
{
.bus = LCDIF_BASE_ADDR,
.addr = 0,
.pixfmt = 24,
.detect = NULL,
.enable = do_enable_mipi2hdmi,
.mode = {
.name = "MIPI2HDMI_1280x720",
.refresh = 60,
.xres = 1280,
.yres = 720,
.pixclock = 13468, //74250000
.left_margin = 220,
.right_margin = 110,
.upper_margin = 20,
.lower_margin = 5,
.hsync_len = 40,
.vsync_len = 5,
.sync = FB_SYNC_EXT,
.vmode = FB_VMODE_NONINTERLACED
}
},
...
}
int board_video_skip(void)
{
int i;
int ret = 0;
charconst*panel = env_get("panel");
if(!panel) {
...
} else{
for(i = 0; i < display_count; i++) {
if(!strcmp(panel, displays[i].mode.name))
break;
}
}
if(i < display_count) {
if(!strcmp(panel, "MIPI_CUSTOM") || !strcmp(panel, "MIPI2HDMI_CUSTOM")) {
charconst* options = env_get("custom_video_mode");
char*opt = strdup(options);
get_mode_frome_env(&displays[i], opt);
}
...
staticvoid get_mode_frome_env(structdisplay_info_t*dev, char*options)
{
char*opt;
while((opt = strsep(&options, ",")) != NULL) {
if(!*opt)
continue;
if(!strncmp(opt, "xres=", 5)) {
dev->mode.xres = simple_strtoul(opt + 5, NULL, 0);
} elseif(!strncmp(opt, "yres=", 5)) {
dev->mode.yres = simple_strtoul(opt + 5, NULL, 0);
} elseif(!strncmp(opt, "pixclock=", 9)) {
dev->mode.pixclock = simple_strtoul(opt + 9, NULL, 0);
} elseif(!strncmp(opt, "left_margin=", 12)) {
dev->mode.left_margin = simple_strtoul(opt + 12, NULL, 0);
} elseif(!strncmp(opt, "right_margin=", 13)) {
dev->mode.right_margin = simple_strtoul(opt + 13, NULL, 0);
} elseif(!strncmp(opt, "upper_margin=", 13)) {
dev->mode.upper_margin = simple_strtoul(opt + 13, NULL, 0);
} elseif(!strncmp(opt, "lower_margin=", 13)) {
dev->mode.lower_margin = simple_strtoul(opt + 13, NULL, 0);
} elseif(!strncmp(opt, "hsync_len=", 10)) {
dev->mode.hsync_len = simple_strtoul(opt + 10, NULL, 0);
} elseif(!strncmp(opt, "vsync_len=", 10)) {
dev->mode.vsync_len = simple_strtoul(opt + 10, NULL, 0);
} elseif(!strncmp(opt, "sync=", 5)) {
dev->mode.sync = simple_strtoul(opt + 5, NULL, 0);
} elseif(!strncmp(opt, "vmode=", 6)) {
dev->mode.vmode = simple_strtoul(opt + 6, NULL, 0);
} elseif(!strncmp(opt, "refresh=", 8)) {
dev->mode.refresh = simple_strtoul(opt + 8, NULL, 0);
}
}
printf("use custom mode %s: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %08X, %08X \n ", \
dev->mode.name,dev->mode.refresh, dev->mode.xres, dev->mode.yres, dev->mode.pixclock, \
dev->mode.left_margin, dev->mode.right_margin, dev->mode.upper_margin, dev->mode.lower_margin, \
dev->mode.hsync_len, dev->mode.vsync_len, dev->mode.sync, dev->mode.vmode);
}
MIPI转LVDS和HDMI模块,能够正常显示的条件是:
...
u-boot=> setenv panel MIPI2HDMI_CUSTOM
u-boot=> setenv custom_video_mode xres=1024,yres=768
u-boot=> sa
SavingEnvironment to MMC... Writing to MMC(1)... OK
u-boot=> reset
resetting ...
...
LoadingEnvironment from MMC... OK
use custom mode MIPI2HDMI_CUSTOM: 60, 1024, 768, 12048, 200, 64, 24, 1, 136, 3, 00000004, 00000000
...
...
u-boot=> setenv panel MIPI_CUSTOM
u-boot=> setenv custom_video_mode xres=800,yres=600,pixclock=20000,refresh=55
u-boot=> sa
SavingEnvironment to MMC... Writing to MMC(1)... OK
u-boot=> reset
resetting ...
...
LoadingEnvironment from MMC... OK
use custom mode MIPI_CUSTOM: 55, 800, 600, 20000, 48, 40, 16, 13, 48, 3, 00000004, 00000000
Display: MIPI_CUSTOM (800x600)
Video: 800x600x24
...
这种显示屏对比不需配置的MIPI显示屏多了一步配置,可以参照原厂提供的RM67191进行修改。
首先,添加一组显示参数,显示参数根据显示屏修改,修改文件board/freescale/imx8mmevk/imx8mmevk.c。
{
.bus = LCDIF_BASE_ADDR,
.addr = 0,
.pixfmt = 24,
.detect = NULL,
.enable = do_enable_mipi_led,
.mode = {
.name = "RM67191_OLED",
.refresh = 60,
.xres = 1080,
.yres = 1920,
.pixclock = 7575, /* 132000000 */
.left_margin = 34,
.right_margin = 20,
.upper_margin = 4,
.lower_margin = 10,
.hsync_len = 2,
.vsync_len = 2,
.sync = FB_SYNC_EXT,
.vmode = FB_VMODE_NONINTERLACED
}
}
然后修改这组参数的使能函数
void do_enable_mipi_led(structdisplay_info_tconst*dev)
{
imx_iomux_v3_setup_multiple_pads(backlight_pads,
ARRAY_SIZE(backlight_pads));
gpio_request(IMX_GPIO_NR(1, 1), "backlight");
gpio_direction_output(IMX_GPIO_NR(1, 1), 0);
gpio_request(IMX_GPIO_NR(1, 8), "DSI EN");
gpio_direction_output(IMX_GPIO_NR(1, 8), 0);
mdelay(10);
gpio_direction_output(IMX_GPIO_NR(1, 8), 1);
/* enable the dispmix & mipi phy power domain */
call_imx_sip(FSL_SIP_GPC, FSL_SIP_CONFIG_GPC_PM_DOMAIN, DISPMIX, true, 0);
call_imx_sip(FSL_SIP_GPC, FSL_SIP_CONFIG_GPC_PM_DOMAIN, MIPI, true, 0);
/* Put lcdif out of reset */
disp_mix_bus_rstn_reset(imx8mm_mipi_dsim_plat_data.gpr_base, false);
disp_mix_lcdif_clks_enable(imx8mm_mipi_dsim_plat_data.gpr_base, true);
/* Setup mipi dsim */
sec_mipi_dsim_setup(&imx8mm_mipi_dsim_plat_data);
rm67191_init();
rm67191_dev.name = dev->mode.name;
imx_mipi_dsi_bridge_attach(&rm67191_dev); /* attach rm67191 device */
}
struct mipi_dsi_client_dev rm67191_dev = {
.channel = 0,
.lanes = 4,
.format = MIPI_DSI_FMT_RGB888,
.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE,
};
修改显示屏驱动drivers/video/rm67191.c,在函数int rm67191lcdsetup(struct mipidsiclientdev *paneldev)添加自己的屏的初始化序列。
修改完成后编译测试。
注意:uboot代码不开源,修改代码需要联系销售人员
全部0条评论
快来发表一下你的评论吧 !