Linux内核-7寸触摸屏驱动移植

来自华清远见研发中心
FarSight讨论 | 贡献2020年7月28日 (二) 14:05的版本

跳转至: 导航搜索

实验平台

华清远见开发环境,FS-MP1A平台;

实验目的

熟悉基于Linux操作系统下的块设备驱动移植配置过程。

实验步骤

过程与5寸触摸屏移植过程相同,如果步骤重复请跳过。

  • 修改设备树

修改arch/arm/boot/dts/stm32mp157a-fsmp1a-rgb070.dts文件,在文件末尾增加如下内容:

&i2c2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c2_pins_a>;
	pinctrl-1 = <&i2c2_pins_sleep_a>;
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <7>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;

	touchscreen@5d {
		compatible = "goodix,gt911";
		reg = <0x5d>;
		irq-gpios = <&gpiog 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
		reset-gpios = <&gpiog 8	GPIO_ACTIVE_HIGH>;
		interrupt-parent = <&gpiog>;
		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
		status = "okay";

		// touchscreen-inverted-x;
		touchscreen-inverted-y;
		touchscreen-swapped-x-y;
	};
};
  • 配置内核

由于内核源码默认配置以及支持sii902x,本节列出主要选项,如下:

linux@ubuntu:$ make menuconfig
Device Drivers  --->
	Graphics support  --->
		<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
		<*> DRM Support for STMicroelectronics SoC Series
			Display Interface Bridges  --->
				<*> Silicon Image sii902x RGB/HDMI bridge
  • 编译内核级设备树:
linux@ubuntu:$ make -j4 uImage dtbs LOADADDR=0xC2000040
  • 重启测试

将编译好的设备树和内核镜像拷贝到/tftpboot目录下,通过tftp引导内核,设备连接MIPI屏幕,重启设备后查看/dev会多出event0的信息,这是点击屏幕会的到反馈。

root@fsmp1a:# ls /dev/input

54-1-4-1.png