I.MX6 Goodix GT9xx touchscreen driver porting


/************************************************************************
 *          I.MX6 Goodix GT9xx touchscreen driver porting
 * 聲明:
 *     本文主要是記錄GT9xx電容Touch移植過程中遇到的一些問題。
 *
 *                                      2016-1-27 深圳 南山平山村 曾劍鋒
 ***********************************************************************/

一、參考文檔:
    GT9XX驅動移植說明書_for_Android_2014011401.pdf

二、error 1:
    1. 出錯信息:
        1. 直接將驅動放在kernel里系統會卡死,出錯信息如下:
            USB Gadget resume begins
            fsl_udc_resume, Wait for wakeup thread finishes
            dr_controller_run: udc out low power mode
            USB Gadget resume ends
            fsl-usb2-udc: bind to driver android_usb 
            mousedev: PS/2 mouse device common for all mice
            input: gpio-keys as /devices/platform/gpio-keys/input/input0
            <<-GTP-INFO->> GTP driver installing...
            <<-GTP-INFO->> GTP Driver Version: V2.4<2014/11/28>
            <<-GTP-INFO->> GTP Driver Built@11:15:29, Jan 26 2016
            <<-GTP-INFO->> GTP I2C Address: 0x5d
            <<-GTP-INFO->> Guitar reset
            <<-GTP-INFO->> Chip Type: GOODIX_GT9
            <<-GTP-INFO->> IC Version: 9157_1040
            <<-GTP-INFO->> X_MAX: 720, Y_MAX: 1280, TRIGGER: 0x01
            <<-GTP-INFO->> create proc entry gt9xx_config success
            input: goodix-ts as /devices/virtual/input/input1
            <<-GTP-INFO->> GTP works in interrupt mode.
            <<-GTP-INFO->> Applied memory size:2562.
            <<-GTP-INFO->> Applied memory size:2562.
            <<-GTP-INFO->> I2C function: without pre and end cmd!
            <<-GTP-INFO->> Create proc entry success!
            mtk_tpd: hotknot_device register failed
            USB Gadget resume begins
            fsl_udc_resume, Wait for wakeup thread finishes
            ehci_fsl_bus_suspend begins, Host 1
            ehci_fsl_bus_suspend ends, Host 1
            <系統會卡死在這里,接下來沒有任何信息輸出>
        2. 作為模塊加入內核,使用久了,系統也會卡死:
            root@android:/ # cd /data/local
            root@android:/data/local # ls
            gt9xxm.ko
            tmp
            root@android:/data/local # insmod gt9xxm.ko                                    
            <<-GTP-INFO->> GTP driver installing...
            <<-GTP-INFO->> GTP Driver Version: V2.4<2014/11/28>
            <<-GTP-INFO->> GTP Driver Built@11:40:19, Jan 26 2016
            <<-GTP-INFO->> GTP I2C Address: 0x5d
            <<-GTP-INFO->> Guitar reset
            <<-GTP-INFO->> Chip Type: GOODIX_GT9
            <<-GTP-INFO->> IC Version: 9157_1040
            <<-GTP-INFO->> X_MAX: 720, Y_MAX: 1280, TRIGGER: 0x01
            <<-GTP-INFO->> create proc entry gt9xx_config success
            input: goodix-ts as /devices/virtual/input/input1
            cpufreq_interactive_input_connect: connect to goodix-ts
            <<-GTP-INFO->> GTP works in interrupt mode.
            <<-GTP-INFO->> Applied memory size:2562.
            <<-GTP-INFO->> Applied memory size:2562.
            <<-GTP-INFO->> I2C function: without pre and end cmd!
            root@android:/data/local # <<-GTP-INFO->> Create proc entry success!
            mtk_tpd: hotknot_device register failed
    2. 解決方法:
        1. cat gt9xx.h
            ......
            #define HOTKNOT_ENABLE        0    // hotknot module
            #define HOTKNOT_BLOCK_RW      0    // block rw operation in hotknot 
            ......
        2. cat goodix_tool.c
            s32 init_wr_node(struct i2c_client *client)
            {
                ......
            #if 0
                if (misc_register(&hotknot_misc_device))
                {
                      printk("mtk_tpd: hotknot_device register failed\n");
                      return FAIL;
                }
            #endif
                ......
            } 
    3. 思路來源:
        1. 想通過盡可能減少驅動的功能來判斷驅動哪里出了問題。
        2. cat gt9xx.h
            ......
            #define HOTKNOT_ENABLE        1    // hotknot module
            #define HOTKNOT_BLOCK_RW      1    // block rw operation in hotknot 
            ......
        3. 如上所述,不需要該功能,當然我也不知道這是什么功能。
        4. 改為如下內容:
            #define HOTKNOT_ENABLE        0    // hotknot module
            #define HOTKNOT_BLOCK_RW      0    // block rw operation in hotknot 
        5. 報錯如下:
            ......
              CC      drivers/input/touchscreen/gt9xx.o
            drivers/input/touchscreen/gt9xx.c: In function 'goodix_ts_suspend':
            drivers/input/touchscreen/gt9xx.c:2735:5: warning: unused variable 'buf' [-Wunused-variable]
              CC      drivers/input/touchscreen/gt9xx_update.o
              CC      drivers/input/touchscreen/goodix_tool.o
            drivers/input/touchscreen/goodix_tool.c: In function 'init_wr_node':
            drivers/input/touchscreen/goodix_tool.c:346:21: error: 'hotknot_misc_device' undeclared (first use in this function)
            drivers/input/touchscreen/goodix_tool.c:346:21: note: each undeclared identifier is reported only once for each function it appears in
            drivers/input/touchscreen/goodix_tool.c: At top level:
            drivers/input/touchscreen/goodix_tool.c:855:16: warning: 'hotknot_write' defined but not used [-Wunused-function]
            drivers/input/touchscreen/goodix_tool.c:1243:16: warning: 'hotknot_read' defined but not used [-Wunused-function]
            make[3]: *** [drivers/input/touchscreen/goodix_tool.o] Error 1
            make[2]: *** [drivers/input/touchscreen] Error 2
            make[1]: *** [drivers/input] Error 2
            make: *** [drivers] Error 2
            error: make uImage failed.
            ./remake.sh: 18: exit: Illegal number: -1
        6. 既然已經禁止了,那么不可能還有hotknot_misc_device設備注冊的,也就意味着這個版本的驅動有錯。
        7. 綜上所述:可能是我們的kernel不支持hotknot這個功能導致的。

