【RV1126】调试GT911,1024x600 7寸 MIPI 电容触摸屏

文章目录

  • 一、驱动注册失败
  • 二、触摸屏可以触摸,但是x轴数据反了
  • 三、可以触摸了,但是Y轴数据跳变,几乎只有一半的屏幕是可以正常滑动的
  • 三、汇顶触摸屏配置文件解析
  • 四、使用新的配置文件
    • 4.1 新配置解决问题
    • 4.2 测试触摸的方法
      • 在kernel增加frame buffer(/dev/fb0)设备节点
      • 在buildroot中配置增加tslib
    • 4.3 测试
  • 五、工作一段时间触摸屏驱动崩溃
  • 六、在LVGL中的触摸修改:上下滑动方向相反

硬件:易百纳38x38mm RV1126板
SDK:2.2

一、驱动注册失败

上电信息中出现如下:

[    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

解决:在kernel/drivers/input/touchscreen/gt9xx/gt9xx.c驱动中搜索“no max-x defined”的关键句;发现设备树中没有配置tp-size属性,根据代码的理解是选择触摸屏芯片的型号(若代码中没有对应的芯片型号,可以自己添加):

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;
	}

在设备树文件/kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts修改增加tp-size为如下:

&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>;
        };
};

解决了:

[    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” 这个参数表面看是 tp 的尺寸,实际在代码中通过这个参数来选择配置信息和触摸调整,在源码中根据 tp-size 设置 tp 方向是否需要镜像、切换,还有需要使用的配置参数。
如果 bgt927 设置为 TRUE,其他的 bgtxxx 都要设置 FALSE
开始调试时,下面三个参数都设置为 FALSE,然后根据 bgt927 选择配置参数,编译烧录后根据实际现象再调整下面三个参数
gtp_change-x2y:x、y交换方向
gtp_x_reverse:x 方向坐标镜像
gtp_y_reverse:y 方向左边镜像

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是读取设备树里的tp-size来获取的:用于调节触摸xy轴

二、触摸屏可以触摸,但是x轴数据反了

gt9xx.c驱动里面有调整X轴和Y轴数据方向代码,只需要修改下驱动即可;

m89or101 = FALSE;
bgt9271 = TRUE;
gtp_change_x2y = FALSE;    ===>X轴和Y轴数据交换
gtp_x_reverse = TRUE;      ===>X轴数据反转
gtp_y_reverse = TRUE;      ===>XY轴数据反转

如果上面配置修改没有起作用,看下代码哪里做了判断,修改如下即可触摸正常:

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

三、可以触摸了,但是Y轴数据跳变,几乎只有一半的屏幕是可以正常滑动的

参考:RK3399触摸不准,修改drivers中gt9xx.h的cfg

文件目录kernel/drivers/input/touchscreen/gt9xx/gt9xx.h打开这个调试宏

#define DEBUG_SWITCH  1

Debug看日志

[    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.

这句话:

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

那问题就很明显了,应该是cfg不对,X轴和Y轴的最大尺寸是错的!

根据文件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_ */

对应的配置文件gtp_dat_gt11居然用的分辨率是<1200, 1920>,所以确定是:kernel/drivers/input/touchscreen/gt9xx/gt9xx_cfg.h文件里面的配置出错了!

需要找供应商要触摸屏的cfg文件,不然无解!

三、汇顶触摸屏配置文件解析

参考:汇顶GT9xxx触摸配置

使用汇顶Gt9xxx触摸屏,需要修改 drivers/input/touchscreen/gt9xxnewgt9xx.h 来更改分辨率

在这里插入图片描述测试校验和的工具:

#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();
}

四、使用新的配置文件

4.1 新配置解决问题

千方百计搞到一个可以使用的配置文件。

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

终于可以用了!

最后的配置(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;
...

设备树(rv1109-38-v10-spi-nand.dts)相关的部分:

&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 测试触摸的方法

在kernel增加frame buffer(/dev/fb0)设备节点

RV1126文件系统下面没有/dev/fb0设备节点:
进入kernel

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

进入配置:

修改位置一,如下:
在这里插入图片描述修改

位置二,如下:

在这里插入图片描述

之后重新编译生成固件烧写到开发板。

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

在buildroot中配置增加tslib

在这里插入图片描述

在上电后在/etc/profile文件中增加字段:
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 测试

  • 校准:ts_calibrate
  • 打印原始值:ts_print_mt
    • 确定左上角是0,0,右下角是1024,600
    • 观察数据,手指从左上角连续滑动到右上角,是否数据是连续增加的?但凡有不连续,掉数据、跳数据的都是有问题的。

五、工作一段时间触摸屏驱动崩溃

在上面触摸屏数据没有问题后,驱动工作一段时间就崩溃,驱动崩溃的log信息如下:

[ 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

解决方法:
在GT911.cfg配置文件中根据下面的内容
在这里插入图片描述将第7个字节中的触发方式改成上升沿触发,就好了。改完以后要将第184位的校验码减1。或者按照上面的校验工具计算一下。

六、在LVGL中的触摸修改:上下滑动方向相反

在开发板中运行例程lv_port_linux_frame_buffer,触摸左右滑动正常,但是上下滑动是反的。直接修改:
从触摸屏事件回调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);

修改:

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;
            }
        } 
        ...
}

