linux TP实验之GT9XX触摸驱动
1 准备工作
开发板:aio-rk3288j
SDK版本:rk3288_linux_release_20210304
下载工具:Linux_Upgrade_Tool_v2.1
内核版本:4.4.194
文件系统:buildroot
Ubuntu版本:18.04
交叉编译工具:gcc version 6.3.1 20170404
2原理图

3 时序图


4 配置步骤
4.1 驱动添加到内核菜单
驱动源码路径:kernel/drivers/input/touchscreen/gt9xx
Kconfig文件添加如下内容

在Makefile里添加编译gt9xx驱动

在内核菜单中去配置gt9xx的驱动,把它编译进内核。打开make menuconfig
路径:
Devrive Drivers ->Input device support -> Touchscreens->Goodix gt9xx support for rockchip

4.2修改设备树
设备树路径:kernel/arch/arm/boot/dts/rk3288-firefly-aio.dts
&i2c4 {
status = "okay";
clock-frequency = <400000>;
gt9xx: goodix-ts@14 {
compatible = "goodix,gt9xx";
reg = <0x14>;
interrupt-parent = <&gpio5>;
interrupts = <19 IRQ_TYPE_EDGE_FALLING>;
touch-gpio = <&gpio5 19 GPIO_ACTIVE_HIGH>;
reset-gpio = <&gpio7 9 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&goodix_touch &goodix_reset>;
max-x = <1024>;
max-y = <600>;
tp-size = <910>;
};
};
&pinctrl {
gt9xx {
goodix_touch: goodix-touch {
rockchip,pins = <5 19 RK_FUNC_GPIO &pcfg_pull_up>;
};
goodix_reset: goodix-reset {
rockchip,pins = <7 9 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
5 源码修改
gt9xx.h 文件配置修改
#define DEBUG_SWITCH 1 开启调试开关,打印信息(很重要)
#define GTP_CUSTOM_CFG 1 用来用户自定义设置;
#define GTP_DRIVER_SEND_CFG 1 用来发送CFG文件配置;
group是厂家指定,6个group(0 - 5),该方案配置group3
// TODO: define your config for Sensor_ID == 3 here, if needed
#define CTP_CFG_GROUP3 {
\
//厂家提供
0x00,0x00,0x04,0x58,0x02,0x05,0x0C,0x20,0x02,0xC6,0x28,0x0F,0x64,0x50,0x03, \
0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x1A,0x1E,0x14,0x8A,0x29,0x0C, \
0x2A,0x28,0x0F,0x0A,0x00,0x00,0x00,0x81,0x03,0x11,0x00,0x01,0x00,0x00,0x00, \
0x03,0x00,0x00,0x00,0x00,0x00,0x14,0x52,0x94,0xC5,0x02,0x07,0x00,0x00,0x04, \
0xD4,0x17,0x00,0xA6,0x1E,0x00,0x80,0x28,0x00,0x62,0x36,0x00,0x4E,0x47,0x00, \
0x4E,0x00,0x00,0x00,0x00,0x00,0x00,

本文介绍了GT9XX触摸屏驱动在Linux环境下的配置过程,包括驱动添加到内核菜单、设备树修改等内容,并详细展示了如何通过源码修改实现自定义配置。

960

被折叠的 条评论
为什么被折叠?



