RV1126Debug GT911, 1024×600 7-inch MIPI capacitive touch screen

Article directory

  • 1. Driver registration failed
  • 2. The touch screen can be touched, but the x-axis data is reversed
  • 3. It can be touched, but the Y-axis data jumps, and only half of the screen can be slid normally
  • 3. Goodix touch screen configuration file analysis
  • Fourth, use the new configuration file
    • 4.1 New configuration solves the problem
    • 4.2 Methods of testing touch
      • Add frame buffer (/dev/fb0) device node in kernel
      • Configure and add tslib in buildroot
    • 4.3 Testing
  • 5. The touch screen driver crashes after working for a period of time
  • 6. Touch modification in LVGL: Up and down sliding direction is opposite

Hardware: Ebaina 38x38mm RV1126 board
SDK: 2.2

1. Driver registration failed

The power-on information appears as follows:

[ 0.403505] i2c /dev entries driver
[ 0.406719] goodix_ts_probe() start
[ 0.406762] Goodix-TS 3-005d: no max-x defined
[ 0.406797] Goodix-TS: probe of 3-005d failed with error -22

Solution: Search for the key sentence of “no max-x defined” in the kernel/drivers/input/touchscreen/gt9xx/gt9xx.c driver; find that the tp-size attribute is not configured in the device tree, according to the code The understanding is to select the model of the touch screen chip (if there is no corresponding chip model in the code, you can add it yourself):

if (of_property_read_u32(np, "tp-size", & amp;val)) {<!-- -->
    dev_err( &client->dev, "no max-x defined\\
");
    return -EINVAL;
    }

if (val == 89) {<!-- -->
m89or101 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 101) {<!-- -->
m89or101 = FALSE;
gtp_change_x2y = TRUE;
gtp_x_reverse = TRUE;
gtp_y_reverse = FALSE;
} else if (val == 911) {<!-- -->
m89or101 = FALSE;
bgt911 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 970) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = TRUE;
gtp_change_x2y = FALSE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 910) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = FALSE;
bgt910 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
}

Modify and add tp-size in the device tree file /kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts as follows:

 &i2c3 {<!-- -->
status = "okay";
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = < & i2c3m1_xfer>;
gt9xx: gt9xx@5d {<!-- -->
compatible = "goodix,gt9xx";
reg = <0x5d>;
// gtp_ics_slot_report;
touch-gpio = < & gpio2 RK_PA6 IRQ_TYPE_EDGE_RISING>;
reset-gpio = < & gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
max-x = <1024>;
max-y = <600>;
tp-size = <911>;
// power-supply = < & amp;vcc18_lcd_n>;
        };
};

solved:

[ 0.403886] i2c /dev entries driver
[ 0.407113] goodix_ts_probe() start
[ 0.407181] Goodix-TS 3-005d: 3-005d supply tp not found, using dummy regulator
[ 0.407292] Goodix-TS 3-005d: Linked as a consumer to regulator.0
[ 0.579130] input: goodix-ts as /devices/platform/ff520000.i2c/i2c-3/3-005d/input/input0

“tp-size” This parameter appears to be the size of tp on the surface. In fact, this parameter is used to select configuration information and touch adjustments in the code. In the source code, according to tp-size, the direction of tp needs to be mirrored, switched, and needs to be used configuration parameters.
If bgt927 is set to TRUE, all other bgtxxx are set to FALSE
When starting debugging, the following three parameters are all set to FALSE, then select the configuration parameters according to bgt927, and then adjust the following three parameters according to the actual phenomenon after compiling and burning
gtp_change-x2y: x, y exchange direction
gtp_x_reverse: coordinate mirroring in the x direction
gtp_y_reverse: Mirror left in the y direction

if (val == 89) {<!-- -->
m89or101 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 101) {<!-- -->
m89or101 = FALSE;
gtp_change_x2y = TRUE;
gtp_x_reverse = TRUE;
gtp_y_reverse = FALSE;
} else if (val == 911) {<!-- -->
m89or101 = FALSE;
bgt911 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 970) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = TRUE;
gtp_change_x2y = FALSE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 910) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = FALSE;
bgt910 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
}

val is obtained by reading the tp-size in the device tree: used to adjust the touch xy axis

2. The touch screen can be touched, but the x-axis data is reversed

The gt9xx.c driver has codes for adjusting the data direction of the X-axis and Y-axis, you only need to modify the driver;

