一、进入系统后设置MIPI屏流程:
因为hi3516DV300 对mipi屏的 支持默认分辨率,支持 720 x 1280 与 1080 x 1920两种 分辨率,所对这两种分辨率的屏配置时 只配置
在VO初始化时 配置
enDispPicSize = PIC_720P;
enIntfSync = VO_OUTPUT_720X1280_60;
MIP
combo_dev_cfg_t MIPI_TX_720X1280_60_CONFIG =
{
.devno = 0,
.lane_id = {0, 1, 2, 3},
.output_mode = OUTPUT_MODE_DSI_VIDEO,
.output_format = OUT_FORMAT_RGB_24_BIT,
.video_mode = BURST_MODE,
.sync_info = {
.vid_pkt_size = 720, // hact
.vid_hsa_pixels = 24, // hsa
.vid_hbp_pixels = 50, // hbp
.vid_hline_pixels = 844, // hact + hsa + hbp + hfp
.vid_vsa_lines = 4, // vsa
.vid_vbp_lines = 20, // vbp
.vid_vfp_lines = 16, // vfp
.vid_active_lines = 1280, // vact
.edou_cmd_size = 0,
},
.phy_data_rate = 459,
.pixel_clk = 66850,
};
其中 hact ,hsa ,hbp, vsa ,vbp ,vfp ,vact 这些值 一般屏厂都人提供, phy_data_rate 可以跟据,LCD╱MIPI 屏幕对接 使用指南.pdf文档里的计算公式计算,但跟据调的十几款mipi屏的经验,这个计算很多时候无法把屏点亮,此值 可以跟据屏厂提供值配置,若屏厂无法提供,就把计算得出的值 加 50 -150,不等偿试。
MIPI屏下参数:
双个字节配置:
HI_VOID vo_InitMipiScreen_T(HI_S32 s32fd,unsigned char addr ,unsigned char data)
{
HI_S32 fd = s32fd;
HI_S32 s32Ret;
cmd_info_t cmd_info = {0};
cmd_info.devno = 0;
cmd_info.cmd_size = data << 8 | addr;
//printf(" cmd_info.cmd_size = 0x%04x \n",cmd_info.cmd_size);
cmd_info.data_type = 0x23;
cmd_info.cmd = NULL;
s32Ret = ioctl(fd, HI_MIPI_TX_SET_CMD,&cmd_info);
if(HI_SUCCESS != S32Ret)
{
cose(fd);
return;
}
usleep(1000);
}
多字节配置:
HI_VOID VO_InitMipiScreen_M(HI_S32 s32fd,unsigned char* data,int len)
{
HI_S32 fd = s32fd;
HI_S32 s32Ret;
cmd_info_t cmd_info = {0};
if(data == NULL)
{
close(fd);
return ;
}
cmd_info.devno = 0;
cmd_info.cmd_size = len;
cmd_info.data_type = 0x29;
cmd_info.cmd = data;
s32Ret = ioctl(fd, HI_MIPI_TX_SET_CMD, &cmd_info);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("MIPI_TX SET CMD failed\n");
close(fd);
return;
}
usleep(1000);
}
``
一个字节配置:
```c
int VO_InitScreen_ONE(HI_S32 s32fd,unsigned char data)
{
int s32Ret;
cmd_info_t cmd_info = {0};
cmd_info.devno = 0;
cmd_info.cmd_size = data ;
cmd_info.data_type = 0x05;
cmd_info.cmd = NULL;
s32Ret = mipi_tx_ioctl(HI_MIPI_TX_SET_CMD, &cmd_info,NULL);
if (0 != s32Ret)
{
close(fd);
return;
}
udelay(1000);
}
注意:每写入一条命 令最好有个延时,避免写入不全的问题。
二、当系统中无相应分辨率的除了要以上步骤外需要配置如下:
800 * 1280
需要配置 VO 属性结构体 ,值 与 combo_dev_cfg_t 中的相应值相同即可:
enDispPicSize = PIC_800P;
enIntfSync = VO_OUTPUT_USER; //系统中没有的分辨率全部使用 此配置
VO_PUB_ATTR_S stVoPubAttr = {0};
stVoPubAttr.enIntfType = enVoIntfType;
stVoPubAttr.enIntfSync = enIntfSync;
stVoPubAttr.u32BgColor = pstVoConfig->u32BgColor;
stVoPubAttr.stSyncInfo.bSynm = 1;
stVoPubAttr.stSyncInfo.bIop = 1;
stVoPubAttr.stSyncInfo.u16Vact = 1280;
stVoPubAttr.stSyncInfo.u16Vbb = 4;
stVoPubAttr.stSyncInfo.u16Vfb = 8;
stVoPubAttr.stSyncInfo.u16Hact = 800;
stVoPubAttr.stSyncInfo.u16Hbb = 50;
stVoPubAttr.stSyncInfo.u16Hfb = 16;
stVoPubAttr.stSyncInfo.u16Hpw = 16;
stVoPubAttr.stSyncInfo.u16Vpw = 4;