RK Android7.1 TP GT1X
GT1X 驱动,cfg 资源 https://download.csdn.net/download/qq_40949012/20432225?spm=1001.2014.3001.5501
一.DTS
1 2 3 4 5 6 7 8 9 10 11 | &i2c4 { gt1x:goodix_ts @14 { status = "okay" ; compatible = "goodix,gt1x" ; reg = < 0x14 >; max-x = < 1280 >; max-y = < 800 >; touch-gpio = <&gpio3 16 IRQ_TYPE_LEVEL_LOW>; reset-gpio = <&gpio3 17 GPIO_ACTIVE_HIGH>; }; }; |
二.修改驱动源码
2.1.kernel\drivers\input\touchscreen\gt1x\gt1x.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /** * gt1x_parse_dt - parse platform infomation form devices tree. */ static int gt1x_parse_dt(struct device *dev) { struct device_node *np; int ret; if (!dev) return -ENODEV; np = dev->of_node; gt1x_int_gpio = of_get_named_gpio(np, "goodix,irq-gpio" , 0 ); //"touch-gpio" gt1x_rst_gpio = of_get_named_gpio(np, "goodix,rst-gpio" , 0 ); //"reset-gpio" if (!gpio_is_valid(gt1x_int_gpio) || !gpio_is_valid(gt1x_rst_gpio)) { GTP_ERROR( "Invalid GPIO, irq-gpio:%d, rst-gpio:%d" , gt1x_int_gpio, gt1x_rst_gpio); return -EINVAL; } vdd_ana = regulator_get(dev, "vdd_ana" ); if (IS_ERR(vdd_ana)) { GTP_ERROR( "regulator get of vdd_ana failed" ); ret = PTR_ERR(vdd_ana); vdd_ana = NULL; return ret; } vcc_i2c = regulator_get(dev, "vcc_i2c" ); if (IS_ERR(vcc_i2c)) { GTP_ERROR( "regulator get of vcc_i2c failed" ); ret = PTR_ERR(vcc_i2c); vcc_i2c = NULL; goto ERR_GET_VCC; } return 0 ; ERR_GET_VCC: regulator_put(vdd_ana); vdd_ana = NULL; return ret; return 0 ; } |
2.2.修改CFG参数,更改为厂家提供的CFG参数,其余的GTP_CFG_GROUP1,GTP_CFG_GROUP2,GTP_CFG_GROUP3,GTP_CFG_GROUP4,GTP_CFG_GROUP5均清空
2.4.kernel\drivers\input\touchscreen\gt1x\gt1x_generic.h
设置GTP_CUSTOM_CFG为1,加载自定义配置
1 | #define GTP_CUSTOM_CFG 1 // customize resolution & interrupt trigger mode |
修改自定义CFG
1 2 3 4 5 6 7 8 9 10 11 | # if GTP_CUSTOM_CFG #define GTP_MAX_HEIGHT 1280 #define GTP_MAX_WIDTH 800 #define GTP_INT_TRIGGER 1 /* 0:Rising 1:Falling */ #define GTP_WAKEUP_LEVEL 1 # else #define GTP_MAX_HEIGHT 4096 #define GTP_MAX_WIDTH 4096 #define GTP_INT_TRIGGER 1 #define GTP_WAKEUP_LEVEL 1 #endif |
三.#define GTP_DEBUG_ON 1 // enable log printed by GTP_DEBUG(...) 方便调试输出信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | dmesg | grep GTP [ 0.648308 ] <<GTP-DBG>>[gt1x_ts_init: 752 ]GTP driver installing... [ 0.879360 ] <<GTP-INF>>[gt1x_ts_probe: 509 ] GTP Driver Version: V1. 4 < 2015 / 07 / 10 > //驱动加载成功 [ 0.879435 ] <<GTP-INF>>[gt1x_ts_probe: 510 ] GTP I2C Address: 0x14 [ 0.879748 ] <<GTP-ERR>>[gt1x_parse_dt: 317 ] vdd_ana not specified, fallback to power-supply [ 0.879883 ] <<GTP-ERR>>[gt1x_parse_dt: 320 ] power not specified, ignore power ctrl [ 0.880121 ] <<GTP-INF>>[gt1x_reset_guitar: 779 ] GTP RESET! [ 0.945381 ] <<GTP-DBG>>[gt1x_set_reset_status: 672 ]Set reset status. [ 0.968541 ] <<GTP-INF>>[gt1x_get_chip_type: 898 ] Chip Type: GT1X [ 0.977775 ] <<GTP-INF>>[gt1x_read_version: 854 ] IC VERSION:GT1158_00012A(Patch)_0102(Mask)_00(SensorID) //触摸屏id [ 1.000212 ] <<GTP-INF>>[gt1x_init_panel: 650 ] X_MAX= 800 ,Y_MAX= 1280 ,TRIGGER= 0x01 ,WAKEUP_LEVEL= 1 [ 1.001155 ] <<GTP-DBG>>[gt1x_request_irq: 408 ]INT trigger type: 1 [ 1.001280 ] <<GTP-DBG>>[gt1x_ts_probe: 557 ]GTP works in interrupt mode. [ 1.002817 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1314 ]Additional Int Pulse. [ 1.007746 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1314 ]Additional Int Pulse. [ 1.021001 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1314 ]Additional Int Pulse. [ 15.741651 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1273 ]( 0 )( 391 , 1192 )[ 100 ] [ 15.754392 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1273 ]( 0 )( 391 , 1192 )[ 100 ] [ 15.767474 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1273 ]( 0 )( 391 , 1192 )[ 100 ] [ 15.780796 ] <<GTP-DBG>>[gt1x_touch_event_handler: 1273 ]( 0 )( 391 , 1192 )[ 100 ] |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】