Loading...
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* -------------------------------------------------------------------------
3 * Copyright (C) 2014-2015, Intel Corporation
4 *
5 * Derived from:
6 * gslX68X.c
7 * Copyright (C) 2010-2015, Shanghai Sileadinc Co.Ltd
8 *
9 * -------------------------------------------------------------------------
10 */
11
12#include <linux/i2c.h>
13#include <linux/module.h>
14#include <linux/acpi.h>
15#include <linux/interrupt.h>
16#include <linux/gpio/consumer.h>
17#include <linux/delay.h>
18#include <linux/firmware.h>
19#include <linux/input.h>
20#include <linux/input/mt.h>
21#include <linux/input/touchscreen.h>
22#include <linux/pm.h>
23#include <linux/pm_runtime.h>
24#include <linux/irq.h>
25#include <linux/regulator/consumer.h>
26
27#include <asm/unaligned.h>
28
29#define SILEAD_TS_NAME "silead_ts"
30
31#define SILEAD_REG_RESET 0xE0
32#define SILEAD_REG_DATA 0x80
33#define SILEAD_REG_TOUCH_NR 0x80
34#define SILEAD_REG_POWER 0xBC
35#define SILEAD_REG_CLOCK 0xE4
36#define SILEAD_REG_STATUS 0xB0
37#define SILEAD_REG_ID 0xFC
38#define SILEAD_REG_MEM_CHECK 0xB0
39
40#define SILEAD_STATUS_OK 0x5A5A5A5A
41#define SILEAD_TS_DATA_LEN 44
42#define SILEAD_CLOCK 0x04
43
44#define SILEAD_CMD_RESET 0x88
45#define SILEAD_CMD_START 0x00
46
47#define SILEAD_POINT_DATA_LEN 0x04
48#define SILEAD_POINT_Y_OFF 0x00
49#define SILEAD_POINT_Y_MSB_OFF 0x01
50#define SILEAD_POINT_X_OFF 0x02
51#define SILEAD_POINT_X_MSB_OFF 0x03
52#define SILEAD_EXTRA_DATA_MASK 0xF0
53
54#define SILEAD_CMD_SLEEP_MIN 10000
55#define SILEAD_CMD_SLEEP_MAX 20000
56#define SILEAD_POWER_SLEEP 20
57#define SILEAD_STARTUP_SLEEP 30
58
59#define SILEAD_MAX_FINGERS 10
60
61enum silead_ts_power {
62 SILEAD_POWER_ON = 1,
63 SILEAD_POWER_OFF = 0
64};
65
66struct silead_ts_data {
67 struct i2c_client *client;
68 struct gpio_desc *gpio_power;
69 struct input_dev *input;
70 struct input_dev *pen_input;
71 struct regulator_bulk_data regulators[2];
72 char fw_name[64];
73 struct touchscreen_properties prop;
74 u32 max_fingers;
75 u32 chip_id;
76 struct input_mt_pos pos[SILEAD_MAX_FINGERS];
77 int slots[SILEAD_MAX_FINGERS];
78 int id[SILEAD_MAX_FINGERS];
79 u32 efi_fw_min_max[4];
80 bool efi_fw_min_max_set;
81 bool pen_supported;
82 bool pen_down;
83 u32 pen_x_res;
84 u32 pen_y_res;
85 int pen_up_count;
86};
87
88struct silead_fw_data {
89 u32 offset;
90 u32 val;
91};
92
93static void silead_apply_efi_fw_min_max(struct silead_ts_data *data)
94{
95 struct input_absinfo *absinfo_x = &data->input->absinfo[ABS_MT_POSITION_X];
96 struct input_absinfo *absinfo_y = &data->input->absinfo[ABS_MT_POSITION_Y];
97
98 if (!data->efi_fw_min_max_set)
99 return;
100
101 absinfo_x->minimum = data->efi_fw_min_max[0];
102 absinfo_x->maximum = data->efi_fw_min_max[1];
103 absinfo_y->minimum = data->efi_fw_min_max[2];
104 absinfo_y->maximum = data->efi_fw_min_max[3];
105
106 if (data->prop.invert_x) {
107 absinfo_x->maximum -= absinfo_x->minimum;
108 absinfo_x->minimum = 0;
109 }
110
111 if (data->prop.invert_y) {
112 absinfo_y->maximum -= absinfo_y->minimum;
113 absinfo_y->minimum = 0;
114 }
115
116 if (data->prop.swap_x_y) {
117 swap(absinfo_x->minimum, absinfo_y->minimum);
118 swap(absinfo_x->maximum, absinfo_y->maximum);
119 }
120}
121
122static int silead_ts_request_input_dev(struct silead_ts_data *data)
123{
124 struct device *dev = &data->client->dev;
125 int error;
126
127 data->input = devm_input_allocate_device(dev);
128 if (!data->input) {
129 dev_err(dev,
130 "Failed to allocate input device\n");
131 return -ENOMEM;
132 }
133
134 input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0);
135 input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0);
136 touchscreen_parse_properties(data->input, true, &data->prop);
137 silead_apply_efi_fw_min_max(data);
138
139 input_mt_init_slots(data->input, data->max_fingers,
140 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED |
141 INPUT_MT_TRACK);
142
143 if (device_property_read_bool(dev, "silead,home-button"))
144 input_set_capability(data->input, EV_KEY, KEY_LEFTMETA);
145
146 data->input->name = SILEAD_TS_NAME;
147 data->input->phys = "input/ts";
148 data->input->id.bustype = BUS_I2C;
149
150 error = input_register_device(data->input);
151 if (error) {
152 dev_err(dev, "Failed to register input device: %d\n", error);
153 return error;
154 }
155
156 return 0;
157}
158
159static int silead_ts_request_pen_input_dev(struct silead_ts_data *data)
160{
161 struct device *dev = &data->client->dev;
162 int error;
163
164 if (!data->pen_supported)
165 return 0;
166
167 data->pen_input = devm_input_allocate_device(dev);
168 if (!data->pen_input)
169 return -ENOMEM;
170
171 input_set_abs_params(data->pen_input, ABS_X, 0, 4095, 0, 0);
172 input_set_abs_params(data->pen_input, ABS_Y, 0, 4095, 0, 0);
173 input_set_capability(data->pen_input, EV_KEY, BTN_TOUCH);
174 input_set_capability(data->pen_input, EV_KEY, BTN_TOOL_PEN);
175 set_bit(INPUT_PROP_DIRECT, data->pen_input->propbit);
176 touchscreen_parse_properties(data->pen_input, false, &data->prop);
177 input_abs_set_res(data->pen_input, ABS_X, data->pen_x_res);
178 input_abs_set_res(data->pen_input, ABS_Y, data->pen_y_res);
179
180 data->pen_input->name = SILEAD_TS_NAME " pen";
181 data->pen_input->phys = "input/pen";
182 data->input->id.bustype = BUS_I2C;
183
184 error = input_register_device(data->pen_input);
185 if (error) {
186 dev_err(dev, "Failed to register pen input device: %d\n", error);
187 return error;
188 }
189
190 return 0;
191}
192
193static void silead_ts_set_power(struct i2c_client *client,
194 enum silead_ts_power state)
195{
196 struct silead_ts_data *data = i2c_get_clientdata(client);
197
198 if (data->gpio_power) {
199 gpiod_set_value_cansleep(data->gpio_power, state);
200 msleep(SILEAD_POWER_SLEEP);
201 }
202}
203
204static bool silead_ts_handle_pen_data(struct silead_ts_data *data, u8 *buf)
205{
206 u8 *coord = buf + SILEAD_POINT_DATA_LEN;
207 struct input_mt_pos pos;
208
209 if (!data->pen_supported || buf[2] != 0x00 || buf[3] != 0x00)
210 return false;
211
212 if (buf[0] == 0x00 && buf[1] == 0x00 && data->pen_down) {
213 data->pen_up_count++;
214 if (data->pen_up_count == 6) {
215 data->pen_down = false;
216 goto sync;
217 }
218 return true;
219 }
220
221 if (buf[0] == 0x01 && buf[1] == 0x08) {
222 touchscreen_set_mt_pos(&pos, &data->prop,
223 get_unaligned_le16(&coord[SILEAD_POINT_X_OFF]) & 0xfff,
224 get_unaligned_le16(&coord[SILEAD_POINT_Y_OFF]) & 0xfff);
225
226 input_report_abs(data->pen_input, ABS_X, pos.x);
227 input_report_abs(data->pen_input, ABS_Y, pos.y);
228
229 data->pen_up_count = 0;
230 data->pen_down = true;
231 goto sync;
232 }
233
234 return false;
235
236sync:
237 input_report_key(data->pen_input, BTN_TOOL_PEN, data->pen_down);
238 input_report_key(data->pen_input, BTN_TOUCH, data->pen_down);
239 input_sync(data->pen_input);
240 return true;
241}
242
243static void silead_ts_read_data(struct i2c_client *client)
244{
245 struct silead_ts_data *data = i2c_get_clientdata(client);
246 struct input_dev *input = data->input;
247 struct device *dev = &client->dev;
248 u8 *bufp, buf[SILEAD_TS_DATA_LEN];
249 int touch_nr, softbutton, error, i;
250 bool softbutton_pressed = false;
251
252 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_DATA,
253 SILEAD_TS_DATA_LEN, buf);
254 if (error < 0) {
255 dev_err(dev, "Data read error %d\n", error);
256 return;
257 }
258
259 if (buf[0] > data->max_fingers) {
260 dev_warn(dev, "More touches reported then supported %d > %d\n",
261 buf[0], data->max_fingers);
262 buf[0] = data->max_fingers;
263 }
264
265 if (silead_ts_handle_pen_data(data, buf))
266 goto sync; /* Pen is down, release all previous touches */
267
268 touch_nr = 0;
269 bufp = buf + SILEAD_POINT_DATA_LEN;
270 for (i = 0; i < buf[0]; i++, bufp += SILEAD_POINT_DATA_LEN) {
271 softbutton = (bufp[SILEAD_POINT_Y_MSB_OFF] &
272 SILEAD_EXTRA_DATA_MASK) >> 4;
273
274 if (softbutton) {
275 /*
276 * For now only respond to softbutton == 0x01, some
277 * tablets *without* a capacative button send 0x04
278 * when crossing the edges of the screen.
279 */
280 if (softbutton == 0x01)
281 softbutton_pressed = true;
282
283 continue;
284 }
285
286 /*
287 * Bits 4-7 are the touch id, note not all models have
288 * hardware touch ids so atm we don't use these.
289 */
290 data->id[touch_nr] = (bufp[SILEAD_POINT_X_MSB_OFF] &
291 SILEAD_EXTRA_DATA_MASK) >> 4;
292 touchscreen_set_mt_pos(&data->pos[touch_nr], &data->prop,
293 get_unaligned_le16(&bufp[SILEAD_POINT_X_OFF]) & 0xfff,
294 get_unaligned_le16(&bufp[SILEAD_POINT_Y_OFF]) & 0xfff);
295 touch_nr++;
296 }
297
298 input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0);
299
300 for (i = 0; i < touch_nr; i++) {
301 input_mt_slot(input, data->slots[i]);
302 input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
303 input_report_abs(input, ABS_MT_POSITION_X, data->pos[i].x);
304 input_report_abs(input, ABS_MT_POSITION_Y, data->pos[i].y);
305
306 dev_dbg(dev, "x=%d y=%d hw_id=%d sw_id=%d\n", data->pos[i].x,
307 data->pos[i].y, data->id[i], data->slots[i]);
308 }
309
310sync:
311 input_mt_sync_frame(input);
312 input_report_key(input, KEY_LEFTMETA, softbutton_pressed);
313 input_sync(input);
314}
315
316static int silead_ts_init(struct i2c_client *client)
317{
318 struct silead_ts_data *data = i2c_get_clientdata(client);
319 int error;
320
321 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
322 SILEAD_CMD_RESET);
323 if (error)
324 goto i2c_write_err;
325 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
326
327 error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR,
328 data->max_fingers);
329 if (error)
330 goto i2c_write_err;
331 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
332
333 error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
334 SILEAD_CLOCK);
335 if (error)
336 goto i2c_write_err;
337 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
338
339 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
340 SILEAD_CMD_START);
341 if (error)
342 goto i2c_write_err;
343 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
344
345 return 0;
346
347i2c_write_err:
348 dev_err(&client->dev, "Registers clear error %d\n", error);
349 return error;
350}
351
352static int silead_ts_reset(struct i2c_client *client)
353{
354 int error;
355
356 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
357 SILEAD_CMD_RESET);
358 if (error)
359 goto i2c_write_err;
360 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
361
362 error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
363 SILEAD_CLOCK);
364 if (error)
365 goto i2c_write_err;
366 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
367
368 error = i2c_smbus_write_byte_data(client, SILEAD_REG_POWER,
369 SILEAD_CMD_START);
370 if (error)
371 goto i2c_write_err;
372 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
373
374 return 0;
375
376i2c_write_err:
377 dev_err(&client->dev, "Chip reset error %d\n", error);
378 return error;
379}
380
381static int silead_ts_startup(struct i2c_client *client)
382{
383 int error;
384
385 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 0x00);
386 if (error) {
387 dev_err(&client->dev, "Startup error %d\n", error);
388 return error;
389 }
390
391 msleep(SILEAD_STARTUP_SLEEP);
392
393 return 0;
394}
395
396static int silead_ts_load_fw(struct i2c_client *client)
397{
398 struct device *dev = &client->dev;
399 struct silead_ts_data *data = i2c_get_clientdata(client);
400 const struct firmware *fw = NULL;
401 struct silead_fw_data *fw_data;
402 unsigned int fw_size, i;
403 int error;
404
405 dev_dbg(dev, "Firmware file name: %s", data->fw_name);
406
407 /*
408 * Unfortunately, at the time of writing this comment, we have been unable to
409 * get permission from Silead, or from device OEMs, to distribute the necessary
410 * Silead firmware files in linux-firmware.
411 *
412 * On a whole bunch of devices the UEFI BIOS code contains a touchscreen driver,
413 * which contains an embedded copy of the firmware. The fw-loader code has a
414 * "platform" fallback mechanism, which together with info on the firmware
415 * from drivers/platform/x86/touchscreen_dmi.c will use the firmware from the
416 * UEFI driver when the firmware is missing from /lib/firmware. This makes the
417 * touchscreen work OOTB without users needing to manually download the firmware.
418 *
419 * The firmware bundled with the original Windows/Android is usually newer then
420 * the firmware in the UEFI driver and it is better calibrated. This better
421 * calibration can lead to significant differences in the reported min/max
422 * coordinates.
423 *
424 * To deal with this we first try to load the firmware without "platform"
425 * fallback. If that fails we retry with "platform" fallback and if that
426 * succeeds we apply an (optional) set of alternative min/max values from the
427 * "silead,efi-fw-min-max" property.
428 */
429 error = firmware_request_nowarn(&fw, data->fw_name, dev);
430 if (error) {
431 error = firmware_request_platform(&fw, data->fw_name, dev);
432 if (error) {
433 dev_err(dev, "Firmware request error %d\n", error);
434 return error;
435 }
436
437 error = device_property_read_u32_array(dev, "silead,efi-fw-min-max",
438 data->efi_fw_min_max,
439 ARRAY_SIZE(data->efi_fw_min_max));
440 if (!error)
441 data->efi_fw_min_max_set = true;
442
443 /* The EFI (platform) embedded fw does not have pen support */
444 if (data->pen_supported) {
445 dev_warn(dev, "Warning loading '%s' from filesystem failed, using EFI embedded copy.\n",
446 data->fw_name);
447 dev_warn(dev, "Warning pen support is known to be broken in the EFI embedded fw version\n");
448 data->pen_supported = false;
449 }
450 }
451
452 fw_size = fw->size / sizeof(*fw_data);
453 fw_data = (struct silead_fw_data *)fw->data;
454
455 for (i = 0; i < fw_size; i++) {
456 error = i2c_smbus_write_i2c_block_data(client,
457 fw_data[i].offset,
458 4,
459 (u8 *)&fw_data[i].val);
460 if (error) {
461 dev_err(dev, "Firmware load error %d\n", error);
462 break;
463 }
464 }
465
466 release_firmware(fw);
467 return error ?: 0;
468}
469
470static u32 silead_ts_get_status(struct i2c_client *client)
471{
472 int error;
473 __le32 status;
474
475 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_STATUS,
476 sizeof(status), (u8 *)&status);
477 if (error < 0) {
478 dev_err(&client->dev, "Status read error %d\n", error);
479 return error;
480 }
481
482 return le32_to_cpu(status);
483}
484
485static int silead_ts_get_id(struct i2c_client *client)
486{
487 struct silead_ts_data *data = i2c_get_clientdata(client);
488 __le32 chip_id;
489 int error;
490
491 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_ID,
492 sizeof(chip_id), (u8 *)&chip_id);
493 if (error < 0)
494 return error;
495
496 data->chip_id = le32_to_cpu(chip_id);
497 dev_info(&client->dev, "Silead chip ID: 0x%8X", data->chip_id);
498
499 return 0;
500}
501
502static int silead_ts_setup(struct i2c_client *client)
503{
504 int error;
505 u32 status;
506
507 /*
508 * Some buggy BIOS-es bring up the chip in a stuck state where it
509 * blocks the I2C bus. The following steps are necessary to
510 * unstuck the chip / bus:
511 * 1. Turn off the Silead chip.
512 * 2. Try to do an I2C transfer with the chip, this will fail in
513 * response to which the I2C-bus-driver will call:
514 * i2c_recover_bus() which will unstuck the I2C-bus. Note the
515 * unstuck-ing of the I2C bus only works if we first drop the
516 * chip off the bus by turning it off.
517 * 3. Turn the chip back on.
518 *
519 * On the x86/ACPI systems were this problem is seen, step 1. and
520 * 3. require making ACPI calls and dealing with ACPI Power
521 * Resources. The workaround below runtime-suspends the chip to
522 * turn it off, leaving it up to the ACPI subsystem to deal with
523 * this.
524 */
525
526 if (device_property_read_bool(&client->dev,
527 "silead,stuck-controller-bug")) {
528 pm_runtime_set_active(&client->dev);
529 pm_runtime_enable(&client->dev);
530 pm_runtime_allow(&client->dev);
531
532 pm_runtime_suspend(&client->dev);
533
534 dev_warn(&client->dev, FW_BUG "Stuck I2C bus: please ignore the next 'controller timed out' error\n");
535 silead_ts_get_id(client);
536
537 /* The forbid will also resume the device */
538 pm_runtime_forbid(&client->dev);
539 pm_runtime_disable(&client->dev);
540 }
541
542 silead_ts_set_power(client, SILEAD_POWER_OFF);
543 silead_ts_set_power(client, SILEAD_POWER_ON);
544
545 error = silead_ts_get_id(client);
546 if (error) {
547 dev_err(&client->dev, "Chip ID read error %d\n", error);
548 return error;
549 }
550
551 error = silead_ts_init(client);
552 if (error)
553 return error;
554
555 error = silead_ts_reset(client);
556 if (error)
557 return error;
558
559 error = silead_ts_load_fw(client);
560 if (error)
561 return error;
562
563 error = silead_ts_startup(client);
564 if (error)
565 return error;
566
567 status = silead_ts_get_status(client);
568 if (status != SILEAD_STATUS_OK) {
569 dev_err(&client->dev,
570 "Initialization error, status: 0x%X\n", status);
571 return -ENODEV;
572 }
573
574 return 0;
575}
576
577static irqreturn_t silead_ts_threaded_irq_handler(int irq, void *id)
578{
579 struct silead_ts_data *data = id;
580 struct i2c_client *client = data->client;
581
582 silead_ts_read_data(client);
583
584 return IRQ_HANDLED;
585}
586
587static void silead_ts_read_props(struct i2c_client *client)
588{
589 struct silead_ts_data *data = i2c_get_clientdata(client);
590 struct device *dev = &client->dev;
591 const char *str;
592 int error;
593
594 error = device_property_read_u32(dev, "silead,max-fingers",
595 &data->max_fingers);
596 if (error) {
597 dev_dbg(dev, "Max fingers read error %d\n", error);
598 data->max_fingers = 5; /* Most devices handle up-to 5 fingers */
599 }
600
601 error = device_property_read_string(dev, "firmware-name", &str);
602 if (!error)
603 snprintf(data->fw_name, sizeof(data->fw_name),
604 "silead/%s", str);
605 else
606 dev_dbg(dev, "Firmware file name read error. Using default.");
607
608 data->pen_supported = device_property_read_bool(dev, "silead,pen-supported");
609 device_property_read_u32(dev, "silead,pen-resolution-x", &data->pen_x_res);
610 device_property_read_u32(dev, "silead,pen-resolution-y", &data->pen_y_res);
611}
612
613#ifdef CONFIG_ACPI
614static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
615 const struct i2c_device_id *id)
616{
617 const struct acpi_device_id *acpi_id;
618 struct device *dev = &data->client->dev;
619 int i;
620
621 if (ACPI_HANDLE(dev)) {
622 acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
623 if (!acpi_id)
624 return -ENODEV;
625
626 snprintf(data->fw_name, sizeof(data->fw_name),
627 "silead/%s.fw", acpi_id->id);
628
629 for (i = 0; i < strlen(data->fw_name); i++)
630 data->fw_name[i] = tolower(data->fw_name[i]);
631 } else {
632 snprintf(data->fw_name, sizeof(data->fw_name),
633 "silead/%s.fw", id->name);
634 }
635
636 return 0;
637}
638#else
639static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
640 const struct i2c_device_id *id)
641{
642 snprintf(data->fw_name, sizeof(data->fw_name),
643 "silead/%s.fw", id->name);
644 return 0;
645}
646#endif
647
648static void silead_disable_regulator(void *arg)
649{
650 struct silead_ts_data *data = arg;
651
652 regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
653}
654
655static int silead_ts_probe(struct i2c_client *client)
656{
657 const struct i2c_device_id *id = i2c_client_get_device_id(client);
658 struct silead_ts_data *data;
659 struct device *dev = &client->dev;
660 int error;
661
662 if (!i2c_check_functionality(client->adapter,
663 I2C_FUNC_I2C |
664 I2C_FUNC_SMBUS_READ_I2C_BLOCK |
665 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
666 dev_err(dev, "I2C functionality check failed\n");
667 return -ENXIO;
668 }
669
670 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
671 if (!data)
672 return -ENOMEM;
673
674 i2c_set_clientdata(client, data);
675 data->client = client;
676
677 error = silead_ts_set_default_fw_name(data, id);
678 if (error)
679 return error;
680
681 silead_ts_read_props(client);
682
683 /* We must have the IRQ provided by DT or ACPI subsystem */
684 if (client->irq <= 0)
685 return -ENODEV;
686
687 data->regulators[0].supply = "vddio";
688 data->regulators[1].supply = "avdd";
689 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators),
690 data->regulators);
691 if (error)
692 return error;
693
694 /*
695 * Enable regulators at probe and disable them at remove, we need
696 * to keep the chip powered otherwise it forgets its firmware.
697 */
698 error = regulator_bulk_enable(ARRAY_SIZE(data->regulators),
699 data->regulators);
700 if (error)
701 return error;
702
703 error = devm_add_action_or_reset(dev, silead_disable_regulator, data);
704 if (error)
705 return error;
706
707 /* Power GPIO pin */
708 data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
709 if (IS_ERR(data->gpio_power)) {
710 if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
711 dev_err(dev, "Shutdown GPIO request failed\n");
712 return PTR_ERR(data->gpio_power);
713 }
714
715 error = silead_ts_setup(client);
716 if (error)
717 return error;
718
719 error = silead_ts_request_input_dev(data);
720 if (error)
721 return error;
722
723 error = silead_ts_request_pen_input_dev(data);
724 if (error)
725 return error;
726
727 error = devm_request_threaded_irq(dev, client->irq,
728 NULL, silead_ts_threaded_irq_handler,
729 IRQF_ONESHOT, client->name, data);
730 if (error) {
731 if (error != -EPROBE_DEFER)
732 dev_err(dev, "IRQ request failed %d\n", error);
733 return error;
734 }
735
736 return 0;
737}
738
739static int __maybe_unused silead_ts_suspend(struct device *dev)
740{
741 struct i2c_client *client = to_i2c_client(dev);
742
743 disable_irq(client->irq);
744 silead_ts_set_power(client, SILEAD_POWER_OFF);
745 return 0;
746}
747
748static int __maybe_unused silead_ts_resume(struct device *dev)
749{
750 struct i2c_client *client = to_i2c_client(dev);
751 bool second_try = false;
752 int error, status;
753
754 silead_ts_set_power(client, SILEAD_POWER_ON);
755
756 retry:
757 error = silead_ts_reset(client);
758 if (error)
759 return error;
760
761 if (second_try) {
762 error = silead_ts_load_fw(client);
763 if (error)
764 return error;
765 }
766
767 error = silead_ts_startup(client);
768 if (error)
769 return error;
770
771 status = silead_ts_get_status(client);
772 if (status != SILEAD_STATUS_OK) {
773 if (!second_try) {
774 second_try = true;
775 dev_dbg(dev, "Reloading firmware after unsuccessful resume\n");
776 goto retry;
777 }
778 dev_err(dev, "Resume error, status: 0x%02x\n", status);
779 return -ENODEV;
780 }
781
782 enable_irq(client->irq);
783
784 return 0;
785}
786
787static SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume);
788
789static const struct i2c_device_id silead_ts_id[] = {
790 { "gsl1680", 0 },
791 { "gsl1688", 0 },
792 { "gsl3670", 0 },
793 { "gsl3675", 0 },
794 { "gsl3692", 0 },
795 { "mssl1680", 0 },
796 { }
797};
798MODULE_DEVICE_TABLE(i2c, silead_ts_id);
799
800#ifdef CONFIG_ACPI
801static const struct acpi_device_id silead_ts_acpi_match[] = {
802 { "GSL1680", 0 },
803 { "GSL1688", 0 },
804 { "GSL3670", 0 },
805 { "GSL3675", 0 },
806 { "GSL3692", 0 },
807 { "MSSL1680", 0 },
808 { "MSSL0001", 0 },
809 { "MSSL0002", 0 },
810 { "MSSL0017", 0 },
811 { }
812};
813MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match);
814#endif
815
816#ifdef CONFIG_OF
817static const struct of_device_id silead_ts_of_match[] = {
818 { .compatible = "silead,gsl1680" },
819 { .compatible = "silead,gsl1688" },
820 { .compatible = "silead,gsl3670" },
821 { .compatible = "silead,gsl3675" },
822 { .compatible = "silead,gsl3692" },
823 { },
824};
825MODULE_DEVICE_TABLE(of, silead_ts_of_match);
826#endif
827
828static struct i2c_driver silead_ts_driver = {
829 .probe_new = silead_ts_probe,
830 .id_table = silead_ts_id,
831 .driver = {
832 .name = SILEAD_TS_NAME,
833 .acpi_match_table = ACPI_PTR(silead_ts_acpi_match),
834 .of_match_table = of_match_ptr(silead_ts_of_match),
835 .pm = &silead_ts_pm,
836 },
837};
838module_i2c_driver(silead_ts_driver);
839
840MODULE_AUTHOR("Robert Dolca <robert.dolca@intel.com>");
841MODULE_DESCRIPTION("Silead I2C touchscreen driver");
842MODULE_LICENSE("GPL");
1/* -------------------------------------------------------------------------
2 * Copyright (C) 2014-2015, Intel Corporation
3 *
4 * Derived from:
5 * gslX68X.c
6 * Copyright (C) 2010-2015, Shanghai Sileadinc Co.Ltd
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * -------------------------------------------------------------------------
18 */
19
20#include <linux/i2c.h>
21#include <linux/module.h>
22#include <linux/acpi.h>
23#include <linux/interrupt.h>
24#include <linux/gpio/consumer.h>
25#include <linux/delay.h>
26#include <linux/firmware.h>
27#include <linux/input.h>
28#include <linux/input/mt.h>
29#include <linux/input/touchscreen.h>
30#include <linux/pm.h>
31#include <linux/irq.h>
32#include <linux/regulator/consumer.h>
33
34#include <asm/unaligned.h>
35
36#define SILEAD_TS_NAME "silead_ts"
37
38#define SILEAD_REG_RESET 0xE0
39#define SILEAD_REG_DATA 0x80
40#define SILEAD_REG_TOUCH_NR 0x80
41#define SILEAD_REG_POWER 0xBC
42#define SILEAD_REG_CLOCK 0xE4
43#define SILEAD_REG_STATUS 0xB0
44#define SILEAD_REG_ID 0xFC
45#define SILEAD_REG_MEM_CHECK 0xB0
46
47#define SILEAD_STATUS_OK 0x5A5A5A5A
48#define SILEAD_TS_DATA_LEN 44
49#define SILEAD_CLOCK 0x04
50
51#define SILEAD_CMD_RESET 0x88
52#define SILEAD_CMD_START 0x00
53
54#define SILEAD_POINT_DATA_LEN 0x04
55#define SILEAD_POINT_Y_OFF 0x00
56#define SILEAD_POINT_Y_MSB_OFF 0x01
57#define SILEAD_POINT_X_OFF 0x02
58#define SILEAD_POINT_X_MSB_OFF 0x03
59#define SILEAD_TOUCH_ID_MASK 0xF0
60
61#define SILEAD_CMD_SLEEP_MIN 10000
62#define SILEAD_CMD_SLEEP_MAX 20000
63#define SILEAD_POWER_SLEEP 20
64#define SILEAD_STARTUP_SLEEP 30
65
66#define SILEAD_MAX_FINGERS 10
67
68enum silead_ts_power {
69 SILEAD_POWER_ON = 1,
70 SILEAD_POWER_OFF = 0
71};
72
73struct silead_ts_data {
74 struct i2c_client *client;
75 struct gpio_desc *gpio_power;
76 struct input_dev *input;
77 struct regulator_bulk_data regulators[2];
78 char fw_name[64];
79 struct touchscreen_properties prop;
80 u32 max_fingers;
81 u32 chip_id;
82 struct input_mt_pos pos[SILEAD_MAX_FINGERS];
83 int slots[SILEAD_MAX_FINGERS];
84 int id[SILEAD_MAX_FINGERS];
85};
86
87struct silead_fw_data {
88 u32 offset;
89 u32 val;
90};
91
92static int silead_ts_request_input_dev(struct silead_ts_data *data)
93{
94 struct device *dev = &data->client->dev;
95 int error;
96
97 data->input = devm_input_allocate_device(dev);
98 if (!data->input) {
99 dev_err(dev,
100 "Failed to allocate input device\n");
101 return -ENOMEM;
102 }
103
104 input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0);
105 input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0);
106 touchscreen_parse_properties(data->input, true, &data->prop);
107
108 input_mt_init_slots(data->input, data->max_fingers,
109 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED |
110 INPUT_MT_TRACK);
111
112 data->input->name = SILEAD_TS_NAME;
113 data->input->phys = "input/ts";
114 data->input->id.bustype = BUS_I2C;
115
116 error = input_register_device(data->input);
117 if (error) {
118 dev_err(dev, "Failed to register input device: %d\n", error);
119 return error;
120 }
121
122 return 0;
123}
124
125static void silead_ts_set_power(struct i2c_client *client,
126 enum silead_ts_power state)
127{
128 struct silead_ts_data *data = i2c_get_clientdata(client);
129
130 if (data->gpio_power) {
131 gpiod_set_value_cansleep(data->gpio_power, state);
132 msleep(SILEAD_POWER_SLEEP);
133 }
134}
135
136static void silead_ts_read_data(struct i2c_client *client)
137{
138 struct silead_ts_data *data = i2c_get_clientdata(client);
139 struct input_dev *input = data->input;
140 struct device *dev = &client->dev;
141 u8 *bufp, buf[SILEAD_TS_DATA_LEN];
142 int touch_nr, error, i;
143
144 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_DATA,
145 SILEAD_TS_DATA_LEN, buf);
146 if (error < 0) {
147 dev_err(dev, "Data read error %d\n", error);
148 return;
149 }
150
151 touch_nr = buf[0];
152 if (touch_nr > data->max_fingers) {
153 dev_warn(dev, "More touches reported then supported %d > %d\n",
154 touch_nr, data->max_fingers);
155 touch_nr = data->max_fingers;
156 }
157
158 bufp = buf + SILEAD_POINT_DATA_LEN;
159 for (i = 0; i < touch_nr; i++, bufp += SILEAD_POINT_DATA_LEN) {
160 /* Bits 4-7 are the touch id */
161 data->id[i] = (bufp[SILEAD_POINT_X_MSB_OFF] &
162 SILEAD_TOUCH_ID_MASK) >> 4;
163 touchscreen_set_mt_pos(&data->pos[i], &data->prop,
164 get_unaligned_le16(&bufp[SILEAD_POINT_X_OFF]) & 0xfff,
165 get_unaligned_le16(&bufp[SILEAD_POINT_Y_OFF]) & 0xfff);
166 }
167
168 input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0);
169
170 for (i = 0; i < touch_nr; i++) {
171 input_mt_slot(input, data->slots[i]);
172 input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
173 input_report_abs(input, ABS_MT_POSITION_X, data->pos[i].x);
174 input_report_abs(input, ABS_MT_POSITION_Y, data->pos[i].y);
175
176 dev_dbg(dev, "x=%d y=%d hw_id=%d sw_id=%d\n", data->pos[i].x,
177 data->pos[i].y, data->id[i], data->slots[i]);
178 }
179
180 input_mt_sync_frame(input);
181 input_sync(input);
182}
183
184static int silead_ts_init(struct i2c_client *client)
185{
186 struct silead_ts_data *data = i2c_get_clientdata(client);
187 int error;
188
189 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
190 SILEAD_CMD_RESET);
191 if (error)
192 goto i2c_write_err;
193 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
194
195 error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR,
196 data->max_fingers);
197 if (error)
198 goto i2c_write_err;
199 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
200
201 error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
202 SILEAD_CLOCK);
203 if (error)
204 goto i2c_write_err;
205 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
206
207 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
208 SILEAD_CMD_START);
209 if (error)
210 goto i2c_write_err;
211 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
212
213 return 0;
214
215i2c_write_err:
216 dev_err(&client->dev, "Registers clear error %d\n", error);
217 return error;
218}
219
220static int silead_ts_reset(struct i2c_client *client)
221{
222 int error;
223
224 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
225 SILEAD_CMD_RESET);
226 if (error)
227 goto i2c_write_err;
228 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
229
230 error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
231 SILEAD_CLOCK);
232 if (error)
233 goto i2c_write_err;
234 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
235
236 error = i2c_smbus_write_byte_data(client, SILEAD_REG_POWER,
237 SILEAD_CMD_START);
238 if (error)
239 goto i2c_write_err;
240 usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
241
242 return 0;
243
244i2c_write_err:
245 dev_err(&client->dev, "Chip reset error %d\n", error);
246 return error;
247}
248
249static int silead_ts_startup(struct i2c_client *client)
250{
251 int error;
252
253 error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 0x00);
254 if (error) {
255 dev_err(&client->dev, "Startup error %d\n", error);
256 return error;
257 }
258
259 msleep(SILEAD_STARTUP_SLEEP);
260
261 return 0;
262}
263
264static int silead_ts_load_fw(struct i2c_client *client)
265{
266 struct device *dev = &client->dev;
267 struct silead_ts_data *data = i2c_get_clientdata(client);
268 unsigned int fw_size, i;
269 const struct firmware *fw;
270 struct silead_fw_data *fw_data;
271 int error;
272
273 dev_dbg(dev, "Firmware file name: %s", data->fw_name);
274
275 error = request_firmware(&fw, data->fw_name, dev);
276 if (error) {
277 dev_err(dev, "Firmware request error %d\n", error);
278 return error;
279 }
280
281 fw_size = fw->size / sizeof(*fw_data);
282 fw_data = (struct silead_fw_data *)fw->data;
283
284 for (i = 0; i < fw_size; i++) {
285 error = i2c_smbus_write_i2c_block_data(client,
286 fw_data[i].offset,
287 4,
288 (u8 *)&fw_data[i].val);
289 if (error) {
290 dev_err(dev, "Firmware load error %d\n", error);
291 break;
292 }
293 }
294
295 release_firmware(fw);
296 return error ?: 0;
297}
298
299static u32 silead_ts_get_status(struct i2c_client *client)
300{
301 int error;
302 __le32 status;
303
304 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_STATUS,
305 sizeof(status), (u8 *)&status);
306 if (error < 0) {
307 dev_err(&client->dev, "Status read error %d\n", error);
308 return error;
309 }
310
311 return le32_to_cpu(status);
312}
313
314static int silead_ts_get_id(struct i2c_client *client)
315{
316 struct silead_ts_data *data = i2c_get_clientdata(client);
317 __le32 chip_id;
318 int error;
319
320 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_ID,
321 sizeof(chip_id), (u8 *)&chip_id);
322 if (error < 0) {
323 dev_err(&client->dev, "Chip ID read error %d\n", error);
324 return error;
325 }
326
327 data->chip_id = le32_to_cpu(chip_id);
328 dev_info(&client->dev, "Silead chip ID: 0x%8X", data->chip_id);
329
330 return 0;
331}
332
333static int silead_ts_setup(struct i2c_client *client)
334{
335 int error;
336 u32 status;
337
338 silead_ts_set_power(client, SILEAD_POWER_OFF);
339 silead_ts_set_power(client, SILEAD_POWER_ON);
340
341 error = silead_ts_get_id(client);
342 if (error)
343 return error;
344
345 error = silead_ts_init(client);
346 if (error)
347 return error;
348
349 error = silead_ts_reset(client);
350 if (error)
351 return error;
352
353 error = silead_ts_load_fw(client);
354 if (error)
355 return error;
356
357 error = silead_ts_startup(client);
358 if (error)
359 return error;
360
361 status = silead_ts_get_status(client);
362 if (status != SILEAD_STATUS_OK) {
363 dev_err(&client->dev,
364 "Initialization error, status: 0x%X\n", status);
365 return -ENODEV;
366 }
367
368 return 0;
369}
370
371static irqreturn_t silead_ts_threaded_irq_handler(int irq, void *id)
372{
373 struct silead_ts_data *data = id;
374 struct i2c_client *client = data->client;
375
376 silead_ts_read_data(client);
377
378 return IRQ_HANDLED;
379}
380
381static void silead_ts_read_props(struct i2c_client *client)
382{
383 struct silead_ts_data *data = i2c_get_clientdata(client);
384 struct device *dev = &client->dev;
385 const char *str;
386 int error;
387
388 error = device_property_read_u32(dev, "silead,max-fingers",
389 &data->max_fingers);
390 if (error) {
391 dev_dbg(dev, "Max fingers read error %d\n", error);
392 data->max_fingers = 5; /* Most devices handle up-to 5 fingers */
393 }
394
395 error = device_property_read_string(dev, "firmware-name", &str);
396 if (!error)
397 snprintf(data->fw_name, sizeof(data->fw_name),
398 "silead/%s", str);
399 else
400 dev_dbg(dev, "Firmware file name read error. Using default.");
401}
402
403#ifdef CONFIG_ACPI
404static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
405 const struct i2c_device_id *id)
406{
407 const struct acpi_device_id *acpi_id;
408 struct device *dev = &data->client->dev;
409 int i;
410
411 if (ACPI_HANDLE(dev)) {
412 acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
413 if (!acpi_id)
414 return -ENODEV;
415
416 snprintf(data->fw_name, sizeof(data->fw_name),
417 "silead/%s.fw", acpi_id->id);
418
419 for (i = 0; i < strlen(data->fw_name); i++)
420 data->fw_name[i] = tolower(data->fw_name[i]);
421 } else {
422 snprintf(data->fw_name, sizeof(data->fw_name),
423 "silead/%s.fw", id->name);
424 }
425
426 return 0;
427}
428#else
429static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
430 const struct i2c_device_id *id)
431{
432 snprintf(data->fw_name, sizeof(data->fw_name),
433 "silead/%s.fw", id->name);
434 return 0;
435}
436#endif
437
438static void silead_disable_regulator(void *arg)
439{
440 struct silead_ts_data *data = arg;
441
442 regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
443}
444
445static int silead_ts_probe(struct i2c_client *client,
446 const struct i2c_device_id *id)
447{
448 struct silead_ts_data *data;
449 struct device *dev = &client->dev;
450 int error;
451
452 if (!i2c_check_functionality(client->adapter,
453 I2C_FUNC_I2C |
454 I2C_FUNC_SMBUS_READ_I2C_BLOCK |
455 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
456 dev_err(dev, "I2C functionality check failed\n");
457 return -ENXIO;
458 }
459
460 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
461 if (!data)
462 return -ENOMEM;
463
464 i2c_set_clientdata(client, data);
465 data->client = client;
466
467 error = silead_ts_set_default_fw_name(data, id);
468 if (error)
469 return error;
470
471 silead_ts_read_props(client);
472
473 /* We must have the IRQ provided by DT or ACPI subsytem */
474 if (client->irq <= 0)
475 return -ENODEV;
476
477 data->regulators[0].supply = "vddio";
478 data->regulators[1].supply = "avdd";
479 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators),
480 data->regulators);
481 if (error)
482 return error;
483
484 /*
485 * Enable regulators at probe and disable them at remove, we need
486 * to keep the chip powered otherwise it forgets its firmware.
487 */
488 error = regulator_bulk_enable(ARRAY_SIZE(data->regulators),
489 data->regulators);
490 if (error)
491 return error;
492
493 error = devm_add_action_or_reset(dev, silead_disable_regulator, data);
494 if (error)
495 return error;
496
497 /* Power GPIO pin */
498 data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
499 if (IS_ERR(data->gpio_power)) {
500 if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
501 dev_err(dev, "Shutdown GPIO request failed\n");
502 return PTR_ERR(data->gpio_power);
503 }
504
505 error = silead_ts_setup(client);
506 if (error)
507 return error;
508
509 error = silead_ts_request_input_dev(data);
510 if (error)
511 return error;
512
513 error = devm_request_threaded_irq(dev, client->irq,
514 NULL, silead_ts_threaded_irq_handler,
515 IRQF_ONESHOT, client->name, data);
516 if (error) {
517 if (error != -EPROBE_DEFER)
518 dev_err(dev, "IRQ request failed %d\n", error);
519 return error;
520 }
521
522 return 0;
523}
524
525static int __maybe_unused silead_ts_suspend(struct device *dev)
526{
527 struct i2c_client *client = to_i2c_client(dev);
528
529 silead_ts_set_power(client, SILEAD_POWER_OFF);
530 return 0;
531}
532
533static int __maybe_unused silead_ts_resume(struct device *dev)
534{
535 struct i2c_client *client = to_i2c_client(dev);
536 int error, status;
537
538 silead_ts_set_power(client, SILEAD_POWER_ON);
539
540 error = silead_ts_reset(client);
541 if (error)
542 return error;
543
544 error = silead_ts_startup(client);
545 if (error)
546 return error;
547
548 status = silead_ts_get_status(client);
549 if (status != SILEAD_STATUS_OK) {
550 dev_err(dev, "Resume error, status: 0x%02x\n", status);
551 return -ENODEV;
552 }
553
554 return 0;
555}
556
557static SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume);
558
559static const struct i2c_device_id silead_ts_id[] = {
560 { "gsl1680", 0 },
561 { "gsl1688", 0 },
562 { "gsl3670", 0 },
563 { "gsl3675", 0 },
564 { "gsl3692", 0 },
565 { "mssl1680", 0 },
566 { }
567};
568MODULE_DEVICE_TABLE(i2c, silead_ts_id);
569
570#ifdef CONFIG_ACPI
571static const struct acpi_device_id silead_ts_acpi_match[] = {
572 { "GSL1680", 0 },
573 { "GSL1688", 0 },
574 { "GSL3670", 0 },
575 { "GSL3675", 0 },
576 { "GSL3692", 0 },
577 { "MSSL1680", 0 },
578 { }
579};
580MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match);
581#endif
582
583static struct i2c_driver silead_ts_driver = {
584 .probe = silead_ts_probe,
585 .id_table = silead_ts_id,
586 .driver = {
587 .name = SILEAD_TS_NAME,
588 .acpi_match_table = ACPI_PTR(silead_ts_acpi_match),
589 .pm = &silead_ts_pm,
590 },
591};
592module_i2c_driver(silead_ts_driver);
593
594MODULE_AUTHOR("Robert Dolca <robert.dolca@intel.com>");
595MODULE_DESCRIPTION("Silead I2C touchscreen driver");
596MODULE_LICENSE("GPL");