RK3566调试cst3xx触屏驱动

SDK中加入驱动文件

在kernel/driver/input/touchscreen下加入cst3xx的驱动文件夹,修改目前下的Makefile文件和Kconfig文件。

文件夹下的Makefile内容如下:

obj-$(CONFIG_TOUCHSCREEN_HYN_CST3XX)	+= hyn_cst3xx.o

Makefile文件加入:

obj-$(CONFIG_TOUCHSCREEN_HYN_CST3XX)	+= hyn_cst3xx/

Kconfig文件加入:

config TOUCHSCREEN_HYN_CST3XX
	tristate "hyn cst3xx based touchscreens"
	depends on I2C
	help
	  Say Y here if you have a hyn based touchscreen
	  controller.

	  If unsure, say N.

	  To compile this driver as a module, choose M here: the
	  module will be called hyn_ts.

在rk3566-rk817-tablet.dts中的i2c4下加入触屏节点:

&i2c4 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4m0_xfer>;
	clock-frequency = <400000>;
	i2c-scl-rising-time-ns = <138>;
	i2c-scl-falling-time-ns = <4>;

	ts@38 {
		compatible = "cst3xx";
		reg = <0x38>;
		irq-gpio = <&gpio3 RK_PD7 IRQ_TYPE_EDGE_RISING>;
		wake-gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_LOW>;
	};
};

irq-gpio为中断引脚,wake-gpio为复位引脚;

kernel中加入cst3xx的驱动

cd到kernel路径下,执行 make menuconfig ARCH=arm64,选中"hyn cst3xx based touchscreens"

RK3566调试cst3xx触屏驱动_第1张图片

然后选中"save"将新的配置保存到.config中,再执行:

cp .config arch/arm64/configs/rockchip_linux_defconfig

 将.config的内容保存到rockchip_linux_defconfig中,然后从新编译内核,退回上级目录,执行:

./build.sh kernel

编译成功之后,将新生成的boot.img烧写到主板上。

调试

烧写boot.img后,点击触摸屏界面无响应,需要进行问题排查。

查看启动日志中关于cst3xx的信息:

[root@RK356X:/]# dmesg | grep cst3xx
[    1.031378] cst3xx enter hyn_ts_probe
[    1.091606] hyn cst3xx Enter cst3xx_ts_init
[    1.091915] input: cst3xx as /devices/platform/fe5d0000.i2c/i2c-4/4-0038/input/input2
[    1.092150] cst3xx request ts->irq is :103

表明cst3xx初始化成功,作为input2输入设备;但是ts-irq的编号似乎不对,当前的gpio编号(GPIO3_D7)为127。

查看GPIO的输入输出状态:

[root@RK356X:/]# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/fdd60000.gpio, gpio0:
 gpio-5   (                    |xgpio-pin           ) out lo
 gpio-6   (                    |xgpio-pin           ) out hi
 gpio-20  (                    |reset               ) out hi

gpiochip1: GPIOs 32-63, parent: platform/fe740000.gpio, gpio1:
 gpio-42  (                    |reset               ) out hi
 gpio-56  (                    |pcie20_3v3          ) out hi

gpiochip2: GPIOs 64-95, parent: platform/fe750000.gpio, gpio2:
 gpio-77  (                    |bt_default_rts      ) in  hi
 gpio-79  (                    |bt_default_reset    ) out lo

gpiochip3: GPIOs 96-127, parent: platform/fe760000.gpio, gpio3:
 gpio-124 (                    |headset_gpio        ) in  lo
 gpio-125 (                    |reset               ) out hi
 gpio-126 (                    |cst3xx wake pin     ) out lo

gpiochip4: GPIOs 128-159, parent: platform/fe770000.gpio, gpio4:
 gpio-134 (                    |xgpio-pin           ) out lo
 gpio-136 (                    |bt_default_wake_host) in  hi
 gpio-137 (                    |bt_default_wake     ) in  lo
 gpio-146 (                    |mdio-reset          ) out hi

gpiochip5: GPIOs 509-511, parent: platform/rk805-pinctrl, rk817-gpio, can sleep:

其中没有关于gpio-127的描述。

监听触屏事件:

[root@RK356X:/]# evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "cst3xx"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event type 3 (EV_ABS)
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max       10
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      255
    Event code 50 (ABS_MT_WIDTH_MAJOR)
      Value      0
      Min        0
      Max      200
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      480
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      854
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