m89or101 = FALSE;
bgt9271 = TRUE;
gtp_change_x2y = FALSE; ===>X-axis and Y-axis data exchange
gtp_x_reverse = TRUE; ===>X-axis data reversal
gtp_y_reverse = TRUE; ===>XY axis data reversal

If the above configuration modification does not work, see where the code has made a judgment, and modify it as follows to touch normal:

//if (!bgt911 & amp; & amp; !bgt970) {<!-- -->
if (gtp_x_reverse)
x = ts->abs_x_max - x;
if (gtp_y_reverse)
y = ts->abs_y_max - y;
// }

3. It can be touched, but the Y-axis data jumps, and almost only half of the screen can be slid normally

Reference: RK3399 is not allowed to touch, modify the cfg of gt9xx.h in drivers

File directory kernel/drivers/input/touchscreen/gt9xx/gt9xx.h to open this debug macro

#define DEBUG_SWITCH 1

Debug to see the log

[ 0.403131] <<-GTP-INFO->> GTP driver installing...
[ 0.403670] i2c /dev entries driver
[ 0.406933] goodix_ts_probe() start
[ 0.406968] <<-GTP-INFO->> GTP Driver Version: V2.2<2014/01/14>
[ 0.406983] <<-GTP-INFO->>GTP I2C Address: 0x5d
[ 0.407028] Goodix-TS 3-005d: 3-005d supply tp not found, using dummy regulator
[ 0.407138] Goodix-TS 3-005d: Linked as a consumer to regulator.0
[ 0.432077] <<-GTP-INFO->> Guitar reset
[ 0.556023] <<-GTP-INFO->> Chip Type: GOODIX_GT9
[ 0.556497] <<-GTP-INFO->> IC Version: 911_1060
[ 0.556524] <<-GTP-INFO->> <gtp_init_panel>_1429
[ 0.556524]
[ 0.556551] <<-GTP-DEBUG->> [1459]Config Groups' Lengths: 186, 0, 0, 0, 0, 0
[ 0.556888] <<-GTP-INFO->> CTP_CONFIG_GROUP1 used, config length: 186
[ 0.557242] <<-GTP-DEBUG->> [1534] CFG_GROUP1 Config Version: 67, 0x43; IC Config Version: 65, 0x41
[ 0.557269] <<-GTP-INFO->> <gtp_init_panel>_1538
[ 0.557269]
[ 0.557297] <<-GTP-INFO->> <gtp_init_panel>_1603 <4096, 4096>
[ 0.557297]
[ 0.557315] <<-GTP-INFO->> <gtp_init_panel>_1605
[ 0.557315]
[ 0.557332] <<-GTP-INFO->> <gtp_init_panel>_1644
[ 0.557332]
[ 0.557353] <<-GTP-INFO->> Driver send config.
[ 0.563126] <<-GTP-INFO->> X_MAX: 4096, Y_MAX: 4096, TRIGGER: 0x01
[ 0.578615] <<-GTP-INFO->> create proc entry gt9xx_config success
[ 0.578938] input: goodix-ts as /devices/platform/ff520000.i2c/i2c-3/3-005d/input/input0
[ 0.579234] <<-GTP-DEBUG->> [1870]INT trigger type: 1
[ 0.579560] <<-GTP-INFO->> <gtp_request_irq>_1884 ts->irq=81 ret=0
[ 0.579560]
[ 0.579596] <<-GTP-INFO->> <gtp_request_irq>_1914 ts->irq=81 ret=0
[ 0.579596]
[ 0.579618] <<-GTP-INFO->> GTP works in interrupt mode.

This sentence:

[ 0.563126] <<-GTP-INFO->> X_MAX: 4096, Y_MAX: 4096, TRIGGER: 0x01

The problem is obvious. It should be that the cfg is wrong, and the maximum size of the X-axis and Y-axis is wrong!

According to the file kernel/drivers/input/touchscreen/gt9xx/gt9xx_cfg.h

#ifndef _GOODIX_GT9XX_CFG_H_
#define _GOODIX_GT9XX_CFG_H_

/* CFG for GT911 */
u8 gtp_dat_gt11[] = {<!-- -->
/* <1200, 1920>*/
#include "WGJ89006B_GT911_Config_20140625_085816_0X43.cfg"
};

