andorid6.0 mtk6737平臺 ctp除錯方法
mtk平臺上ctp除錯很簡單:搞定6根線就可以了,分別是地線,中斷線,電源線,I2C線(2根),reset復位線。
這裡地線就不討論了。從原理圖可以知道CTP是i2c 裝置,保證I2C通訊正常前提是CTP上電正常,I2C通訊正常後,就要初始化ctp了(TP若本身就帶rom,裡面有引數,不用寫引數,你的TP只要供電正常+中斷正常,就可以工作),最後就是保證觸控功能的中斷訊號正常工作。
從上面可以看出:基本上就是圍繞那6跟線做的
TP攻略:
1.把驅動新增到程式碼裡面去
2.供電OK,I2C就通訊正常
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
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移植
D kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config10
D kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config8
D kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config9
D kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/firmware2
D kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/firmware3
M kernel-3.18/arch/arm64/boot/dts/cust_eint.dtsi
M kernel-3.18/arch/arm64/boot/dts/neostra8735_tb_n.dts
M kernel-3.18/arch/arm64/configs/neostra8735_tb_n_debug_defconfig
M kernel-3.18/arch/arm64/configs/neostra8735_tb_n_defconfig
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/Kconfig
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/Makefile
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_extents.c
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_generic.c
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_tools.c
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_tpd.c
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/gt1x_update.c
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config1/gt1x_config.h
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config2/gt1x_config.h
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config6/gt1x_config.h
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/config7/gt1x_config.h
M kernel-3.18/drivers/input/touchscreen/mediatek/GT1151/include/gt1x_tpd_common.h
M kernel-3.18/drivers/input/touchscreen/mediatek/Kconfig
M kernel-3.18/drivers/input/touchscreen/mediatek/Makefile
M kernel-3.18/drivers/input/touchscreen/mediatek/mtk_tpd.c
M kernel-3.18/drivers/misc/mediatek/dws/mt6735/neostra8735_tb_n.dws
M vendor/mediatek/proprietary/bootable/bootloader/lk/target/neostra8735_tb_n/dct/dct/codegen.dws
M vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/neostra8735_tb_n/dct/dct/codegen.dws
M vendor/mediatek/proprietary/custom/neostra8735_tb_n/kernel/dct/dct/codegen.dws