手指点击触屏,主板没有上报坐标。

查看中断情况:

[root@RK356X:/]# cat   /proc/interrupts
           CPU0       CPU1       CPU2       CPU3

103:   50954018          0          0          0     gpio3  31 Edge      cst3xx

可以看到cst3xx的中断管脚为gpio3 31,并且产生了50954018次中断。

排查硬件

中断管脚

通过万用表测量,TP_INT管脚输出的高电平为1.8V,但是处理器的I/O电平配置的3.3V,需要将触摸屏的I/O电平配置成VCC才行。和触屏厂家沟通后,确定配置的触屏I/O电压为1.8V,厂家重新配置了一个固件,并且寄了一个烧录工具,通过烧录工具将新固件烧录进触屏后,INT管脚输出的高电平为2.69V(VCC=3.3V的情况),还是没有完全正常。

复位管脚

处理器的GPIO与触摸屏的TP_RST管脚之间串联了一个100Ω的电阻,通过万用表测量处理器端GPIO的电压为0V,触摸屏的RST管脚的电压为2.18V,说明处理器的GPIO一直输出的是低电平,但是触摸屏的RST管脚有上拉电阻,所以经过分压之后RST管脚上有电压,且这个电压不足以使触摸屏复位。怀疑是厂家给的驱动有问题,询问厂家当前给的驱动是否匹配以及是否有适配的驱动,厂家回复当前的驱动需要修改,并发了新的驱动。

使用新驱动进行调试

根据新驱动加入dts节点:

&i2c4 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4m0_xfer>;
	clock-frequency = <400000>;
	i2c-scl-rising-time-ns = <138>;
	i2c-scl-falling-time-ns = <4>;

	hynitron@38 {
		compatible = "hynitron,hyn_ts";	
		reg = <0x38>;  					
		hynitron,reset-gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_LOW>; 
		hynitron,irq-gpio = <&gpio3 RK_PD7 IRQ_TYPE_EDGE_FALLING>; 	
		hynitron,max-touch-number = <5>;			
		hynitron,display-coords = < 480 854>;	

		hynitron,have-key;
		hynitron,key-number = <0>;	
		hynitron,key-code = <139 172 158>; 	
		hynitron,key-y-coord = <900 900 900>; 
		hynitron,key-x-coord = <100 300 400>;
	};
};

并替换驱动文件,然后编译,编译报了一些错,分析得知这些错是和debug相关的,所以将hynitron_config.h文件中相关的宏设置为0:

#define ANDROID_TOOL_SURPORT                0

#define HYN_SYSFS_NODE_EN                       0

并修改hynitron_core.c文件:

#if ANDROID_TOOL_SURPORT
	 hynitron_touch_setmode(hyn_ts_data->client,hyn_ts_data->work_mode,hyn_ts_data->config_chip_product_line==HYN_CHIP_PRODUCT_LINE_MUT_CAP);
#endif

加入ANDROID_TOOL_SURPORT编译条件。

编译成功之后,烧写boot.img到主板,主板启动之后,触摸屏还是不能使用。

获取触屏相关的开机日志:

