msm8953 LCD porting details

1. Introduction

This article is based on Qualcomm msm8953 LCD module porting instructions. LCD transplantation mainly involves modification of LK and kernel.

2. Practical preparation

1. Terminology

HSYNC:行同步信号,表示扫描1行的开始。
VSYNC:帧同步信号,表示扫描1帧的开始,一帧也就是LCD显示的一个画面。
HFP:Horizon front porch
水平前沿,在每行或每列的象素结束到LCD 行时钟输出脉冲之间的像素时钟数
HBP:Horizon back porch
水平后沿,是指在每行或每列的象素数据开始输出时要插入的像素时钟周期数
VFP:Vertical front porch
垂直前沿,本帧数据输出结束到下一帧垂直同步周期开始之前的无效行数
VBP:Vertical back porch
垂直后沿,在垂直同步周期之后帧开头时的无效行数
HDP:Horizon display period
VDP:Vertical display period
HPW:Hsync plus width
行同步脉宽。单位:像素时钟周期
VPW:Vsync plus width
垂直同步脉宽。单位:显示一行的时间

The timing properties are as follows:
insert image description here

2. Common sense is essential

1、像素(pixel)
整个图像是由一个个的像素组成的,像素就是一个显示点。
2、像素间距(pitch)
pitch是连续2个像素的像素中心的距离。
3、像素深度/位数(bits per pixel,简称bpp)
一个像素在计算机中由多少个位来描述。常见的像素深度:1位、8位、16位、24位、324、分辨率(resolution)
屏幕的横向和纵向的像素个数就叫分辨率。屏幕尺寸和分辨率无关的,屏幕尺寸是指屏幕的对角线尺寸。屏幕尺寸和分辨率、像素间距三者之间有关联。

3. File part
1) Screen initialization command data, panel parameters, etc. provided by the screen manufacturer
2) Qualcomm 80-NH713-1_Y_DSI_Timing_Parameters_User_Interactive_Spreadsheet.xls

4. DSI data frame format description
insert image description here
qcom, mdss-dsi-on-command meaning description:

byte 0: dcs data type 数据类型如上
byte 1: set to indicate this is an individual packet
	 	value: 01 (indicates this is an individual packet)
	 		   00 (indicates this will be appended to the next individual packet in the packet stream)
byte 2: virtual channel number
byte 3: expect ack from client (dcs read command)
byte 4: wait number of specified ms after dcs command
	 transmitted
byte 5, 6: 16 bits length in network byte order
byte 7 and beyond: number byte of payload

Commonly used data formats:
1) 0x05 DCS WRITE, no parameters
05 01 00 00 32 00 02 28 00
05: Data type
01 00 00: Represents single frame, virtual channel number, request response flag
0x32: Delay after sending the frame Time in milliseconds, which is 50ms
00 02: length
28 00: payload, namely data (register address + data)
2) 0x15 DCS WRITE, 1 parameter
15 01 00 00 c8 00 02 11 00
3) 0x29 Generic Long Write
29 01 00 00 00 00 02 53 24
4) 0x39 DCS Long Write Command Packet
39 01 00 00 0A 00 02 29 00
5) 0x13 Generic Short WRITE, 1 parameter
13 01 00 00 00 00 02 BC 46

3. Practical operation instructions

1. Generation of .H and dtsi files
You can generate .h and dts files through the device/qcom/common/display/tools/parser.pl script.
The command is: perl parser.pl panel_xxx_xxx_xxx.xml panel
Note:
1) The xml file can be copied from the ready-made, after generating the target file, modify the configuration according to the actual screen information.
2) The generated files are *.h and *.dtsi. Among them, .h is placed in lk/dev/gcdb/display/include/panel_lt8911b_1080p_video.h, and the dtsi file is placed in kernel/msm-4.9/arch/arm64/boot/dts/qcom/dsi-panel-lt8911b-1080p-video.dtsi.

2. LK modification
1) target/msm8953/oem_panel.c file
1.1) Import the header file of panel data

#include "include/panel_lt8911b_1080p_video.h"

1.2) Declare the panel id in the enumeration variable

enum {
    
    
	LT8911B_1080P_VIDEO_PANEL,
};

1.3) Add panel name and id to target panel support list

static struct panel_list supp_panels[] = {
    
    
	{
    
    "dsi_lt8911b_1080p_video", LT8911B_1080P_VIDEO_PANEL},
};

1.4) Initialize the panel according to the panel id and data

