基于rk3288平台的gt9xx 触摸驱动移植

一、硬件介绍:
    1 core-rk3288j 核心板
    2 外接lvds 1280*480的屏幕
    3 触摸芯片GT928,I2C驱动,触摸驱动发布版本和时间* Version: 2.4  * Release Date: 2014/11/28 */
    4 操作系统Ubuntu16.04 
二、触摸芯片硬件电路描述
    1 触摸零点右上角
    2 触摸尺寸 1280*480
    3 中断下降沿触发;
    4 I2C1 接口
    如:
    GTP_INT  GPIO7_A6 <&gpio7 6 GPIO_ACTIVE_HIGH>;
    GTP_RST  GPIO7_A5 <&gpio7 5 GPIO_ACTIVE_LOW>
    I2C1_SDA 
    I2C1_SCL
三、开启驱动移植
1 dts 配置硬件
&i2c1 {
        status = "okay";
        goodix_ts@5d {
                        compatible = "goodix,gt9xx";
                        reg = <0x5d>;
                        interrupt-parent = <&gpio7>;
                        interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
                        goodix,rst-gpio = <&gpio7 5 GPIO_ACTIVE_LOW>;
                        goodix,irq-gpio = <&gpio7 6 GPIO_ACTIVE_HIGH>;
                        goodix,cfg-group2 = [
                                41 E0 01 00 05 05 05 00 02 08 28
                                05 5A 3C 03 05 00 00 00 00 00 00
                                00 00 00 00 00 90 30 66 36 2D 05
                                0D 00 00 00 00 03 25 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 00 00 00 00 00 00 00 00
                                00 00 00 01 04 05 06 07 08 09 0C
                                0D 0E 0F FF FF FF FF FF FF FF FF
                                FF FF FF FF 00 00 00 00 00 00 2A
                                29 28 27 26 25 24 23 22 21 20 1F
                                1E 1C 1B 19 14 13 12 11 10 0F 0E
                                0D 0C 0A 08 07 06 04 02 00 00 00
                                00 00 00 00 00 00 00 00 0C 01];
                };

};
2 gt9xx.h 文件配置修改
放在最前面的:
on/off 开启/关闭配置
1 打开 GTP_CUSTOM_CFG  需要配置成1,用来用户自定义设置;
2 打开GTP_DRIVER_SEND_CFG   需要配置成1 ,用来发送CFG文件配置;
3 打开GTP_DEBUG_ON        可以看到配置成1 ,可以看到调试信息;

例如:

//***************************PART1:ON/OFF define*******************************
#define GTP_CUSTOM_CFG        1
#define GTP_CHANGE_X2Y        0    //swap x y
#define GTP_DRIVER_SEND_CFG   1    //driver send config
#define GTP_HAVE_TOUCH_KEY    0
#define GTP_POWER_CTRL_SLEEP  0    //power off when suspend
#define GTP_ICS_SLOT_REPORT   0    // slot protocol

#define GTP_AUTO_UPDATE       0    // auto update fw by .bin file as default
#define GTP_HEADER_FW_UPDATE  0    // auto update fw by gtp_default_FW in gt9xx_firmware.h, function together with

GTP_AUTO_UPDATE
#define GTP_AUTO_UPDATE_CFG   0    // auto update config by .cfg file, function together with GTP_AUTO_UPDATE

#define GTP_COMPATIBLE_MODE   0    // compatible with GT9XXF

#define GTP_CREATE_WR_NODE    0
#define GTP_ESD_PROTECT       0    // esd protection with a cycle of 2 seconds

#define GTP_WITH_PEN          0
#define GTP_PEN_HAVE_BUTTON   0    // active pen has buttons, function together with GTP_WITH_PEN

#define GTP_GESTURE_WAKEUP    0    // gesture wakeup

#define GTP_DEBUG_ON          1
#define GTP_DEBUG_ARRAY_ON    0
#define GTP_DEBUG_FUNC_ON     0

#if GTP_COMPATIBLE_MODE

第一步::
//*************************** PART2:TODO define **********************************
// STEP_1(REQUIRED): Define Configuration Information Group(s)
// Sensor_ID Map:
/* sensor_opt1 sensor_opt2 Sensor_ID
    GND         GND          0
    VDDIO      GND          1
    NC           GND          2
    GND         NC/300K    3
    VDDIO      NC/300K    4
    NC           NC/300K    5
*/
// TODO: define your own default or for Sensor_ID == 0 config here.
// The predefined one is just a sample config, which is not suitable for your tp in most cases.

#define CTP_CFG_GROUP0 {\

}
    // TODO: define your config for Sensor_ID == 1 here, if needed
#define CTP_CFG_GROUP1 {\
    }

