2 * Driver for Goodix Touchscreens
4 * Copyright (c) 2014 Red Hat Inc.
5 * Copyright (c) 2015 K. Merker <merker@debian.org>
7 * This code is based on gt9xx.c authored by andrew@goodix.com:
9 * 2010 - 2012 Goodix Technology.
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the Free
15 * Software Foundation; version 2 of the License.
18 #include <linux/kernel.h>
19 #include <linux/dmi.h>
20 #include <linux/firmware.h>
21 #include <linux/gpio/consumer.h>
22 #include <linux/i2c.h>
23 #include <linux/input.h>
24 #include <linux/input/mt.h>
25 #include <linux/input/touchscreen.h>
26 #include <linux/module.h>
27 #include <linux/delay.h>
28 #include <linux/irq.h>
29 #include <linux/interrupt.h>
30 #include <linux/slab.h>
31 #include <linux/acpi.h>
33 #include <asm/unaligned.h>
35 struct goodix_ts_data;
37 struct goodix_chip_data {
40 int (*check_config)(struct goodix_ts_data *, const struct firmware *);
43 struct goodix_ts_data {
44 struct i2c_client *client;
45 struct input_dev *input_dev;
46 const struct goodix_chip_data *chip;
47 struct touchscreen_properties prop;
48 unsigned int max_touch_num;
49 unsigned int int_trigger_type;
50 struct gpio_desc *gpiod_int;
51 struct gpio_desc *gpiod_rst;
55 struct completion firmware_loading_complete;
56 unsigned long irq_flags;
59 #define GOODIX_GPIO_INT_NAME "irq"
60 #define GOODIX_GPIO_RST_NAME "reset"
62 #define GOODIX_MAX_HEIGHT 4096
63 #define GOODIX_MAX_WIDTH 4096
64 #define GOODIX_INT_TRIGGER 1
65 #define GOODIX_CONTACT_SIZE 8
66 #define GOODIX_MAX_CONTACTS 10
68 #define GOODIX_CONFIG_MAX_LENGTH 240
69 #define GOODIX_CONFIG_911_LENGTH 186
70 #define GOODIX_CONFIG_967_LENGTH 228
72 /* Register defines */
73 #define GOODIX_REG_COMMAND 0x8040
74 #define GOODIX_CMD_SCREEN_OFF 0x05
76 #define GOODIX_READ_COOR_ADDR 0x814E
77 #define GOODIX_GT1X_REG_CONFIG_DATA 0x8050
78 #define GOODIX_GT9X_REG_CONFIG_DATA 0x8047
79 #define GOODIX_REG_ID 0x8140
81 #define GOODIX_BUFFER_STATUS_READY BIT(7)
82 #define GOODIX_BUFFER_STATUS_TIMEOUT 20
84 #define RESOLUTION_LOC 1
85 #define MAX_CONTACTS_LOC 5
88 static int goodix_check_cfg_8(struct goodix_ts_data *ts,
89 const struct firmware *cfg);
90 static int goodix_check_cfg_16(struct goodix_ts_data *ts,
91 const struct firmware *cfg);
93 static const struct goodix_chip_data gt1x_chip_data = {
94 .config_addr = GOODIX_GT1X_REG_CONFIG_DATA,
95 .config_len = GOODIX_CONFIG_MAX_LENGTH,
96 .check_config = goodix_check_cfg_16,
99 static const struct goodix_chip_data gt911_chip_data = {
100 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
101 .config_len = GOODIX_CONFIG_911_LENGTH,
102 .check_config = goodix_check_cfg_8,
105 static const struct goodix_chip_data gt967_chip_data = {
106 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
107 .config_len = GOODIX_CONFIG_967_LENGTH,
108 .check_config = goodix_check_cfg_8,
111 static const struct goodix_chip_data gt9x_chip_data = {
112 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
113 .config_len = GOODIX_CONFIG_MAX_LENGTH,
114 .check_config = goodix_check_cfg_8,
117 static const unsigned long goodix_irq_flags[] = {
118 IRQ_TYPE_EDGE_RISING,
119 IRQ_TYPE_EDGE_FALLING,
125 * Those tablets have their coordinates origin at the bottom right
126 * of the tablet, as if rotated 180 degrees
128 static const struct dmi_system_id rotated_screen[] = {
129 #if defined(CONFIG_DMI) && defined(CONFIG_X86)
131 .ident = "WinBook TW100",
133 DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
138 .ident = "WinBook TW700",
140 DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
141 DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
149 * goodix_i2c_read - read data from a register of the i2c slave device.
151 * @client: i2c device.
152 * @reg: the register to read from.
153 * @buf: raw write data buffer.
154 * @len: length of the buffer to write
156 static int goodix_i2c_read(struct i2c_client *client,
157 u16 reg, u8 *buf, int len)
159 struct i2c_msg msgs[2];
160 __be16 wbuf = cpu_to_be16(reg);
164 msgs[0].addr = client->addr;
166 msgs[0].buf = (u8 *)&wbuf;
168 msgs[1].flags = I2C_M_RD;
169 msgs[1].addr = client->addr;
173 ret = i2c_transfer(client->adapter, msgs, 2);
174 return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
178 * goodix_i2c_write - write data to a register of the i2c slave device.
180 * @client: i2c device.
181 * @reg: the register to write to.
182 * @buf: raw data buffer to write.
183 * @len: length of the buffer to write
185 static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf,
192 addr_buf = kmalloc(len + 2, GFP_KERNEL);
196 addr_buf[0] = reg >> 8;
197 addr_buf[1] = reg & 0xFF;
198 memcpy(&addr_buf[2], buf, len);
201 msg.addr = client->addr;
205 ret = i2c_transfer(client->adapter, &msg, 1);
207 return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
210 static int goodix_i2c_write_u8(struct i2c_client *client, u16 reg, u8 value)
212 return goodix_i2c_write(client, reg, &value, sizeof(value));
215 static const struct goodix_chip_data *goodix_get_chip_data(u16 id)
220 return >1x_chip_data;
227 return >911_chip_data;
231 return >967_chip_data;
234 return >9x_chip_data;
238 static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
240 unsigned long max_timeout;
245 * The 'buffer status' bit, which indicates that the data is valid, is
246 * not set as soon as the interrupt is raised, but slightly after.
247 * This takes around 10 ms to happen, so we poll for 20 ms.
249 max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT);
251 error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR,
252 data, GOODIX_CONTACT_SIZE + 1);
254 dev_err(&ts->client->dev, "I2C transfer error: %d\n",
259 if (data[0] & GOODIX_BUFFER_STATUS_READY) {
260 touch_num = data[0] & 0x0f;
261 if (touch_num > ts->max_touch_num)
265 data += 1 + GOODIX_CONTACT_SIZE;
266 error = goodix_i2c_read(ts->client,
267 GOODIX_READ_COOR_ADDR +
268 1 + GOODIX_CONTACT_SIZE,
270 GOODIX_CONTACT_SIZE *
279 usleep_range(1000, 2000); /* Poll every 1 - 2 ms */
280 } while (time_before(jiffies, max_timeout));
283 * The Goodix panel will send spurious interrupts after a
284 * 'finger up' event, which will always cause a timeout.
289 static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
291 int id = coor_data[0] & 0x0F;
292 int input_x = get_unaligned_le16(&coor_data[1]);
293 int input_y = get_unaligned_le16(&coor_data[3]);
294 int input_w = get_unaligned_le16(&coor_data[5]);
296 input_mt_slot(ts->input_dev, id);
297 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
298 touchscreen_report_pos(ts->input_dev, &ts->prop,
299 input_x, input_y, true);
300 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w);
301 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w);
305 * goodix_process_events - Process incoming events
307 * @ts: our goodix_ts_data pointer
309 * Called when the IRQ is triggered. Read the current device state, and push
310 * the input events to the user space.
312 static void goodix_process_events(struct goodix_ts_data *ts)
314 u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
318 touch_num = goodix_ts_read_input_report(ts, point_data);
323 * Bit 4 of the first byte reports the status of the capacitive
324 * Windows/Home button.
326 input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
328 for (i = 0; i < touch_num; i++)
329 goodix_ts_report_touch(ts,
330 &point_data[1 + GOODIX_CONTACT_SIZE * i]);
332 input_mt_sync_frame(ts->input_dev);
333 input_sync(ts->input_dev);
337 * goodix_ts_irq_handler - The IRQ handler
339 * @irq: interrupt number.
340 * @dev_id: private data pointer.
342 static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
344 struct goodix_ts_data *ts = dev_id;
346 goodix_process_events(ts);
348 if (goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0) < 0)
349 dev_err(&ts->client->dev, "I2C write end_cmd error\n");
354 static void goodix_free_irq(struct goodix_ts_data *ts)
356 devm_free_irq(&ts->client->dev, ts->client->irq, ts);
359 static int goodix_request_irq(struct goodix_ts_data *ts)
361 return devm_request_threaded_irq(&ts->client->dev, ts->client->irq,
362 NULL, goodix_ts_irq_handler,
363 ts->irq_flags, ts->client->name, ts);
366 static int goodix_check_cfg_8(struct goodix_ts_data *ts,
367 const struct firmware *cfg)
369 int i, raw_cfg_len = cfg->size - 2;
372 for (i = 0; i < raw_cfg_len; i++)
373 check_sum += cfg->data[i];
374 check_sum = (~check_sum) + 1;
375 if (check_sum != cfg->data[raw_cfg_len]) {
376 dev_err(&ts->client->dev,
377 "The checksum of the config fw is not correct");
381 if (cfg->data[raw_cfg_len + 1] != 1) {
382 dev_err(&ts->client->dev,
383 "Config fw must have Config_Fresh register set");
390 static int goodix_check_cfg_16(struct goodix_ts_data *ts,
391 const struct firmware *cfg)
393 int i, raw_cfg_len = cfg->size - 3;
396 for (i = 0; i < raw_cfg_len; i += 2)
397 check_sum += get_unaligned_be16(&cfg->data[i]);
398 check_sum = (~check_sum) + 1;
399 if (check_sum != get_unaligned_be16(&cfg->data[raw_cfg_len])) {
400 dev_err(&ts->client->dev,
401 "The checksum of the config fw is not correct");
405 if (cfg->data[raw_cfg_len + 2] != 1) {
406 dev_err(&ts->client->dev,
407 "Config fw must have Config_Fresh register set");
415 * goodix_check_cfg - Checks if config fw is valid
417 * @ts: goodix_ts_data pointer
418 * @cfg: firmware config data
420 static int goodix_check_cfg(struct goodix_ts_data *ts,
421 const struct firmware *cfg)
423 if (cfg->size > GOODIX_CONFIG_MAX_LENGTH) {
424 dev_err(&ts->client->dev,
425 "The length of the config fw is not correct");
429 return ts->chip->check_config(ts, cfg);
433 * goodix_send_cfg - Write fw config to device
435 * @ts: goodix_ts_data pointer
436 * @cfg: config firmware to write to device
438 static int goodix_send_cfg(struct goodix_ts_data *ts,
439 const struct firmware *cfg)
443 error = goodix_check_cfg(ts, cfg);
447 error = goodix_i2c_write(ts->client, ts->chip->config_addr, cfg->data,
450 dev_err(&ts->client->dev, "Failed to write config data: %d",
454 dev_dbg(&ts->client->dev, "Config sent successfully.");
456 /* Let the firmware reconfigure itself, so sleep for 10ms */
457 usleep_range(10000, 11000);
462 static int goodix_int_sync(struct goodix_ts_data *ts)
466 error = gpiod_direction_output(ts->gpiod_int, 0);
470 msleep(50); /* T5: 50ms */
472 error = gpiod_direction_input(ts->gpiod_int);
480 * goodix_reset - Reset device during power on
482 * @ts: goodix_ts_data pointer
484 static int goodix_reset(struct goodix_ts_data *ts)
488 /* begin select I2C slave addr */
489 error = gpiod_direction_output(ts->gpiod_rst, 0);
493 msleep(20); /* T2: > 10ms */
495 /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
496 error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14);
500 usleep_range(100, 2000); /* T3: > 100us */
502 error = gpiod_direction_output(ts->gpiod_rst, 1);
506 usleep_range(6000, 10000); /* T4: > 5ms */
508 /* end select I2C slave addr */
509 error = gpiod_direction_input(ts->gpiod_rst);
513 error = goodix_int_sync(ts);
521 * goodix_get_gpio_config - Get GPIO config from ACPI/DT
523 * @ts: goodix_ts_data pointer
525 static int goodix_get_gpio_config(struct goodix_ts_data *ts)
529 struct gpio_desc *gpiod;
533 dev = &ts->client->dev;
535 /* Get the interrupt GPIO pin number */
536 gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN);
538 error = PTR_ERR(gpiod);
539 if (error != -EPROBE_DEFER)
540 dev_dbg(dev, "Failed to get %s GPIO: %d\n",
541 GOODIX_GPIO_INT_NAME, error);
545 ts->gpiod_int = gpiod;
547 /* Get the reset line GPIO pin number */
548 gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN);
550 error = PTR_ERR(gpiod);
551 if (error != -EPROBE_DEFER)
552 dev_dbg(dev, "Failed to get %s GPIO: %d\n",
553 GOODIX_GPIO_RST_NAME, error);
557 ts->gpiod_rst = gpiod;
563 * goodix_read_config - Read the embedded configuration of the panel
565 * @ts: our goodix_ts_data pointer
567 * Must be called during probe
569 static void goodix_read_config(struct goodix_ts_data *ts)
571 u8 config[GOODIX_CONFIG_MAX_LENGTH];
575 error = goodix_i2c_read(ts->client, ts->chip->config_addr,
576 config, ts->chip->config_len);
578 dev_warn(&ts->client->dev, "Error reading config: %d\n",
580 ts->int_trigger_type = GOODIX_INT_TRIGGER;
581 ts->max_touch_num = GOODIX_MAX_CONTACTS;
585 ts->int_trigger_type = config[TRIGGER_LOC] & 0x03;
586 ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f;
588 x_max = get_unaligned_le16(&config[RESOLUTION_LOC]);
589 y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]);
590 if (x_max && y_max) {
591 input_abs_set_max(ts->input_dev, ABS_MT_POSITION_X, x_max - 1);
592 input_abs_set_max(ts->input_dev, ABS_MT_POSITION_Y, y_max - 1);
597 * goodix_read_version - Read goodix touchscreen version
599 * @ts: our goodix_ts_data pointer
601 static int goodix_read_version(struct goodix_ts_data *ts)
607 error = goodix_i2c_read(ts->client, GOODIX_REG_ID, buf, sizeof(buf));
609 dev_err(&ts->client->dev, "read version failed: %d\n", error);
613 memcpy(id_str, buf, 4);
615 if (kstrtou16(id_str, 10, &ts->id))
618 ts->version = get_unaligned_le16(&buf[4]);
620 dev_info(&ts->client->dev, "ID %d, version: %04x\n", ts->id,
627 * goodix_i2c_test - I2C test function to check if the device answers.
629 * @client: the i2c client
631 static int goodix_i2c_test(struct i2c_client *client)
637 while (retry++ < 2) {
638 error = goodix_i2c_read(client, GOODIX_REG_ID,
643 dev_err(&client->dev, "i2c test failed attempt %d: %d\n",
652 * goodix_configure_dev - Finish device initialization
654 * @ts: our goodix_ts_data pointer
656 * Must be called from probe to finish initialization of the device.
657 * Contains the common initialization code for both devices that
658 * declare gpio pins and devices that do not. It is either called
659 * directly from probe or from request_firmware_wait callback.
661 static int goodix_configure_dev(struct goodix_ts_data *ts)
665 ts->int_trigger_type = GOODIX_INT_TRIGGER;
666 ts->max_touch_num = GOODIX_MAX_CONTACTS;
668 ts->input_dev = devm_input_allocate_device(&ts->client->dev);
669 if (!ts->input_dev) {
670 dev_err(&ts->client->dev, "Failed to allocate input device.");
674 ts->input_dev->name = "Goodix Capacitive TouchScreen";
675 ts->input_dev->phys = "input/ts";
676 ts->input_dev->id.bustype = BUS_I2C;
677 ts->input_dev->id.vendor = 0x0416;
678 ts->input_dev->id.product = ts->id;
679 ts->input_dev->id.version = ts->version;
681 /* Capacitive Windows/Home button on some devices */
682 input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA);
684 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X);
685 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y);
686 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
687 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
689 /* Read configuration and apply touchscreen parameters */
690 goodix_read_config(ts);
692 /* Try overriding touchscreen parameters via device properties */
693 touchscreen_parse_properties(ts->input_dev, true, &ts->prop);
695 if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) {
696 dev_err(&ts->client->dev,
697 "Invalid config (%d, %d, %d), using defaults\n",
698 ts->prop.max_x, ts->prop.max_y, ts->max_touch_num);
699 ts->prop.max_x = GOODIX_MAX_WIDTH - 1;
700 ts->prop.max_y = GOODIX_MAX_HEIGHT - 1;
701 ts->max_touch_num = GOODIX_MAX_CONTACTS;
702 input_abs_set_max(ts->input_dev,
703 ABS_MT_POSITION_X, ts->prop.max_x);
704 input_abs_set_max(ts->input_dev,
705 ABS_MT_POSITION_Y, ts->prop.max_y);
708 if (dmi_check_system(rotated_screen)) {
709 ts->prop.invert_x = true;
710 ts->prop.invert_y = true;
711 dev_dbg(&ts->client->dev,
712 "Applying '180 degrees rotated screen' quirk\n");
715 error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
716 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
718 dev_err(&ts->client->dev,
719 "Failed to initialize MT slots: %d", error);
723 error = input_register_device(ts->input_dev);
725 dev_err(&ts->client->dev,
726 "Failed to register input device: %d", error);
730 ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT;
731 error = goodix_request_irq(ts);
733 dev_err(&ts->client->dev, "request IRQ failed: %d\n", error);
741 * goodix_config_cb - Callback to finish device init
743 * @ts: our goodix_ts_data pointer
745 * request_firmware_wait callback that finishes
746 * initialization of the device.
748 static void goodix_config_cb(const struct firmware *cfg, void *ctx)
750 struct goodix_ts_data *ts = ctx;
754 /* send device configuration to the firmware */
755 error = goodix_send_cfg(ts, cfg);
757 goto err_release_cfg;
760 goodix_configure_dev(ts);
763 release_firmware(cfg);
764 complete_all(&ts->firmware_loading_complete);
767 static int goodix_ts_probe(struct i2c_client *client,
768 const struct i2c_device_id *id)
770 struct goodix_ts_data *ts;
773 dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr);
775 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
776 dev_err(&client->dev, "I2C check functionality failed.\n");
780 ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
785 i2c_set_clientdata(client, ts);
786 init_completion(&ts->firmware_loading_complete);
788 error = goodix_get_gpio_config(ts);
792 if (ts->gpiod_int && ts->gpiod_rst) {
793 /* reset the controller */
794 error = goodix_reset(ts);
796 dev_err(&client->dev, "Controller reset failed.\n");
801 error = goodix_i2c_test(client);
803 dev_err(&client->dev, "I2C communication failure: %d\n", error);
807 error = goodix_read_version(ts);
809 dev_err(&client->dev, "Read version failed.\n");
813 ts->chip = goodix_get_chip_data(ts->id);
815 if (ts->gpiod_int && ts->gpiod_rst) {
816 /* update device config */
817 ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL,
818 "goodix_%d_cfg.bin", ts->id);
822 error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name,
823 &client->dev, GFP_KERNEL, ts,
826 dev_err(&client->dev,
827 "Failed to invoke firmware loader: %d\n",
834 error = goodix_configure_dev(ts);
842 static int goodix_ts_remove(struct i2c_client *client)
844 struct goodix_ts_data *ts = i2c_get_clientdata(client);
846 if (ts->gpiod_int && ts->gpiod_rst)
847 wait_for_completion(&ts->firmware_loading_complete);
852 static int __maybe_unused goodix_suspend(struct device *dev)
854 struct i2c_client *client = to_i2c_client(dev);
855 struct goodix_ts_data *ts = i2c_get_clientdata(client);
858 /* We need gpio pins to suspend/resume */
859 if (!ts->gpiod_int || !ts->gpiod_rst) {
860 disable_irq(client->irq);
864 wait_for_completion(&ts->firmware_loading_complete);
866 /* Free IRQ as IRQ pin is used as output in the suspend sequence */
869 /* Output LOW on the INT pin for 5 ms */
870 error = gpiod_direction_output(ts->gpiod_int, 0);
872 goodix_request_irq(ts);
876 usleep_range(5000, 6000);
878 error = goodix_i2c_write_u8(ts->client, GOODIX_REG_COMMAND,
879 GOODIX_CMD_SCREEN_OFF);
881 dev_err(&ts->client->dev, "Screen off command failed\n");
882 gpiod_direction_input(ts->gpiod_int);
883 goodix_request_irq(ts);
888 * The datasheet specifies that the interval between sending screen-off
889 * command and wake-up should be longer than 58 ms. To avoid waking up
890 * sooner, delay 58ms here.
896 static int __maybe_unused goodix_resume(struct device *dev)
898 struct i2c_client *client = to_i2c_client(dev);
899 struct goodix_ts_data *ts = i2c_get_clientdata(client);
902 if (!ts->gpiod_int || !ts->gpiod_rst) {
903 enable_irq(client->irq);
908 * Exit sleep mode by outputting HIGH level to INT pin
911 error = gpiod_direction_output(ts->gpiod_int, 1);
915 usleep_range(2000, 5000);
917 error = goodix_int_sync(ts);
921 error = goodix_request_irq(ts);
928 static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
930 static const struct i2c_device_id goodix_ts_id[] = {
931 { "GDIX1001:00", 0 },
934 MODULE_DEVICE_TABLE(i2c, goodix_ts_id);
937 static const struct acpi_device_id goodix_acpi_match[] = {
942 MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);
946 static const struct of_device_id goodix_of_match[] = {
947 { .compatible = "goodix,gt1151" },
948 { .compatible = "goodix,gt5688" },
949 { .compatible = "goodix,gt911" },
950 { .compatible = "goodix,gt9110" },
951 { .compatible = "goodix,gt912" },
952 { .compatible = "goodix,gt927" },
953 { .compatible = "goodix,gt9271" },
954 { .compatible = "goodix,gt928" },
955 { .compatible = "goodix,gt967" },
958 MODULE_DEVICE_TABLE(of, goodix_of_match);
961 static struct i2c_driver goodix_ts_driver = {
962 .probe = goodix_ts_probe,
963 .remove = goodix_ts_remove,
964 .id_table = goodix_ts_id,
967 .acpi_match_table = ACPI_PTR(goodix_acpi_match),
968 .of_match_table = of_match_ptr(goodix_of_match),
969 .pm = &goodix_pm_ops,
972 module_i2c_driver(goodix_ts_driver);
974 MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
975 MODULE_AUTHOR("Bastien Nocera <hadess@hadess.net>");
976 MODULE_DESCRIPTION("Goodix touchscreen driver");
977 MODULE_LICENSE("GPL v2");