u8 gtp_dat_8_9[] = {<!-- -->
/* TODO: Puts your update firmware data here! */
/* <1920, 1200> 8.9 */
/* #include "WGJ89006B_GT9271_Config_20140625_085816_0X41.cfg" */
/* #include "WGJ10162_GT9271_Config_20140820_182456.cfg" */
#include "WGJ10162B_GT9271_1060_Config_20140821_1341110X42.cfg"
};

u8 gtp_dat_8_9_1[] = {<!-- -->
#include "GT9271_Config_20170526.cfg"
};

u8 gtp_dat_9_7[] = {<!-- -->
/* <1536, 2048> 9.7 */
#include "GT9110P_Config_20160217_1526_2048_97.cfg"
};

u8 gtp_dat_10_1[] = {<!-- -->
/* TODO: Puts your update firmware data here! */
/* <1200, 1920> 10.1 */
#include "WGJ10187_GT9271_Config_20140623_104014_0X41.cfg"
};

u8 gtp_dat_7[] = {<!-- -->
/* TODO: Puts your update firmware data here! */
/* <1024, 600> 7.0 */
#include "WGJ10187_GT910_Config_20140623_104014_0X41.cfg"
};

#endif /* _GOODIX_GT9XX_CFG_H_ */

The corresponding configuration file gtp_dat_gt11 actually uses the resolution <1200, 1920>, so it is sure to be: kernel/drivers/input/touchscreen/gt9xx/gt9xx_cfg. The configuration in the h file is wrong!

Need to find the cfg file of the touch screen from the supplier, otherwise there is no solution!

3. Goodix touch screen configuration file analysis

Reference: Goodix GT9xxx touch configuration

To use Goodix Gt9xxx touch screen, you need to modify drivers/input/touchscreen/gt9xxnewgt9xx.h to change the resolution

Tools for testing checksums:

#include <QCoreApplication>
#include <stdio.h>
#include <QDebug>
 
uint8_t CTP_CFG_GROUP1[]= {<!-- -->\
0x00,0x00,0x04,0x58,0x02,0x0A,0x0D,0x00,0x01,0x0A,
0x1E,0x0F,0x58,0x41,0x03,0x05,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x2E,0x0E,
0x2F,0x31,0xEB,0x04,0x00,0x00,0x00,0x22,0x02,0x1D,
0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
0x00,0x1E,0x50,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,
0xC8,0x21,0x00,0xAA,0x28,0x00,0x90,0x31,0x00,0x7C,
0x3B,0x00,0x6C,0x48,0x00,0x6C,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,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,
0x10,0x12,0x13,0x14,0x16,0x18,0x1C,0x1D,0x1E,0x1F,
0x20,0x21,0x22,0x24,0x26,0x28,0x29,0x2A,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0F,0x01};
 
uint8_t CTP_CFG_GROUP2[]= {<!-- -->\
        0x42,0x00,0x05,0x20,0x03,0x0A,0x3D,0x00,0x01,0x08,\
        0x28,0x0F,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x17,0x19,0x1D,0x14,0x8D,0x2D,0x88,\
        0x1E,0x20,0x31,0x0D,0x00,0x00,0x00,0x42,0x03,0x1D,\
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
        0x00,0x14,0x2D,0x94,0xD5,0x02,0x07,0x00,0x00,0x04,\
        0xAF,0x15,0x00,0x95,0x19,0x00,0x80,0x1E,0x00,0x70,\
        0x23,0x00,0x63,0x29,0x00,0x63,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,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
        0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0xFF,0xFF,\
        0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x02,0x04,0x06,0x07,0x08,0x0A,0x0C,\
        0x0F,0x10,0x11,0x12,0x13,0x19,0x1B,0x1C,0x1E,0x1F,\
        0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0xFF,0xFF,\
        0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x00,0xEE,0x01};
 
 
uint8_t SumCheck(uint8_t *data, int data_len)
{<!-- -->
    uint8_t sum_check = 0;
    for(int i = 0;(i<data_len) & amp; & amp;(i<1000);i ++ )
    {<!-- -->
        sum_check += data[i];
    }
    sum_check = ~sum_check;
    sum_check += 1;
    return sum_check;
}
 
