RK3288 Android8.1 adds lvds and gt9 touch screen (1)

Our company's screen is divided into two parts

1.lvds is responsible for lighting up the screen and displaying the UI

2.gt9 touch screen is responsible for touch and click feedback operations

Now let’s talk about how to configure lvds

RK's LVDS screen debugging mainly involves configuring the correct LVDS dts. If the configuration is correct, it can basically be lit.

1 First get the screen specifications from the LVDS screen manufacturer. The useful information in the specifications is the timing parameters.

1.1 The following is the timing parameter table from the specification book I got.

Insert image description here

**From this timing table, we can know
the clock dclk frequency: clock-frequency =65MHZ
horizontal effective pixels: Hactive=1024
vertical effective pixels: Vactive=768
total horizontal period=1344
hback-porch/hfront-porch/hsync- len: horizontal synchronization signal
vback-porch/vfront-porch/vsync-len: vertical synchronization signal
According to the formula, the total horizontal period = hback-porch + hfront-porch + hsync-len + Hactive
knows hback-porch + hfront-porch + hsync- len = total horizontal period - Hactive = 320
total vertical period = 806
**
According to the formula, total vertical period = vback-porch + vfront-porch + vsync-len + Vactive,
we know that vback-porch + vfront-porch + vsync-len = vertical total Period - Vactive=38
 

1.2 DTS
screen parameters of screen parameters include screen format, dclk, timing, etc.

	display-timings {
		native-mode = <&lvds_panel_name>;
		lvds_panel_name: timing0 {
			creen-type = <SCREEN_LVDS>;
			//creen-type = <SCREEN_DUAL_LVDS>;
			lvds-format = <LVDS_8BIT_1>;
		  // lvds-format = <LVDS_8BIT_2>;
			out-face    = <OUT_P888>;
                clock-frequency = <65000000>;
                hactive = <1024>;    
                vactive = <768>;    
                hback-porch = <120>; //只需保证hback-porch + hfront-porch + hsync-len=320
                hfront-porch = <160>;
                hsync-len = <40>;     
                hsync-active = <0>;
                vback-porch = <11>;   //只需保证vback-porch + vfront-porch + vsync-len=38
                vfront-porch = <25>; 
                vsync-len = <2>;     
                vsync-active = <0>;
                de-active = <0>;
                pixelclk-active = <0>;

screen-type:屏幕类型,mipi 屏有两种:单 mipi(SCREEN_MIPI)、双 mipi(SCREEN_DUAL_MIPI)。

lvds-format:lvds 数据格式。jeida —-> LVDS_8BIT_2   vesa---->LVDS_8BIT_2 


out-face:屏幕接线格式。



clock-frequency:dclk 频率,单位为 Hz,一般屏的规格书中有,也可以通过公式计算:H*V(包括同步信号)*fps

Hactive:水平有效像素

Vactive:垂直有效像素

hback-porch/hfront-porch/hsync-len:水平同步信号

vback-porch/vfront-porch/vsync-len:水平同步信号

hsync-active、vsync-active、de-active、pixelclk-active:分别为 hync、vsync、DEN、dclk 的极性控制。置 1 将对极性进行翻转。

swap-rb、swap-rg、swap-gb:置 1 将对对应的颜色进行翻转。

2 Configure the enable pin
2.1 Check the schematic diagram to know that the enable pin uses GPIO7_A3 (gpio7 3)

Insert image description here

Insert image description here

3 The configured lvds dts are as follows:
The path is \kernel\arch\arm\boot\dts\rk3288-*.dts. Add the following LVDSdts configuration 

// added by elink_dsy for lvds start <<<



&route_lvds {
	status = "okay";
};

&lvds {
	status = "okay";
};
// kernel 指定 DSI 对应 VOP lvds 连接 VOPL
&lvds_in_vopl {
	status = "okay";
};

&lvds_in_vopb {
	status = "disabled";
};

&lvds_panel {
	status = "okay";
	compatible ="simple-panel";
	backlight = <&backlight>;
	enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
	enable-delay-ms = <10>;
	rockchip,data-mapping = "vesa";
//	rockchip,data-mapping = "jeida";
	rockchip,data-width = <24>;
//	rockchip,output = "duallvds";
	rockchip,output = "lvds";

	display-timings {
		native-mode = <&lvds_panel_name>;
		lvds_panel_name: timing0 {
			creen-type = <SCREEN_LVDS>;
			//creen-type = <SCREEN_DUAL_LVDS>;
			lvds-format = <LVDS_8BIT_1>;
		  // lvds-format = <LVDS_8BIT_2>;
			out-face    = <OUT_P888>;
                clock-frequency = <65000000>;
                hactive = <1024>;    
                vactive = <768>;    
                hback-porch = <120>; 
                hfront-porch = <160>;
                hsync-len = <40>;     
                hsync-active = <0>;
                vback-porch = <11>;  
                vfront-porch = <25>; 
                vsync-len = <2>;     
                vsync-active = <0>;
                de-active = <0>;
                pixelclk-active = <0>;
		};
	};
};
// added lvds end <<<
status:okay   状态

compatible:simple-panel  与 lvds panel 驱动进行匹配

backlight:  &backlight 引用背光节点, panel 驱动会解析并对背光进行控制

enable-gpios:  &gpio7 3 GPIO_ACTIVE_HIGH 屏的 enable 脚的 gpio 配置,参考原理图。

enable-delay-ms: 10  开启背光之前的延时,参考屏规格书

rockchip,data-mapping: vesa or jeida LVDS 信号的两种编码方式 ,具体对应关
系参考 data mapping 说明;

rockchip,data-width:18 or 24 or 30 LVDS 的数据位, RGB 三个分量都是 6bit
的填 18,RGB 三个分量都是 8bit 的填 24,
RGB 三个分量都是 10bit 的填 30。

rockchip,output:  lvds or duallvds 双通道 LVDS, 目前只有 rk3288 支持。

    screen-type:屏幕类型,mipi 屏有两种:单 mipi(SCREEN_MIPI)、双 mipi(SCREEN_DUAL_MIPI)。
    
    lvds-format:lvds 数据格式。jeida —-> LVDS_8BIT_2   vesa---->LVDS_8BIT_2 

    
    out-face:屏幕接线格式。
    

    
    clock-frequency:dclk 频率,单位为 Hz,一般屏的规格书中有,也可以通过公式计算:H*V(包括同步信号)*fps
    
    Hactive:水平有效像素
    
    Vactive:垂直有效像素
    
    hback-porch/hfront-porch/hsync-len:水平同步信号
    
    vback-porch/vfront-porch/vsync-len:水平同步信号
    
    hsync-active、vsync-active、de-active、pixelclk-active:分别为 hync、vsync、DEN、dclk 的极性控制。置 1 将对极性进行翻转。
    
    swap-rb、swap-rg、swap-gb:置 1 将对对应的颜色进行翻转。

You can refer to the document "DRM-based Android Display Usage Guide_V1.0_20180129.pdf" provided by RK

Guess you like

Origin blog.csdn.net/u010823818/article/details/131193282