触摸屏事件是ABS_MT_POSITION_XABS_MT_POSITION_Y这里,由于上下滑动是相反的,所以直接在ABS_MT_POSITION_Y上下方向的最大值600减去得到的值就可以了。

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

滑动就都正常了。

复盘了一下,这个问题画了一个礼拜才解决!花的时间35H+。不过收获真的太多了!第一次深入研究这个驱动这么久!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/3847.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【学习经验分享NO.21】学习资料分享(持续更新)

本博客将收集整理人工智能深度学习相关资料&#xff0c;进行整理&#xff0c;供大家学习使用。如果有需要帮忙整理的请留言。将不断更新&#xff0c;请持续关注。 一、深度学习论文资料 链接&#xff1a;https://pan.baidu.com/s/18LO5df0dp9-IE8Z3aFyrPg 提取码&#xff1a;c…

记录springboot+vue+fastdfs实现简易的文件(上传、下载、删除、预览)操作

前言说明&#xff1a;springboot vue FastDFS实现文件上传&#xff08;支持预览&#xff09;升级版 FASTDFS部分 FASTDFS安装过程&#xff1a;基于centos 7安装FastDFS文件服务器 SpringBoot部分 springboot源码实现 package com.core.doc.controller;import com.baomid…

【多线程】CAS

✨个人主页&#xff1a;bit me&#x1f447; ✨当前专栏&#xff1a;Java EE初阶&#x1f447; 目 录&#x1f40d;一. 什么是 CAS&#x1f98e;二. CAS 是怎么实现的&#x1f996;三. CAS 典型应用场景&#x1f436;1. 实现原子类&#x1f431;2. 实现自旋锁&#x1f995;四. …

进程间通信----信号量

文章目录信号量1. 问题2. 什么是信号量3. 信号量的使用4. 信号量的控制6. 实例信号量 1. 问题 程序中&#xff0c;有时存在一种特殊代码&#xff0c;最多只允许一个进程执行该部分代码。这部分区域&#xff0c;称为“临界区” 然而在多进程并发执行时&#xff0c;当一个进程进…

Pseudo-completeness(前中序遍历确定后序遍历)

题目链接&#xff1a;题目详情 - 7-16 Pseudo-completeness (pintia.cn) 样例1输入&#xff1a; 7 4 2 5 1 6 3 7 1 2 4 5 3 6 7样例1输出&#xff1a; 1 4 5 2 6 7 3 1样例2输入&#xff1a; 10 8 4 9 2 10 5 1 6 3 7 1 2 4 8 9 5 10 3 6 7样例2输出&#xff1a; 2 8 9 4…

启动容器(后台模式)

使用以下命令创建一个以进程方式运行的容器 rootLAPTOP-B38J348H:~# docker run -d ubuntu:15.10 /bin/sh -c "while true; do echo hello world ; sleep 1; done" 在输出中&#xff0c;我们没有看到期望的 "hello world"&#xff0c;而是一串长字符 f7…

IDEA的全新UI可以在配置里启用了,快来试试吧!

刚看到IDEA官方昨天发了这样一条推&#xff1a;IDEA的新UI可以在2022.3版本上直接使用了&#xff01;开启方法如下&#xff1a;打开IDEA的Setting界面&#xff0c;在Appearance & Behavior下有个被标注为Beta标签的New UI菜单&#xff0c;具体如下图&#xff1a;勾选Enable…

ChartGPT多重插补法 填充缺失点

问题描述已知时间戳与对应的值&#xff0c;需要根据时间戳找到缺失的点&#xff0c;然后进行值的填充。例如&#xff1a;源码<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 --><dependency><groupId>org.apache.commons</gr…

【微信小程序】-- uni-app 项目-- 配置 tabBar 效果(五十一)

&#x1f48c; 所属专栏&#xff1a;【微信小程序开发教程】 &#x1f600; 作  者&#xff1a;我是夜阑的狗&#x1f436; &#x1f680; 个人简介&#xff1a;一个正在努力学技术的CV工程师&#xff0c;专注基础和实战分享 &#xff0c;欢迎咨询&#xff01; &…

