【RV1126】Debug GT911, 1024x600 7-inch MIPI capacitive touch screen

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: kernel/drivers/input/touchscreen/gt9xx/gt9xx.cSearch the key sentence of "no max-x defined" in the driver; find that the tp-size attribute is not configured in the device tree, and according to the understanding of the code, select the model of the touch screen chip (if there is no corresponding chip model in the code, you can Add to):

if (of_property_read_u32(np, "tp-size", &val)) {
    
    
    	dev_err(&client->dev, "no max-x defined\n");
    	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;
	}

The modification in the device tree file /kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dtsis added tp-sizeas 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 = <&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

The parameter "tp-size" 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 what else needs to be used. configuration parameters.
If bgt927 is set to TRUE, other bgtxxx must be set to FALSE.
When starting debugging, the following three parameters are all set to FALSE, and then select the configuration parameters according to bgt927. After compiling and burning, adjust the following three parameters
gtp_change-x2y according to the actual situation: X, y exchange direction
gtp_x_reverse: coordinate mirroring in x direction
gtp_y_reverse: left mirroring in 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轴和Y轴数据交换
gtp_x_reverse = TRUE;      ===>X轴数据反转
gtp_y_reverse = TRUE;      ===>XY轴数据反转

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 && !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 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.hto 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 documentkernel/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_gt11actually uses a resolution of <1200, 1920>, so it is certain that kernel/drivers/input/touchscreen/gt9xx/gt9xx_cfg.hthe configuration in the 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

insert image description hereTools 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)&&(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----------\n",i+1);
		printf("lcd_x_pix = %d\n",(list[i][1])|list[i][2]<<8);
		printf("lcd_y_pix = %d\n",(list[i][3])|list[i][4]<<8);
		printf("sum_check = 0x%2x\n",sum_check);
		printf("sum       = 0x%2x\n",list[i][184]);
		if(sum_check == list[i][184])
			printf("check ok\n");
		else
			printf("check error!!!\n");
    }
    return a.exec();
}

Fourth, use the 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!

Final config( 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\n",
			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\n");
	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, &rst_flags);
    ts->pwr_pin = of_get_named_gpio_flags(np, "power-gpio", 0, &pwr_flags);
    //ts->tp_select_pin = of_get_named_gpio_flags(np, "tp-select-gpio", 0, &tp_select_flags);
/*    if (of_property_read_u32(np, "max-x", &val)) {
    	dev_err(&client->dev, "no max-x defined\n");
    	return -EINVAL;
    }
    //ts->abs_x_max = val;
    if (of_property_read_u32(np, "max-y", &val)) {
    	dev_err(&client->dev, "no max-y defined\n");
    	return -EINVAL;
    }*/
    //ts->abs_y_max = val;
    if (of_property_read_u32(np, "configfile-num", &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 = <&backlight>;
		//power-supply = <&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
		];
		
		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 = <&vcc18_lcd_n>;
			status ="okay";
        };
};

4.2 Methods of testing touch

Add frame buffer (/dev/fb0) device node in 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 image description heremodify

Position two, as follows:

insert image description here

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

make ARCH=arm savedefconfig // 将.config 保存为 deconfig
cp defconfig arch/arm/configs/rv1126_defconfig
cd ..
./build.sh kernel

Configure and add tslib in buildroot

insert image description here

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 the original value:ts_print_mt
    • Make sure the upper left corner is 0,0and the lower right corner is1024,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 period of time

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:
In the GT911.cfg configuration file,
insert image description herechange the trigger mode in the seventh byte to rising edge trigger according to the following content, 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: Up and down sliding direction 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. Direct modification:
Call back from the touch screen event 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; // 这里修改
    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, &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; // 在这里修改
                #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 event is ABS_MT_POSITION_Xthe same as ABS_MT_POSITION_Yhere. Since the up and down sliding is opposite, it is ABS_MT_POSITION_Yenough to directly subtract the obtained value from the maximum value of 600 in the up and down direction.
Will

else if(in.code == ABS_MT_POSITION_Y)
#if EVDEV_SWAP_AXES
    evdev_root_x = in.value; // 在这里修改
#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; // 在这里修改
#else
    evdev_root_y = in.value;
#endif

Swipe is normal.

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

Guess you like

Origin blog.csdn.net/qq_28877125/article/details/129718120