blob: 134c66c431b8afc8132397e26933c3500c78002a [file] [log] [blame]
Simon Budig43c4d132012-07-24 23:29:36 -07001/*
2 * Copyright (C) 2012 Simon Budig, <simon.budig@kernelconcepts.de>
Lothar Waßmannfd335ab2014-03-28 09:31:14 -07003 * Daniel Wagener <daniel.wagener@kernelconcepts.de> (M09 firmware support)
Lothar Waßmanndac90dc22014-03-28 09:23:02 -07004 * Lothar Waßmann <LW@KARO-electronics.de> (DT support)
Simon Budig43c4d132012-07-24 23:29:36 -07005 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20/*
21 * This is a driver for the EDT "Polytouch" family of touch controllers
22 * based on the FocalTech FT5x06 line of chips.
23 *
24 * Development of this driver has been sponsored by Glyn:
25 * http://www.glyn.com/Products/Displays
26 */
27
28#include <linux/module.h>
29#include <linux/ratelimit.h>
30#include <linux/interrupt.h>
31#include <linux/input.h>
32#include <linux/i2c.h>
33#include <linux/uaccess.h>
34#include <linux/delay.h>
35#include <linux/debugfs.h>
36#include <linux/slab.h>
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -070037#include <linux/gpio/consumer.h>
Simon Budig43c4d132012-07-24 23:29:36 -070038#include <linux/input/mt.h>
Maxime Ripard2c005592015-03-21 20:18:06 -070039#include <linux/input/touchscreen.h>
Simon Budig43c4d132012-07-24 23:29:36 -070040
41#define MAX_SUPPORT_POINTS 5
42
43#define WORK_REGISTER_THRESHOLD 0x00
44#define WORK_REGISTER_REPORT_RATE 0x08
45#define WORK_REGISTER_GAIN 0x30
46#define WORK_REGISTER_OFFSET 0x31
47#define WORK_REGISTER_NUM_X 0x33
48#define WORK_REGISTER_NUM_Y 0x34
49
Lothar Waßmannfd335ab2014-03-28 09:31:14 -070050#define M09_REGISTER_THRESHOLD 0x80
51#define M09_REGISTER_GAIN 0x92
52#define M09_REGISTER_OFFSET 0x93
53#define M09_REGISTER_NUM_X 0x94
54#define M09_REGISTER_NUM_Y 0x95
55
56#define NO_REGISTER 0xff
57
Simon Budig43c4d132012-07-24 23:29:36 -070058#define WORK_REGISTER_OPMODE 0x3c
59#define FACTORY_REGISTER_OPMODE 0x01
60
61#define TOUCH_EVENT_DOWN 0x00
62#define TOUCH_EVENT_UP 0x01
63#define TOUCH_EVENT_ON 0x02
64#define TOUCH_EVENT_RESERVED 0x03
65
66#define EDT_NAME_LEN 23
67#define EDT_SWITCH_MODE_RETRIES 10
68#define EDT_SWITCH_MODE_DELAY 5 /* msec */
69#define EDT_RAW_DATA_RETRIES 100
70#define EDT_RAW_DATA_DELAY 1 /* msec */
71
Lothar Waßmannfd335ab2014-03-28 09:31:14 -070072enum edt_ver {
73 M06,
74 M09,
75};
76
77struct edt_reg_addr {
78 int reg_threshold;
79 int reg_report_rate;
80 int reg_gain;
81 int reg_offset;
82 int reg_num_x;
83 int reg_num_y;
84};
85
Simon Budig43c4d132012-07-24 23:29:36 -070086struct edt_ft5x06_ts_data {
87 struct i2c_client *client;
88 struct input_dev *input;
89 u16 num_x;
90 u16 num_y;
91
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -070092 struct gpio_desc *reset_gpio;
93 struct gpio_desc *wake_gpio;
Lothar Waßmanndac90dc22014-03-28 09:23:02 -070094
Simon Budig43c4d132012-07-24 23:29:36 -070095#if defined(CONFIG_DEBUG_FS)
96 struct dentry *debug_dir;
97 u8 *raw_buffer;
98 size_t raw_bufsize;
99#endif
100
101 struct mutex mutex;
102 bool factory_mode;
103 int threshold;
104 int gain;
105 int offset;
106 int report_rate;
107
108 char name[EDT_NAME_LEN];
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700109
110 struct edt_reg_addr reg_addr;
111 enum edt_ver version;
Simon Budig43c4d132012-07-24 23:29:36 -0700112};
113
114static int edt_ft5x06_ts_readwrite(struct i2c_client *client,
115 u16 wr_len, u8 *wr_buf,
116 u16 rd_len, u8 *rd_buf)
117{
118 struct i2c_msg wrmsg[2];
119 int i = 0;
120 int ret;
121
122 if (wr_len) {
123 wrmsg[i].addr = client->addr;
124 wrmsg[i].flags = 0;
125 wrmsg[i].len = wr_len;
126 wrmsg[i].buf = wr_buf;
127 i++;
128 }
129 if (rd_len) {
130 wrmsg[i].addr = client->addr;
131 wrmsg[i].flags = I2C_M_RD;
132 wrmsg[i].len = rd_len;
133 wrmsg[i].buf = rd_buf;
134 i++;
135 }
136
137 ret = i2c_transfer(client->adapter, wrmsg, i);
138 if (ret < 0)
139 return ret;
140 if (ret != i)
141 return -EIO;
142
143 return 0;
144}
145
146static bool edt_ft5x06_ts_check_crc(struct edt_ft5x06_ts_data *tsdata,
147 u8 *buf, int buflen)
148{
149 int i;
150 u8 crc = 0;
151
152 for (i = 0; i < buflen - 1; i++)
153 crc ^= buf[i];
154
155 if (crc != buf[buflen-1]) {
156 dev_err_ratelimited(&tsdata->client->dev,
157 "crc error: 0x%02x expected, got 0x%02x\n",
158 crc, buf[buflen-1]);
159 return false;
160 }
161
162 return true;
163}
164
165static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
166{
167 struct edt_ft5x06_ts_data *tsdata = dev_id;
168 struct device *dev = &tsdata->client->dev;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700169 u8 cmd;
170 u8 rdbuf[29];
Simon Budig43c4d132012-07-24 23:29:36 -0700171 int i, type, x, y, id;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700172 int offset, tplen, datalen;
Simon Budig43c4d132012-07-24 23:29:36 -0700173 int error;
174
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700175 switch (tsdata->version) {
176 case M06:
177 cmd = 0xf9; /* tell the controller to send touch data */
178 offset = 5; /* where the actual touch data starts */
179 tplen = 4; /* data comes in so called frames */
180 datalen = 26; /* how much bytes to listen for */
181 break;
182
183 case M09:
184 cmd = 0x02;
185 offset = 1;
186 tplen = 6;
187 datalen = 29;
188 break;
189
190 default:
191 goto out;
192 }
193
Simon Budig43c4d132012-07-24 23:29:36 -0700194 memset(rdbuf, 0, sizeof(rdbuf));
195
196 error = edt_ft5x06_ts_readwrite(tsdata->client,
197 sizeof(cmd), &cmd,
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700198 datalen, rdbuf);
Simon Budig43c4d132012-07-24 23:29:36 -0700199 if (error) {
200 dev_err_ratelimited(dev, "Unable to fetch data, error: %d\n",
201 error);
202 goto out;
203 }
204
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700205 /* M09 does not send header or CRC */
206 if (tsdata->version == M06) {
207 if (rdbuf[0] != 0xaa || rdbuf[1] != 0xaa ||
208 rdbuf[2] != datalen) {
209 dev_err_ratelimited(dev,
210 "Unexpected header: %02x%02x%02x!\n",
211 rdbuf[0], rdbuf[1], rdbuf[2]);
212 goto out;
213 }
214
215 if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
216 goto out;
Simon Budig43c4d132012-07-24 23:29:36 -0700217 }
218
Simon Budig43c4d132012-07-24 23:29:36 -0700219 for (i = 0; i < MAX_SUPPORT_POINTS; i++) {
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700220 u8 *buf = &rdbuf[i * tplen + offset];
Simon Budig43c4d132012-07-24 23:29:36 -0700221 bool down;
222
223 type = buf[0] >> 6;
224 /* ignore Reserved events */
225 if (type == TOUCH_EVENT_RESERVED)
226 continue;
227
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700228 /* M06 sometimes sends bogus coordinates in TOUCH_DOWN */
229 if (tsdata->version == M06 && type == TOUCH_EVENT_DOWN)
Lothar Waßmannee3e9462014-03-28 09:28:17 -0700230 continue;
231
Simon Budig43c4d132012-07-24 23:29:36 -0700232 x = ((buf[0] << 8) | buf[1]) & 0x0fff;
233 y = ((buf[2] << 8) | buf[3]) & 0x0fff;
234 id = (buf[2] >> 4) & 0x0f;
Lothar Waßmann1730d812014-03-28 09:20:08 -0700235 down = type != TOUCH_EVENT_UP;
Simon Budig43c4d132012-07-24 23:29:36 -0700236
237 input_mt_slot(tsdata->input, id);
238 input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, down);
239
240 if (!down)
241 continue;
242
243 input_report_abs(tsdata->input, ABS_MT_POSITION_X, x);
244 input_report_abs(tsdata->input, ABS_MT_POSITION_Y, y);
245 }
246
247 input_mt_report_pointer_emulation(tsdata->input, true);
248 input_sync(tsdata->input);
249
250out:
251 return IRQ_HANDLED;
252}
253
254static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
255 u8 addr, u8 value)
256{
257 u8 wrbuf[4];
258
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700259 switch (tsdata->version) {
260 case M06:
261 wrbuf[0] = tsdata->factory_mode ? 0xf3 : 0xfc;
262 wrbuf[1] = tsdata->factory_mode ? addr & 0x7f : addr & 0x3f;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700263 wrbuf[2] = value;
264 wrbuf[3] = wrbuf[0] ^ wrbuf[1] ^ wrbuf[2];
265 return edt_ft5x06_ts_readwrite(tsdata->client, 4,
266 wrbuf, 0, NULL);
267 case M09:
268 wrbuf[0] = addr;
269 wrbuf[1] = value;
Simon Budig43c4d132012-07-24 23:29:36 -0700270
Robert Woerlecc071ac2014-06-07 22:20:23 -0700271 return edt_ft5x06_ts_readwrite(tsdata->client, 2,
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700272 wrbuf, 0, NULL);
273
274 default:
275 return -EINVAL;
276 }
Simon Budig43c4d132012-07-24 23:29:36 -0700277}
278
279static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
280 u8 addr)
281{
282 u8 wrbuf[2], rdbuf[2];
283 int error;
284
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700285 switch (tsdata->version) {
286 case M06:
287 wrbuf[0] = tsdata->factory_mode ? 0xf3 : 0xfc;
288 wrbuf[1] = tsdata->factory_mode ? addr & 0x7f : addr & 0x3f;
289 wrbuf[1] |= tsdata->factory_mode ? 0x80 : 0x40;
Simon Budig43c4d132012-07-24 23:29:36 -0700290
Dan Carpentere2c3ecf2014-04-03 09:17:05 -0700291 error = edt_ft5x06_ts_readwrite(tsdata->client, 2, wrbuf, 2,
292 rdbuf);
293 if (error)
294 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700295
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700296 if ((wrbuf[0] ^ wrbuf[1] ^ rdbuf[0]) != rdbuf[1]) {
297 dev_err(&tsdata->client->dev,
298 "crc error: 0x%02x expected, got 0x%02x\n",
299 wrbuf[0] ^ wrbuf[1] ^ rdbuf[0],
300 rdbuf[1]);
301 return -EIO;
302 }
303 break;
304
305 case M09:
306 wrbuf[0] = addr;
307 error = edt_ft5x06_ts_readwrite(tsdata->client, 1,
308 wrbuf, 1, rdbuf);
309 if (error)
310 return error;
311 break;
312
313 default:
314 return -EINVAL;
Simon Budig43c4d132012-07-24 23:29:36 -0700315 }
316
317 return rdbuf[0];
318}
319
320struct edt_ft5x06_attribute {
321 struct device_attribute dattr;
322 size_t field_offset;
323 u8 limit_low;
324 u8 limit_high;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700325 u8 addr_m06;
326 u8 addr_m09;
Simon Budig43c4d132012-07-24 23:29:36 -0700327};
328
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700329#define EDT_ATTR(_field, _mode, _addr_m06, _addr_m09, \
330 _limit_low, _limit_high) \
Simon Budig43c4d132012-07-24 23:29:36 -0700331 struct edt_ft5x06_attribute edt_ft5x06_attr_##_field = { \
332 .dattr = __ATTR(_field, _mode, \
333 edt_ft5x06_setting_show, \
334 edt_ft5x06_setting_store), \
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700335 .field_offset = offsetof(struct edt_ft5x06_ts_data, _field), \
336 .addr_m06 = _addr_m06, \
337 .addr_m09 = _addr_m09, \
Simon Budig43c4d132012-07-24 23:29:36 -0700338 .limit_low = _limit_low, \
339 .limit_high = _limit_high, \
Simon Budig43c4d132012-07-24 23:29:36 -0700340 }
341
342static ssize_t edt_ft5x06_setting_show(struct device *dev,
343 struct device_attribute *dattr,
344 char *buf)
345{
346 struct i2c_client *client = to_i2c_client(dev);
347 struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
348 struct edt_ft5x06_attribute *attr =
349 container_of(dattr, struct edt_ft5x06_attribute, dattr);
Lothar Waßmann1730d812014-03-28 09:20:08 -0700350 u8 *field = (u8 *)tsdata + attr->field_offset;
Simon Budig43c4d132012-07-24 23:29:36 -0700351 int val;
352 size_t count = 0;
353 int error = 0;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700354 u8 addr;
Simon Budig43c4d132012-07-24 23:29:36 -0700355
356 mutex_lock(&tsdata->mutex);
357
358 if (tsdata->factory_mode) {
359 error = -EIO;
360 goto out;
361 }
362
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700363 switch (tsdata->version) {
364 case M06:
365 addr = attr->addr_m06;
366 break;
367
368 case M09:
369 addr = attr->addr_m09;
370 break;
371
372 default:
373 error = -ENODEV;
Simon Budig43c4d132012-07-24 23:29:36 -0700374 goto out;
375 }
376
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700377 if (addr != NO_REGISTER) {
378 val = edt_ft5x06_register_read(tsdata, addr);
379 if (val < 0) {
380 error = val;
381 dev_err(&tsdata->client->dev,
382 "Failed to fetch attribute %s, error %d\n",
383 dattr->attr.name, error);
384 goto out;
385 }
386 } else {
387 val = *field;
388 }
389
Simon Budig43c4d132012-07-24 23:29:36 -0700390 if (val != *field) {
391 dev_warn(&tsdata->client->dev,
392 "%s: read (%d) and stored value (%d) differ\n",
393 dattr->attr.name, val, *field);
394 *field = val;
395 }
396
397 count = scnprintf(buf, PAGE_SIZE, "%d\n", val);
398out:
399 mutex_unlock(&tsdata->mutex);
400 return error ?: count;
401}
402
403static ssize_t edt_ft5x06_setting_store(struct device *dev,
404 struct device_attribute *dattr,
405 const char *buf, size_t count)
406{
407 struct i2c_client *client = to_i2c_client(dev);
408 struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
409 struct edt_ft5x06_attribute *attr =
410 container_of(dattr, struct edt_ft5x06_attribute, dattr);
Lothar Waßmann1730d812014-03-28 09:20:08 -0700411 u8 *field = (u8 *)tsdata + attr->field_offset;
Simon Budig43c4d132012-07-24 23:29:36 -0700412 unsigned int val;
413 int error;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700414 u8 addr;
Simon Budig43c4d132012-07-24 23:29:36 -0700415
416 mutex_lock(&tsdata->mutex);
417
418 if (tsdata->factory_mode) {
419 error = -EIO;
420 goto out;
421 }
422
423 error = kstrtouint(buf, 0, &val);
424 if (error)
425 goto out;
426
427 if (val < attr->limit_low || val > attr->limit_high) {
428 error = -ERANGE;
429 goto out;
430 }
431
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700432 switch (tsdata->version) {
433 case M06:
434 addr = attr->addr_m06;
435 break;
436
437 case M09:
438 addr = attr->addr_m09;
439 break;
440
441 default:
442 error = -ENODEV;
Simon Budig43c4d132012-07-24 23:29:36 -0700443 goto out;
444 }
445
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700446 if (addr != NO_REGISTER) {
447 error = edt_ft5x06_register_write(tsdata, addr, val);
448 if (error) {
449 dev_err(&tsdata->client->dev,
450 "Failed to update attribute %s, error: %d\n",
451 dattr->attr.name, error);
452 goto out;
453 }
454 }
Simon Budig43c4d132012-07-24 23:29:36 -0700455 *field = val;
456
457out:
458 mutex_unlock(&tsdata->mutex);
459 return error ?: count;
460}
461
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700462static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,
463 M09_REGISTER_GAIN, 0, 31);
464static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,
465 M09_REGISTER_OFFSET, 0, 31);
466static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
467 M09_REGISTER_THRESHOLD, 20, 80);
468static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
469 NO_REGISTER, 3, 14);
Simon Budig43c4d132012-07-24 23:29:36 -0700470
471static struct attribute *edt_ft5x06_attrs[] = {
472 &edt_ft5x06_attr_gain.dattr.attr,
473 &edt_ft5x06_attr_offset.dattr.attr,
474 &edt_ft5x06_attr_threshold.dattr.attr,
475 &edt_ft5x06_attr_report_rate.dattr.attr,
476 NULL
477};
478
479static const struct attribute_group edt_ft5x06_attr_group = {
480 .attrs = edt_ft5x06_attrs,
481};
482
483#ifdef CONFIG_DEBUG_FS
484static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
485{
486 struct i2c_client *client = tsdata->client;
487 int retries = EDT_SWITCH_MODE_RETRIES;
488 int ret;
489 int error;
490
491 disable_irq(client->irq);
492
493 if (!tsdata->raw_buffer) {
494 tsdata->raw_bufsize = tsdata->num_x * tsdata->num_y *
495 sizeof(u16);
496 tsdata->raw_buffer = kzalloc(tsdata->raw_bufsize, GFP_KERNEL);
497 if (!tsdata->raw_buffer) {
498 error = -ENOMEM;
499 goto err_out;
500 }
501 }
502
503 /* mode register is 0x3c when in the work mode */
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700504 if (tsdata->version == M09)
505 goto m09_out;
506
Simon Budig43c4d132012-07-24 23:29:36 -0700507 error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03);
508 if (error) {
509 dev_err(&client->dev,
510 "failed to switch to factory mode, error %d\n", error);
511 goto err_out;
512 }
513
514 tsdata->factory_mode = true;
515 do {
516 mdelay(EDT_SWITCH_MODE_DELAY);
517 /* mode register is 0x01 when in factory mode */
518 ret = edt_ft5x06_register_read(tsdata, FACTORY_REGISTER_OPMODE);
519 if (ret == 0x03)
520 break;
521 } while (--retries > 0);
522
523 if (retries == 0) {
524 dev_err(&client->dev, "not in factory mode after %dms.\n",
525 EDT_SWITCH_MODE_RETRIES * EDT_SWITCH_MODE_DELAY);
526 error = -EIO;
527 goto err_out;
528 }
529
530 return 0;
531
532err_out:
533 kfree(tsdata->raw_buffer);
534 tsdata->raw_buffer = NULL;
535 tsdata->factory_mode = false;
536 enable_irq(client->irq);
537
538 return error;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700539
540m09_out:
541 dev_err(&client->dev, "No factory mode support for M09\n");
542 return -EINVAL;
543
Simon Budig43c4d132012-07-24 23:29:36 -0700544}
545
546static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
547{
548 struct i2c_client *client = tsdata->client;
549 int retries = EDT_SWITCH_MODE_RETRIES;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700550 struct edt_reg_addr *reg_addr = &tsdata->reg_addr;
Simon Budig43c4d132012-07-24 23:29:36 -0700551 int ret;
552 int error;
553
554 /* mode register is 0x01 when in the factory mode */
555 error = edt_ft5x06_register_write(tsdata, FACTORY_REGISTER_OPMODE, 0x1);
556 if (error) {
557 dev_err(&client->dev,
558 "failed to switch to work mode, error: %d\n", error);
559 return error;
560 }
561
562 tsdata->factory_mode = false;
563
564 do {
565 mdelay(EDT_SWITCH_MODE_DELAY);
566 /* mode register is 0x01 when in factory mode */
567 ret = edt_ft5x06_register_read(tsdata, WORK_REGISTER_OPMODE);
568 if (ret == 0x01)
569 break;
570 } while (--retries > 0);
571
572 if (retries == 0) {
573 dev_err(&client->dev, "not in work mode after %dms.\n",
574 EDT_SWITCH_MODE_RETRIES * EDT_SWITCH_MODE_DELAY);
575 tsdata->factory_mode = true;
576 return -EIO;
577 }
578
Sachin Kamat8efcc502013-03-28 01:14:42 -0700579 kfree(tsdata->raw_buffer);
Simon Budig43c4d132012-07-24 23:29:36 -0700580 tsdata->raw_buffer = NULL;
581
582 /* restore parameters */
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700583 edt_ft5x06_register_write(tsdata, reg_addr->reg_threshold,
Simon Budig43c4d132012-07-24 23:29:36 -0700584 tsdata->threshold);
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700585 edt_ft5x06_register_write(tsdata, reg_addr->reg_gain,
Simon Budig43c4d132012-07-24 23:29:36 -0700586 tsdata->gain);
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700587 edt_ft5x06_register_write(tsdata, reg_addr->reg_offset,
Simon Budig43c4d132012-07-24 23:29:36 -0700588 tsdata->offset);
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700589 if (reg_addr->reg_report_rate)
590 edt_ft5x06_register_write(tsdata, reg_addr->reg_report_rate,
Simon Budig43c4d132012-07-24 23:29:36 -0700591 tsdata->report_rate);
592
593 enable_irq(client->irq);
594
595 return 0;
596}
597
598static int edt_ft5x06_debugfs_mode_get(void *data, u64 *mode)
599{
600 struct edt_ft5x06_ts_data *tsdata = data;
601
602 *mode = tsdata->factory_mode;
603
604 return 0;
605};
606
607static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
608{
609 struct edt_ft5x06_ts_data *tsdata = data;
610 int retval = 0;
611
612 if (mode > 1)
613 return -ERANGE;
614
615 mutex_lock(&tsdata->mutex);
616
617 if (mode != tsdata->factory_mode) {
618 retval = mode ? edt_ft5x06_factory_mode(tsdata) :
Lothar Waßmann1730d812014-03-28 09:20:08 -0700619 edt_ft5x06_work_mode(tsdata);
Simon Budig43c4d132012-07-24 23:29:36 -0700620 }
621
622 mutex_unlock(&tsdata->mutex);
623
624 return retval;
625};
626
627DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
628 edt_ft5x06_debugfs_mode_set, "%llu\n");
629
Simon Budig43c4d132012-07-24 23:29:36 -0700630static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
631 char __user *buf, size_t count, loff_t *off)
632{
633 struct edt_ft5x06_ts_data *tsdata = file->private_data;
634 struct i2c_client *client = tsdata->client;
635 int retries = EDT_RAW_DATA_RETRIES;
636 int val, i, error;
637 size_t read = 0;
638 int colbytes;
639 char wrbuf[3];
640 u8 *rdbuf;
641
642 if (*off < 0 || *off >= tsdata->raw_bufsize)
643 return 0;
644
645 mutex_lock(&tsdata->mutex);
646
647 if (!tsdata->factory_mode || !tsdata->raw_buffer) {
648 error = -EIO;
649 goto out;
650 }
651
652 error = edt_ft5x06_register_write(tsdata, 0x08, 0x01);
653 if (error) {
654 dev_dbg(&client->dev,
655 "failed to write 0x08 register, error %d\n", error);
656 goto out;
657 }
658
659 do {
660 msleep(EDT_RAW_DATA_DELAY);
661 val = edt_ft5x06_register_read(tsdata, 0x08);
662 if (val < 1)
663 break;
664 } while (--retries > 0);
665
666 if (val < 0) {
667 error = val;
668 dev_dbg(&client->dev,
669 "failed to read 0x08 register, error %d\n", error);
670 goto out;
671 }
672
673 if (retries == 0) {
674 dev_dbg(&client->dev,
675 "timed out waiting for register to settle\n");
676 error = -ETIMEDOUT;
677 goto out;
678 }
679
680 rdbuf = tsdata->raw_buffer;
681 colbytes = tsdata->num_y * sizeof(u16);
682
683 wrbuf[0] = 0xf5;
684 wrbuf[1] = 0x0e;
685 for (i = 0; i < tsdata->num_x; i++) {
686 wrbuf[2] = i; /* column index */
687 error = edt_ft5x06_ts_readwrite(tsdata->client,
688 sizeof(wrbuf), wrbuf,
689 colbytes, rdbuf);
690 if (error)
691 goto out;
692
693 rdbuf += colbytes;
694 }
695
696 read = min_t(size_t, count, tsdata->raw_bufsize - *off);
Axel Lin35b1da42012-09-19 15:56:23 -0700697 if (copy_to_user(buf, tsdata->raw_buffer + *off, read)) {
698 error = -EFAULT;
699 goto out;
700 }
701
702 *off += read;
Simon Budig43c4d132012-07-24 23:29:36 -0700703out:
704 mutex_unlock(&tsdata->mutex);
705 return error ?: read;
706};
707
Simon Budig43c4d132012-07-24 23:29:36 -0700708static const struct file_operations debugfs_raw_data_fops = {
Wei Yongjunf6c0df62012-10-17 23:55:54 -0700709 .open = simple_open,
Simon Budig43c4d132012-07-24 23:29:36 -0700710 .read = edt_ft5x06_debugfs_raw_data_read,
711};
712
Bill Pemberton5298cc42012-11-23 21:38:25 -0800713static void
Simon Budig43c4d132012-07-24 23:29:36 -0700714edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
715 const char *debugfs_name)
716{
717 tsdata->debug_dir = debugfs_create_dir(debugfs_name, NULL);
718 if (!tsdata->debug_dir)
719 return;
720
721 debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);
722 debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);
723
724 debugfs_create_file("mode", S_IRUSR | S_IWUSR,
725 tsdata->debug_dir, tsdata, &debugfs_mode_fops);
726 debugfs_create_file("raw_data", S_IRUSR,
727 tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
728}
729
Bill Pembertone2619cf2012-11-23 21:50:47 -0800730static void
Simon Budig43c4d132012-07-24 23:29:36 -0700731edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
732{
Fabian Frederickf69c6ec2014-07-09 09:45:57 -0700733 debugfs_remove_recursive(tsdata->debug_dir);
Guenter Roecka1d0fa72012-08-21 22:01:45 -0700734 kfree(tsdata->raw_buffer);
Simon Budig43c4d132012-07-24 23:29:36 -0700735}
736
737#else
738
739static inline void
740edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
741 const char *debugfs_name)
742{
743}
744
745static inline void
746edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
747{
748}
749
750#endif /* CONFIG_DEBUGFS */
751
Bill Pemberton5298cc42012-11-23 21:38:25 -0800752static int edt_ft5x06_ts_identify(struct i2c_client *client,
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700753 struct edt_ft5x06_ts_data *tsdata,
754 char *fw_version)
Simon Budig43c4d132012-07-24 23:29:36 -0700755{
756 u8 rdbuf[EDT_NAME_LEN];
757 char *p;
758 int error;
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700759 char *model_name = tsdata->name;
Simon Budig43c4d132012-07-24 23:29:36 -0700760
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700761 /* see what we find if we assume it is a M06 *
762 * if we get less than EDT_NAME_LEN, we don't want
763 * to have garbage in there
764 */
765 memset(rdbuf, 0, sizeof(rdbuf));
Simon Budig43c4d132012-07-24 23:29:36 -0700766 error = edt_ft5x06_ts_readwrite(client, 1, "\xbb",
767 EDT_NAME_LEN - 1, rdbuf);
768 if (error)
769 return error;
770
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700771 /* if we find something consistent, stay with that assumption
772 * at least M09 won't send 3 bytes here
773 */
Rasmus Villemoes0f3ae5b2014-10-13 15:54:48 -0700774 if (!(strncasecmp(rdbuf + 1, "EP0", 3))) {
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700775 tsdata->version = M06;
Simon Budig43c4d132012-07-24 23:29:36 -0700776
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700777 /* remove last '$' end marker */
778 rdbuf[EDT_NAME_LEN - 1] = '\0';
779 if (rdbuf[EDT_NAME_LEN - 2] == '$')
780 rdbuf[EDT_NAME_LEN - 2] = '\0';
Simon Budig43c4d132012-07-24 23:29:36 -0700781
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700782 /* look for Model/Version separator */
783 p = strchr(rdbuf, '*');
784 if (p)
785 *p++ = '\0';
786 strlcpy(model_name, rdbuf + 1, EDT_NAME_LEN);
787 strlcpy(fw_version, p ? p : "", EDT_NAME_LEN);
788 } else {
789 /* since there are only two versions around (M06, M09) */
790 tsdata->version = M09;
791
792 error = edt_ft5x06_ts_readwrite(client, 1, "\xA6",
793 2, rdbuf);
794 if (error)
795 return error;
796
797 strlcpy(fw_version, rdbuf, 2);
798
799 error = edt_ft5x06_ts_readwrite(client, 1, "\xA8",
800 1, rdbuf);
801 if (error)
802 return error;
803
804 snprintf(model_name, EDT_NAME_LEN, "EP0%i%i0M09",
805 rdbuf[0] >> 4, rdbuf[0] & 0x0F);
806 }
Simon Budig43c4d132012-07-24 23:29:36 -0700807
808 return 0;
809}
810
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700811#define EDT_GET_PROP(name, reg) { \
812 u32 val; \
813 if (of_property_read_u32(np, #name, &val) == 0) \
814 edt_ft5x06_register_write(tsdata, reg, val); \
815}
816
Dmitry Torokhov22ddbac2015-09-12 09:37:03 -0700817static void edt_ft5x06_ts_get_defaults(struct device_node *np,
818 struct edt_ft5x06_ts_data *tsdata)
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700819{
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700820 struct edt_reg_addr *reg_addr = &tsdata->reg_addr;
821
822 EDT_GET_PROP(threshold, reg_addr->reg_threshold);
823 EDT_GET_PROP(gain, reg_addr->reg_gain);
824 EDT_GET_PROP(offset, reg_addr->reg_offset);
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700825}
826
Bill Pemberton5298cc42012-11-23 21:38:25 -0800827static void
Simon Budig43c4d132012-07-24 23:29:36 -0700828edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata)
829{
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700830 struct edt_reg_addr *reg_addr = &tsdata->reg_addr;
831
Simon Budig43c4d132012-07-24 23:29:36 -0700832 tsdata->threshold = edt_ft5x06_register_read(tsdata,
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700833 reg_addr->reg_threshold);
834 tsdata->gain = edt_ft5x06_register_read(tsdata, reg_addr->reg_gain);
835 tsdata->offset = edt_ft5x06_register_read(tsdata, reg_addr->reg_offset);
836 if (reg_addr->reg_report_rate != NO_REGISTER)
837 tsdata->report_rate = edt_ft5x06_register_read(tsdata,
838 reg_addr->reg_report_rate);
839 tsdata->num_x = edt_ft5x06_register_read(tsdata, reg_addr->reg_num_x);
840 tsdata->num_y = edt_ft5x06_register_read(tsdata, reg_addr->reg_num_y);
841}
842
843static void
844edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
845{
846 struct edt_reg_addr *reg_addr = &tsdata->reg_addr;
847
848 switch (tsdata->version) {
849 case M06:
850 reg_addr->reg_threshold = WORK_REGISTER_THRESHOLD;
851 reg_addr->reg_report_rate = WORK_REGISTER_REPORT_RATE;
852 reg_addr->reg_gain = WORK_REGISTER_GAIN;
853 reg_addr->reg_offset = WORK_REGISTER_OFFSET;
854 reg_addr->reg_num_x = WORK_REGISTER_NUM_X;
855 reg_addr->reg_num_y = WORK_REGISTER_NUM_Y;
856 break;
857
858 case M09:
859 reg_addr->reg_threshold = M09_REGISTER_THRESHOLD;
860 reg_addr->reg_gain = M09_REGISTER_GAIN;
861 reg_addr->reg_offset = M09_REGISTER_OFFSET;
862 reg_addr->reg_num_x = M09_REGISTER_NUM_X;
863 reg_addr->reg_num_y = M09_REGISTER_NUM_Y;
864 break;
865 }
Simon Budig43c4d132012-07-24 23:29:36 -0700866}
867
Bill Pemberton5298cc42012-11-23 21:38:25 -0800868static int edt_ft5x06_ts_probe(struct i2c_client *client,
Simon Budig43c4d132012-07-24 23:29:36 -0700869 const struct i2c_device_id *id)
870{
Simon Budig43c4d132012-07-24 23:29:36 -0700871 struct edt_ft5x06_ts_data *tsdata;
872 struct input_dev *input;
873 int error;
874 char fw_version[EDT_NAME_LEN];
875
876 dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
877
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800878 tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL);
879 if (!tsdata) {
Simon Budig43c4d132012-07-24 23:29:36 -0700880 dev_err(&client->dev, "failed to allocate driver data.\n");
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800881 return -ENOMEM;
882 }
883
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -0700884 tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
885 "reset", GPIOD_OUT_HIGH);
886 if (IS_ERR(tsdata->reset_gpio)) {
887 error = PTR_ERR(tsdata->reset_gpio);
888 dev_err(&client->dev,
889 "Failed to request GPIO reset pin, error %d\n", error);
890 return error;
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700891 }
892
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -0700893 tsdata->wake_gpio = devm_gpiod_get_optional(&client->dev,
894 "wake", GPIOD_OUT_LOW);
895 if (IS_ERR(tsdata->wake_gpio)) {
896 error = PTR_ERR(tsdata->wake_gpio);
897 dev_err(&client->dev,
898 "Failed to request GPIO wake pin, error %d\n", error);
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700899 return error;
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -0700900 }
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700901
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -0700902 if (tsdata->wake_gpio) {
903 usleep_range(5000, 6000);
904 gpiod_set_value_cansleep(tsdata->wake_gpio, 1);
905 }
906
907 if (tsdata->reset_gpio) {
908 usleep_range(5000, 6000);
909 gpiod_set_value_cansleep(tsdata->reset_gpio, 0);
910 msleep(300);
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700911 }
912
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800913 input = devm_input_allocate_device(&client->dev);
914 if (!input) {
915 dev_err(&client->dev, "failed to allocate input device.\n");
916 return -ENOMEM;
Simon Budig43c4d132012-07-24 23:29:36 -0700917 }
918
919 mutex_init(&tsdata->mutex);
920 tsdata->client = client;
921 tsdata->input = input;
922 tsdata->factory_mode = false;
923
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700924 error = edt_ft5x06_ts_identify(client, tsdata, fw_version);
Simon Budig43c4d132012-07-24 23:29:36 -0700925 if (error) {
926 dev_err(&client->dev, "touchscreen probe failed\n");
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800927 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700928 }
929
Lothar Waßmannfd335ab2014-03-28 09:31:14 -0700930 edt_ft5x06_ts_set_regs(tsdata);
Dmitry Torokhov22ddbac2015-09-12 09:37:03 -0700931 edt_ft5x06_ts_get_defaults(client->dev.of_node, tsdata);
Simon Budig43c4d132012-07-24 23:29:36 -0700932 edt_ft5x06_ts_get_parameters(tsdata);
933
934 dev_dbg(&client->dev,
935 "Model \"%s\", Rev. \"%s\", %dx%d sensors\n",
936 tsdata->name, fw_version, tsdata->num_x, tsdata->num_y);
937
938 input->name = tsdata->name;
939 input->id.bustype = BUS_I2C;
940 input->dev.parent = &client->dev;
941
Simon Budig43c4d132012-07-24 23:29:36 -0700942 input_set_abs_params(input, ABS_MT_POSITION_X,
943 0, tsdata->num_x * 64 - 1, 0, 0);
944 input_set_abs_params(input, ABS_MT_POSITION_Y,
945 0, tsdata->num_y * 64 - 1, 0, 0);
Maxime Ripard2c005592015-03-21 20:18:06 -0700946
Dmitry Torokhov22ddbac2015-09-12 09:37:03 -0700947 touchscreen_parse_properties(input, true);
Maxime Ripard2c005592015-03-21 20:18:06 -0700948
Dmitry Torokhov38e1b722015-06-01 10:41:11 -0700949 error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, INPUT_MT_DIRECT);
Simon Budig43c4d132012-07-24 23:29:36 -0700950 if (error) {
951 dev_err(&client->dev, "Unable to init MT slots.\n");
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800952 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700953 }
954
955 input_set_drvdata(input, tsdata);
956 i2c_set_clientdata(client, tsdata);
957
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700958 error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
959 edt_ft5x06_ts_isr,
960 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
961 client->name, tsdata);
Simon Budig43c4d132012-07-24 23:29:36 -0700962 if (error) {
963 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800964 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700965 }
966
967 error = sysfs_create_group(&client->dev.kobj, &edt_ft5x06_attr_group);
968 if (error)
Lothar Waßmann02300bd2014-01-16 16:26:55 -0800969 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700970
971 error = input_register_device(input);
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700972 if (error)
973 goto err_remove_attrs;
Simon Budig43c4d132012-07-24 23:29:36 -0700974
975 edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
976 device_init_wakeup(&client->dev, 1);
977
978 dev_dbg(&client->dev,
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700979 "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
Franklin S Cooper Jr13c23cd2015-09-11 17:30:34 -0700980 client->irq, desc_to_gpio(tsdata->wake_gpio),
981 desc_to_gpio(tsdata->reset_gpio));
Simon Budig43c4d132012-07-24 23:29:36 -0700982
983 return 0;
Lothar Waßmanndac90dc22014-03-28 09:23:02 -0700984
985err_remove_attrs:
986 sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
987 return error;
Simon Budig43c4d132012-07-24 23:29:36 -0700988}
989
Bill Pembertone2619cf2012-11-23 21:50:47 -0800990static int edt_ft5x06_ts_remove(struct i2c_client *client)
Simon Budig43c4d132012-07-24 23:29:36 -0700991{
Simon Budig43c4d132012-07-24 23:29:36 -0700992 struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
993
994 edt_ft5x06_ts_teardown_debugfs(tsdata);
995 sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
996
Simon Budig43c4d132012-07-24 23:29:36 -0700997 return 0;
998}
999
Jingoo Han02b6a582014-11-02 00:04:14 -07001000static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
Simon Budig43c4d132012-07-24 23:29:36 -07001001{
1002 struct i2c_client *client = to_i2c_client(dev);
1003
1004 if (device_may_wakeup(dev))
1005 enable_irq_wake(client->irq);
1006
1007 return 0;
1008}
1009
Jingoo Han02b6a582014-11-02 00:04:14 -07001010static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
Simon Budig43c4d132012-07-24 23:29:36 -07001011{
1012 struct i2c_client *client = to_i2c_client(dev);
1013
1014 if (device_may_wakeup(dev))
1015 disable_irq_wake(client->irq);
1016
1017 return 0;
1018}
Simon Budig43c4d132012-07-24 23:29:36 -07001019
1020static SIMPLE_DEV_PM_OPS(edt_ft5x06_ts_pm_ops,
1021 edt_ft5x06_ts_suspend, edt_ft5x06_ts_resume);
1022
1023static const struct i2c_device_id edt_ft5x06_ts_id[] = {
Lothar Waßmann1730d812014-03-28 09:20:08 -07001024 { "edt-ft5x06", 0, },
1025 { /* sentinel */ }
Simon Budig43c4d132012-07-24 23:29:36 -07001026};
1027MODULE_DEVICE_TABLE(i2c, edt_ft5x06_ts_id);
1028
Lothar Waßmanndac90dc22014-03-28 09:23:02 -07001029#ifdef CONFIG_OF
1030static const struct of_device_id edt_ft5x06_of_match[] = {
1031 { .compatible = "edt,edt-ft5206", },
1032 { .compatible = "edt,edt-ft5306", },
1033 { .compatible = "edt,edt-ft5406", },
1034 { /* sentinel */ }
1035};
1036MODULE_DEVICE_TABLE(of, edt_ft5x06_of_match);
1037#endif
1038
Simon Budig43c4d132012-07-24 23:29:36 -07001039static struct i2c_driver edt_ft5x06_ts_driver = {
1040 .driver = {
Simon Budig43c4d132012-07-24 23:29:36 -07001041 .name = "edt_ft5x06",
Lothar Waßmanndac90dc22014-03-28 09:23:02 -07001042 .of_match_table = of_match_ptr(edt_ft5x06_of_match),
Simon Budig43c4d132012-07-24 23:29:36 -07001043 .pm = &edt_ft5x06_ts_pm_ops,
1044 },
1045 .id_table = edt_ft5x06_ts_id,
1046 .probe = edt_ft5x06_ts_probe,
Bill Pemberton1cb0aa82012-11-23 21:27:39 -08001047 .remove = edt_ft5x06_ts_remove,
Simon Budig43c4d132012-07-24 23:29:36 -07001048};
1049
1050module_i2c_driver(edt_ft5x06_ts_driver);
1051
1052MODULE_AUTHOR("Simon Budig <simon.budig@kernelconcepts.de>");
1053MODULE_DESCRIPTION("EDT FT5x06 I2C Touchscreen Driver");
1054MODULE_LICENSE("GPL");