本文主要是介绍MT6765 CTP移植与调试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
以GT911为例说明下.
1 拷贝驱动与客制化文件.
alps/kernel-4.9/drivers/input/touchscreen/mediatek/GT911
2 添加编译条件
在alps/kernel-4.9/drivers/input/touchscreen/mediatek/Kconfig下添加
config TOUCHSCREEN_MTK_GT911
bool "GT1151 for Mediatek package"
default n
help
Say Y here if you have GT911 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/GT911/Kconfig"
在alps/kernel-4.9/drivers/input/touchscreen/mediatek/Makefile下添加
obj-$(CONFIG_TOUCHSCREEN_MTK_GT911) += GT911/
3 打开编译开关
alps/kernel-4.9/arch/arm64/configs/k62v1_64_bsp_defconfig
CONFIG_TOUCHSCREEN_MTK_GT911=y
CONFIG_GT911_FIRMWARE="firmware" CTP固件升级包(有些驱动没有这个文件)
CONFIG_GT911_CONFIG="config2" CTP参数配置
后面两个定义的是alps/kernel-4.9/drivers/input/touchscreen/mediatek/GT911/Makefile
里面的Makefile指定的参数路径
ccflags-y += -I$(srctree)/drivers/input/touchscreen/mediatek/GT911/include/$(CONFIG_GT1151_FIRMWARE)/
ccflags-y += -I$(srctree)/drivers/input/touchscreen/mediatek/GT911/include/$(CONFIG_GT1151_CONFIG)/
4 IO口配置
配置GPIO,如,配置Reset脚
alps/kernel-4.x/arch/arm/boot/dts/k62tv1_bsp.dts
搜
tp_pins_rst_output0
tp_pins_rst_output1
修改为reset pin
同时配置了IIC, 屏幕大小,触摸按键数等
检查配置工具里对应的IO口配置
alps/kernel-4.4/drivers/misc/mediatek/dws/mt6739/k39tv1_bsp.dws
alps/vendor/mediatek/proprietary/bootable/bootloader/lk/target/k39tv1_bsp/dct/dct/codegen.dws
alps/vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/k39tv1_bsp/dct/dct/codegen.dws
5 修改触摸按键定义
alps/kernel-4.9/drivers/input/touchscreen/mediatek/GT911/tpd_gt9xx_common.h
6 传输问题
如果是DMA传输且不通,检查gt9xx_driver.c的DMA 传输的参数或地址是否正确
如果是IIC传输且不通,检查gt9xx_driver.c的IIC地址是否正确,I2C_PUSHPULL_FLAG是否使用
7 MTK 平台的linux设备驱动名
在文件./GT911/gt9xx_driver.c里找到
static struct tpd_driver_t tpd_device_driver = {
.tpd_device_name = "gt9xx",
.tpd_local_init = tpd_local_init,
.suspend = tpd_suspend,
.resume = tpd_resume,
.attrs = {
.attr = gt9xx_attrs,
.num = ARRAY_SIZE(gt9xx_attrs),
},
};
设备初始化成功,则存在设备名
8 兼容问题
初始化文件mtk_tpd.c里面
late_initcall(tpd_device_init);
检测是否存在某一个设备. 兼容多个设备只有一个设备存在.
int tpd_driver_add(struct tpd_driver_t *tpd_drv)
这篇关于MT6765 CTP移植与调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!