Debugging touchpanel has been around for a while. Today, the platform is msm7x27, android2.2, and TP is mainly I2C. I2C is not introduced here, but self-search is unclear, this article mainly introduces the content of TP porting on this platform. Note that the platform uses hardware I2C instead of gpio simulation.
1. File nodes of devices and drivers
The device in the/sys/bus/I2C/devices directory is the I2C device described in the i2c_board_info structure,
The device names under/sys/bus/I2C/devices are named according to the i2caddress defined in the i2c_board_info struct.
# Ls
I2c-0
0-0038 // i2c_board_info ("ft5xxx", 0x70> 1),/* This is the slave address of the I2C device */
0-005c // i2c_board_info ("ssd2531", 0x53),/* The slave address of the I2C device */
0-000a // i2c_board_info ("bma200", 0x0a),/* This is the slave address of the I2C device */
0-001e // i2c_board_info ("hmc5883", 0x3c> 1),/* The slave address of the I2C device */
0-003c // i2c_board_info ("ov2655", 0x60> 1)
0-0030
0-0010 // i2c_board_info ("rda5802", 0x20> 1 ),
0-001c // i2c_board_info ("ltr600", 0x38> 1),/* The slave address of the I2C device */
I2c-1
<6> [1.107875] input: ft5xxxas/devices/i2c-0/0-0038/input/input3
# Cd sys/devices/i2c-0
# Ls
Uevent
Name
New_device
Delete_device
Subsystem
Power
0-0038
0-005c
0-000a
0-001e
0-003c
0-0030
0-0010
0-001c
I2c-dev
# Cd 0-005c
# Ls
Uevent
Name
Modalias
Subsystem
Power
#
# CD 0-0038
# Ls
Uevent
Name
Modalias
Subsystem
Power
Driver
Input
# Cat name
Ft5xxx
#
Ii. debugging methods
ADB shell dmesg> dmesg. log;
Alternatively, you can view CAT/proc/kmsg in real time. For example, if the returned coordinates are correct during touch;
After you view the input device in real time, you can go to shell: getevent to list all the event devices. The corresponding operations will output information. Paste the log as follows:
<3> [1, 1.095116] [ft5xxx] entermutitouch _
<3> [1, 1.095168] [ft5xxx] entermutitouch_probe
<3> [2, 1.095183] [ft5xxx] mutitouch_chip-> pdata-> gpio_rst = 41
<3> [1, 1.107221] [ft5xxx] entermutitouch_read_dev
<3> [1, 1.107238] [ft5xxx] entermutitouch _
<3> [1, 1.107356] [ft5xxx] entermutitouch_read
<6> [1, 1.107440] Read ft5302 id = 0x79
<3> [1, 1.107451] [ft5xxx] entermutitouch_write
<3> [1, 1.107558] [ft5xxx] entermutitouch _
<6> [1, 1.107638] Select ctpft5302
<6> [1.108021] input: ft5xxx as/devices/i2c-0/0-0038/input/input3
<3> [1, 1.108341] [ft5xxx] leavemutitouch_probe
3. Modified files:
1. kernel/ARCH/ARM/Mach-Sm/board-msm7x27-qrd.c
Initialize msm7x2x_init upon startup, configure the gpio corresponding to int and rstpin, and the address of I2C device, etc.
# Ifdef config_touchscreen_ft5xxx
I2c_register_board_info (0, ft5xxx_i2c_board_info, array_size (ft5xxx_i2c_board_info ));
Ts_ft5xxx_config_gpio ();
# Endif
The key I2C address is in ft5xxx_i2c_board_info
Static struct i2c_board_infoft5xxx_i2c_board_info [] = {
{
I2c_board_info ("ft5xxx", 0x70> 1 ),
. IRQ = msm_gpio_to_int (ts_ft5xxx_gpio_int ),
. Platform_data = & ft5xxx_ts_data,
},
};
This address is in the 7-bit format and does not include the read/write bits. Generally, the address obtained from datasheet needs to be shifted to the right by one bit. During read/write, the system will perform the processing on its own, I read from the file system that the driver name is shifted, that is, the value passed in from here, but the address of the waveform graph device is still not moved. If the host and Server Load balancer cannot communicate with each other, you can try the one-bit left operation.
2. kernel/Drivers/input/touchscreen/ft5xxx. c
This is the driver file. The two main functions are mutitouch_probe and mutitouch_ts_work,
Mutitouch_probe reads the device ID, sets the device property parameters (acceptable event type, XY coordinate range, device name (must be consistent with drivername), and bus type ), register the input device to create the device node/dev/input/eventx, create the corresponding work and register the sleep function
Mutitouch_ts_work is the associated function after the call of the corresponding work triggered by the interruption. It mainly reads the coordinate information and reports it to the upper layer. To complete this function, you must be familiar with the IC, including read and write commands, the format of the data packet.
3. kernel/ARCH/ARM/configs/msm7627-perf-qrd_defconfig
Configure the macro config_touchscreen_ft5xxx = y.
4. kernel/Drivers/input/touchscreen/makefile
Compile related driver files based on macros
OBJ-$ (config_touchscreen_ft5xxx) + = ft5xxx. o
5. kernel/Drivers/input/touchscreen/kconfig
Config touchscreen_ft5xxx
Tristate "ft5xxx capacitive touchpanel"
Depends on I2C
Iv. Supplement
1. Where is the sda scl set?
Board-msm7x27-qrd.c: msm_i2c_gpio_config ()
Gpio_scl = 60;
Gpio_sda = 61;
2. the reset duration is the low-level duration.
Gpio_set_value (tc_chip-> pdata-> gpio_rst, io_low );
Mdelay (200 );
Gpio_set_value (tc_chip-> pdata-> gpio_rst, io_hight );
Mdelay (2 );
3. Other Related Documents
I2c-msm.c
4. For a TP, in addition to being familiar with datasheet, you need to know the system interfaces provided by Linux.
For example, how to apply for an interruption and how to create a work queue.
5. Reference
Linux subsystem analysis and touch screen driver analysis: the simplest example of adding an input device
Http://blog.csdn.net/Ralph_sqd/article/details/5933388
The hierarchical design concept of Linux Device Driver: inputdev
Http://www.linuxidc.com/Linux/2010-06/26812p2.htm
I2C-based embedded multi-point touch screen Driver Design: A description of the driver Process
Http://www.dzsc.com/data/html/2011-3-11/89104.html
LINUX multi-touch interface: detailed descriptions of input device parameters
Http://tanatseng.blog.163.com/blog/static/174991629201132561941518/
Android multi-point touch: instructions from driver to framework to Application
Http://wenku.baidu.com/view/a6a0ee0b79563c1ec5da7119.html