// TODO: define your config for Sensor_ID == 2 here, if needed
#define CTP_CFG_GROUP2 {\
        0x41,0xE0,0x01,0x00,0x05,0x05,0x05,0x00,0x02,0x08,0x28,\
        0x05,0x5A,0x3C,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x00,0x00,0x90,0x30,0x66,0x36,0x2D,0x05,\
        0x0D,0x00,0x00,0x00,0x00,0x03,0x25,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,\
        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,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\
        0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,\
        0x29,0x28,0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20,0x1F,\
        0x1E,0x1C,0x1B,0x19,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,\
        0x0D,0x0C,0x0A,0x08,0x07,0x06,0x04,0x02,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x01\
    }

// TODO: define your config for Sensor_ID == 3 here, if needed
#define CTP_CFG_GROUP3 {\
}
// TODO: define your config for Sensor_ID == 4 here, if needed
#define CTP_CFG_GROUP4 {\
    }

// TODO: define your config for Sensor_ID == 5 here, if needed
#define CTP_CFG_GROUP5 {\
    }
   
第二步:设置中断和复位引脚
// STEP_2(REQUIRED): Customize your I/O ports & I/O operations
#define GTP_RST_PORT    5//S5PV210_GPJ3(6)
#define GTP_INT_PORT    6//S5PV210_GPH1(3)

第三步:设置触摸区域和下降沿触发
// STEP_3(optional): Specify your special config info if needed
#if GTP_CUSTOM_CFG
  #define GTP_MAX_HEIGHT   480
  #define GTP_MAX_WIDTH    1280
  #define GTP_INT_TRIGGER  1            // 0: Rising 1: Falling

四、总结及问题汇总

1 触摸不灵或者不准的问题,需要厂家给CFG文件,修改gt9xx.h 文件,不是必须修改dts文件,需要把宏GTP_DRIVER_SEND_CFG 配置成1。
格式内容如下:
#define CTP_CFG_GROUP2 {\
        0x41,0x00,0x05,0xE0,0x01,0x05,0x0D,0x00,0x02,0x08,0x28,\
        0x05,0x5A,0x3C,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x00,0x00,0x90,0x30,0x66,0x36,0x2D,0x05,\
        0x0D,0x00,0x00,0x00,0x00,0x03,0x25,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,\
        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,0x0F,0x0E,0x0D,0x0C,0x09,0x08,0x07,0x06,0x05,\
        0x04,0x01,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\
        0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,\
        0x29,0x28,0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20,0x1F,\
        0x1E,0x1C,0x1B,0x19,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,\
        0x0D,0x0C,0x0A,0x08,0x07,0x06,0x04,0x02,0x00,0x00,0x00,\
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01\
}
2 厂家 有指定也就是的sensorID, 配置到哪个group 是厂家指定的,比如有0-5,6个group,我的配置在了group2;
#define CTP_CFG_GROUP2
3 debug信息如下:
正确的

[    2.596431] <<-GTP-DEBUG->> [2356]GTP power on.
[    2.596491] <<-GTP-INFO->> Guitar reset
[    2.735657] <<-GTP-INFO->> IC Version: 928_1040
[    2.738181] <<-GTP-INFO->> Sensor_ID: 2
[    2.738186] <<-GTP-DEBUG->> [1394]Get config data from device tree.
[    2.738196] <<-GTP-INFO->> Config group2 used,length: 186
[    2.739467] <<-GTP-DEBUG->> [1430]Config Version: 65, 0x41; IC Config Version: 65, 0x41
[    2.739473] <<-GTP-INFO->> Driver send config.
[    2.765064] <<-GTP-INFO->> X_MAX: 1280, Y_MAX: 480, TRIGGER: 0x01
[    2.783848] <<-GTP-INFO->> create proc entry gt9xx_config success
[    2.784195] input: goodix-ts as /devices/virtual/input/input1
[    2.784497] <<-GTP-DEBUG->> [1746]INT trigger type:1

如果遇到如下debug信息,一般onfig data解析错误,GTP init panel failed.一般就是cfg文件没设置好,询问厂家技术支持放置在group0-group5的哪个里面。

[    2.585428] <<-GTP-DEBUG->> [2356]GTP power on.
[    2.585488] <<-GTP-INFO->> Guitar reset
[    2.725369] <<-GTP-INFO->> IC Version: 928_1040
[    2.727878] <<-GTP-INFO->> Sensor_ID: 2
[    2.727883] <<-GTP-DEBUG->> [1394]Get config data from device tree.
[    2.727891] <<-GTP-ERROR->> Failed to parse config data form device tree.
[    2.727893] <<-GTP-ERROR->> GTP init panel failed.
[    2.727914] <<-GTP-INFO->> create proc entry gt9xx_config success
[    2.728268] input: goodix-ts as /devices/virtual/input/input1
[    2.728591] <<-GTP-DEBUG->> [1746]INT trigger type:1
[    2.728674] <<-GTP-INFO->> GTP works in interrupt mode.