[root@RK356X:/]# dmesg | grep HYN
[    1.088041] [HYN]hynitron_driver_init: Enter
[    1.088079] [HYN][Info]Driver version: Hynitron TouchScreen Rockchip Driver V2.1 20201222
[    1.088229] [HYN]hyn_probe: Enter
[    1.088246] [HYN]hyn_platform_data_init: Enter
[    1.088256] [HYN]hyn_parse_dt: Enter
[    1.088269] [HYN][Info]display x(480 ) y(854 )
[    1.088320] [HYN]DTS max touch number:5, irq gpio:127, reset gpio:126
[    1.088330] [HYN]hyn_parse_dt: Exit(1519)
[    1.088339] [HYN]hyn_gpio_configure: Enter
[    1.108392] [HYN]hyn_gpio_configure: Exit(1387)
[    1.108408] [HYN]hyn_ts_data_init: Enter
[    1.108420] [HYN]config [hyn] scan_id = 7,config_chip_type:0x9e.
[    1.108432] [HYN]client addr is different,now use default addr,please confirm. client->addr=0x5a, default iic addr=0x5a.
[    1.108444] [HYN]config_chip_type:0x9e,main_addr:0x5a,x_overturn=0,y_overturn=0,xy_exchange=0,.
[    1.108454] [HYN]hyn_ts_data_init: Exit(1561)
[    1.168489] [HYN]hyn_firmware_info: Enter
[    1.168503] [HYN]cst3xx_firmware_info: Enter
[    1.168713] [HYN]hyn_firmware_info: Exit(2454)
[    1.168726] [HYN][Error]hyn_firmware_info failed,start check boot.
[    1.168739] [HYN]cst3xxse_bootloader_enter: Enter
[    1.195768] [HYN] bootloader mode client->addr:0x5a.
[    1.224069] [HYN] bootloader mode client->addr:0x5a.
[    1.253277] [HYN] bootloader mode client->addr:0x5a.
[    1.283425] [HYN] bootloader mode client->addr:0x5a.
[    1.314551] [HYN] bootloader mode client->addr:0x5a.
[    1.314670] [HYN][Error]cst3xx_bootloader_enter error,please check VCC/RST/SDA/SCL and chip type.
[    1.314684] [HYN]exit bootloader mode,client->addr:0x5a.
[    1.374706] [HYN]hyn_detect_bootloader: Exit(2900)
[    1.374719] [HYN][Error]Touch Probe : detect hynitron ic type fail...
[    1.374765] [HYN]hyn_probe: Exit(1940)
[    1.374910] [HYN]hynitron_driver_init: Exit(2022)

分析日志得出,是器件I2C地址不匹配,当前触摸屏配置的I2C器件地址是0x38,而驱动中设置的是0x5A。

修改hynitron_core.h文件,

#define HYN_MAIN_IIC_ADDR_CONFIG                    0x5A

改为:

#define HYN_MAIN_IIC_ADDR_CONFIG                    0x38

修改之后,再次编译内核并且烧录,触摸屏还是没反应,获取触屏相关的开机日志:
 

[root@RK356X:/]# dmesg | grep HYN
[    1.413024] [HYN]hynitron_driver_init: Enter
[    1.413126] [HYN][Info]Driver version: Hynitron TouchScreen Rockchip Driver V2.1 20201222
[    1.413365] [HYN]hyn_probe: Enter
[    1.413396] [HYN]hyn_platform_data_init: Enter
[    1.413417] [HYN]hyn_parse_dt: Enter
[    1.413445] [HYN][Info]display x(480 ) y(854 )
[    1.413536] [HYN]DTS max touch number:5, irq gpio:127, reset gpio:126
[    1.413558] [HYN]hyn_parse_dt: Exit(1519)
[    1.413576] [HYN]hyn_gpio_configure: Enter
[    1.433649] [HYN]hyn_gpio_configure: Exit(1387)
[    1.433670] [HYN]hyn_ts_data_init: Enter
[    1.433690] [HYN]config [hyn] scan_id = 7,config_chip_type:0x9e.
[    1.433709] [HYN]config_chip_type:0x9e,main_addr:0x38,x_overturn=0,y_overturn=0,xy_exchange=0,.
[    1.433723] [HYN]hyn_ts_data_init: Exit(1561)
[    1.493755] [HYN]hyn_firmware_info: Enter
[    1.493769] [HYN]cst3xx_firmware_info: Enter
[    1.504280] [HYN][Info]the chip chip_ic_checkcode:0x0.
[    1.504296] [HYN][Error]cst3xx_firmware_info read error .
[    1.504307] [HYN]hyn_firmware_info: Exit(2454)
[    1.504316] [HYN][Error]hyn_firmware_info failed,start check boot.
[    1.504327] [HYN]cst3xxse_bootloader_enter: Enter
[    1.531352] [HYN] bootloader mode client->addr:0x5a.
[    1.559477] [HYN] bootloader mode client->addr:0x5a.
[    1.588703] [HYN] bootloader mode client->addr:0x5a.
[    1.618968] [HYN] bootloader mode client->addr:0x5a.
[    1.650170] [HYN] bootloader mode client->addr:0x5a.
[    1.650327] [HYN][Error]cst3xx_bootloader_enter error,please check VCC/RST/SDA/SCL and chip type.
[    1.650342] [HYN]exit bootloader mode,client->addr:0x38.
[    1.710364] [HYN]hyn_detect_bootloader: Exit(2900)
[    1.710377] [HYN][Error]Touch Probe : detect hynitron ic type fail...
[    1.710413] [HYN]hyn_probe: Exit(1940)
[    1.710564] [HYN]hynitron_driver_init: Exit(2022)

