Input: auo-pixcir-ts - drop support for platform data
[platform/kernel/linux-starfive.git] / drivers / input / touchscreen / auo-pixcir-ts.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Driver for AUO in-cell touchscreens
4  *
5  * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
6  *
7  * loosely based on auo_touch.c from Dell Streak vendor-kernel
8  *
9  * Copyright (c) 2008 QUALCOMM Incorporated.
10  * Copyright (c) 2008 QUALCOMM USA, INC.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/interrupt.h>
16 #include <linux/slab.h>
17 #include <linux/input.h>
18 #include <linux/jiffies.h>
19 #include <linux/i2c.h>
20 #include <linux/mutex.h>
21 #include <linux/delay.h>
22 #include <linux/gpio.h>
23 #include <linux/of.h>
24 #include <linux/of_gpio.h>
25
26 /*
27  * Coordinate calculation:
28  * X1 = X1_LSB + X1_MSB*256
29  * Y1 = Y1_LSB + Y1_MSB*256
30  * X2 = X2_LSB + X2_MSB*256
31  * Y2 = Y2_LSB + Y2_MSB*256
32  */
33 #define AUO_PIXCIR_REG_X1_LSB           0x00
34 #define AUO_PIXCIR_REG_X1_MSB           0x01
35 #define AUO_PIXCIR_REG_Y1_LSB           0x02
36 #define AUO_PIXCIR_REG_Y1_MSB           0x03
37 #define AUO_PIXCIR_REG_X2_LSB           0x04
38 #define AUO_PIXCIR_REG_X2_MSB           0x05
39 #define AUO_PIXCIR_REG_Y2_LSB           0x06
40 #define AUO_PIXCIR_REG_Y2_MSB           0x07
41
42 #define AUO_PIXCIR_REG_STRENGTH         0x0d
43 #define AUO_PIXCIR_REG_STRENGTH_X1_LSB  0x0e
44 #define AUO_PIXCIR_REG_STRENGTH_X1_MSB  0x0f
45
46 #define AUO_PIXCIR_REG_RAW_DATA_X       0x2b
47 #define AUO_PIXCIR_REG_RAW_DATA_Y       0x4f
48
49 #define AUO_PIXCIR_REG_X_SENSITIVITY    0x6f
50 #define AUO_PIXCIR_REG_Y_SENSITIVITY    0x70
51 #define AUO_PIXCIR_REG_INT_SETTING      0x71
52 #define AUO_PIXCIR_REG_INT_WIDTH        0x72
53 #define AUO_PIXCIR_REG_POWER_MODE       0x73
54
55 #define AUO_PIXCIR_REG_VERSION          0x77
56 #define AUO_PIXCIR_REG_CALIBRATE        0x78
57
58 #define AUO_PIXCIR_REG_TOUCHAREA_X1     0x1e
59 #define AUO_PIXCIR_REG_TOUCHAREA_Y1     0x1f
60 #define AUO_PIXCIR_REG_TOUCHAREA_X2     0x20
61 #define AUO_PIXCIR_REG_TOUCHAREA_Y2     0x21
62
63 #define AUO_PIXCIR_REG_EEPROM_CALIB_X   0x42
64 #define AUO_PIXCIR_REG_EEPROM_CALIB_Y   0xad
65
66 #define AUO_PIXCIR_INT_TPNUM_MASK       0xe0
67 #define AUO_PIXCIR_INT_TPNUM_SHIFT      5
68 #define AUO_PIXCIR_INT_RELEASE          (1 << 4)
69 #define AUO_PIXCIR_INT_ENABLE           (1 << 3)
70 #define AUO_PIXCIR_INT_POL_HIGH         (1 << 2)
71
72 /*
73  * Interrupt modes:
74  * periodical:          interrupt is asserted periodicaly
75  * compare coordinates: interrupt is asserted when coordinates change
76  * indicate touch:      interrupt is asserted during touch
77  */
78 #define AUO_PIXCIR_INT_PERIODICAL       0x00
79 #define AUO_PIXCIR_INT_COMP_COORD       0x01
80 #define AUO_PIXCIR_INT_TOUCH_IND        0x02
81 #define AUO_PIXCIR_INT_MODE_MASK        0x03
82
83 /*
84  * Power modes:
85  * active:      scan speed 60Hz
86  * sleep:       scan speed 10Hz can be auto-activated, wakeup on 1st touch
87  * deep sleep:  scan speed 1Hz can only be entered or left manually.
88  */
89 #define AUO_PIXCIR_POWER_ACTIVE         0x00
90 #define AUO_PIXCIR_POWER_SLEEP          0x01
91 #define AUO_PIXCIR_POWER_DEEP_SLEEP     0x02
92 #define AUO_PIXCIR_POWER_MASK           0x03
93
94 #define AUO_PIXCIR_POWER_ALLOW_SLEEP    (1 << 2)
95 #define AUO_PIXCIR_POWER_IDLE_TIME(ms)  ((ms & 0xf) << 4)
96
97 #define AUO_PIXCIR_CALIBRATE            0x03
98
99 #define AUO_PIXCIR_EEPROM_CALIB_X_LEN   62
100 #define AUO_PIXCIR_EEPROM_CALIB_Y_LEN   36
101
102 #define AUO_PIXCIR_RAW_DATA_X_LEN       18
103 #define AUO_PIXCIR_RAW_DATA_Y_LEN       11
104
105 #define AUO_PIXCIR_STRENGTH_ENABLE      (1 << 0)
106
107 /* Touchscreen absolute values */
108 #define AUO_PIXCIR_REPORT_POINTS        2
109 #define AUO_PIXCIR_MAX_AREA             0xff
110 #define AUO_PIXCIR_PENUP_TIMEOUT_MS     10
111
112 struct auo_pixcir_ts {
113         struct i2c_client       *client;
114         struct input_dev        *input;
115         int                     gpio_int;
116         int                     gpio_rst;
117         char                    phys[32];
118
119         unsigned int            x_max;
120         unsigned int            y_max;
121
122         /* special handling for touch_indicate interrupt mode */
123         bool                    touch_ind_mode;
124
125         wait_queue_head_t       wait;
126         bool                    stopped;
127 };
128
129 struct auo_point_t {
130         int     coord_x;
131         int     coord_y;
132         int     area_major;
133         int     area_minor;
134         int     orientation;
135 };
136
137 static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts,
138                                    struct auo_point_t *point)
139 {
140         struct i2c_client *client = ts->client;
141         uint8_t raw_coord[8];
142         uint8_t raw_area[4];
143         int i, ret;
144
145         /* touch coordinates */
146         ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_X1_LSB,
147                                             8, raw_coord);
148         if (ret < 0) {
149                 dev_err(&client->dev, "failed to read coordinate, %d\n", ret);
150                 return ret;
151         }
152
153         /* touch area */
154         ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_TOUCHAREA_X1,
155                                             4, raw_area);
156         if (ret < 0) {
157                 dev_err(&client->dev, "could not read touch area, %d\n", ret);
158                 return ret;
159         }
160
161         for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) {
162                 point[i].coord_x =
163                         raw_coord[4 * i + 1] << 8 | raw_coord[4 * i];
164                 point[i].coord_y =
165                         raw_coord[4 * i + 3] << 8 | raw_coord[4 * i + 2];
166
167                 if (point[i].coord_x > ts->x_max ||
168                     point[i].coord_y > ts->y_max) {
169                         dev_warn(&client->dev, "coordinates (%d,%d) invalid\n",
170                                 point[i].coord_x, point[i].coord_y);
171                         point[i].coord_x = point[i].coord_y = 0;
172                 }
173
174                 /* determine touch major, minor and orientation */
175                 point[i].area_major = max(raw_area[2 * i], raw_area[2 * i + 1]);
176                 point[i].area_minor = min(raw_area[2 * i], raw_area[2 * i + 1]);
177                 point[i].orientation = raw_area[2 * i] > raw_area[2 * i + 1];
178         }
179
180         return 0;
181 }
182
183 static irqreturn_t auo_pixcir_interrupt(int irq, void *dev_id)
184 {
185         struct auo_pixcir_ts *ts = dev_id;
186         struct auo_point_t point[AUO_PIXCIR_REPORT_POINTS];
187         int i;
188         int ret;
189         int fingers = 0;
190         int abs = -1;
191
192         while (!ts->stopped) {
193
194                 /* check for up event in touch touch_ind_mode */
195                 if (ts->touch_ind_mode) {
196                         if (gpio_get_value(ts->gpio_int) == 0) {
197                                 input_mt_sync(ts->input);
198                                 input_report_key(ts->input, BTN_TOUCH, 0);
199                                 input_sync(ts->input);
200                                 break;
201                         }
202                 }
203
204                 ret = auo_pixcir_collect_data(ts, point);
205                 if (ret < 0) {
206                         /* we want to loop only in touch_ind_mode */
207                         if (!ts->touch_ind_mode)
208                                 break;
209
210                         wait_event_timeout(ts->wait, ts->stopped,
211                                 msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS));
212                         continue;
213                 }
214
215                 for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) {
216                         if (point[i].coord_x > 0 || point[i].coord_y > 0) {
217                                 input_report_abs(ts->input, ABS_MT_POSITION_X,
218                                                  point[i].coord_x);
219                                 input_report_abs(ts->input, ABS_MT_POSITION_Y,
220                                                  point[i].coord_y);
221                                 input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR,
222                                                  point[i].area_major);
223                                 input_report_abs(ts->input, ABS_MT_TOUCH_MINOR,
224                                                  point[i].area_minor);
225                                 input_report_abs(ts->input, ABS_MT_ORIENTATION,
226                                                  point[i].orientation);
227                                 input_mt_sync(ts->input);
228
229                                 /* use first finger as source for singletouch */
230                                 if (fingers == 0)
231                                         abs = i;
232
233                                 /* number of touch points could also be queried
234                                  * via i2c but would require an additional call
235                                  */
236                                 fingers++;
237                         }
238                 }
239
240                 input_report_key(ts->input, BTN_TOUCH, fingers > 0);
241
242                 if (abs > -1) {
243                         input_report_abs(ts->input, ABS_X, point[abs].coord_x);
244                         input_report_abs(ts->input, ABS_Y, point[abs].coord_y);
245                 }
246
247                 input_sync(ts->input);
248
249                 /* we want to loop only in touch_ind_mode */
250                 if (!ts->touch_ind_mode)
251                         break;
252
253                 wait_event_timeout(ts->wait, ts->stopped,
254                                  msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS));
255         }
256
257         return IRQ_HANDLED;
258 }
259
260 /*
261  * Set the power mode of the device.
262  * Valid modes are
263  * - AUO_PIXCIR_POWER_ACTIVE
264  * - AUO_PIXCIR_POWER_SLEEP - automatically left on first touch
265  * - AUO_PIXCIR_POWER_DEEP_SLEEP
266  */
267 static int auo_pixcir_power_mode(struct auo_pixcir_ts *ts, int mode)
268 {
269         struct i2c_client *client = ts->client;
270         int ret;
271
272         ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_POWER_MODE);
273         if (ret < 0) {
274                 dev_err(&client->dev, "unable to read reg %Xh, %d\n",
275                         AUO_PIXCIR_REG_POWER_MODE, ret);
276                 return ret;
277         }
278
279         ret &= ~AUO_PIXCIR_POWER_MASK;
280         ret |= mode;
281
282         ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_POWER_MODE, ret);
283         if (ret) {
284                 dev_err(&client->dev, "unable to write reg %Xh, %d\n",
285                         AUO_PIXCIR_REG_POWER_MODE, ret);
286                 return ret;
287         }
288
289         return 0;
290 }
291
292 static int auo_pixcir_int_config(struct auo_pixcir_ts *ts, int int_setting)
293 {
294         struct i2c_client *client = ts->client;
295         int ret;
296
297         ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING);
298         if (ret < 0) {
299                 dev_err(&client->dev, "unable to read reg %Xh, %d\n",
300                         AUO_PIXCIR_REG_INT_SETTING, ret);
301                 return ret;
302         }
303
304         ret &= ~AUO_PIXCIR_INT_MODE_MASK;
305         ret |= int_setting;
306         ret |= AUO_PIXCIR_INT_POL_HIGH; /* always use high for interrupts */
307
308         ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING,
309                                         ret);
310         if (ret < 0) {
311                 dev_err(&client->dev, "unable to write reg %Xh, %d\n",
312                         AUO_PIXCIR_REG_INT_SETTING, ret);
313                 return ret;
314         }
315
316         ts->touch_ind_mode = int_setting == AUO_PIXCIR_INT_TOUCH_IND;
317
318         return 0;
319 }
320
321 /* control the generation of interrupts on the device side */
322 static int auo_pixcir_int_toggle(struct auo_pixcir_ts *ts, bool enable)
323 {
324         struct i2c_client *client = ts->client;
325         int ret;
326
327         ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING);
328         if (ret < 0) {
329                 dev_err(&client->dev, "unable to read reg %Xh, %d\n",
330                         AUO_PIXCIR_REG_INT_SETTING, ret);
331                 return ret;
332         }
333
334         if (enable)
335                 ret |= AUO_PIXCIR_INT_ENABLE;
336         else
337                 ret &= ~AUO_PIXCIR_INT_ENABLE;
338
339         ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING,
340                                         ret);
341         if (ret < 0) {
342                 dev_err(&client->dev, "unable to write reg %Xh, %d\n",
343                         AUO_PIXCIR_REG_INT_SETTING, ret);
344                 return ret;
345         }
346
347         return 0;
348 }
349
350 static int auo_pixcir_start(struct auo_pixcir_ts *ts)
351 {
352         struct i2c_client *client = ts->client;
353         int ret;
354
355         ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_ACTIVE);
356         if (ret < 0) {
357                 dev_err(&client->dev, "could not set power mode, %d\n",
358                         ret);
359                 return ret;
360         }
361
362         ts->stopped = false;
363         mb();
364         enable_irq(client->irq);
365
366         ret = auo_pixcir_int_toggle(ts, 1);
367         if (ret < 0) {
368                 dev_err(&client->dev, "could not enable interrupt, %d\n",
369                         ret);
370                 disable_irq(client->irq);
371                 return ret;
372         }
373
374         return 0;
375 }
376
377 static int auo_pixcir_stop(struct auo_pixcir_ts *ts)
378 {
379         struct i2c_client *client = ts->client;
380         int ret;
381
382         ret = auo_pixcir_int_toggle(ts, 0);
383         if (ret < 0) {
384                 dev_err(&client->dev, "could not disable interrupt, %d\n",
385                         ret);
386                 return ret;
387         }
388
389         /* disable receiving of interrupts */
390         disable_irq(client->irq);
391         ts->stopped = true;
392         mb();
393         wake_up(&ts->wait);
394
395         return auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_DEEP_SLEEP);
396 }
397
398 static int auo_pixcir_input_open(struct input_dev *dev)
399 {
400         struct auo_pixcir_ts *ts = input_get_drvdata(dev);
401
402         return auo_pixcir_start(ts);
403 }
404
405 static void auo_pixcir_input_close(struct input_dev *dev)
406 {
407         struct auo_pixcir_ts *ts = input_get_drvdata(dev);
408
409         auo_pixcir_stop(ts);
410 }
411
412 static int __maybe_unused auo_pixcir_suspend(struct device *dev)
413 {
414         struct i2c_client *client = to_i2c_client(dev);
415         struct auo_pixcir_ts *ts = i2c_get_clientdata(client);
416         struct input_dev *input = ts->input;
417         int ret = 0;
418
419         mutex_lock(&input->mutex);
420
421         /* when configured as wakeup source, device should always wake system
422          * therefore start device if necessary
423          */
424         if (device_may_wakeup(&client->dev)) {
425                 /* need to start device if not open, to be wakeup source */
426                 if (!input_device_enabled(input)) {
427                         ret = auo_pixcir_start(ts);
428                         if (ret)
429                                 goto unlock;
430                 }
431
432                 enable_irq_wake(client->irq);
433                 ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP);
434         } else if (input_device_enabled(input)) {
435                 ret = auo_pixcir_stop(ts);
436         }
437
438 unlock:
439         mutex_unlock(&input->mutex);
440
441         return ret;
442 }
443
444 static int __maybe_unused auo_pixcir_resume(struct device *dev)
445 {
446         struct i2c_client *client = to_i2c_client(dev);
447         struct auo_pixcir_ts *ts = i2c_get_clientdata(client);
448         struct input_dev *input = ts->input;
449         int ret = 0;
450
451         mutex_lock(&input->mutex);
452
453         if (device_may_wakeup(&client->dev)) {
454                 disable_irq_wake(client->irq);
455
456                 /* need to stop device if it was not open on suspend */
457                 if (!input_device_enabled(input)) {
458                         ret = auo_pixcir_stop(ts);
459                         if (ret)
460                                 goto unlock;
461                 }
462
463                 /* device wakes automatically from SLEEP */
464         } else if (input_device_enabled(input)) {
465                 ret = auo_pixcir_start(ts);
466         }
467
468 unlock:
469         mutex_unlock(&input->mutex);
470
471         return ret;
472 }
473
474 static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops,
475                          auo_pixcir_suspend, auo_pixcir_resume);
476
477 #ifdef CONFIG_OF
478 static int auo_pixcir_parse_dt(struct device *dev, struct auo_pixcir_ts *ts)
479 {
480         struct device_node *np = dev->of_node;
481
482         if (!np)
483                 return -ENOENT;
484
485         ts->gpio_int = of_get_gpio(np, 0);
486         if (!gpio_is_valid(ts->gpio_int)) {
487                 dev_err(dev, "failed to get interrupt gpio\n");
488                 return -EINVAL;
489         }
490
491         ts->gpio_rst = of_get_gpio(np, 1);
492         if (!gpio_is_valid(ts->gpio_rst)) {
493                 dev_err(dev, "failed to get reset gpio\n");
494                 return -EINVAL;
495         }
496
497         if (of_property_read_u32(np, "x-size", &ts->x_max)) {
498                 dev_err(dev, "failed to get x-size property\n");
499                 return -EINVAL;
500         }
501
502         if (of_property_read_u32(np, "y-size", &ts->y_max)) {
503                 dev_err(dev, "failed to get y-size property\n");
504                 return -EINVAL;
505         }
506
507         return 0;
508 }
509 #else
510 static int auo_pixcir_parse_dt(struct device *dev, struct auo_pixcir_ts *ts)
511 {
512         return -EINVAL;
513 }
514 #endif
515
516 static void auo_pixcir_reset(void *data)
517 {
518         struct auo_pixcir_ts *ts = data;
519
520         gpio_set_value(ts->gpio_rst, 0);
521 }
522
523 static int auo_pixcir_probe(struct i2c_client *client,
524                             const struct i2c_device_id *id)
525 {
526         struct auo_pixcir_ts *ts;
527         struct input_dev *input_dev;
528         int version;
529         int error;
530
531         ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
532         if (!ts)
533                 return -ENOMEM;
534
535         input_dev = devm_input_allocate_device(&client->dev);
536         if (!input_dev) {
537                 dev_err(&client->dev, "could not allocate input device\n");
538                 return -ENOMEM;
539         }
540
541         ts->client = client;
542         ts->input = input_dev;
543         ts->touch_ind_mode = 0;
544         ts->stopped = true;
545         init_waitqueue_head(&ts->wait);
546
547         snprintf(ts->phys, sizeof(ts->phys),
548                  "%s/input0", dev_name(&client->dev));
549
550         error = auo_pixcir_parse_dt(&client->dev, ts);
551         if (error)
552                 return error;
553
554         input_dev->name = "AUO-Pixcir touchscreen";
555         input_dev->phys = ts->phys;
556         input_dev->id.bustype = BUS_I2C;
557
558         input_dev->open = auo_pixcir_input_open;
559         input_dev->close = auo_pixcir_input_close;
560
561         __set_bit(EV_ABS, input_dev->evbit);
562         __set_bit(EV_KEY, input_dev->evbit);
563
564         __set_bit(BTN_TOUCH, input_dev->keybit);
565
566         /* For single touch */
567         input_set_abs_params(input_dev, ABS_X, 0, ts->x_max, 0, 0);
568         input_set_abs_params(input_dev, ABS_Y, 0, ts->y_max, 0, 0);
569
570         /* For multi touch */
571         input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ts->x_max, 0, 0);
572         input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0);
573         input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
574                              0, AUO_PIXCIR_MAX_AREA, 0, 0);
575         input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
576                              0, AUO_PIXCIR_MAX_AREA, 0, 0);
577         input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
578
579         input_set_drvdata(ts->input, ts);
580
581         error = devm_gpio_request_one(&client->dev, ts->gpio_int,
582                                       GPIOF_DIR_IN, "auo_pixcir_ts_int");
583         if (error) {
584                 dev_err(&client->dev, "request of gpio %d failed, %d\n",
585                         ts->gpio_int, error);
586                 return error;
587         }
588
589         error = devm_gpio_request_one(&client->dev, ts->gpio_rst,
590                                       GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
591                                       "auo_pixcir_ts_rst");
592         if (error) {
593                 dev_err(&client->dev, "request of gpio %d failed, %d\n",
594                         ts->gpio_rst, error);
595                 return error;
596         }
597
598         error = devm_add_action_or_reset(&client->dev, auo_pixcir_reset, ts);
599         if (error) {
600                 dev_err(&client->dev, "failed to register reset action, %d\n",
601                         error);
602                 return error;
603         }
604
605         msleep(200);
606
607         version = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_VERSION);
608         if (version < 0) {
609                 error = version;
610                 return error;
611         }
612
613         dev_info(&client->dev, "firmware version 0x%X\n", version);
614
615         /* default to asserting the interrupt when the screen is touched */
616         error = auo_pixcir_int_config(ts, AUO_PIXCIR_INT_TOUCH_IND);
617         if (error)
618                 return error;
619
620         error = devm_request_threaded_irq(&client->dev, client->irq,
621                                           NULL, auo_pixcir_interrupt,
622                                           IRQF_TRIGGER_RISING | IRQF_ONESHOT,
623                                           input_dev->name, ts);
624         if (error) {
625                 dev_err(&client->dev, "irq %d requested failed, %d\n",
626                         client->irq, error);
627                 return error;
628         }
629
630         /* stop device and put it into deep sleep until it is opened */
631         error = auo_pixcir_stop(ts);
632         if (error)
633                 return error;
634
635         error = input_register_device(input_dev);
636         if (error) {
637                 dev_err(&client->dev, "could not register input device, %d\n",
638                         error);
639                 return error;
640         }
641
642         i2c_set_clientdata(client, ts);
643
644         return 0;
645 }
646
647 static const struct i2c_device_id auo_pixcir_idtable[] = {
648         { "auo_pixcir_ts", 0 },
649         { }
650 };
651 MODULE_DEVICE_TABLE(i2c, auo_pixcir_idtable);
652
653 #ifdef CONFIG_OF
654 static const struct of_device_id auo_pixcir_ts_dt_idtable[] = {
655         { .compatible = "auo,auo_pixcir_ts" },
656         {},
657 };
658 MODULE_DEVICE_TABLE(of, auo_pixcir_ts_dt_idtable);
659 #endif
660
661 static struct i2c_driver auo_pixcir_driver = {
662         .driver = {
663                 .name   = "auo_pixcir_ts",
664                 .pm     = &auo_pixcir_pm_ops,
665                 .of_match_table = of_match_ptr(auo_pixcir_ts_dt_idtable),
666         },
667         .probe          = auo_pixcir_probe,
668         .id_table       = auo_pixcir_idtable,
669 };
670
671 module_i2c_driver(auo_pixcir_driver);
672
673 MODULE_DESCRIPTION("AUO-PIXCIR touchscreen driver");
674 MODULE_LICENSE("GPL v2");
675 MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");