Platform: RK3399
OS: Android 7.1
Kernel: v4.4.103
Board: Firefly-AIO-3399C
TSC2007 的 Datasheet 给出了它的一个典型应用电路:
我们自己打了几块调试的小板,大概如下图这样:
然后是接到开发板上准备调试 :
一、内核驱动
tsc2007的驱动源码在内核中是已经存在的,其路径如下:
kernel/drivers/input/touchscreen/tsc2007.c
所以,我们只需要在kernel目录下,通过 make menuconfig 命令来配置内核并重新编译即可;或者,在调试阶段,也可以用一种简单粗暴的方式——直接改Makefile(kernel/drivers/input/touchscreen/Makefile):
#
# Makefile for the touchscreen drivers.
#
...
#obj-$(CONFIG_TOUCHSCREEN_TSC2007) += tsc2007.o
obj-y += tsc2007.o
...
这里可以简单看一下 tsc2007 的设备结构体在驱动文件中的定义:
struct tsc2007 {
struct input_dev *input;
char phys[32];
struct i2c_client *client;
u16 model;
u16 x_plate_ohms;
u16 max_rt;
unsigned long poll_period; /* in jiffies */
int fuzzx;
int fuzzy;
int fuzzz;
unsigned gpio;
int irq;
wait_queue_head_t wait;
bool stopped;
int (*get_pendown_state)(struct device *);
void (*clear_penirq)(void);