测试内核:NXP官方imx6ull,Linux version 4.1.15
1、设备树
&i2c2 {
clock_frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
goodix_ts@14 {
compatible = "goodix,gt115x";
reg = <0x14>;
status = "okay";
interrupt-parent = <&gpio1>;
interrupts = <9 IRQ_TYPE_EDGE_RISING>;
reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
irq-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
// 手动指定分辨率(覆盖默认值)
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
};
2、驱动文件
drivers/input/touchscreen/goodix.c
static const struct of_device_id goodix_of_match[] = {
{ .compatible = "goodix,gt911" },
{ .compatible = "goodix,gt9110" },
{ .compatible = "goodix,gt912" },
{ .compatible = "goodix,gt927" },
{ .compatible = "goodix,gt9271" },
{ .compatible = "goodix,gt928" },
{ .compatible = "goodix,gt967" },
{ .compatible = "goodix,gt115x" }, // <-- 添加这一行
{ }
};
3、menuconfig配置
Device Drivers --->
Input device support --->
[*] Touchscreens --->
<*> Goodix I2C touchscreen # 选中为 <*> (编译进内核)
4、测试
root@ATK-IMX6U:~# hexdump /dev/input/event1
0000000 6b4f 685f 3511 0008 0003 0039 0000 0000
0000010 6b4f 685f 3511 0008 0003 0035 01fb 0000
0000020 6b4f 685f 3511 0008 0003 0036 0086 0000
0000030 6b4f 685f 3511 0008 0003 0030 0040 0000