根据供应商所提供的资料和驱动,通过I2C和设备树移植驱动,将驱动挂载在I2C上。
kernel.rar
在kernel/drivers/input/touchscreen下新建文件夹CYTTSP5将供应商给的这个路径下的文件夹全部拷贝
以及下面文件也拷贝到对应的路径
kernel/include/linux/cyttsp5_core.h
kernel/include/linux/cyttsp5_device_access-api.h
kernel/include/linux/cyttsp5_platform.h
根据供应商提供的KERNEL驱动kernel/arch/arm/boot/dts里的omap4-panda.dts文件获取相关的设备树节点内容,添加如下设备树节点
+ tsc@24 {
+ compatible = "cy,cyttsp5_i2c_adapter";
+ reg = <0x24>;
+ interrupts = <10 2>;
+ interrupt-parent = <&gpio7>;
+ cy,adapter_id = "cyttsp5_i2c_adapter";
+
+ cy,core {
+ cy,name = "cyttsp5_core";
+
+ cy,irq_gpio = <234>;
+ cy,rst_gpio = <233>;
+ cy,hid_desc_register = <1>;
+ /*CY_CORE_FLAG_RESTORE_PARAMETERS */
+ cy,flags = <4>;
+ /* CY_CORE_EWG_NONE */
+ cy,easy_wakeup_gesture = <0>;
+ cy,btn_keys = <172 /* KEY_HOMEPAGE */
+ /* previously was KEY_HOME, new Android versions use KEY_HOMEPAGE */
+ 139 /* KEY_MENU */
+ 158 /* KEY_BACK */
+ 217 /* KEY_SEARCH */
+ 114 /* KEY_VOLUMEDOWN */
+ 115 /* KEY_VOLUMEUP */
+ 212 /* KEY_CAMERA */
+ 116>; /* KEY_POWER */
+ cy,btn_keys-tag = <0>;
+
+ cy,mt {
+ cy,name = "cyttsp5_mt";
+
+ cy,inp_dev_name = "cyttsp5_mt";
+ /* CY_MT_FLAG_FLIP | CY_MT_FLAG_INV_X | CY_MT_FLAG_INV_Y */
+ cy,flags = <0x18>;
+ cy,abs =
+ /* ABS_MT_POSITION_X, CY_ABS_MIN_X, CY_ABS_MAX_X, 0, 0 */
+ <0x35 0 880 0 0
+ /* ABS_MT_POSITION_Y, CY_ABS_MIN_Y, CY_ABS_MAX_Y, 0, 0 */
+ 0x36 0 1280 0 0
+ /* ABS_MT_PRESSURE, CY_ABS_MIN_P, CY_ABS_MAX_P, 0, 0 */
+ 0x3a 0 255 0 0
+ /* CY_IGNORE_VALUE, CY_ABS_MIN_W, CY_ABS_MAX_W, 0, 0 */
+ 0xffff 0 255 0 0
+ /* ABS_MT_TRACKING_ID, CY_ABS_MIN_T, CY_ABS_MAX_T, 0, 0 */
+ 0x39 0 15 0 0
+ /* ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0 */
+ 0x30 0 255 0 0
+ /* ABS_MT_TOUCH_MINOR, 0, 255, 0, 0 */
+ 0x31 0 255 0 0
+ /* ABS_MT_ORIENTATION, -127, 127, 0, 0 */
+ 0x34 0xffffff81 127 0 0
+ /* ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0 */
+ 0x37 0 1 0 0
+ /* ABS_MT_DISTANCE, 0, 255, 0, 0 */
+ 0x3b 0 255 0 0>;
+
+ cy,vkeys_x = <720>;
+ cy,vkeys_y = <1280>;
+
+ cy,virtual_keys = /* KeyCode CenterX CenterY Width Height */
+ /* KEY_BACK */
+ <158 1360 90 160 180
+ /* KEY_MENU */
+ 139 1360 270 160 180
+ /* KEY_HOMEPAGE */
+ 172 1360 450 160 180
+ /* KEY SEARCH */
+ 217 1360 630 160 180>;
+ };
+
+ cy,btn {
+ cy,name = "cyttsp5_btn";
+
+ cy,inp_dev_name = "cyttsp5_btn";
+ };
+
+ cy,proximity {
+ cy,name = "cyttsp5_proximity";
+
+ cy,inp_dev_name = "cyttsp5_proximity";
+ cy,abs =
+ /* ABS_DISTANCE, CY_PROXIMITY_MIN_VAL, CY_PROXIMITY_MAX_VAL, 0, 0 */
+ <0x19 0 1 0 0>;
+ };
+ };
+ };
其中一些键值对含义代表:
(1)
+ interrupts = <10 2>;
+ interrupt-parent = <&gpio7>;
代表中断脚是gpio7下的第十脚,2表示中断方式为high-to-low edge triggered
(2)
+ cy,irq_gpio = <234>;
+ cy,rst_gpio = <233>;
RK3288 5.1的计算方式:例如gpio7的第十脚:7*32+10=234
RK3288 7.1的计算方式:例如gpio7的第十脚:7*32+10-8=226
(3)
+ cy,flags = <0x18>;
代表触摸原点位置,修改他可以修改原点位置
其中0x18适配于标准版卡,触摸正常
0x08:左右触摸反
0x38:上下触摸反
先加入编译CYTTSP5整个文件夹
diff --git a/kernel/drivers/input/touchscreen/Makefile b/kernel/drivers/input/touchscreen/Makefile
index 2f464d6a1b..35f21817e4 100755
--- a/kernel/drivers/input/touchscreen/Makefile
+++ b/kernel/drivers/input/touchscreen/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_TOUCHSCREEN_GSLX680) += rockchip_gslX680_rk3128.o
obj-$(CONFIG_TOUCHSCREEN_CT36X_TS) += ct36x/
obj-$(CONFIG_TOUCHSCREEN_GT8XX) += rk29_i2c_goodix.o
obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xx/
+obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5) += cyttsp5/ //宏名称需要与供应商所提供编译主要c文件的一致
obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o
obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
根据供应商所提供的kernel/drivers/input/touchscreen的makefile,删除其他驱动的编译,发现只需要编译部分文件
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5) += cyttsp5.o //需要
cyttsp5-y := cyttsp5_core.o cyttsp5_mt_common.o //需要
cyttsp5-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_MT_A) += cyttsp5_mta.o
cyttsp5-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_MT_B) += cyttsp5_mtb.o //需要
cyttsp5-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BUTTON) += cyttsp5_btn.o
cyttsp5-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PROXIMITY) += cyttsp5_proximity.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT) += cyttsp5_devtree.o //需要
ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5
obj-y += cyttsp5_platform.o //需要
endif
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_I2C) += cyttsp5_i2c.o //需要
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_SPI) += cyttsp5_spi.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEBUG_MDL) += cyttsp5_debug.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_LOADER) += cyttsp5_loader.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS) += cyttsp5_device_access.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_TEST_DEVICE_ACCESS_API) += cyttsp5_test_device_access_api.o
则在kconfig文件里添加所需要用到的内容(具体内容根据所对应的宏从kernel/drivers/input/touchscreen的kconfig里复制)
diff --git a/kernel/drivers/input/touchscreen/Kconfig b/kernel/drivers/input/touchscreen/Kconfig
index 9d8a2a4a95..6fb8db8282 100755
--- a/kernel/drivers/input/touchscreen/Kconfig
+++ b/kernel/drivers/input/touchscreen/Kconfig
@@ -38,6 +38,64 @@ config TOUCHSCREEN_GT9XX
code includes that in its table of IIC devices.
If unsure, say N.
+config TOUCHSCREEN_CYPRESS_CYTTSP5
+ tristate "CYTTSP5 TrueTouch Gen5 Touchscreen Driver"
+ help
+ Core driver for CYTTSP5 TrueTouch(tm) Standard Product
+ Geneartion5 touchscreen controllers.
+
+ Say Y here if you have a CYTTSP5 Gen5 touchscreen.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called cyttsp5.
+
+config TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
+ bool "CYTTSP5 Enable Device Tree support"
+ depends on TOUCHSCREEN_CYPRESS_CYTTSP5 && OF
+ help
+ Say Y here to enable support for device tree.
+
+ If unsure, say N.
+
+config TOUCHSCREEN_CYPRESS_CYTTSP5_I2C
+ tristate "CYTTSP5 TrueTouch Gen5 I2C"
+ depends on TOUCHSCREEN_CYPRESS_CYTTSP5
+ select I2C
+ help
+ Say Y here to enable I2C bus interface to CYTTSP5 TrueTouch(tm)
+ Standard Product Generation5 touchscreen controller.
+
+ If unsure, say Y.
+
+ To compile this driver as a module, choose M here: the
+ module will be called cyttsp5_i2c.
+
+choice
+ bool "CYTTSP5 TrueTouch Gen5 MultiTouch Protocol"
+ depends on TOUCHSCREEN_CYPRESS_CYTTSP5
+ default TOUCHSCREEN_CYPRESS_CYTTSP5_MT_B
+ help
+ This option controls which MultiTouch protocol will be used to
+ report the touch events.
+
+config TOUCHSCREEN_CYPRESS_CYTTSP5_MT_A
+ bool "Protocol A"
+ help
+ Select to enable MultiTouch touch reporting using protocol A
+ on Parade TrueTouch(tm) Standard Product Generation4 touchscreen
+ bool "CYTTSP5 TrueTouch Gen5 MultiTouch Protocol"
+ depends on TOUCHSCREEN_CYPRESS_CYTTSP5
+ default TOUCHSCREEN_CYPRESS_CYTTSP5_MT_B
+ help
+ This option controls which MultiTouch protocol will be used to
+ report the touch events.
+
+config TOUCHSCREEN_CYPRESS_CYTTSP5_MT_A
+ bool "Protocol A"
+ help
+ Select to enable MultiTouch touch reporting using protocol A
+ on Parade TrueTouch(tm) Standard Product Generation4 touchscreen
+ controller.
+
+config TOUCHSCREEN_CYPRESS_CYTTSP5_MT_B
+ bool "Protocol B"
+ help
+ Select to enable MultiTouch touch reporting using protocol B
+ on Parade TrueTouch(tm) Standard Product Generation4 touchscreen
+ controller.
+
+endchoice
+
config TOUCHSCREEN_CT36X_TS
tristate "CT36X touchscreens support"
最后在menuconfig里将所需要用到的宏打开并保存到不同平台所对应的config