分析日志得出,驱动在进行一些firmware操作是出现了错误,修改hynitron_core.c文件中关于firmware的操作,主要是屏蔽int hyn_probe()函数中的一些操作:

/************************************************************************
* Name: hyn_probe
* Brief:
* Input:
* Output:
* Return:
***********************************************************************/
static int hyn_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
    int ret =-1;	
	struct hynitron_ts_data *ts_data = NULL;	
    HYN_FUNC_ENTER();

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		HYN_ERROR("I2C not supported");
		return -ENODEV;
	}
	/* malloc memory for global struct variable,init 0 */
	ts_data = kzalloc(sizeof(*ts_data), GFP_KERNEL);
	if (!ts_data) {
		HYN_ERROR("allocate memory for ts_data fail");
		return -ENOMEM;
	}
	hyn_ts_data=ts_data;
	ts_data->client = client;
	ts_data->dev = &client->dev;
	i2c_set_clientdata(client, ts_data);
	//ts_data->device_id = id->driver_data; //if null,may cause dump

	ret=hyn_platform_data_init(ts_data);
	if (ret<0) {
		HYN_ERROR("hyn_platform_data_init fail,please check DTS.");
		kfree(ts_data);
		return ret;
	}

	ret = hyn_gpio_configure(ts_data);
	if (ret<0) {
		HYN_ERROR("hyn_gpio_configure fail");
		return -1;
	}	
	hyn_ts_data_init(client); 
	
	mdelay(60);
	
	/* 11111111 */
//	ret=hyn_firmware_info(client);
//	if(ret<0){
//		HYN_ERROR("hyn_firmware_info failed,start check boot.\n");
//		ret=hyn_detect_bootloader(client);
//	    if (ret<0){
//	        HYN_ERROR("Touch Probe : detect hynitron ic type fail...");
//	        goto err_end;
//	    }
//		mdelay(30);
//	}else{
//		HYN_INFO("hyn_firmware_info success.\n");
//	}

	ret=hyn_input_dev_int(ts_data);
	if (ret<0){
        HYN_ERROR("Touch Probe : hyn_input_dev_int  fail...");
        goto err_end;
    }
	ret=hyn_irq_init(client);
	if (ret<0){
        HYN_ERROR("Touch Probe : hyn_irq_init  fail...");
        goto err_end;
    }	  
	hyn_irq_disable();	

	/* 22222222 */
//	ret=hyn_update_firmware_init(client);
//	if (ret<0){
//        HYN_ERROR("Touch Probe : hyn_update_firmware_init  fail...");
//        goto err_end;
//    }


#if ANDROID_TOOL_SURPORT
	ret = hynitron_proc_fs_init();
	if(ret<0) {
		HYN_ERROR("[create hyniyron proc fs node failed.\n");
	}
#endif

#if HYN_SYSFS_NODE_EN
	ret =hyn_create_sysfs(client);
	if (ret < 0) {
		HYN_ERROR("create hyniyron proc fs node failed.\n");
	}
#endif

#if HYN_GESTURE_EN
    hyn_gesture_init(hyn_ts_data->input_dev, client);
	if (ret<0){
        HYN_ERROR("Touch Probe : hyn_gesture_init  fail...");
    }
#endif

#if HYN_PSENSOR_EN
 	hyn_proximity_init();	
	if(ret<0){
        HYN_ERROR("Touch Probe : hyn_proximiy_init  fail...");
    }
#endif

#if HYN_ESDCHECK_EN
	hyn_esd_init();
#endif


#if   defined(CONFIG_FB)
		INIT_WORK(&ts_data->resume_work,hyn_ts_resume_work);
		ts_data->fb_notif.notifier_call = hyn_fb_notifier_callback;
		fb_register_client(&ts_data->fb_notif);
#elif defined(CONFIG_HAS_EARLYSUSPEND)
		ts_data->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1;
		ts_data->early_suspend.suspend=hyn_ts_early_suspend;
		ts_data->early_suspend.resume=hyn_ts_late_resume;
		register_early_suspend(&ts_data->early_suspend);
