RK3288的GTxx觸摸屏驅動調試

電容屏是在LCD屏上覆蓋一個透明的矩陣鍵盤,在調試goodix gt9xx系列觸控屏的驅動時,會遇到各種問題!
1、linux啓動時,觸控屏驅動偶爾不能加載固件信息。
2、在使用過程中偶爾不能觸發或觸發失靈現象。
3、觸屏反應緩慢,靈敏度很差。
4、當用戶按下時,獲取按下的座標位置不對應!

[RK3288][Android5.1][GT9271]打印dmesg的log信息:

<4>[    1.051266] <<-GTP-INFO->> GTP driver installing...
<4>[    1.051444] <<-GTP-INFO->> GTP Driver Version: V2.4<2014/11/28>
<4>[    1.051460] <<-GTP-INFO->> GTP Driver Built@11:52:24, Sep 25 2018
<4>[    1.051471] <<-GTP-INFO->> GTP I2C Address: 0x5d
<7>[    1.051493] of_get_named_gpio_flags exited with status 229
<7>[    1.051504] of_get_named_gpio_flags exited with status 230
<7>[    1.051516] _gpio_request: gpio-229 (GTP INT IRQ) status -16
<4>[    1.051525] <<-GTP-ERROR->> Failed to request GPIO:229, ERRNO:-16
<4>[    1.051551] <<-GTP-INFO->> Guitar reset
<4>[    1.176930] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177112] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177286] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177457] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177629] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177800] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.177971] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.178141] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.178311] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.178482] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 3223937Khz) is too high!
<4>[    1.179390] <<-GTP-ERROR->> I2C Read: 0x8047, 1 bytes failed, errcode: -11! Process reset.
<4>[    1.179402] <<-GTP-INFO->> Guitar reset
<4>[    1.294964] <<-GTP-ERROR->> GTP i2c test failed time 1.
<4>[    1.314658] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.315180] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.315701] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.316221] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.316740] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.317260] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.317778] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.318298] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.318816] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.319335] rockchip_i2c ff660000.i2c: Warning: addr[0x005d] msg[0].scl_rate( = 0Khz) is too low!
<4>[    1.322341] <<-GTP-ERROR->> I2C Read: 0x8047, 1 bytes failed, errcode: -11! Process reset.
<4>[    1.322353] <<-GTP-INFO->> Guitar reset
<4>[    1.432720] <<-GTP-ERROR->> GTP i2c test failed time 2.
<4>[    1.459903] <<-GTP-ERROR->> I2C Read: 0x8047, 1 bytes failed, errcode: -11! Process reset.
<4>[    1.459917] <<-GTP-INFO->> Guitar reset
<4>[    1.570483] <<-GTP-ERROR->> GTP i2c test failed time 3.
<4>[    1.597673] <<-GTP-ERROR->> I2C Read: 0x8047, 1 bytes failed, errcode: -11! Process reset.
<4>[    1.597687] <<-GTP-INFO->> Guitar reset
<4>[    1.708243] <<-GTP-ERROR->> GTP i2c test failed time 4.
<4>[    1.735426] <<-GTP-ERROR->> I2C Read: 0x8047, 1 bytes failed, errcode: -11! Process reset.
<4>[    1.735438] <<-GTP-INFO->> Guitar reset
<4>[    1.846005] <<-GTP-ERROR->> GTP i2c test failed time 5.
<4>[    1.865686] <<-GTP-ERROR->> I2C communication ERROR!
<4>[    1.879869] <<-GTP-ERROR->> I2C Read: 0x8140, 6 bytes failed, errcode: -11! Process reset.
<4>[    1.879882] <<-GTP-INFO->> Guitar reset
<4>[    1.993603] <<-GTP-ERROR->> GTP read version failed
<4>[    1.993616] <<-GTP-ERROR->> Read version failed.
<4>[    2.001135] <<-GTP-ERROR->> I2C Read: 0x41E4, 1 bytes failed, errcode: -11! Process reset.
<4>[    2.001148] <<-GTP-INFO->> Guitar reset
<4>[    2.119199] <<-GTP-ERROR->> I2C Read: 0x41E4, 1 bytes failed, errcode: -11! Process reset.
<4>[    2.119212] <<-GTP-INFO->> Guitar reset
<4>[    2.229769] <<-GTP-ERROR->> Firmware error, no config sent!
<4>[    2.229781] <<-GTP-ERROR->> GTP init panel failed.
<4>[    2.229814] <<-GTP-INFO->> create proc entry gt9xx_config success
<6>[    2.229973] input: goodix-ts as /devices/virtual/input/input0
<4>[    2.230141] <<-GTP-DEBUG->> [1745]INT trigger type:1
<4>[    2.230155] <<-GTP-ERROR->> Request IRQ failed!ERRNO:-22.
<4>[    2.230176] <<-GTP-INFO->> GTP works in polling mode.
<4>[    2.230190] <<-GTP-INFO->> Applied memory size:2562.
<4>[    2.230202] <<-GTP-INFO->> I2C function: without pre and end cmd!
<4>[    2.230230] <<-GTP-INFO->> Create proc entry success!