int main(int argc, char *argv[])
{<!-- -->
    QCoreApplication a(argc, argv);
 
    uint8_t sum_check = 0;
    uint8_t *list[2] = {<!-- -->CTP_CFG_GROUP1,CTP_CFG_GROUP2};
    for(int i = 0;i<2;i ++ )
    {<!-- -->
sum_check = SumCheck(list[i],184);
printf("-------------num:%d----------\\
",i + 1);
printf("lcd_x_pix = %d\\
",(list[i][1])|list[i][2]<<8);
printf("lcd_y_pix = %d\\
",(list[i][3])|list[i][4]<<8);
printf("sum_check = 0x%2x\\
",sum_check);
printf("sum = 0x%2x\\
",list[i][184]);
if(sum_check == list[i][184])
printf("check ok\\
");
else
printf("check error!!!\\
");
    }
    return a.exec();
}

4. Use a new configuration file

4.1 New configuration solves the problem

Do everything possible to get a working configuration file.

GT911.cfg

0x41,0x00,0x04,0x58,0x02,0x0A,0x3C,0x00,0x02,0x54,0x28,0x0F,0x50,0x2D,0x03,0x05,0x00,0x00,0x00,0x00,0x40,0x00,0x04,0x18 ,0x1A,0x1E,0x14,0x87,0x28,0x0A,0x3C,0x44,0x15,0x0E,0x00,0x00,0x00,0xA9,0x03,0x1C,0x00,0x01,0x00,0x00,0x00,0x00,0xFF,0x5D,0x66 ,0x98,0x32,0x28,0x50,0x94,0xC5,0x02,0x07,0x00,0x00,0x01,0xA1,0x2A,0x00,0x91,0x31,0x00,0x85,0x38,0x00,0x7A,0x41,0x00,0x72,0x4A ,0x00,0x72,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,0xFF,0xFF ,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C ,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x24,0x26,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x01

Finally it works!

The final configuration (kernel/drivers/input/touchscreen/gt9xx/gt9xx_cfg.h):

#ifndef _GOODIX_GT9XX_CFG_H_
#define _GOODIX_GT9XX_CFG_H_

/* CFG for GT911 */
u8 gtp_dat_gt11[] = {<!-- -->
/* <1200, 1920>*/
// #include "WGJ89006B_GT911_Config_20140625_085816_0X43.cfg"
/* <1024, 600> 7.0 */
#include "GT911.cfg"
};
.....

gt9xx.c

...
if (val == 89) {<!-- -->
m89or101 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
} else if (val == 101) {<!-- -->
m89or101 = FALSE;
gtp_change_x2y = TRUE;
gtp_x_reverse = TRUE;
gtp_y_reverse = FALSE;
} else if (val == 911) {<!-- -->
m89or101 = FALSE;
bgt911 = TRUE;
gtp_change_x2y = FALSE;
gtp_x_reverse = TRUE;
gtp_y_reverse = TRUE;
} else if (val == 970) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = TRUE;
gtp_change_x2y = FALSE;
gtp_x_reverse = FALSE;
gtp_y_reverse = FALSE;
} else if (val == 910) {<!-- -->
m89or101 = FALSE;
bgt911 = FALSE;
bgt970 = FALSE;
bgt910 = TRUE;
gtp_change_x2y = TRUE;
gtp_x_reverse = FALSE;
gtp_y_reverse = TRUE;
}

ts->tp_regulator = devm_regulator_get( &client->dev, "tp");
if (IS_ERR(ts->tp_regulator)) {<!-- -->
dev_err( &client->dev, "failed to get regulator, %ld\\
",
PTR_ERR(ts->tp_regulator));
return PTR_ERR(ts->tp_regulator);
}

ret = regulator_enable(ts->tp_regulator);
if (ret < 0)
GTP_ERROR("failed to enable tp regulator\\
");
msleep(20);

    ts->irq_pin = of_get_named_gpio_flags(np, "touch-gpio", 0, (enum of_gpio_flags *)( &ts->irq_flags));
    ts->rst_pin = of_get_named_gpio_flags(np, "reset-gpio", 0, & amp;rst_flags);
    ts->pwr_pin = of_get_named_gpio_flags(np, "power-gpio", 0, & amp;pwr_flags);
    //ts->tp_select_pin = of_get_named_gpio_flags(np, "tp-select-gpio", 0, & amp;tp_select_flags);
/* if (of_property_read_u32(np, "max-x", & amp;val)) {
    dev_err( &client->dev, "no max-x defined\\
");
    return -EINVAL;
    }
    //ts->abs_x_max = val;
    if (of_property_read_u32(np, "max-y", & amp;val)) {
    dev_err( &client->dev, "no max-y defined\\
");
    return -EINVAL;
    }*/
    //ts->abs_y_max = val;
    if (of_property_read_u32(np, "configfile-num", & amp;val)) {<!-- -->
ts->cfg_file_num = 0;
    } else {<!-- -->
ts->cfg_file_num = val;
    }
    ts->pendown =PEN_RELEASE;
    ts->client = client;
...

Device tree (rv1109-38-v10-spi-nand.dts) related parts:

 &dsi {<!-- -->
status = "okay";

rockchip,lane-rate = <480>;
panel@0 {<!-- -->
compatible = "simple-panel-dsi";
reg = <0>;
//backlight = < & amp;backlight>;
//power-supply = < & amp;vcc18_lcd_n>;
prepare-delay-ms = <5>;
reset-delay-ms = <1>;
init-delay-ms = <80>;
disable-delay-ms = <10>;
unprepare-delay-ms = <5>;

width-mm = <165>;
height-mm = <100>;

dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
dsi,lanes = <4>;
panel-init-sequence = [
05 64 01 11
05 78 01 29
];
\t\t
display-timings {<!-- -->
native-mode = < & timing0>;

timing0: timing0 {<!-- -->
clock-frequency = <33359000>;
hactive = <1024>;
vactive = <600>;
hfront-porch = <50>;
hsync-len = <7>;
hback-porch = <50>;
vfront-porch = <18>;
vsync-len = <5>;
vback-porch = <17>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};

ports {<!-- -->
#address-cells = <1>;
#size-cells = <0>;

port@0 {<!-- -->
reg = <0>;
panel_in_dsi: endpoint {<!-- -->
remote-endpoint = < & dsi_out_panel>;
};
};
};
};

ports {<!-- -->
#address-cells = <1>;
#size-cells = <0>;

port@1 {<!-- -->
reg = <1>;
dsi_out_panel: endpoint {<!-- -->
remote-endpoint = < & panel_in_dsi>;
};
};
};
};

 &i2c3 {<!-- -->
        status = "okay";
        clock-frequency = <400000>;
  pinctrl-names = "default";
  pinctrl-0 = < & i2c3m1_xfer>;
        gt9xx: gt9xx@5d {<!-- -->
        compatible = "goodix,gt9xx";
       reg = <0x5d>;
      gtp_ics_slot_report;
       touch-gpio = < & gpio2 RK_PA6 IRQ_TYPE_EDGE_RISING>;
       reset-gpio = < & gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
    //max-x = <600>;
    //max-y = <1024>;
tp-size = <911>;
// power-supply = < & amp;vcc18_lcd_n>;
status ="okay";
        };
};

4.2 Method of testing touch

Increase the frame buffer (/dev/fb0) device node in the kernel

There is no /dev/fb0 device node under the RV1126 file system:
enter the kernel

cd kernel
make ARCH=arm rv1126_defconfig
make ARCH=arm menuconfig

Enter configuration:

Modify position one, as follows:
Insert picture description modification here

Position two, as follows:

Then recompile and generate firmware to burn to the development board.

make ARCH=arm savedefconfig // save .config as deconfig
cp defconfig arch/arm/configs/rv1126_defconfig
cd..
./build.sh kernel

Configure and add tslib in buildroot

Add fields to the /etc/profile file after power-on:
vi /etc/profile

export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none

4.3 Testing

  • Calibration: ts_calibrate
  • Print raw value: ts_print_mt
    • Make sure the upper left corner is 0,0 and the lower right corner is 1024,600
    • Observe the data, the finger slides continuously from the upper left corner to the upper right corner, does the data increase continuously? As long as there is discontinuity, data loss, and data jumping are all problematic.

5. The touch screen driver crashes after working for a while

After there is no problem with the above touch screen data, the driver crashes after working for a while, and the log information of the driver crash is as follows:

[ 7205.681477] irq 80: nobody cared (try booting with the "irqpoll" option)
[ 7205.681531] CPU: 0 PID: 367 Comm: dbus-daemon Tainted: G O 4.19.111 #2
[ 7205.681548] Hardware name: Generic DT based system
[ 7205.681592] [<b010f408>] (unwind_backtrace) from [<b010b96c>] (show_stack + 0x10/0x14)
[ 7205.681623] [<b010b96c>] (show_stack) from [<b089b5a4>] (dump_stack + 0x90/0xa4)
[ 7205.681654] [<b089b5a4>] (dump_stack) from [<b016f8a8>] (__report_bad_irq + 0x28/0xcc)
[ 7205.681681] [<b016f8a8>] (__report_bad_irq) from [<b016fcb0>] (note_interrupt + 0x28c/0x2dc)
[ 7205.681710] [<b016fcb0>] (note_interrupt) from [<b016cd8c>] (handle_irq_event_percpu + 0x5c/0x7c)
[ 7205.681741] [<b016cd8c>] (handle_irq_event_percpu) from [<b016cde4>] (handle_irq_event + 0x38/0x5c)
[ 7205.681771] [<b016cde4>] (handle_irq_event) from [<b0170b30>] (handle_edge_irq + 0x134/0x1e4)
[ 7205.681798] [<b0170b30>] (handle_edge_irq) from [<b016bf68>] (generic_handle_irq + 0x24/0x34)
[ 7205.681829] [<b016bf68>] (generic_handle_irq) from [<b03e5250>] (rockchip_irq_demux + 0x10c/0x1bc)
[ 7205.681858] [<b03e5250>] (rockchip_irq_demux) from [<b016bf68>] (generic_handle_irq + 0x24/0x34)
[ 7205.681887] [<b016bf68>] (generic_handle_irq) from [<b016c53c>] (__handle_domain_irq + 0x5c/0xb4)
[ 7205.681919] [<b016c53c>] (__handle_domain_irq) from [<b03d6d8c>] (gic_handle_irq + 0x3c/0x78)
[ 7205.681949] [<b03d6d8c>] (gic_handle_irq) from [<b0101a78>] (__irq_svc + 0x58/0x8c)
[ 7205.681967] Exception stack(0xdcc23cd8 to 0xdcc23d20)
[ 7205.681985] 3cc0: 9e9654d6 00000000
[ 7205.682009] 3ce0: 3e2b9000 b0c52d00 00000202 00000013 dcc22000 00000000 dcc23d28 dcc22000
[ 7205.682033] 3d00: dd364500 dcc23e2c 05355555 dcc23d28 0000000b b010215c 400f0153 ffffffff
[ 7205.682061] [<b0101a78>] (__irq_svc) from [<b010215c>] (__do_softirq + 0xa4/0x274)
[ 7205.682092] [<b010215c>] (__do_softirq) from [<b012ac98>] (irq_exit + 0xdc/0x10c)
[ 7205.682123] [<b012ac98>] (irq_exit) from [<b016c540>] (__handle_domain_irq + 0x60/0xb4)
[ 7205.682153] [<b016c540>] (__handle_domain_irq) from [<b03d6d8c>] (gic_handle_irq + 0x3c/0x78)
[ 7205.682181] [<b03d6d8c>] (gic_handle_irq) from [<b0101a78>] (__irq_svc + 0x58/0x8c)
[ 7205.682198] Exception stack(0xdcc23da8 to 0xdcc23df0)
[ 7205.682219] 3da0: eef0c140 00000002 00000000 0000a863 eef0c140 dd30c8c0
[ 7205.682243] 3dc0: b0d0b980 00000000 b08b15c4 dd30c8c0 dd364500 dcc23e2c 00000000 dcc23df8
[ 7205.682262] 3de0: b01479b8 b08b6244 600f0053 ffffffff
[ 7205.682292] [<b0101a78>] (__irq_svc) from [<b08b6244>] (_raw_spin_unlock_irq + 0x1c/0x4c)
[ 7205.682324] [<b08b6244>] (_raw_spin_unlock_irq) from [<b01479b8>] (finish_task_switch + 0x70/0x204)
[ 7205.682352] [<b01479b8>] (finish_task_switch) from [<b08b15c4>] (__schedule + 0x1fc/0x580)
[ 7205.682380] [<b08b15c4>] (__schedule) from [<b08b1998>] (schedule + 0x50/0xb4)
[ 7205.682410] [<b08b1998>] (schedule) from [<b08b5758>] (schedule_hrtimeout_range_clock + 0x150/0x15c)
[ 7205.682440] [<b08b5758>] (schedule_hrtimeout_range_clock) from [<b08b577c>] (schedule_hrtimeout_range + 0x18/0x20)
[ 7205.682472] [<b08b577c>] (schedule_hrtimeout_range) from [<b025074c>] (do_epoll_wait + 0x38c/0x510)
[ 7205.682502] [<b025074c>] (do_epoll_wait) from [<b0101000>] (ret_fast_syscall + 0x0/0x4c)
[ 7205.682520] Exception stack(0xdcc23fa8 to 0xdcc23ff0)
[ 7205.682542] 3fa0: 00000000 00000074 00000003 ae965608 00000040 ffffffff
[ 7205.682565] 3fc0: 00000000 00000074 0002e4ec 000000fc 00000001 ae965a48 00000002 00000053
[ 7205.682585] 3fe0: 000000fc ae9655e8 a6e4c9c5 a6dcd706
[ 7205.682599] handlers:
[ 7205.682624] [<96dc5706>] irq_default_primary_handler threaded [<ce5e0b64>] goodix_ts_irq_handler
[ 7205.682651] Disabling IRQ #80

Solution:
According to the following content in the GT911.cfg configuration file
Change the trigger mode in the seventh byte to rising edge trigger, and it will be fine. After the modification, the check code of the 184th bit should be subtracted by 1. Or calculate it according to the calibration tool above.

6. Touch modification in LVGL: the direction of sliding up and down is opposite

Run the routine lv_port_linux_frame_buffer on the development board, touch left and right sliding normally, but up and down sliding is reversed. Modify directly:
Enter from the touch screen event callback evdev_read:

 evdev_init();
    static lv_indev_drv_t indev_drv_1;
    lv_indev_drv_init( &indev_drv_1); /*Basic initialization*/
    indev_drv_1.type = LV_INDEV_TYPE_POINTER;

    /*This function will be called periodically (by the library) to get the mouse position and state*/
    indev_drv_1.read_cb = evdev_read; // modify here
    lv_indev_t *mouse_indev = lv_indev_drv_register( & indev_drv_1);

Revise:

void evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data)
{<!-- -->
    struct input_event in;

    while(read(evdev_fd, & amp;in, sizeof(struct input_event)) > 0) {<!-- -->
        if(in.type == EV_REL) {<!-- -->
            if(in.code == REL_X)
#if EVDEV_SWAP_AXES
                    evdev_root_y += in.value;
#else
evdev_root_x += in.value;
#endif
            else if(in.code == REL_Y)
#if EVDEV_SWAP_AXES
evdev_root_x += in.value;
#else
evdev_root_y += in.value;
#endif
        } else if(in.type == EV_ABS) {<!-- -->
            if(in.code == ABS_X)
#if EVDEV_SWAP_AXES
evdev_root_y = in.value;
#else
evdev_root_x = in. value;
#endif
            else if(in.code == ABS_Y)
#if EVDEV_SWAP_AXES
evdev_root_x = in. value;
#else
evdev_root_y = in.value;
#endif
            else if(in.code == ABS_MT_POSITION_X)
#if EVDEV_SWAP_AXES
                    evdev_root_y = in.value;
                #else
                    evdev_root_x = in. value;
                #endif
            else if(in.code == ABS_MT_POSITION_Y)
                #if EVDEV_SWAP_AXES
                    evdev_root_x = 600-in.value; // modify here
                #else
                    evdev_root_y = in.value;
                #endif
            else if(in.code == ABS_MT_TRACKING_ID) {<!-- -->
                if(in. value == -1)
                    evdev_button = LV_INDEV_STATE_REL;
                else if(in. value == 0)
                    evdev_button = LV_INDEV_STATE_PR;
            }
        }
        ...
}

The touch screen events are ABS_MT_POSITION_X and ABS_MT_POSITION_Y Here, since the up and down sliding is opposite, so directly subtract the maximum value of ABS_MT_POSITION_Y up and down from 600 value is fine.
Will

else if(in.code == ABS_MT_POSITION_Y)
#if EVDEV_SWAP_AXES
    evdev_root_x = in.value; // modify here
#else
    evdev_root_y = in.value;
#endif

Change to:

else if(in.code == ABS_MT_POSITION_Y)
#if EVDEV_SWAP_AXES
    evdev_root_x = 600-in.value; // modify here
#else
    evdev_root_y = in.value;
#endif

Swipe is normal.

After a review, this problem was solved after a week of drawing! Time spent 35H+. But the harvest is really too much! This is the first time I have studied this driver in depth for so long!