下载 gt9xx 官方提供的 v2.4 驱动
附件GT9xx_Driver_for_Android_V2.4.0.1_20161104.zip
驱动部分
把 2.4 的驱动部分的源码文件复制到 /kernel/msm-4.9/drivers/input/touchscreen
下面的 gt9xx
文件夹下面,然后 复制修改 gt9xx_v2.8
下面的 Makefile 和 Kconfig。
Makefile
#
# Makefile for the Goodix gt9xx touchscreen driver.
#
#subdir-ccflags-y += -DDEBUG
EXTRA_CFLAGS +=-Wno-date-time
EXTRA_CFLAGS +=-Wno-error=date-time
obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx.o
obj-$(CONFIG_TOUCHSCREEN_GT9XX_UPDATE) += gt9xx_update.o
obj-$(CONFIG_TOUCHSCREEN_GT9XX_TOOL) += goodix_tool.o
注意需要 EXTRA_CFLAGS
,这两个如果不添加会报错 error: expansion of date or time macro is not reproducible
Kconfig
#
# Goodix GT9xx Touchscreen driver
#
config TOUCHSCREEN_GT9XX_v28
bool "Goodix touchpanel GT9xx series"
depends on I2C
help
Enable this for support Goodix GT9xx_v28 driver.
Say Y here if you have a Goodix GT9xx touchscreen
controller.
If unsure, say N.
config TOUCHSCREEN_GT9XX_UPDATE
tristate "Goodix GT9xx touch controller auto update support"
depends on TOUCHSCREEN_GT9XX_v28
help
Enable this for support firmware update.
Say Y here if you want update touch controller
firmware.
If unsure, say N.
config TOUCHSCREEN_GT9XX_TOOL
tristate "Goodix GT9xx Tools for debuging"
depends on TOUCHSCREEN_GT9XX_v28
help
This implement interface support for Goodix GT9xx
touchscreen debug.
Say Y here if you want to have a Android app debug interface
to your system.
If unsure, say N.
修改 touchscreen 下面的 Makefile, 修改为 obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx/
, 删除 #obj-y += gt1x/
开启内核选项
首先确认哪个 config 对应最后的 .config
,我这边的是 kernel/msm-4.9/arch/arm/configs/msm8937_defconfig
,在最后增加:
CONFIG_TOUCHSCREEN_GT9XX_v28=y
CONFIG_TOUCHSCREEN_GT9XX_UPDATE=y
CONFIG_TOUCHSCREEN_GT9XX_TOOL=y
修改设备树
kernel/msm-4.9/arch/arm64/boot/dts/qcom/qm215-qrd.dtsi
修改 i2c 相关。仿照官方的 dts 和 qcom 的 apq8009-dragon.dts
apq8053-lite-dragon-v2.2.dtsi
&i2c_3 { /* BLSP3 QUP1 (NFC) */
status = "ok";
goodix_ts@5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
interrupt-parent = <&tlmm>;
interrupts = <65 0x2>;
goodix,rst-gpio = <&tlmm 64 0x0>;
goodix,irq-gpio = <&tlmm 65 0x2008>;
goodix,power-gpio = <&tlmm 33 0x0>;
vdd_ana-supply = <&pm8916_l10>;
vcc_i2c-supply = <&pm8916_l6>;
pinctrl-names = "pmx_ts_active","pmx_ts_suspend";
pinctrl-0 = <&ts_int_active &ts_reset_active>;
pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
touchscreen-max-id = <11>;
touchscreen-size-x = <1200>;
touchscreen-size-y = <1920>;
touchscreen-max-w = <1024>;
touchscreen-max-p = <1024>;
goodix,type-a-report = <0>;
goodix,driver-send-cfg = <1>;
goodix,wakeup-with-reset = <0>;
goodix,resume-in-workqueue = <0>;
goodix,int-sync = <1>;
goodix,swap-x2y = <0>;
goodix,esd-protect = <1>;
goodix,pen-suppress-finger = <0>;
goodix,auto-update = <1>;
goodix,auto-update-cfg = <0>;
goodix,power-off-sleep = <0>;
goodix,cfg-group0 = [
5A B0 04 80 07 0A 35 10 22 08 32 0D 50 3C 0A 04
01 01 00 B4 11 11 44 15 19 1B 14 95 35 FF 3A 3C
39 13 00 00 00 98 03 1C 00 00 00 00 03 00 00 00
00 80 0A 37 46 40 E5 52 23 28 00 04 81 38 00 7F
3B 00 7D 3E 00 7C 41 00 7A 44 0C 7A 00 50 33 50
0B 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 55 00 01 00 00 02 00 00 00
1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 10 0F 0E
0D 0C 0B 0A 09 08 07 06 05 04 03 02 01 00 2A 29
28 27 26 25 24 23 22 21 20 1F 1E 1D 1C 1B 19 18
17 16 15 14 13 12 11 10 0F 0E 0D 0C 0B 0A 09 08
07 06 05 04 03 02 01 00 08 01
];
goodix,cfg-group2 = [
5B B0 04 80 07 0A 35 10 22 08 32 0D 50 32 0A 04
01 01 00 B4 11 11 44 2B 31 36 28 95 35 FF 3E 40
39 13 00 00 00 DA 03 1C 00 00 00 00 03 00 00 00
00 80 0A 32 42 40 E5 52 23 28 00 04 7D 33 00 7D
36 00 7E 39 00 7F 3C 00 80 40 0C 80 00 50 33 50
0B 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 55 00 01 00 00 02 00 00 00
1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 10 0F 0E
0D 0C 0B 0A 09 08 07 06 05 04 03 02 01 00 2A 29
28 27 26 25 24 23 22 21 20 1F 1E 1D 1C 1B 19 18
17 16 15 14 13 12 11 10 0F 0E 0D 0C 0B 0A 09 08
07 06 05 04 03 02 01 00 81 01
];
};
Todo
后期根据需要考虑使用 v2.8 的驱动。直接使用 qcom 中的源码,或者使用 官方驱动。
https://github.com/goodix/gt9xx_driver_android
附件 gt9xx_driver_android-master.zip
参考
https://blog.csdn.net/qlexcel/article/details/99696108
https://forum.mangoh.io/t/i2c-nack-error-messages/3518
https://blog.csdn.net/mike8825/article/details/52057637
https://www.cnblogs.com/yejintianming00/p/9339754.html