RK Android7.1 TP GT1X
GT1X 驱动,cfg 资源 https://download.csdn.net/download/qq_40949012/20432225?spm=1001.2014.3001.5501
一.DTS
&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
/**
* 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,加载自定义配置
#define GTP_CUSTOM_CFG 1 // customize resolution & interrupt trigger mode
修改自定义CFG
#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(...) 方便调试输出信息。
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]

浙公网安备 33010602011771号