高通平台触摸屏调试

高通平台+Android9.0 TP

TP芯片厂商主要有:Goodix(汇顶)、FocalTech(敦泰)、synaptics(新思)、cypress(赛普拉斯)
1.向触摸屏厂商要驱动包
驱动添加的路径:
/m620/kernel/msm-4.9/drivers/input/touchscreen/gt9xx$

-rw-rw-r-- 14674 Mar 17 10:25 goodix_tool.c
-rw-rw-r-- 67411 Mar 17 10:25 gt9xx.c
-rw-rw-r-- 6455 Mar 17 10:25 gt9xx.h
-rw-rw-r-- 38548 Mar 17 10:25 gt9xx_update.c
-rw-rw-r-- 1270 Mar 17 10:25 Kconfig
-rw-rw-r-- 217 Mar 17 10:25 Makefile

2.添加编译驱动(有些系统需要去掉其他tp驱动)
2.1 /m620/kernel/msm-4.9/arch/arm64/configs$vi msm8953_defconfig

#raynor
CONFIG_TOUCHSCREEN_GT9XX=y
CONFIG_GT9XX_TOUCHPANEL_DRIVER=y
#CONFIG_GT9XX_TOUCHPANEL_UPDATE=y
#CONFIG_GT9XX_TOUCHPANEL_DEBUG=y
#CONFIG_GT9XX_SEC_TOUCHPANEL_UPDATE=y
#CONFIG_GT9XX_SEC_TOUCHPANEL_DEBUG=y
CONFIG_TOUCHSCREEN_GT1X=y
CONFIG_TOUCHSCREEN_FTS=y

2.2 /m620/kernel/msm-4.9/drivers/input/touchscreen$ vi Kconfig

source "drivers/input/touchscreen/gt9xx/Kconfig"
source "drivers/input/touchscreen/gt9xx_second/Kconfig"
source "drivers/input/touchscreen/focaltech_touch/Kconfig"

2.3/m620/kernel/msm-4.9/drivers/input/touchscreen$ vi Makefile

obj-$(CONFIG_TOUCHSCREEN_GT9XX)     += gt9xx/
obj-$(CONFIG_TOUCHSCREEN_GT9XX_SEC)             += gt9xx_second/
obj-$(CONFIG_TOUCHSCREEN_GT1X)      += gt1x/
obj-$(CONFIG_TOUCHSCREEN_GT1X_SEC)  += gt1x_second/
obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/
obj-$(CONFIG_TOUCHSCREEN_FTS_SEC) += focaltech_touch_second/

3.添加设备树文件配置
3.1 /m620/kernel/msm-4.9/arch/arm64/boot/dts/qcom$ vi msm8953-mtp.dtsi

