2 * Driver for Goodix Touchscreens
4 * Copyright (c) 2014 Red Hat Inc.
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/module.h>
26 #include <linux/delay.h>
27 #include <linux/irq.h>
28 #include <linux/interrupt.h>
29 #include <linux/slab.h>
30 #include <linux/acpi.h>
32 #include <asm/unaligned.h>
34 struct goodix_ts_data;
36 struct goodix_chip_data {
39 int (*check_config)(struct goodix_ts_data *, const struct firmware *);
42 struct goodix_ts_data {
43 struct i2c_client *client;
44 struct input_dev *input_dev;
45 const struct goodix_chip_data *chip;
51 unsigned int max_touch_num;
52 unsigned int int_trigger_type;
53 struct gpio_desc *gpiod_int;
54 struct gpio_desc *gpiod_rst;
58 struct completion firmware_loading_complete;
59 unsigned long irq_flags;
62 #define GOODIX_GPIO_INT_NAME "irq"
63 #define GOODIX_GPIO_RST_NAME "reset"
65 #define GOODIX_MAX_HEIGHT 4096
66 #define GOODIX_MAX_WIDTH 4096
67 #define GOODIX_INT_TRIGGER 1
68 #define GOODIX_CONTACT_SIZE 8
69 #define GOODIX_MAX_CONTACTS 10
71 #define GOODIX_CONFIG_MAX_LENGTH 240
72 #define GOODIX_CONFIG_911_LENGTH 186
73 #define GOODIX_CONFIG_967_LENGTH 228
75 /* Register defines */
76 #define GOODIX_REG_COMMAND 0x8040
77 #define GOODIX_CMD_SCREEN_OFF 0x05
79 #define GOODIX_READ_COOR_ADDR 0x814E
80 #define GOODIX_GT1X_REG_CONFIG_DATA 0x8050
81 #define GOODIX_GT9X_REG_CONFIG_DATA 0x8047
82 #define GOODIX_REG_ID 0x8140
84 #define GOODIX_BUFFER_STATUS_READY BIT(7)
85 #define GOODIX_BUFFER_STATUS_TIMEOUT 20
87 #define RESOLUTION_LOC 1
88 #define MAX_CONTACTS_LOC 5
91 static int goodix_check_cfg_8(struct goodix_ts_data *ts,
92 const struct firmware *cfg);
93 static int goodix_check_cfg_16(struct goodix_ts_data *ts,
94 const struct firmware *cfg);
96 static const struct goodix_chip_data gt1x_chip_data = {
97 .config_addr = GOODIX_GT1X_REG_CONFIG_DATA,
98 .config_len = GOODIX_CONFIG_MAX_LENGTH,
99 .check_config = goodix_check_cfg_16,
102 static const struct goodix_chip_data gt911_chip_data = {
103 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
104 .config_len = GOODIX_CONFIG_911_LENGTH,
105 .check_config = goodix_check_cfg_8,
108 static const struct goodix_chip_data gt967_chip_data = {
109 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
110 .config_len = GOODIX_CONFIG_967_LENGTH,
111 .check_config = goodix_check_cfg_8,
114 static const struct goodix_chip_data gt9x_chip_data = {
115 .config_addr = GOODIX_GT9X_REG_CONFIG_DATA,
116 .config_len = GOODIX_CONFIG_MAX_LENGTH,
117 .check_config = goodix_check_cfg_8,
120 static const unsigned long goodix_irq_flags[] = {
121 IRQ_TYPE_EDGE_RISING,
122 IRQ_TYPE_EDGE_FALLING,
128 * Those tablets have their coordinates origin at the bottom right
129 * of the tablet, as if rotated 180 degrees
131 static const struct dmi_system_id rotated_screen[] = {
132 #if defined(CONFIG_DMI) && defined(CONFIG_X86)
134 .ident = "WinBook TW100",
136 DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
141 .ident = "WinBook TW700",
143 DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
144 DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
152 * goodix_i2c_read - read data from a register of the i2c slave device.
154 * @client: i2c device.
155 * @reg: the register to read from.
156 * @buf: raw write data buffer.
157 * @len: length of the buffer to write
159 static int goodix_i2c_read(struct i2c_client *client,
160 u16 reg, u8 *buf, int len)
162 struct i2c_msg msgs[2];
163 u16 wbuf = cpu_to_be16(reg);
167 msgs[0].addr = client->addr;
169 msgs[0].buf = (u8 *)&wbuf;
171 msgs[1].flags = I2C_M_RD;
172 msgs[1].addr = client->addr;
176 ret = i2c_transfer(client->adapter, msgs, 2);
177 return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
181 * goodix_i2c_write - write data to a register of the i2c slave device.
183 * @client: i2c device.
184 * @reg: the register to write to.
185 * @buf: raw data buffer to write.
186 * @len: length of the buffer to write
188 static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf,
195 addr_buf = kmalloc(len + 2, GFP_KERNEL);
199 addr_buf[0] = reg >> 8;
200 addr_buf[1] = reg & 0xFF;
201 memcpy(&addr_buf[2], buf, len);
204 msg.addr = client->addr;
208 ret = i2c_transfer(client->adapter, &msg, 1);
210 return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
213 static int goodix_i2c_write_u8(struct i2c_client *client, u16 reg, u8 value)
215 return goodix_i2c_write(client, reg, &value, sizeof(value));
218 static const struct goodix_chip_data *goodix_get_chip_data(u16 id)
222 return >1x_chip_data;
229 return >911_chip_data;
233 return >967_chip_data;
236 return >9x_chip_data;
240 static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
242 unsigned long max_timeout;
247 * The 'buffer status' bit, which indicates that the data is valid, is
248 * not set as soon as the interrupt is raised, but slightly after.
249 * This takes around 10 ms to happen, so we poll for 20 ms.
251 max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT);
253 error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR,
254 data, GOODIX_CONTACT_SIZE + 1);
256 dev_err(&ts->client->dev, "I2C transfer error: %d\n",
261 if (data[0] & GOODIX_BUFFER_STATUS_READY) {
262 touch_num = data[0] & 0x0f;
263 if (touch_num > ts->max_touch_num)
267 data += 1 + GOODIX_CONTACT_SIZE;
268 error = goodix_i2c_read(ts->client,
269 GOODIX_READ_COOR_ADDR +
270 1 + GOODIX_CONTACT_SIZE,
272 GOODIX_CONTACT_SIZE *
281 usleep_range(1000, 2000); /* Poll every 1 - 2 ms */
282 } while (time_before(jiffies, max_timeout));
285 * The Goodix panel will send spurious interrupts after a
286 * 'finger up' event, which will always cause a timeout.
291 static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
293 int id = coor_data[0] & 0x0F;
294 int input_x = get_unaligned_le16(&coor_data[1]);
295 int input_y = get_unaligned_le16(&coor_data[3]);
296 int input_w = get_unaligned_le16(&coor_data[5]);
298 /* Inversions have to happen before axis swapping */
300 input_x = ts->abs_x_max - input_x;
302 input_y = ts->abs_y_max - input_y;
304 swap(input_x, input_y);
306 input_mt_slot(ts->input_dev, id);
307 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
308 input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x);
309 input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, input_y);
310 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w);
311 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w);
315 * goodix_process_events - Process incoming events
317 * @ts: our goodix_ts_data pointer
319 * Called when the IRQ is triggered. Read the current device state, and push
320 * the input events to the user space.
322 static void goodix_process_events(struct goodix_ts_data *ts)
324 u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
328 touch_num = goodix_ts_read_input_report(ts, point_data);
333 * Bit 4 of the first byte reports the status of the capacitive
334 * Windows/Home button.
336 input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
338 for (i = 0; i < touch_num; i++)
339 goodix_ts_report_touch(ts,
340 &point_data[1 + GOODIX_CONTACT_SIZE * i]);
342 input_mt_sync_frame(ts->input_dev);
343 input_sync(ts->input_dev);
347 * goodix_ts_irq_handler - The IRQ handler
349 * @irq: interrupt number.
350 * @dev_id: private data pointer.
352 static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
354 struct goodix_ts_data *ts = dev_id;
356 goodix_process_events(ts);
358 if (goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0) < 0)
359 dev_err(&ts->client->dev, "I2C write end_cmd error\n");
364 static void goodix_free_irq(struct goodix_ts_data *ts)
366 devm_free_irq(&ts->client->dev, ts->client->irq, ts);
369 static int goodix_request_irq(struct goodix_ts_data *ts)
371 return devm_request_threaded_irq(&ts->client->dev, ts->client->irq,
372 NULL, goodix_ts_irq_handler,
373 ts->irq_flags, ts->client->name, ts);
376 static int goodix_check_cfg_8(struct goodix_ts_data *ts,
377 const struct firmware *cfg)
379 int i, raw_cfg_len = cfg->size - 2;
382 for (i = 0; i < raw_cfg_len; i++)
383 check_sum += cfg->data[i];
384 check_sum = (~check_sum) + 1;
385 if (check_sum != cfg->data[raw_cfg_len]) {
386 dev_err(&ts->client->dev,
387 "The checksum of the config fw is not correct");
391 if (cfg->data[raw_cfg_len + 1] != 1) {
392 dev_err(&ts->client->dev,
393 "Config fw must have Config_Fresh register set");
400 static int goodix_check_cfg_16(struct goodix_ts_data *ts,
401 const struct firmware *cfg)
403 int i, raw_cfg_len = cfg->size - 3;
406 for (i = 0; i < raw_cfg_len; i += 2)
407 check_sum += get_unaligned_be16(&cfg->data[i]);
408 check_sum = (~check_sum) + 1;
409 if (check_sum != get_unaligned_be16(&cfg->data[raw_cfg_len])) {
410 dev_err(&ts->client->dev,
411 "The checksum of the config fw is not correct");
415 if (cfg->data[raw_cfg_len + 2] != 1) {
416 dev_err(&ts->client->dev,
417 "Config fw must have Config_Fresh register set");
425 * goodix_check_cfg - Checks if config fw is valid
427 * @ts: goodix_ts_data pointer
428 * @cfg: firmware config data
430 static int goodix_check_cfg(struct goodix_ts_data *ts,
431 const struct firmware *cfg)
433 if (cfg->size > GOODIX_CONFIG_MAX_LENGTH) {
434 dev_err(&ts->client->dev,
435 "The length of the config fw is not correct");
439 return ts->chip->check_config(ts, cfg);
443 * goodix_send_cfg - Write fw config to device
445 * @ts: goodix_ts_data pointer
446 * @cfg: config firmware to write to device
448 static int goodix_send_cfg(struct goodix_ts_data *ts,
449 const struct firmware *cfg)
453 error = goodix_check_cfg(ts, cfg);
457 error = goodix_i2c_write(ts->client, ts->chip->config_addr, cfg->data,
460 dev_err(&ts->client->dev, "Failed to write config data: %d",
464 dev_dbg(&ts->client->dev, "Config sent successfully.");
466 /* Let the firmware reconfigure itself, so sleep for 10ms */
467 usleep_range(10000, 11000);
472 static int goodix_int_sync(struct goodix_ts_data *ts)
476 error = gpiod_direction_output(ts->gpiod_int, 0);
480 msleep(50); /* T5: 50ms */
482 error = gpiod_direction_input(ts->gpiod_int);
490 * goodix_reset - Reset device during power on
492 * @ts: goodix_ts_data pointer
494 static int goodix_reset(struct goodix_ts_data *ts)
498 /* begin select I2C slave addr */
499 error = gpiod_direction_output(ts->gpiod_rst, 0);
503 msleep(20); /* T2: > 10ms */
505 /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */
506 error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14);
510 usleep_range(100, 2000); /* T3: > 100us */
512 error = gpiod_direction_output(ts->gpiod_rst, 1);
516 usleep_range(6000, 10000); /* T4: > 5ms */
518 /* end select I2C slave addr */
519 error = gpiod_direction_input(ts->gpiod_rst);
523 error = goodix_int_sync(ts);
531 * goodix_get_gpio_config - Get GPIO config from ACPI/DT
533 * @ts: goodix_ts_data pointer
535 static int goodix_get_gpio_config(struct goodix_ts_data *ts)
539 struct gpio_desc *gpiod;
543 dev = &ts->client->dev;
545 /* Get the interrupt GPIO pin number */
546 gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN);
548 error = PTR_ERR(gpiod);
549 if (error != -EPROBE_DEFER)
550 dev_dbg(dev, "Failed to get %s GPIO: %d\n",
551 GOODIX_GPIO_INT_NAME, error);
555 ts->gpiod_int = gpiod;
557 /* Get the reset line GPIO pin number */
558 gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN);
560 error = PTR_ERR(gpiod);
561 if (error != -EPROBE_DEFER)
562 dev_dbg(dev, "Failed to get %s GPIO: %d\n",
563 GOODIX_GPIO_RST_NAME, error);
567 ts->gpiod_rst = gpiod;
573 * goodix_read_config - Read the embedded configuration of the panel
575 * @ts: our goodix_ts_data pointer
577 * Must be called during probe
579 static void goodix_read_config(struct goodix_ts_data *ts)
581 u8 config[GOODIX_CONFIG_MAX_LENGTH];
584 error = goodix_i2c_read(ts->client, ts->chip->config_addr,
585 config, ts->chip->config_len);
587 dev_warn(&ts->client->dev,
588 "Error reading config (%d), using defaults\n",
590 ts->abs_x_max = GOODIX_MAX_WIDTH;
591 ts->abs_y_max = GOODIX_MAX_HEIGHT;
593 swap(ts->abs_x_max, ts->abs_y_max);
594 ts->int_trigger_type = GOODIX_INT_TRIGGER;
595 ts->max_touch_num = GOODIX_MAX_CONTACTS;
599 ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]);
600 ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]);
602 swap(ts->abs_x_max, ts->abs_y_max);
603 ts->int_trigger_type = config[TRIGGER_LOC] & 0x03;
604 ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f;
605 if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) {
606 dev_err(&ts->client->dev,
607 "Invalid config, using defaults\n");
608 ts->abs_x_max = GOODIX_MAX_WIDTH;
609 ts->abs_y_max = GOODIX_MAX_HEIGHT;
611 swap(ts->abs_x_max, ts->abs_y_max);
612 ts->max_touch_num = GOODIX_MAX_CONTACTS;
615 if (dmi_check_system(rotated_screen)) {
616 ts->inverted_x = true;
617 ts->inverted_y = true;
618 dev_dbg(&ts->client->dev,
619 "Applying '180 degrees rotated screen' quirk\n");
624 * goodix_read_version - Read goodix touchscreen version
626 * @ts: our goodix_ts_data pointer
628 static int goodix_read_version(struct goodix_ts_data *ts)
634 error = goodix_i2c_read(ts->client, GOODIX_REG_ID, buf, sizeof(buf));
636 dev_err(&ts->client->dev, "read version failed: %d\n", error);
640 memcpy(id_str, buf, 4);
642 if (kstrtou16(id_str, 10, &ts->id))
645 ts->version = get_unaligned_le16(&buf[4]);
647 dev_info(&ts->client->dev, "ID %d, version: %04x\n", ts->id,
654 * goodix_i2c_test - I2C test function to check if the device answers.
656 * @client: the i2c client
658 static int goodix_i2c_test(struct i2c_client *client)
664 while (retry++ < 2) {
665 error = goodix_i2c_read(client, GOODIX_REG_ID,
670 dev_err(&client->dev, "i2c test failed attempt %d: %d\n",
679 * goodix_request_input_dev - Allocate, populate and register the input device
681 * @ts: our goodix_ts_data pointer
683 * Must be called during probe
685 static int goodix_request_input_dev(struct goodix_ts_data *ts)
689 ts->input_dev = devm_input_allocate_device(&ts->client->dev);
690 if (!ts->input_dev) {
691 dev_err(&ts->client->dev, "Failed to allocate input device.");
695 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
696 0, ts->abs_x_max, 0, 0);
697 input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y,
698 0, ts->abs_y_max, 0, 0);
699 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
700 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
702 input_mt_init_slots(ts->input_dev, ts->max_touch_num,
703 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
705 ts->input_dev->name = "Goodix Capacitive TouchScreen";
706 ts->input_dev->phys = "input/ts";
707 ts->input_dev->id.bustype = BUS_I2C;
708 ts->input_dev->id.vendor = 0x0416;
709 ts->input_dev->id.product = ts->id;
710 ts->input_dev->id.version = ts->version;
712 /* Capacitive Windows/Home button on some devices */
713 input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA);
715 error = input_register_device(ts->input_dev);
717 dev_err(&ts->client->dev,
718 "Failed to register input device: %d", error);
726 * goodix_configure_dev - Finish device initialization
728 * @ts: our goodix_ts_data pointer
730 * Must be called from probe to finish initialization of the device.
731 * Contains the common initialization code for both devices that
732 * declare gpio pins and devices that do not. It is either called
733 * directly from probe or from request_firmware_wait callback.
735 static int goodix_configure_dev(struct goodix_ts_data *ts)
739 ts->swapped_x_y = device_property_read_bool(&ts->client->dev,
740 "touchscreen-swapped-x-y");
741 ts->inverted_x = device_property_read_bool(&ts->client->dev,
742 "touchscreen-inverted-x");
743 ts->inverted_y = device_property_read_bool(&ts->client->dev,
744 "touchscreen-inverted-y");
746 goodix_read_config(ts);
748 error = goodix_request_input_dev(ts);
752 ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT;
753 error = goodix_request_irq(ts);
755 dev_err(&ts->client->dev, "request IRQ failed: %d\n", error);
763 * goodix_config_cb - Callback to finish device init
765 * @ts: our goodix_ts_data pointer
767 * request_firmware_wait callback that finishes
768 * initialization of the device.
770 static void goodix_config_cb(const struct firmware *cfg, void *ctx)
772 struct goodix_ts_data *ts = ctx;
776 /* send device configuration to the firmware */
777 error = goodix_send_cfg(ts, cfg);
779 goto err_release_cfg;
782 goodix_configure_dev(ts);
785 release_firmware(cfg);
786 complete_all(&ts->firmware_loading_complete);
789 static int goodix_ts_probe(struct i2c_client *client,
790 const struct i2c_device_id *id)
792 struct goodix_ts_data *ts;
795 dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr);
797 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
798 dev_err(&client->dev, "I2C check functionality failed.\n");
802 ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
807 i2c_set_clientdata(client, ts);
808 init_completion(&ts->firmware_loading_complete);
810 error = goodix_get_gpio_config(ts);
814 if (ts->gpiod_int && ts->gpiod_rst) {
815 /* reset the controller */
816 error = goodix_reset(ts);
818 dev_err(&client->dev, "Controller reset failed.\n");
823 error = goodix_i2c_test(client);
825 dev_err(&client->dev, "I2C communication failure: %d\n", error);
829 error = goodix_read_version(ts);
831 dev_err(&client->dev, "Read version failed.\n");
835 ts->chip = goodix_get_chip_data(ts->id);
837 if (ts->gpiod_int && ts->gpiod_rst) {
838 /* update device config */
839 ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL,
840 "goodix_%d_cfg.bin", ts->id);
844 error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name,
845 &client->dev, GFP_KERNEL, ts,
848 dev_err(&client->dev,
849 "Failed to invoke firmware loader: %d\n",
856 error = goodix_configure_dev(ts);
864 static int goodix_ts_remove(struct i2c_client *client)
866 struct goodix_ts_data *ts = i2c_get_clientdata(client);
868 if (ts->gpiod_int && ts->gpiod_rst)
869 wait_for_completion(&ts->firmware_loading_complete);
874 static int __maybe_unused goodix_suspend(struct device *dev)
876 struct i2c_client *client = to_i2c_client(dev);
877 struct goodix_ts_data *ts = i2c_get_clientdata(client);
880 /* We need gpio pins to suspend/resume */
881 if (!ts->gpiod_int || !ts->gpiod_rst)
884 wait_for_completion(&ts->firmware_loading_complete);
886 /* Free IRQ as IRQ pin is used as output in the suspend sequence */
889 /* Output LOW on the INT pin for 5 ms */
890 error = gpiod_direction_output(ts->gpiod_int, 0);
892 goodix_request_irq(ts);
896 usleep_range(5000, 6000);
898 error = goodix_i2c_write_u8(ts->client, GOODIX_REG_COMMAND,
899 GOODIX_CMD_SCREEN_OFF);
901 dev_err(&ts->client->dev, "Screen off command failed\n");
902 gpiod_direction_input(ts->gpiod_int);
903 goodix_request_irq(ts);
908 * The datasheet specifies that the interval between sending screen-off
909 * command and wake-up should be longer than 58 ms. To avoid waking up
910 * sooner, delay 58ms here.
916 static int __maybe_unused goodix_resume(struct device *dev)
918 struct i2c_client *client = to_i2c_client(dev);
919 struct goodix_ts_data *ts = i2c_get_clientdata(client);
922 if (!ts->gpiod_int || !ts->gpiod_rst)
926 * Exit sleep mode by outputting HIGH level to INT pin
929 error = gpiod_direction_output(ts->gpiod_int, 1);
933 usleep_range(2000, 5000);
935 error = goodix_int_sync(ts);
939 error = goodix_request_irq(ts);
946 static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume);
948 static const struct i2c_device_id goodix_ts_id[] = {
949 { "GDIX1001:00", 0 },
952 MODULE_DEVICE_TABLE(i2c, goodix_ts_id);
955 static const struct acpi_device_id goodix_acpi_match[] = {
959 MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);
963 static const struct of_device_id goodix_of_match[] = {
964 { .compatible = "goodix,gt1151" },
965 { .compatible = "goodix,gt911" },
966 { .compatible = "goodix,gt9110" },
967 { .compatible = "goodix,gt912" },
968 { .compatible = "goodix,gt927" },
969 { .compatible = "goodix,gt9271" },
970 { .compatible = "goodix,gt928" },
971 { .compatible = "goodix,gt967" },
974 MODULE_DEVICE_TABLE(of, goodix_of_match);
977 static struct i2c_driver goodix_ts_driver = {
978 .probe = goodix_ts_probe,
979 .remove = goodix_ts_remove,
980 .id_table = goodix_ts_id,
983 .acpi_match_table = ACPI_PTR(goodix_acpi_match),
984 .of_match_table = of_match_ptr(goodix_of_match),
985 .pm = &goodix_pm_ops,
988 module_i2c_driver(goodix_ts_driver);
992 MODULE_DESCRIPTION("Goodix touchscreen driver");
993 MODULE_LICENSE("GPL v2");