1、解決方法:

通過示波器捕捉上升沿信號,增大旁路電容1uF,來增加tr上升沿時間!

 

2、解決方法:

修改dts設備樹,觸摸屏觸發方式0x5d低電平觸發

3、解決方法:

//修改I2C傳輸速率
/*******************************************************
Function:
    Read data from the i2c slave device.
Input:
    client:     i2c device.
    buf[0~1]:   read start address.
    buf[2~len-1]:   read data buffer.
    len:    GTP_ADDR_LENGTH + read bytes count
Output:
    numbers of i2c_msgs to transfer: 
      2: succeed, otherwise: failed
*********************************************************/
s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
{
    struct i2c_msg msgs[2];
    s32 ret=-1;
    s32 retries = 0;

    GTP_DEBUG_FUNC();

    msgs[0].flags = !I2C_M_RD;
    msgs[0].addr  = client->addr;
    msgs[0].len   = GTP_ADDR_LENGTH;
    msgs[0].buf   = &buf[0];
    msgs[0].scl_rate = 100 * 1000;    // for Rockchip, etc.
    
    msgs[1].flags = I2C_M_RD;
    msgs[1].addr  = client->addr;
    msgs[1].len   = len - GTP_ADDR_LENGTH;
    msgs[1].buf   = &buf[GTP_ADDR_LENGTH];
    msgs[1].scl_rate = 100 * 1000;

    while(retries < NUMI2C)
    {
        ret = i2c_transfer(client->adapter, msgs, 2);
        if(ret == 2)break;
        retries++;
    }
...
}

/*******************************************************
Function:
    Write data to the i2c slave device.
Input:
    client:     i2c device.
    buf[0~1]:   write start address.
    buf[2~len-1]:   data buffer
    len:    GTP_ADDR_LENGTH + write bytes count
Output:
    numbers of i2c_msgs to transfer: 
        1: succeed, otherwise: failed
*********************************************************/
s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len)
{
    struct i2c_msg msg;
    s32 ret = -1;
    s32 retries = 0;

    GTP_DEBUG_FUNC();

    msg.flags = !I2C_M_RD;
    msg.addr  = client->addr;
    msg.len   = len;
    msg.buf   = buf;
    msg.scl_rate = 100 * 1000;    // for Rockchip, etc

    while(retries < NUMI2C)
    {
        ret = i2c_transfer(client->adapter, &msg, 1);
        if (ret == 1)break;
        retries++;
    }
...
}

//定義GTP_CUSTOM_CFG,上升沿觸發
...
#define GTP_MAX_HEIGHT   800
#define GTP_MAX_WIDTH    1280
#define GTP_INT_TRIGGER  0    // 0: Rising 1: Falling
...
config[RESOLUTION_LOC]     = (u8)GTP_MAX_WIDTH;
config[RESOLUTION_LOC + 1] = (u8)(GTP_MAX_WIDTH>>8);
config[RESOLUTION_LOC + 2] = (u8)GTP_MAX_HEIGHT;
config[RESOLUTION_LOC + 3] = (u8)(GTP_MAX_HEIGHT>>8);

if (GTP_INT_TRIGGER == 0)  //RISING
{
	config[TRIGGER_LOC] &= 0xfe; 
}  
...


4、解決方法:

修改設備樹配置cfg-group0

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章