MTK CTP移植流程

TP启动过程及驱动概述:

Mtk Touch driver:驱动包括Mtkplatform 虚拟平台设备驱动、Module touch IC驱动、Inputsubsystem。
Mtk platform:设备驱动是mtk为了兼容多个touch IC驱动而设计出来的虚拟驱动,它会去遍历每一个touch IC驱动,直到其中一个初始化成功。
Linux input_subsystem:是linux的输入子系统,我们的输入设备都要通过这个子系统进行上报事件以及设置事件的类型。

static struct tpd_driver_t tpd_device_driver = {
        .tpd_device_name = "FT5x0x",
        .tpd_local_init = tpd_local_init,       //tp初始化,主要是注册iic、设置电压、注册中断等
        .suspend = tpd_suspend,               //休眠
        .resume = tpd_resume,                  //唤醒
        .attrs = {
                .attr = ft5x0x_attrs,
                .num  = ARRAY_SIZE(ft5x0x_attrs),
        },
};
MTK平台添加新的TP:

1、将TP驱动文件添加到touchscreen文件下,路径:kernel-4.4\drivers\input\touchscreen\mediatek\ft5x0x

2、添加对应的TP配置:kernel-4.4\drivers\input\touchscreen\mediatek\kconfig

config TOUCHSCREEN_MTK_FT5X0X
        bool "FT5X0X for Mediatek package"
        default n
        help
          Say Y here if you have FT5X0X touch panel.
          If unsure, say N.
          To compile this dirver as a module, choose M here: the
          module will be called.
source "drivers/input/touchscreen/mediatek/ft5x0x/Kconfig"

3、添加makefile:kernel-4.4\drivers\input\touchscreen\mediatek\makefile

obj-$(CONFIG_TOUCHSCREEN_MTK_FT5X0X)        +=  ft5x0x/

4、打开对应TP的宏(把不用的屏蔽掉) kernel-4.4\arch\arm64\configs\k63v1us_64_bsp_defconfig

CONFIG_TOUCHSCREEN_MTK_FT5X0X=y

5、添加TP设备:device\mediateksample\k63v1us_64_bsp\ProjectConfig.mk

CUSTOM_KERNEL_TOUCHPANEL = ft5x0x(文件名)
根据硬件接口配置dts:kernel-4.9\arch\arm\boot\dts\k61v1_32.dts
&touch {
        tpd-resolution = <720 1280>;/*分辨率*/
        use-tpd-button = <0>;/*是否有TP按键,有为1,无为0.*/
        tpd-key-num = <3>;/*TP按键个数*/
        tpd-key-local= <139 172 158 0>;/*按键编码 一般设置为meun、home、back */
        tpd-key-dim-local = <90 883 100 40 230 883 100 40 370 883 100 40 0 0 0 0>;
/*<90 883 100 40> 代表meun key 中心坐标(90,883),100是key的宽度,40是高度*/
        tpd-max-touch-num = <5>;/*支持最大的触摸点数*/
        tpd-filter-enable = <1>;
        tpd-filter-pixel-density = <186>;
        tpd-filter-custom-prameters = <0 0 0 0 0 0 0 0 0 0 0 0>;
        tpd-filter-custom-speed = <0 0 0>;
        pinctrl-names = "default", "state_eint_as_int", "state_eint_output0", "state_eint_output1",
                "state_rst_output0", "state_rst_output1";
        pinctrl-0 = <&ctp_pins_default>;
        pinctrl-1 = <&ctp_pins_eint_as_int>;
        pinctrl-2 = <&ctp_pins_eint_output0>;
        pinctrl-3 = <&ctp_pins_eint_output1>;
        pinctrl-4 = <&ctp_pins_rst_output0>;
        pinctrl-5 = <&ctp_pins_rst_output1>;
        status = "okay";
};
&pio {
/*配置中断pin*/
        ctp_pins_default: eint0default {
        };
        ctp_pins_eint_as_int: eint@0 {
                pins_cmd_dat {
                        pins = <PINMUX_GPIO0__FUNC_GPIO0>;
                        slew-rate = <0>;
                        bias-disable;
                };
        };
        ctp_pins_eint_output0: eintoutput0 {
                pins_cmd_dat {
                        pins = <PINMUX_GPIO0__FUNC_GPIO0>;
                        slew-rate = <1>;
                        output-low;
                };
        };
        ctp_pins_eint_output1: eintoutput1 {
                pins_cmd_dat {
                        pins = <PINMUX_GPIO0__FUNC_GPIO0>;
                        slew-rate = <1>;
                        output-high;
                };
        };
/*配置复位pin*/
        ctp_pins_rst_output0: rstoutput0 {
                pins_cmd_dat {
                        pins = <PINMUX_GPIO90__FUNC_GPIO90>;
                        slew-rate = <1>;
                        output-low;
                };
        };
        ctp_pins_rst_output1: rstoutput1 {
                pins_cmd_dat {
                        pins = <PINMUX_GPIO90__FUNC_GPIO90>;
                        slew-rate = <1>;
output-high;
                };
        };
};

MTK平台默认是将I2C的配置集成在了dws文件里面,通过工具直接修改dws文件并保存之后,编译时再会生成cust.dtsi文件,那我们如果需要更改ctp的i2c配置,方法如下:
android 8.1及以后

dws工具路径:vendor\mediatek\proprietary\scripts\dct\DrvGen.exe
DWS文件路径(MT6765为例):alps-release-p0.mp1-V5\kernel-4.9\drivers\misc\mediatek\dws\mt6765\k65v1_64_bsp.dws

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值