gt9xx驱动移植触摸不准:厂家提供的cfg有问题,重新问厂家要一份正确的
XY坐标镜像:
在gtp_get_points函数里修改代码:
if(ts->pdata->reverse_xy) {
points[i].x = ts->pdata->abs_size_x - (coor_data[1] | (coor_data[2] << 8));
points[i].y = ts->pdata->abs_size_y - (coor_data[3] | (coor_data[4] << 8));
} else {
points[i].x = coor_data[1] | (coor_data[2] << 8);
points[i].y = coor_data[3] | (coor_data[4] << 8);
}
设备树节点:
gt9xx@0x5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
status = "okay";
interrupt-parent = <&gpe>;
interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
reset-gpios = <&gpc 6 0>;
irq-gpios = <&gpe 11 0>;
irq-flags = <2>;
touchscreen-max-id = <11>;
touchscreen-size-x = <720>;
touchscreen-size-y = <1280>;
touchscreen-max-w = <720>;
touchscreen-max-p = <512>;
touchscreen-key-map = <172>, <158>;
goodix,reverse-xy = <1>;
goodix,slide-wakeup = <0>;
goodix,type-a-report = <0>;
goodix,driver-send-cfg = <1>;
goodix,resume-in-workqueue = <0>;
goodix,int-sync = <1>;
goodix,swap-x2y = <1>;
goodix,esd-protect = <0>;
goodix,auto-update-cfg = <0>;
goodix,power-off-sleep = <0>;
goodix,pen-suppress-finger = <0>;
goodix,transform-type = <0>; /* transform for p2s */
goodix,cfg-group2 = <
0x00 0x00 0x05 0xD0 0x02 0x05 0x3D
0x08 0x01 0xC8 0x1E 0x0C 0x50 0x41
0x03 0x05 0x00 0x00 0x00 0x00 0x00
0x00 0x05 0x18 0x1A 0x1E 0x14 0x8C
0x2E 0x0E 0x7D 0x7F 0x0C 0x08 0x00
0x00 0x00 0x59 0x02 0x2C 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x64 0xA0 0x94 0xD5 0x02
0x07 0x14 0x00 0x04 0x8D 0x68 0x00
0x85 0x73 0x00 0x7F 0x7E 0x00 0x7A
0x8B 0x00 0x76 0x98 0x00 0x76 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x02 0x04 0x06 0x08 0x0A 0x0C 0x0E
0x10 0x12 0x14 0x16 0x18 0x1A 0x1C
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
0xFF 0xFF 0x14 0x13 0x12 0x10 0x0F
0x0C 0x0A 0x08 0x06 0x04 0x02 0x00
0x16 0x18 0x1C 0x1D 0x1E 0x1F 0x20
0x21 0x22 0x24 0x26 0x28 0x29 0x2A
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
0xFF 0xFF 0x8A 0x01
>;
};
dev_dbg(&ts->client->dev, "[%d][%d %d %d]\n", points[i].id, points[i].x, points[i].y, points[i].p); // 打印信息
dmesg | grep goodix 查看触摸时的坐标
i2cdetect -l 列出系统中存在的I2C总线
i2cdump -f -y 2 0x5d w 查看I2C2总线上地址为0x5d的寄存器内容
i2cdetect -y 2 查看I2C2总线上的I2C设备
‘--’:表示该地址被检测,但没有芯片应答
‘UU’:表示该地址当前由内核驱动程序使用