rk3568驱动开发之mipi屏

概述

屏是嵌入式驱动开发中常见的设备,一般的带屏项目中最开始要调试的,简单记录一下自己在项目开发中的经验过程。所用平台是rockchip的rk3568,android11。

1.硬件原理图

rk3568驱动开发之mipi屏_第1张图片
硬件原理图主要看接的是哪个mipi接口,屏的电源控制io,背光控制io,这些需要在设备树中配置的要仔细核对。

2.dts参考:

&dsi1_in_vp1 {
	status = "okay";
};


&dsi1 {
	status = "okay";
	//rockchip,lane-rate = <1000>;
	dsi1_panel: panel@0 {
		status = "okay";
		reg = <0>;
		compatible = "simple-panel-dsi";
		power-supply = <&vcc3v3_lcd1_n>;
		reset-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&lcd1_rst_gpio>;
		backlight = <&backlight>;
		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 = [

			05 78 01 11
			05 1E 01 29
		];

		panel-exit-sequence = [
			05 00 01 28
			05 00 01 10
		];

		disp_timings1: display-timings {
			native-mode = <&dsi1_timing0>;
			dsi1_timing0: timing0 {
				clock-frequency = <132000000>;
				hactive = <1200>;
				vactive = <1920>;
				hfront-porch = <80>;
				hsync-len = <1>;
				hback-porch = <60>;
				vfront-porch = <35>;
				vsync-len = <1>;
				vback-porch = <25>;
				hsync-active = <0>;
				vsync-active = <0>;
				de-active = <0>;
				pixelclk-active = <1>;
			};
		};

		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>;
			};
		};
	};

};

&video_phy0 {
	status = "disabled";
};

&video_phy1 {
	status = "okay";
};
&route_dsi1 {
	status = "okay";
	connect = <&vp1_out_dsi1>;
};

PS:以上代码只是参考,并不完整。还有io的配置,包括是否有管脚复用等。
panel-init-sequence 和 panel-exit-sequence是mipi屏的初始化命令,timing0是屏的一些参数。一般是屏厂提供。格式就按照mipi的cmd格式来写。正常情况上电可以点亮屏幕了。如果出了问题,也有调试命令可以查看clk,dsi这些通道是否正常。
rk平台的点屏方式还是比较简洁的,直接在dts中完成。有些平台是需要增加代码实现的。不过原理都差不多。最后,祝大家都能点屏成功。

你可能感兴趣的:(android/linux,驱动开发,驱动开发)