aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/input/edt-ft5x06.txt54
-rw-r--r--drivers/input/touchscreen/Kconfig13
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/edt-ft5x06.c898
-rw-r--r--include/linux/input/edt-ft5x06.h24
5 files changed, 990 insertions, 0 deletions
diff --git a/Documentation/input/edt-ft5x06.txt b/Documentation/input/edt-ft5x06.txt
new file mode 100644
index 00000000000..2032f0b7a8f
--- /dev/null
+++ b/Documentation/input/edt-ft5x06.txt
@@ -0,0 +1,54 @@
1EDT ft5x06 based Polytouch devices
2----------------------------------
3
4The edt-ft5x06 driver is useful for the EDT "Polytouch" family of capacitive
5touch screens. Note that it is *not* suitable for other devices based on the
6focaltec ft5x06 devices, since they contain vendor-specific firmware. In
7particular this driver is not suitable for the Nook tablet.
8
9It has been tested with the following devices:
10 * EP0350M06
11 * EP0430M06
12 * EP0570M06
13 * EP0700M06
14
15The driver allows configuration of the touch screen via a set of sysfs files:
16
17/sys/class/input/eventX/device/device/threshold:
18 allows setting the "click"-threshold in the range from 20 to 80.
19
20/sys/class/input/eventX/device/device/gain:
21 allows setting the sensitivity in the range from 0 to 31. Note that
22 lower values indicate higher sensitivity.
23
24/sys/class/input/eventX/device/device/offset:
25 allows setting the edge compensation in the range from 0 to 31.
26
27/sys/class/input/eventX/device/device/report_rate:
28 allows setting the report rate in the range from 3 to 14.
29
30
31For debugging purposes the driver provides a few files in the debug
32filesystem (if available in the kernel). In /sys/kernel/debug/edt_ft5x06
33you'll find the following files:
34
35num_x, num_y:
36 (readonly) contains the number of sensor fields in X- and
37 Y-direction.
38
39mode:
40 allows switching the sensor between "factory mode" and "operation
41 mode" by writing "1" or "0" to it. In factory mode (1) it is
42 possible to get the raw data from the sensor. Note that in factory
43 mode regular events don't get delivered and the options described
44 above are unavailable.
45
46raw_data:
47 contains num_x * num_y big endian 16 bit values describing the raw
48 values for each sensor field. Note that each read() call on this
49 files triggers a new readout. It is recommended to provide a buffer
50 big enough to contain num_x * num_y * 2 bytes.
51
52Note that reading raw_data gives a I/O error when the device is not in factory
53mode. The same happens when reading/writing to the parameter files when the
54device is not in regular operation mode.
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 73bd2f6b82e..1ba232cbc09 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -472,6 +472,19 @@ config TOUCHSCREEN_PENMOUNT
472 To compile this driver as a module, choose M here: the 472 To compile this driver as a module, choose M here: the
473 module will be called penmount. 473 module will be called penmount.
474 474
475config TOUCHSCREEN_EDT_FT5X06
476 tristate "EDT FocalTech FT5x06 I2C Touchscreen support"
477 depends on I2C
478 help
479 Say Y here if you have an EDT "Polytouch" touchscreen based
480 on the FocalTech FT5x06 family of controllers connected to
481 your system.
482
483 If unsure, say N.
484
485 To compile this driver as a module, choose M here: the
486 module will be called edt-ft5x06.
487
475config TOUCHSCREEN_MIGOR 488config TOUCHSCREEN_MIGOR
476 tristate "Renesas MIGO-R touchscreen" 489 tristate "Renesas MIGO-R touchscreen"
477 depends on SH_MIGOR && I2C 490 depends on SH_MIGOR && I2C
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 5920c60f999..178eb128d90 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o
24obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o 24obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o
25obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o 25obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o
26obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o 26obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
27obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o
27obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o 28obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o
28obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 29obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
29obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o 30obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
new file mode 100644
index 00000000000..9afc777a40a
--- /dev/null
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -0,0 +1,898 @@
1/*
2 * Copyright (C) 2012 Simon Budig, <simon.budig@kernelconcepts.de>
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18/*
19 * This is a driver for the EDT "Polytouch" family of touch controllers
20 * based on the FocalTech FT5x06 line of chips.
21 *
22 * Development of this driver has been sponsored by Glyn:
23 * http://www.glyn.com/Products/Displays
24 */
25
26#include <linux/module.h>
27#include <linux/ratelimit.h>
28#include <linux/interrupt.h>
29#include <linux/input.h>
30#include <linux/i2c.h>
31#include <linux/uaccess.h>
32#include <linux/delay.h>
33#include <linux/debugfs.h>
34#include <linux/slab.h>
35#include <linux/gpio.h>
36#include <linux/input/mt.h>
37#include <linux/input/edt-ft5x06.h>
38
39#define MAX_SUPPORT_POINTS 5
40
41#define WORK_REGISTER_THRESHOLD 0x00
42#define WORK_REGISTER_REPORT_RATE 0x08
43#define WORK_REGISTER_GAIN 0x30
44#define WORK_REGISTER_OFFSET 0x31
45#define WORK_REGISTER_NUM_X 0x33
46#define WORK_REGISTER_NUM_Y 0x34
47
48#define WORK_REGISTER_OPMODE 0x3c
49#define FACTORY_REGISTER_OPMODE 0x01
50
51#define TOUCH_EVENT_DOWN 0x00
52#define TOUCH_EVENT_UP 0x01
53#define TOUCH_EVENT_ON 0x02
54#define TOUCH_EVENT_RESERVED 0x03
55
56#define EDT_NAME_LEN 23
57#define EDT_SWITCH_MODE_RETRIES 10
58#define EDT_SWITCH_MODE_DELAY 5 /* msec */
59#define EDT_RAW_DATA_RETRIES 100
60#define EDT_RAW_DATA_DELAY 1 /* msec */
61
62struct edt_ft5x06_ts_data {
63 struct i2c_client *client;
64 struct input_dev *input;
65 u16 num_x;
66 u16 num_y;
67
68#if defined(CONFIG_DEBUG_FS)
69 struct dentry *debug_dir;
70 u8 *raw_buffer;
71 size_t raw_bufsize;
72#endif
73
74 struct mutex mutex;
75 bool factory_mode;
76 int threshold;
77 int gain;
78 int offset;
79 int report_rate;
80
81 char name[EDT_NAME_LEN];
82};
83
84static int edt_ft5x06_ts_readwrite(struct i2c_client *client,
85 u16 wr_len, u8 *wr_buf,
86 u16 rd_len, u8 *rd_buf)
87{
88 struct i2c_msg wrmsg[2];
89 int i = 0;
90 int ret;
91
92 if (wr_len) {
93 wrmsg[i].addr = client->addr;
94 wrmsg[i].flags = 0;
95 wrmsg[i].len = wr_len;
96 wrmsg[i].buf = wr_buf;
97 i++;
98 }
99 if (rd_len) {
100 wrmsg[i].addr = client->addr;
101 wrmsg[i].flags = I2C_M_RD;
102 wrmsg[i].len = rd_len;
103 wrmsg[i].buf = rd_buf;
104 i++;
105 }
106
107 ret = i2c_transfer(client->adapter, wrmsg, i);
108 if (ret < 0)
109 return ret;
110 if (ret != i)
111 return -EIO;