static int init_panel_data(struct panel_struct *panelstruct,
			struct msm_panel_info *pinfo,
			struct mdss_dsi_phy_ctrl *phy_db)
	...
	switch (panel_id) {
    
    
		case LT8911B_1080P_VIDEO_PANEL:
	        panelstruct->paneldata    = &lt8911b_1080p_video_panel_data;
			panelstruct->panelres     = &lt8911b_1080p_video_panel_res;
			panelstruct->color        = &lt8911b_1080p_video_color;
			panelstruct->videopanel   = &lt8911b_1080p_video_video_panel;
			panelstruct->commandpanel = &lt8911b_1080p_video_command_panel;
			panelstruct->state        = &lt8911b_1080p_video_state;
			panelstruct->laneconfig   = &lt8911b_1080p_video_lane_config;
			panelstruct->paneltiminginfo
				= &lt8911b_1080p_video_timing_info;
			panelstruct->panelresetseq
						 = &lt8911b_1080p_video_reset_seq;
			panelstruct->backlightinfo = &lt8911b_1080p_video_backlight;
            pinfo->mipi.panel_on_cmds = lt8911b_1080p_video_on_command;
            pinfo->mipi.num_of_panel_on_cmds
                    = LT8911B_1080P_VIDEO_ON_COMMAND;
			pinfo->mipi.panel_off_cmds = NULL;
			pinfo->mipi.num_of_panel_off_cmds = 0;
			memcpy(phy_db->timing,
				lt8911b_1080p_video_timings,
				MAX_TIMING_CONFIG * sizeof(uint32_t));
			pinfo->mipi.signature = LT8911B_1080P_VIDEO_SIGNATURE;		
			panelstruct->paneldata->panel_operating_mode &= ~USE_DSI1_PLL_FLAG;
			break;
	}
	...

1.5) Get panel_id for initialization of different screens

int oem_panel_select(const char *panel_name, struct panel_struct *panelstruct,
			struct msm_panel_info *pinfo,
			struct mdss_dsi_phy_ctrl *phy_db)
{
    
    
	...
}

Note: The acquisition logic of panel_id can be defined according to the actual situation.

2) .h file related configuration description
1.1) timing description

static const uint32_t lt8911b_1080p_video_timings[] = {
    
    
		0x1b, 0x09, 0x08, 0x00, 0x24, 0x1f, 0x08, 0x09, 0x05, 0x03, 0x04, 0x00

The timing generated by the excel sheet is 11 bytes, and the array here is 12 bytes, and a byte 0x00 is required.
1.2) Description of panel_config

static struct panel_config lt8911b_1080p_video_panel_data = {
    
    
	"qcom,mdss_dsi_lt8911b_1080p_video", "dsi:0:", "qcom,mdss-dsi-panel",
	10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 1, 10000, 0, 0, 0, 0, 0, 0, NULL
};

When generated through the xml file, 2 bytes will be missing, so two bytes of 0 or NULL must be added.
1.3) On/off command description
If it is not enough, you can add 0 or 0xff for alignment.
Note:
The general format of the command information provided by the screen manufacturer is [length register address data]
length includes register address + data length, in the form of:

...
DSI_CMD(0x03,0xB2);Set RSO
DSI_PA(0x40);   //1 1280Gate	
DSI_PA(0x08);   //2 800RGB	
...
DSI_CMD(0x01,0x11); Sleep Out
DelayX1ms(250);
...

In addition, the time is generally configured in the format of dsi.

2. Kernel modification
1) kernel\msm-4.9\arch\arm64\boot\dts\qcom\msm8953-mdss-panels.dtsi file
1.1) Import the dtsi file of the screen

#include "dsi-panel-lt8911b-1080p-video.dtsi"

1.2) If you need to rotate 180°, add the following statement

&dsi_lt8911b_1080p_dsi_video {
    
    
	qcom,mdss-dsi-panel-orientation = "180";
};

3. Description of screen parameters
Here is an explanation based on the configuration of the dtsi file
1) Description of basic configuration information

//分辨率
qcom,mdss-dsi-panel-width = <1920>;
qcom,mdss-dsi-panel-height = <1080>;

qcom,mdss-dsi-h-front-porch = <88>;//水平前沿
qcom,mdss-dsi-h-back-porch = <148>;//水平后沿
qcom,mdss-dsi-h-pulse-width = <44>;//水平脉冲宽度
qcom,mdss-dsi-h-sync-skew = <0>;

qcom,mdss-dsi-v-back-porch = <36>;//垂直后沿
qcom,mdss-dsi-v-front-porch = <4>;//垂直后沿
qcom,mdss-dsi-v-pulse-width = <5>;//垂直脉冲宽度