#else 	
	ts_data->tp.tp_suspend = hyn_ts_early_suspend;
	ts_data->tp.tp_resume = hyn_ts_late_resume;
  	tp_register_fb(&ts_data->tp);

#endif

    hyn_reset_proc(40);
    hyn_irq_enable();

    HYN_DEBUG("Touch Panel Device Probe %s!", (ret < 0) ? "FAIL" : "PASS");
    HYN_FUNC_EXIT();
	return 0;

err_end:
	if (gpio_is_valid(ts_data->pdata->reset_gpio))
		gpio_free(ts_data->pdata->reset_gpio);
	if (gpio_is_valid(ts_data->pdata->irq_gpio))
		gpio_free(ts_data->pdata->irq_gpio);
 
#if HYN_GESTURE_EN
    hyn_gesture_exit();
#endif

#if HYN_PSENSOR_EN
 	hyn_proximity_exit();	
#endif
#if ANDROID_TOOL_SURPORT
	hynitron_proc_fs_exit();
#endif
#if HYN_SYSFS_NODE_EN
	hyn_release_sysfs(hyn_ts_data->client);
#endif
   //if point is null,may cause dump
	if(hyn_ts_data->use_irq!=0)
	free_irq(hyn_ts_data->use_irq,NULL);
	//if(ts_data->input_dev!=NULL)
     //input_unregister_device(ts_data->input_dev);

	//if(ts_data->hyn_workqueue!=NULL)
    //destroy_workqueue(ts_data->hyn_workqueue);
	if(ts_data->pdata!=NULL)
	kfree(ts_data->pdata);
	if(ts_data!=NULL)
	kfree(ts_data);
    HYN_FUNC_EXIT();
    return ret;
}

增加/* 11111111 */和/* 22222222 */后面的注释。

修改之后,再次编译内核并且烧录,触摸屏还是没反应,通过日志分析得知执行request_threaded_irq()失败了,修改hyn_irq_registration(),屏蔽hyn_ts_data->use_irq = irq_of_parse_and_map(node, 0);

/*****************************************************************************
*  Name: hyn_irq_registration
*  Brief:
*  Input:
*  Output:
*  Return:
*****************************************************************************/
static int hyn_irq_registration(struct i2c_client *client)
{
    struct device_node *node = NULL;
    int ret = 0;


    HYN_FUNC_ENTER();
    node = of_find_matching_node(node, hyn_dt_match);

    if (node)
    {
//        hyn_ts_data->use_irq = irq_of_parse_and_map(node, 0);
        //free_irq(hyn_ts_data->use_irq,NULL);

	HYN_INFO("use_irq:%d", hyn_ts_data->use_irq);

        ret = request_threaded_irq(hyn_ts_data->use_irq, NULL,hyn_eint_interrupt_handler,
        hyn_ts_data->pdata->irq_gpio_flags, "Hynitron Touch Int", hyn_ts_data);   	

        if (ret == 0 ){
			HYN_INFO("IRQ request succussfully, irq=%d ,trigger_rising:%d .", hyn_ts_data->use_irq,HYN_IRQ_TRIGGER_RISING_CONFIG);
			client->irq = hyn_ts_data->use_irq;
#if HYN_GESTURE_EN
            enable_irq_wake(hyn_ts_data->use_irq);
#endif
		}
        else{
            HYN_ERROR("request_irq IRQ LINE NOT AVAILABLE!.ret:%d", ret ); 
			return -1;
        }
    }
    else
    {
        HYN_ERROR("Can not find touch eint device node!");
		return -1;
    }
    HYN_FUNC_EXIT();
    return 0;
}

驱动的hynitron_core.h文件中有如下定义:

#define HYN_IRQ_TRIGGER_RISING_CONFIG                0x01

配置驱动检测边沿为上升沿,而实际需要的驱动检测边沿为下降沿,所以将0x01改为0x00

#define HYN_IRQ_TRIGGER_RISING_CONFIG                0x00

将以上内容修改之后,重新编译生成boot.img烧写到主板,点击触屏还没有反应,获取触屏相关的开机日志:

[root@RK356X:/]# dmesg | grep HYN
[    1.087434] [HYN]hynitron_driver_init: Enter
[    1.087481] [HYN][Info]Driver version: Hynitron TouchScreen Rockchip Driver V2.1 20201222
[    1.087658] [HYN]hyn_probe: Enter
[    1.087676] [HYN]hyn_platform_data_init: Enter
[    1.087690] [HYN]hyn_parse_dt: Enter
[    1.087706] [HYN][Info]display x(480 ) y(854 )
[    1.087760] [HYN]DTS max touch number:5, irq gpio:127, reset gpio:126
[    1.087774] [HYN]hyn_parse_dt: Exit(1523)
[    1.087784] [HYN]hyn_gpio_configure: Enter
[    1.107842] [HYN]hyn_gpio_configure: Exit(1391)
[    1.107858] [HYN]hyn_ts_data_init: Enter
[    1.107873] [HYN]config [hyn] scan_id = 7,config_chip_type:0x9e.
[    1.107911] [HYN]config_chip_type:0x9e,main_addr:0x38,x_overturn=0,y_overturn=0,xy_exchange=0,.
[    1.107927] [HYN]hyn_ts_data_init: Exit(1565)
[    1.167953] [HYN]hyn_input_dev_int: Enter
[    1.168144] [HYN][Info]set key capabilities
[    1.169228] [HYN]hyn_input_dev_int: Exit(1300)
[    1.169388] [HYN]hyn_irq_registration: Enter
[    1.169809] [HYN][Info]use_irq:104
[    1.170218] [HYN][Info]IRQ request succussfully, irq=104 ,trigger_rising:0 .
[    1.170239] [HYN]hyn_irq_registration: Exit(613)
[    1.230287] [HYN]Touch Panel Device Probe PASS!
[    1.230302] [HYN]hyn_probe: Exit(1910)
[    1.231453] [HYN]hynitron_driver_init: Exit(2026)
[    8.870987] [HYN][Error]  buf[6] != 0xAB data is not valid..
[    9.065401] [HYN][Error]  buf[6] != 0xAB data is not valid..
[    9.259495] [HYN][Error]  buf[6] != 0xAB data is not valid..
[    9.479561] [HYN][Error]  buf[6] != 0xAB data is not valid..
[    9.850964] [HYN][Error]  buf[6] != 0xAB data is not valid..
[   10.045146] [HYN][Error]  buf[6] != 0xAB data is not valid..
[   10.239380] [HYN][Error]  buf[6] != 0xAB data is not valid..
[   10.459632] [HYN][Error]  buf[6] != 0xAB data is not valid..

分析日志得知,触屏初始化已通过,但是上报的数据不对,导致触摸没有响应。

获取hyn_ts的开机日志如下:

[root@RK356X:/]# dmesg | grep hyn_ts
[    1.107858] [HYN]hyn_ts_data_init: Enter
[    1.107927] [HYN]hyn_ts_data_init: Exit(1565)
[    1.168396] input: hyn_ts as /devices/platform/fe5d0000.i2c/i2c-4/4-0038/input/input3

得知hyn_ts作为input3设备。

与厂家沟通

将调试日志发送给触屏模组厂及IC厂技术支持人员,技术支持人员反馈是触摸屏固件不对,不支持此传输协议,经过反复沟通,IC厂技术支持人员给了匹配的固件,烧录触屏模组之后,将模组接上主板,重新上电,触屏可以用了。其中还修改了内核DTS文件,将irq-gpio配置为默认上拉。

配置irq、reset默认上下拉的方式如下:

pinctrl节点下增加hynitron节点:

&pinctrl {
	hynitron {
		tp_gpio: tp-gpio {
			rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>,	//reset
					<3 RK_PD7 RK_FUNC_GPIO &pcfg_pull_up>;		//int
		};
	};
}

修改i2c下的hynitron节点:

	hynitron@38 {
		compatible = "hynitron,hyn_ts";	
		reg = <0x38>;  	
		pinctrl-names = "default";
		pinctrl-0 = <&tp_gpio>;				
		hynitron,reset-gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_LOW>; 
		hynitron,irq-gpio = <&gpio3 RK_PD7 IRQ_TYPE_EDGE_FALLING>; 	
		hynitron,max-touch-number = <5>;		
		hynitron,display-coords = < 480 854>;

		hynitron,have-key;
		hynitron,key-number = <0>;	
		hynitron,key-code = <139 172 158>; 	
		hynitron,key-y-coord = <900 900 900>; 
		hynitron,key-x-coord = <100 300 400>;
	};

你可能感兴趣的:(linux系统及驱动开发,linux,drivers,touchscreen)