【C++进阶】智能指针

文章目录为什么需要智能指针&#xff1f;内存泄漏什么是内存泄漏&#xff0c;内存泄漏的危害内存泄漏分类&#xff08;了解&#xff09;如何避免内存泄漏智能指针的使用及原理smart_ptrauto_ptrunique_ptrshared_ptr线程安全的解决循环引用weak_ptr删除器为什么需要智能指针&am…

HJZS电源监视继电器HJZS-E202 AC220V

系列型号&#xff1a; HJZS-E202断电延时继电器 HJZS-E002断电延时继电器 一 应用 HJZS-E202电源监视继电器用于直流或交流操作的各种保护和自动控制的装置中&#xff0c;用以增加触点数量。 二 安装结构 导轨安装9壳体结构&#xff0c;具体尺寸参阅外型尺寸图。 三 产品型号…

蓝桥杯刷题冲刺 | 倒计时14天

作者&#xff1a;指针不指南吗 专栏&#xff1a;蓝桥杯倒计时冲刺 &#x1f43e;马上就要蓝桥杯了&#xff0c;最后的这几天尤为重要&#xff0c;不可懈怠哦&#x1f43e; 文章目录1.最长递增2.走迷宫3.解立方根4.回文特判5.修改数组1.最长递增 题目 链接&#xff1a; 最长递增…

【Java版oj 】 day17杨辉三角形的变形、计算某字符出现次数

目录 一、杨辉三角形的变形 &#xff08;1&#xff09;原题再现 &#xff08;2&#xff09;问题分析 &#xff08;3&#xff09;完整代码 二、计算某字符出现次数 &#xff08;1&#xff09;原题再现 &#xff08;2&#xff09;问题分析 &#xff08;3&#xff09;完整代…

Python调用GPT3.5接口的最新方法

GPT3.5接口调用方法主要包括openai安装、api_requestor.py替换、接口调用、示例程序说明四个部分。 1 openai安装 Python openai库可直接通过pip install openai安装。如果已经安装openai&#xff0c;但是后续提示找不到ChatCompletion&#xff0c;那么请使用命令“pip instal…

【ArcGIS Pro二次开发】(18):地理处理工具类【Geoprocessing】补遗

ArcGIS Pro SDK 3.0中的Geoprocessing类是用于执行地理处理工具的核心类。地理处理工具是用于执行空间分析、数据转换、数据管理等任务的工具集&#xff0c;包括常见的空间分析工具、栅格处理工具、矢量处理工具、地图制图工具等。 之前有简单记录了下Geoprocessing工具的用法…

整理了一份github上比较热门的ChatGPT项目,值得收藏

ChatGPT已经火了一段时间了&#xff0c;但是&#xff0c;热度依旧是各大自媒体的热榜。由于&#xff0c;国内不能直接访问ChatGPT,国内的开发者依托OpenAI的接口&#xff0c;开发出一些ChatGPT的应用。今天就整理一下github上最热门的ChatGPT项目。 lencx/ChatGPT 该项目是Cha…

springboot校友社交系统

050-springboot校友社交系统演示录像开发语言&#xff1a;Java 框架&#xff1a;springboot JDK版本&#xff1a;JDK1.8 服务器&#xff1a;tomcat7 数据库&#xff1a;mysql 5.7&#xff08;一定要5.7版本&#xff09; 数据库工具&#xff1a;Navicat11 开发软件&#xff1a;e…

蓝桥杯第14天(Python版)

并查集的使用# 并查集模板 N400 fa[] def init(): # 初始化&#xff0c;默认自身为根接点for i in range(N):fa.append(i)def merge(x,y): # 发现可以合并&#xff0c;默认选x的根节点为根接点fa[find(x)]find(y)def find(x): # 相等就是根结点&#xff0c;不然就递归查找根…

Vue3监听器使用

watch(监听的对象或值, 回调函数&#xff08;参数新值&#xff0c;旧值&#xff09;, 配置项是对象{ immediate: true//立即监听--进入就会执行一次 deep&#xff1a;true //深度监听 }) 首先引入 import { ref, watch } from vue; 设置响应式数据 const num ref(1) …

【数据结构篇C++实现】- 栈

文章目录&#x1f680;一、栈的原理精讲&#x1f680;二、栈的算法实现⛳栈的顺序存储结构&#x1f389;&#xff08;一&#xff09;顺序栈1.栈的结构体定义2.栈的初始化3.判断空栈4.判断栈满5.元素入栈6.元素出栈7.获取栈顶元素&#x1f389;&#xff08;二&#xff09;共享栈…