//rid-> add i2c3 for tp0
&i2c_3 {  /* BLSP1 QUP3 */
    status = "ok";
    goodix@5d {
        compatible = "goodix,gt9xx";
        reg = <0x5d>;
        interrupt-parent = <&tlmm>;
        interrupts = <65 0x2>;
        reset-gpios = <&tlmm 64 0x0>;
        interrupt-gpios = <&tlmm 65 0x2008>;
        power-gpios = <&tlmm 0 0x0>;
        vdd-supply = <&pm8953_l10>;
        vcc_i2c-supply = <&pm8953_l6>;
        goodix,panel-coords = <0 0 719 1405>;
        goodix,display-coords = <0 0 719 1279>;
        goodix,button-map= <139 172 158>;
        goodix,enable-power-off;
        goodix,product-id = "9147";
        goodix,fw_name = "gtp_fw.bin";
        pinctrl-names = "pmx_ts_active","pmx_ts_suspend";
        pinctrl-0 = <&ts_int_active &ts_reset_active>;
        pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
        goodix,cfg-data0 = [
        44 DA 02 05 05 05 35 C1 01 09
        28 08 48 35 03 05 00 00 FF 7F
        10 50 85 14 17 1A 14 92 00 0A
        31 2F D3 07 03 00 00 A2 33 1D
        00 01 00 00 00 1E 00 09 10 00
        2A 1E 50 94 C5 02 00 0E 00 04
        B1 21 00 96 28 00 7F 31 00 6F
        3B 00 60 48 00 60 10 30 48 00
        F0 4A 3A FF EF 27 00 00 00 00
        00 01 1C 19 17 0F 01 00 01 0F
        0F 03 04 10 42 8F 0F 19 00 00
        46 37 08 0A 0C 0E 10 12 14 16
        18 1A 00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00 00 00
        00 00 08 20 0A 1F 0C 1E 0E 1D
        22 05 24 04 28 00 29 02 2A 06
        00 00 00 00 00 00 00 00 00 00
        00 FF FF FF FF FF FF FF FF AF
        FF FF FF FF 87 01
        ];
        goodix,have-touch-key;
        goodix,driver-send-cfg;
    };

3.2 /m620/kernel/msm-4.9/arch/arm64/boot/dts/qcom$ vi msm8953-pinctrl.dtsi

 /* add pingrp for touchscreen */
                ts_int_default: ts_int_default {
                        mux {
                                pins = "gpio65";
                                function = "gpio";
                        };
                        config {
                                pins = "gpio65";
                                drive-strength = <16>;
                                /*bias-pull-up;*/
                                input-enable;
                                bias-disable;
                        };
                };

                ts_int_output_high: ts_int_output_high {
                        mux {
                                pins = "gpio65";
                                function = "gpio";
                        };
                        config {
                                pins = "gpio65";
                                output-high;
                        };
                };

                ts_int_output_low: ts_int_output_low {
                        mux {
                                pins = "gpio65";
                                function = "gpio";
                        };
                        config {
                                pins = "gpio65";
                                output-low;
                        };
                };

                ts_int_input: ts_int_input {
                        mux {
                                pins = "gpio65";
                                function = "gpio";
                        };
                        config {
                                pins = "gpio65";
                                input-enable;
                                bias-disable;
                        };

4.驱动代码分析
/m620/kernel/msm-4.9/drivers/input/touchscreen/gt9xx$ vi gt9xx.c
msm8953-pinctrl.dtsi中定义的INT和RST管脚的处理

static int goodix_ts_pinctrl_init(struct goodix_ts_data *goodix_data)
{
    int retval;
    goodix_data->ts_pinctrl = devm_pinctrl_get(&(goodix_data->client->dev));
    if(IS_ERR_OR_NULL(goodix_data->ts_pinctrl))
        {
            retval = PTR_ERR(goodix_data->ts_pinctrl);
            dev_err(&goodix_data->client->dev,"Target does not use pinctrl %d\n",retval);
            goto err_pinctrl_get;
        }
    goodix_data->pinctrl_state_active = pinctrl_lookup_state(goodix_data->ts_pinctrl,PINCTRL_STATE_ACTIVE);

    if(IS_ERR_OR_NULL(goodix_data->pinctrl_state_active))
        {
            retval = PTR_ERR(goodix_data->pinctrl_state_active);
            dev_err(&goodix_data->client->dev,"Can not lookup %s pinstate %d\n",PINCTRL_STATE_ACTIVE,retval);
            goto err_pinctrl_lookup;
        }
    goodix_data->pinctrl_state_suspend = pinctrl_lookup_state(goodix_data->ts_pinctrl,PINCTRL_STATE_SUSPEND);

    if(IS_ERR_OR_NULL(goodix_data->pinctrl_state_suspend))
        {
            retval = PTR_ERR(goodix_data->pinctrl_state_suspend);
            dev_err(&goodix_data->client->dev,"Can not lookup %s pinstate %d\n",PINCTRL_STATE_SUSPEND,retval);
            goto err_pinctrl_lookup;
        }
    goodix_data->pinctrl_state_release = pinctrl_lookup_state(goodix_data->ts_pinctrl,PINCTRL_STATE_RELEASE);

    if(IS_ERR_OR_NULL(goodix_data->pinctrl_state_release))
        {
            retval = PTR_ERR(goodix_data->pinctrl_state_release);
            dev_err(&goodix_data->client->dev,"Can not lookup %s pinstate %d\n",PINCTRL_STATE_RELEASE,retval);
        }
    return 0;

err_pinctrl_lookup:
    devm_pinctrl_put(goodix_data->ts_pinctrl);
err_pinctrl_get:
    goodix_data->ts_pinctrl = NULL;
    return retval;
}

附加比较详细的分析,如有需要请点此处:
Qualcomm-android-msm8953-tp-20200421.

你可能感兴趣的:(高通平台触摸屏调试)