第一步:移植代码
从原理图可以看到,使用的事I2C0;
mach-smdkv210,添加i2c,
static struct i2c_board_info i2c_devs0[]__initdata = {
#ifdef CONFIG_TOUCHSCREEN_GOODIX
{
I2C_BOARD_INFO("Goodix-TS",0x55),
.irq = IRQ_EINT(4),
},
#endif
第二步:
copy linux-3.4.2/include/linux/goodix_queue.h和 goodix_touch.h
//copy linux-3.4.2/include/config/touchscreen/goodix.h
copy linux-3.4.2/drivers/input/touchscreen/goodix_touch.c
修改 linux-3.4.2/drivers/input/touchscreen/Makefile
最后添加:
obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix_touch.o
修改 linux-3.4.2/drivers/input/touchscreen/Kconfig
config TOUCHSCREEN_GOODIX
tristate "GOODIX based touchscreen"
depends on I2C
help
It is a android driver to support Gooidx's touchscreen whose name
is guitar on s5pv210 platform.The touchscreen can support multi-touch
not more than two fingers.
Say Y here to enable the driver for the touchscreen on the
S5V SMDK board.
If unsure, say N.To compile this driver as a module, choose M here:
the module will be called goodix_touch.ko.
第三步:配置内核
第四步,编译报错
root@lj:/work/linux-3.4.2# make -j4 zImage
scripts/kconfig/conf --silentoldconfigKconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/input/touchscreen/goodix_touch.o
drivers/input/touchscreen/goodix_touch.c:20:fatal error: linux/earlysuspend.h: No such file or directory
compilation terminated.
make[3]: ***[drivers/input/touchscreen/goodix_touch.o] 错误 1
make[2]: *** [drivers/input/touchscreen] 错误 2
make[1]: *** [drivers/input] 错误 2
make: *** [drivers] 错误 2
make: *** 正在等待未完成的任务....
因为这不是androidkernel报这个错误,在goodix_touch.c 20行和goodix_touch.h20行修改如下:
#ifdef CONFIG_HAS_EARLYSUSPEND
#include
#endif
可以把和这个宏相关的都注释掉
在linux-3.4.2/arch/arm/mach-s5pv210/include/mach/gpio.h添加
#define S5P_EXT_INT0(x) S5PV210_GPH0(x)
#define S5P_EXT_INT1(x) S5PV210_GPH1(x)
#define S5P_EXT_INT2(x) S5PV210_GPH2(x)
#define S5P_EXT_INT3(x) S5PV210_GPH3(x)
第五步,编译测试
移植成功,通过修改对应的宏GOODIX_MULTI_TOUCH,可以设置单点和多点触控。
在goodix_touch.c中函数goodix_ts_work_func加log可以看到tsp的触摸信息