//左边框、右边框、上边框、下边框
qcom,mdss-dsi-h-left-border = <0>;
qcom,mdss-dsi-h-right-border = <0>;
qcom,mdss-dsi-v-top-border = <0>;
qcom,mdss-dsi-v-bottom-border = <0>;
qcom,mdss-dsi-bpp = <24>;//像素深度
//上电命令、下电命令(一般由屏厂商提供),并且遵循dsi帧数据协议格式。
qcom,mdss-dsi-on-command = [
	29 01 00 00 02 00 06 A0 06 87 30 10 10
	29 01 00 00 02 00 06 A0 07 02 30 10 10
	...
	29 01 00 00 00 00 06 00 06 41 00 00 00
	29 01 00 00 00 00 06 00 06 43 00 00 00
	29 01 00 00 00 00 06 10 05 01 00 00 00
];
qcom,mdss-dsi-off-command = [
	29 01 00 00 14 00 06 00 06 01 00 00 00
	29 01 00 00 14 00 06 00 06 00 00 00 00
];
//传输模式
qcom,mdss-dsi-on-command-state = "dsi_lp_mode";
qcom,mdss-dsi-off-command-state = "dsi_hs_mode";
//时序,同.h需要补一位0x00。后文详解		
qcom,mdss-dsi-panel-timings = [
	E6 38 26 00 68 6C 2A 3A 2C 03 04 00];
qcom,mdss-dsi-t-clk-post = <0x02>;//模式切换后的字节时钟周期
qcom,mdss-dsi-t-clk-pre = <0x2B>;//模式切换前的字节时钟周期
//背光的等级划分
qcom,mdss-dsi-bl-min-level = <1>;
qcom,mdss-dsi-bl-max-level = <4095>;
//复位引脚的时序,格式为<电平 时间(毫秒级)>
qcom,mdss-dsi-reset-sequence = <1 20>, <0 20>, <1 20>;
//时序2,后文讲解
qcom,mdss-dsi-panel-timings-phy-v2 = [
	24 1f 08 09 05 03 04 a0	/*Data 0*/
	24 1f 08 09 05 03 04 a0	/*Data 1*/
	24 1f 08 09 05 03 04 a0 /*Data 2*/
	24 1f 08 09 05 03 04 a0 /*Data 3*/
	24 1b 08 09 05 03 04 a0 /*CLK lane*/
];
//背光、复位、pwm引脚。主要是根据硬件配置。
qcom,platform-bklight-en-gpio = <&tlmm 137 0>;	
qcom,platform-reset-gpio = <&tlmm 61 0>;
qcom,mdss-dsi-pwm-gpio = <&pm8953_mpps 4 0>;
//背光控制方式
qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_pwm"; 
//pwm频率
qcom,mdss-dsi-bl-pmic-pwm-frequency = <1000>;		

2) Timing timing calculation and description
It mainly introduces the use of the 80-NH713-1_Y_DSI_Timing_Parameters_User_Interactive_Spreadsheet.xlsm document.
This document needs to be opened with Microsoft EXCEL. If you use WPS, you need to download the components yourself, and you need to open the VBA macro.
In the DSI and MDP registers form, it needs to be filled in according to the actual screen information. As follows:
insert image description here
Switch to the DSI PHY timing setting table, press CTRL+J, CTRL+L respectively, as follows:
insert image description here
VALID appears, indicating that the parameter verification is successful. The data in the DSI PHY timing setting table corresponds to the data of qcom, mdss-dsi-panel-timings. That is converted to:
qcom,mdss-dsi-panel-timings = [
49 0C 06 00 28 2C 0A 10 09 03 04 00]; //Add a byte 0x00
qcom,mdss-dsi-t-clk-post = <0x05 >;
qcom,mdss-dsi-t-clk-pre = <0x12>

The data in the DSI PHY 2.0.0 timing setting is as follows:
insert image description here
The data in the DSI PHY 2.0.0 timing setting table corresponds to qcom, mdss-dsi-panel-timings-phy-v2. That is converted to:
qcom,mdss-dsi-panel-timings-phy-v2 = [
1C 19 02 03 01 03 04 a0 / Data 0 /
1C 19 02 03 01 03 04 a0 / Data 1 /
1C 19 02 03 01 03 04 a0 / Data 2 /
1C 19 02 03 01 03 04 a0 / Data 3 /
1C 07 02 03 01 03 04 a0 / CLK lane /
];
Note: A byte 0xa0 should be added at the end.
Specific data description:
insert image description here

Four. Summary

The main modification of msm8953 LCD transplantation is LK and Kernel, usually based on the ready-made .H and .DTSI files to copy a copy, and then modify according to the parameter information of the screen.

Guess you like

Origin blog.csdn.net/qq_33782617/article/details/126805769