三、error 2:
    1. 觸摸屏點擊有效,但是不准確,TP廠沒有給矯正文件,后來FAE確認是由於矯正配置參數的問題。
    2. 修改gt9xx.h文件:
        ......
        #define GTP_DRIVER_SEND_CFG   1
        ......
    3. 配置參數:
        #define CTP_CFG_GROUP0 {\
            0x46,0xD0,0x02,0x00,0x05,0x0A,0x05,0x40,0x01,0x08,\
            0x28,0x0F,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8A,0x0A,0x0B,\
            0x2E,0x30,0x31,0x0D,0x00,0x00,0x00,0x02,0x03,0x1D,\
            0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,\
            0x00,0x21,0x41,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
            0x9E,0x23,0x00,0x8D,0x28,0x00,0x80,0x2E,0x00,0x74,\
            0x35,0x00,0x69,0x3C,0x00,0x69,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,0x16,0x14,0x12,0x10,0x0E,0x0C,0x0A,0x08,\
            0x06,0x04,0x02,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,\
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
            0x00,0x00,0x16,0x13,0x18,0x12,0x1C,0x10,0x1D,0x0F,\
            0x0A,0x1E,0x00,0x24,0x22,0x02,0x21,0x04,0x20,0x06,\
            0x1F,0x08,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,\
            0x00,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\
            0x9F,0xFF,0xFF,0xFF,0x00,0x01\
            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM