andorid6.0|andorid6.0 mtk6737平台 ctp调试方法

mtk平台上ctp调试很简单:搞定6根线就可以了,分别是地线,中断线,电源线,I2C线(2根),reset复位线。
andorid6.0|andorid6.0 mtk6737平台 ctp调试方法
文章图片
andorid6.0|andorid6.0 mtk6737平台 ctp调试方法
文章图片





这里地线就不讨论了。从原理图可以知道CTP是i2c 设备,保证I2C通讯正常前提是CTP上电正常,I2C通讯正常后,就要初始化ctp了(TP若本身就带rom,里面有参数,不用写参数,你的TP只要供电正常+中断正常,就可以工作),最后就是保证触摸功能的中断信号正常工作。
从上面可以看出:基本上就是围绕那6跟线做的


TP攻略:
1.把驱动添加到代码里面去
2.供电OK,I2C就通讯正常
【andorid6.0|andorid6.0 mtk6737平台 ctp调试方法】3.在1 跟2的基础上,看log初始化是否成功
4.若初始化成功了,就看TP是否正常工作
5.若4不工作,量取中断信号是否对的





关于TP分辨率和坐标设置:andorid6.0这些客制化的东西都在设备树种配置
void tpd_get_dts_info(void)
{
struct device_node *node1 = NULL;
int key_dim_local[16], i;


node1 = of_find_matching_node(node1, touch_of_match);
if (node1) {
of_property_read_u32(node1, "tpd-key-dim-local", &tpd_dts_data.touch_max_num);
of_property_read_u32(node1, "use-tpd-button", &tpd_dts_data.use_tpd_button);
pr_info("[tpd]use-tpd-button = %d\n", tpd_dts_data.use_tpd_button);
of_property_read_u32_array(node1, "tpd-resolution",
tpd_dts_data.tpd_resolution, ARRAY_SIZE(tpd_dts_data.tpd_resolution));
if (tpd_dts_data.use_tpd_button) {
of_property_read_u32(node1, "tpd-key-num", &tpd_dts_data.tpd_key_num);
of_property_read_u32_array(node1, "tpd-key-local",
tpd_dts_data.tpd_key_local, ARRAY_SIZE(tpd_dts_data.tpd_key_local));
of_property_read_u32_array(node1, "tpd-key-dim-local",
key_dim_local, ARRAY_SIZE(key_dim_local));
memcpy(tpd_dts_data.tpd_key_dim_local, key_dim_local, sizeof(key_dim_local));
for (i = 0; i < 4; i++) {
pr_info("[tpd]key[%d].key_x = %d\n", i, tpd_dts_data.tpd_key_dim_local[i].key_x);
pr_info("[tpd]key[%d].key_y = %d\n", i, tpd_dts_data.tpd_key_dim_local[i].key_y);
pr_info("[tpd]key[%d].key_W = %d\n", i, tpd_dts_data.tpd_key_dim_local[i].key_width);
pr_info("[tpd]key[%d].key_H = %d\n", i, tpd_dts_data.tpd_key_dim_local[i].key_height);
}
}
of_property_read_u32(node1, "tpd-filter-enable", &tpd_dts_data.touch_filter.enable);
if (tpd_dts_data.touch_filter.enable) {
of_property_read_u32(node1, "tpd-filter-pixel-density",
&tpd_dts_data.touch_filter.pixel_density);
of_property_read_u32_array(node1, "tpd-filter-custom-prameters",
(u32 *)tpd_dts_data.touch_filter.W_W, ARRAY_SIZE(tpd_dts_data.touch_filter.W_W));
of_property_read_u32_array(node1, "tpd-filter-custom-speed",
tpd_dts_data.touch_filter.VECLOCITY_THRESHOLD,
ARRAY_SIZE(tpd_dts_data.touch_filter.VECLOCITY_THRESHOLD));
}
memcpy(&tpd_filter, &tpd_dts_data.touch_filter, sizeof(tpd_filter));
pr_info("[tpd]tpd-filter-enable = %d, pixel_density = %d\n",
tpd_filter.enable, tpd_filter.pixel_density);
} else {
pr_err("[tpd]%s can't find touch compatible custom node\n", __func__);
}
}

跟你LCD的分辨率是一样的(这个要求是你的LCD跟TP都是横屏或者竖屏)
若lcd 是横屏且TP是竖屏(若LCD是竖屏,TP是横屏),就把TP的 XY对应LCD的yx



中断若有问题为何有问题?

中断信号没有出来:可在串口log中搜关键字debounce,要求debounce跟对应的中断号一致;
若查出不一致,肯定还有那些地方没设置对,或者哪个地方漏了修改;





若中断信号没问题 ,再考虑TP 固件问题
屏出现重启问题:
1)当配了lk没有配置好kernel的lcm时,会出现重启。
2)添加了tp但是i2c没用通,会出现重启的可能。
上述导致重启的原因是:i2c报错挂死出现野指针,导致看门狗直接使系统重启。
3)tp报点不灵敏,宽高设置没有效果,可能是固件数据不准导致。




相关的修改文件(供参考):
CTP 6.0移植:
vendor/mediatek/proprietary/custom/joya6737m_65_m0/kernel/dct/dct/codegen.dws
vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/joya6737m_65_m0/dct/dct/codegen.dws
vendor/mediatek/proprietary/bootable/bootloader/lk/target/joya6737m_65_m0/dct/dct/codegen.dws
kernel-3.18/drivers/misc/mediatek/mach/mt6735/joya6737m_65_m0/dct/dct/codegen.dws
kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config2/gt1x_config.h
kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_tpd.c
kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_generic.c
kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/Kconfig
kernel-3.18/arch/arm64/configs/joya6737m_65_m0_defconfig
kernel-3.18/arch/arm64/configs/joya6737m_65_m0_debug_defconfig
kernel-3.18/arch/arm64/boot/dts/cust_eint.dtsi
kernel-3.18/arch/arm64/boot/dts/joya6737m_65_m0.dts


CTP 7.0移植
Dkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config10
Dkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config8
Dkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config9
Dkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/firmware2
Dkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/firmware3
Mkernel-3.18/arch/arm64/boot/dts/cust_eint.dtsi
Mkernel-3.18/arch/arm64/boot/dts/neostra8735_tb_n.dts
Mkernel-3.18/arch/arm64/configs/neostra8735_tb_n_debug_defconfig
Mkernel-3.18/arch/arm64/configs/neostra8735_tb_n_defconfig
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/Kconfig
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/Makefile
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_extents.c
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_generic.c
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_tools.c
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_tpd.c
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_update.c
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config1/gt1x_config.h
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config2/gt1x_config.h
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config6/gt1x_config.h
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config7/gt1x_config.h
Mkernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/gt1x_tpd_common.h
Mkernel-3.18/drivers/input/touchscreen/mediatek/Kconfig
Mkernel-3.18/drivers/input/touchscreen/mediatek/Makefile
Mkernel-3.18/drivers/input/touchscreen/mediatek/mtk_tpd.c
Mkernel-3.18/drivers/misc/mediatek/dws/mt6735/neostra8735_tb_n.dws
Mvendor/mediatek/proprietary/bootable/bootloader/lk/target/neostra8735_tb_n/dct/dct/codegen.dws
Mvendor/mediatek/proprietary/bootable/bootloader/preloader/custom/neostra8735_tb_n/dct/dct/codegen.dws
Mvendor/mediatek/proprietary/custom/neostra8735_tb_n/kernel/dct/dct/codegen.dws





    推荐阅读