RK系列(RK3568) MIPI屏适配 PWM背光 驱动开发

平台:Android12

SOC:RK3568

一般拿到MIPI屏 厂家会给一个跑的配置文件 

例如我的:

VDD= 1.8~2.0V
RESET=VDD;
STBYB=VDD;
VGH= 18V
VGL= -6V
AVDD= 9.6V
VCOM= 3.2V(tpy.)

MIPI CLK Speed:340Mbps(170MHZ)
H back porch:160
H front porch:160 
H pulse width:10
V back porch:23
V front porch:12
V pulse width:1

MIPI command如下:

//SSD2805_Gen_write(0xB2,0x10);
SSD2805_Gen_write(0x80,0xAC);
SSD2805_Gen_write(0x81,0xB8);
SSD2805_Gen_write(0x82,0x09);
SSD2805_Gen_write(0x83,0x78);
SSD2805_Gen_write(0x84,0x7F);
SSD2805_Gen_write(0x85,0xBB);
SSD2805_Gen_write(0x86,0x70);
		
SSD2805_Gen_write(0x11,0);		
Delayms(200);
				
SSD2805_Gen_write(0x29,0);
Delayms(20);
	   	 
 

那么可以配置设备树

由于我接的是DSI0

backlight = <&backlight>; 设置背光

&dsi0 {
        status = "okay";
        dsi_panel: panel@0 {
                status = "okay";
                compatible = "simple-panel-dsi";
                reg = <0>;
		        power-supply = <&vcc3v3_lcd0_n>;
                backlight = <&backlight>;
                reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_LOW>;
                pinctrl-names = "default";
	            pinctrl-0 = <&dsi0_lcd_rst_gpio>;
                enable-gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
				size,width = <1024>;
                size,height = <600>;
                reset-delay-ms = <60>;
                enable-delay-ms = <60>;
                prepare-delay-ms = <60>;
                unprepare-delay-ms = <60>;
                disable-delay-ms = <60>;
                dsi,flags = <( MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
                        MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
                dsi,format = <MIPI_DSI_FMT_RGB888>;
                dsi,lanes  = <4>;
                panel-init-sequence = [
                        15 00 02 80 ac
						15 00 02 81 b8
						15 00 02 82 09
						15 00 02 83 78
						15 00 02 84 7f
						15 00 02 85 bb
						15 00 02 86 70
						15 C8 02 11 00
						15 C8 02 29 00
                ];

                panel-exit-sequence = [
                        05 05 01 28
                        05 78 01 10
                ];
				//(hactive+hbp+hfp+hsync-len)x (vactive+vbp+vfp+vsync-len)xfps
                disp_timings1: display-timings {
                        native-mode = <&dsi1_timing0>;
                        dsi1_timing0: timing0 {
                                clock-frequency = <50745360>;//1334*634 *60

                                hactive = <1024>;
								hback-porch = <160>;
								hfront-porch = <160>;
								hsync-len = <10>;
								hsync-active = <0>;//1024 + 160+160 -10 = 1334

                                vactive = <600>;
                                vfront-porch = <12>;
                                vback-porch = <23>;
								vsync-len = <1>;//600 + 12 + 23 -1 =634
                                vsync-active = <0>;

                                de-active = <0>;
                                pixelclk-active = <0>;
                        };
                };

                ports {
                        #address-cells = <1>;
                        #size-cells = <0>;

                        port@0 {
                                reg = <0>;
                                panel_in_dsi1: endpoint {
                                        remote-endpoint = <&dsi1_out_panel>;
                                };
                        };
                };
        };

        ports {
                #address-cells = <1>;
                #size-cells = <0>;

                port@1 {
                        reg = <1>;
                        dsi1_out_panel: endpoint {
                                remote-endpoint = <&panel_in_dsi1>;
                        };
                };
        };

};



&dsi0{
    status = "okay";
};
&dsi_panel
{
    status = "okay";
};
&dsi0_in_vp0 {
    status = "okay";
};

&route_dsi0{
    status = "okay";
	connect = <&vp0_out_dsi0>;

};

&video_phy0 {
	status = "okay";
};

&dsi0_in_vp1 {
	status = "disabled";
};

背光的配置

我接的是pwm4

backlight1: backlight1 {
		compatible = "pwm-backlight";
		pwms = <&pwm4 0 25000 0>;
		brightness-levels = <
			  0  20  20  21  21  22  22  23
			 23  24  24  25  25  26  26  27
			 27  28  28  29  29  30  30  31
			 31  32  32  33  33  34  34  35
			 35  36  36  37  37  38  38  39
			 40  41  42  43  44  45  46  47
			 48  49  50  51  52  53  54  55
			 56  57  58  59  60  61  62  63
			 64  65  66  67  68  69  70  71
			 72  73  74  75  76  77  78  79
			 80  81  82  83  84  85  86  87
			 88  89  90  91  92  93  94  95
			 96  97  98  99 100 101 102 103
			104 105 106 107 108 109 110 111
			112 113 114 115 116 117 118 119
			120 121 122 123 124 125 126 127
			128 129 130 131 132 133 134 135
			136 137 138 139 140 141 142 143
			144 145 146 147 148 149 150 151
			152 153 154 155 156 157 158 159
			160 161 162 163 164 165 166 167
			168 169 170 171 172 173 174 175
			176 177 178 179 180 181 182 183
			184 185 186 187 188 189 190 191
			192 193 194 195 196 197 198 199
			200 201 202 203 204 205 206 207
			208 209 210 211 212 213 214 215
			216 217 218 219 220 221 222 223
			224 225 226 227 228 229 230 231
			232 233 234 235 236 237 238 239
			240 241 242 243 244 245 246 247
			248 249 250 251 252 253 254 255
		>;
		default-brightness-level = <200>; 
	};

default-brightness-level = <200>;  要给不然没有背光

猜你喜欢

转载自blog.csdn.net/yinsui1839/article/details/129872792