4 移植的时候需要定义个宏:
#define GTP_CONFIG_OF
这个宏非常关键,在gt9xx.c 文件头部位置,定义上去! 否则驱动无法正常执行。

基于rk3288平台的gt9xx 触摸驱动移植相关推荐

  1. 基于MT6752/32平台 Android L版本驱动移植步骤

    基于MT6752/32平台 Android L版本驱动移植步骤 根据MK官网所述,在Android L 版本上Turnkey ABS 架构将会phase out,而Mediatek Turnkey架构 ...

  2. 基于MT6752/32平台 Android L版本驱动移植步骤 根据MK官网所述,在Android L 版本上Turnkey ABS 架构将会phase out,而Medi

    基于MT6752/32平台 Android L版本驱动移植步骤 根据MK官网所述,在Android L 版本上Turnkey ABS 架构将会phase out,而Mediatek Turnkey架构 ...

  3. MT6752/32平台 Android L版本驱动移植

    基于MT6752/32平台 Android L版本驱动移植步骤 根据MK官网所述,在Android L 版本上Turnkey ABS 架构将会phase out,而Mediatek Turnkey架构 ...

  4. 基于RK3288 平台 Simple card声卡添加及调试

        基于RK3288 平台 Simple card声卡添加及调试 Simple card即简单通用的machine driver, 如果simple-card框架足够满足需求,建议优先使用simp ...

  5. [lcm] Qualcomm平台的显示屏lcd驱动移植步骤

    1lk部分 1-1 target_displayc 1-2 oem_panelc 1-3 panel_innont51021b_1200p_videoh 2Kernel 2-1 dsi-panel-b ...

  6. firefly-rk3288j开发板 TP实验之GT9XX触摸驱动

    linux TP实验之GT9XX触摸驱动 1 准备工作 开发板:aio-rk3288j SDK版本:rk3288_linux_release_20210304 下载工具:Linux_Upgrade_T ...

  7. 一个x86平台的spi flash驱动移植笔记

    最近一个项目,要用到flash存放一些数据,要内核支持.于是又要去移植. 其实,这个项目的合作方式我一直不喜欢,但言语轻微.起初我也不断地提意见,但看了几次的结果后,觉得不提也罢.对于开发人员来说,合 ...

  8. 联咏平台(Novatek) | RTL8188FU WIFI驱动移植

    目录 1 开发环境 2 内核配置 2.1 配置支持USB设备 2.2 配置支持 wifi 设备 2.3 配置支持 wifi 网络 IEEE 802.11 2.4 编译内核 3 wifi 驱动移植 3. ...

  9. LVGL在STM32上的移植及触摸驱动移植(触摸屏控制版)

    前言   在日常的开发中,涉及到用户显示界面控制的时候,如何快速.优美的设计一款用户UI,是攻城狮应该具备的能力(择偶优先权),如何把嵌入式UI设计像高级语言图形化设计一样简便.快捷,今天重磅介绍一款 ...

最新文章

  1. 美翻朋友圈:用Python生成蒙太奇马赛克图片
  2. 导师推荐的学术前沿号
  3. python简单发音-Python如何实现文本转语音
  4. 又是一个程序员粗心的代码引起频繁FullGC的案例
  5. Winform混合式开发框架的特点总结
  6. 新版《Windows Sysinternals实战指南》,读书积赞活动
  7. 113. 路径总和 II golang
  8. 如约而至 Nexus 6 的 Android 7.1.1 已经上线
  9. Pycharm 专业版 导入系统pip安装的包
  10. angularjs控制器之间的数据共享与通信
  11. MySQL数据库datetime类型不能为空值的问题
  12. SQL 拼接语句输出_一文了解Mybatis中动态SQL的实现
  13. 更深更宽的孪生网络,有效提升目标跟踪精度,代码开源
  14. php sql判断l列的存在,thinkphp 模块不存在:404
  15. android适配规则(一)
  16. 电脑文件同步备份软件哪个好用?
  17. 如何做好会员营销 三步教你看懂会员管理
  18. phpmyadmin 下载、安装、配置
  19. 成都VS上海,先锋设计机构与未来建筑的“双城battle”
  20. ORA-29339: tablespace block size 32768 does not match configured block sizes

热门文章

  1. Android OKHTTP发起请求提示:SSLException: Unable to parse TLS packet header
  2. axios发送post报错404问题
  3. mac hdmi 不能调整音量_Sound Control for Mac(mac应用音量控制软件)
  4. flash和js通过什么类如何交互?
  5. 谷歌引擎V8 简单调用
  6. boost网络串口通信库
  7. SBT40100VDC-ASEMI肖特基二极管SBT40100VDC
  8. 艾森豪威尔四象限法则
  9. Keil官网下载器件支持包Software Packs
  10. TOGAF认证流程图