Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Driver for Goodix Touchscreens |
| 3 | * |
| 4 | * Copyright (c) 2014 Red Hat Inc. |
| 5 | * |
| 6 | * This code is based on gt9xx.c authored by andrew@goodix.com: |
| 7 | * |
| 8 | * 2010 - 2012 Goodix Technology. |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * This program is free software; you can redistribute it and/or modify it |
| 13 | * under the terms of the GNU General Public License as published by the Free |
| 14 | * Software Foundation; version 2 of the License. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/kernel.h> |
Bastien Nocera | 8b5a359 | 2015-07-24 09:08:53 -0700 | [diff] [blame] | 18 | #include <linux/dmi.h> |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 19 | #include <linux/firmware.h> |
Irina Tirdea | ec6e1b4 | 2015-12-17 15:57:34 -0800 | [diff] [blame] | 20 | #include <linux/gpio/consumer.h> |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 21 | #include <linux/i2c.h> |
| 22 | #include <linux/input.h> |
| 23 | #include <linux/input/mt.h> |
| 24 | #include <linux/module.h> |
| 25 | #include <linux/delay.h> |
| 26 | #include <linux/irq.h> |
| 27 | #include <linux/interrupt.h> |
| 28 | #include <linux/slab.h> |
Aleksei Mamlin | 771d8f1 | 2015-03-06 16:43:38 -0800 | [diff] [blame] | 29 | #include <linux/acpi.h> |
| 30 | #include <linux/of.h> |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 31 | #include <asm/unaligned.h> |
| 32 | |
| 33 | struct goodix_ts_data { |
| 34 | struct i2c_client *client; |
| 35 | struct input_dev *input_dev; |
| 36 | int abs_x_max; |
| 37 | int abs_y_max; |
| 38 | unsigned int max_touch_num; |
| 39 | unsigned int int_trigger_type; |
Bastien Nocera | 8b5a359 | 2015-07-24 09:08:53 -0700 | [diff] [blame] | 40 | bool rotated_screen; |
Irina Tirdea | a779fbc | 2015-12-17 15:55:21 -0800 | [diff] [blame] | 41 | int cfg_len; |
Irina Tirdea | ec6e1b4 | 2015-12-17 15:57:34 -0800 | [diff] [blame] | 42 | struct gpio_desc *gpiod_int; |
| 43 | struct gpio_desc *gpiod_rst; |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 44 | u16 id; |
| 45 | u16 version; |
| 46 | const char *cfg_name; |
| 47 | struct completion firmware_loading_complete; |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 48 | unsigned long irq_flags; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Irina Tirdea | ec6e1b4 | 2015-12-17 15:57:34 -0800 | [diff] [blame] | 51 | #define GOODIX_GPIO_INT_NAME "irq" |
| 52 | #define GOODIX_GPIO_RST_NAME "reset" |
| 53 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 54 | #define GOODIX_MAX_HEIGHT 4096 |
| 55 | #define GOODIX_MAX_WIDTH 4096 |
| 56 | #define GOODIX_INT_TRIGGER 1 |
| 57 | #define GOODIX_CONTACT_SIZE 8 |
| 58 | #define GOODIX_MAX_CONTACTS 10 |
| 59 | |
| 60 | #define GOODIX_CONFIG_MAX_LENGTH 240 |
Irina Tirdea | a779fbc | 2015-12-17 15:55:21 -0800 | [diff] [blame] | 61 | #define GOODIX_CONFIG_911_LENGTH 186 |
| 62 | #define GOODIX_CONFIG_967_LENGTH 228 |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 63 | |
| 64 | /* Register defines */ |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 65 | #define GOODIX_REG_COMMAND 0x8040 |
| 66 | #define GOODIX_CMD_SCREEN_OFF 0x05 |
| 67 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 68 | #define GOODIX_READ_COOR_ADDR 0x814E |
| 69 | #define GOODIX_REG_CONFIG_DATA 0x8047 |
Irina Tirdea | e70b030 | 2015-06-09 11:04:40 -0700 | [diff] [blame] | 70 | #define GOODIX_REG_ID 0x8140 |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 71 | |
| 72 | #define RESOLUTION_LOC 1 |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 73 | #define MAX_CONTACTS_LOC 5 |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 74 | #define TRIGGER_LOC 6 |
| 75 | |
| 76 | static const unsigned long goodix_irq_flags[] = { |
| 77 | IRQ_TYPE_EDGE_RISING, |
| 78 | IRQ_TYPE_EDGE_FALLING, |
| 79 | IRQ_TYPE_LEVEL_LOW, |
| 80 | IRQ_TYPE_LEVEL_HIGH, |
| 81 | }; |
| 82 | |
Bastien Nocera | 8b5a359 | 2015-07-24 09:08:53 -0700 | [diff] [blame] | 83 | /* |
| 84 | * Those tablets have their coordinates origin at the bottom right |
| 85 | * of the tablet, as if rotated 180 degrees |
| 86 | */ |
| 87 | static const struct dmi_system_id rotated_screen[] = { |
| 88 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) |
| 89 | { |
| 90 | .ident = "WinBook TW100", |
| 91 | .matches = { |
| 92 | DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), |
| 93 | DMI_MATCH(DMI_PRODUCT_NAME, "TW100") |
| 94 | } |
| 95 | }, |
| 96 | { |
| 97 | .ident = "WinBook TW700", |
| 98 | .matches = { |
| 99 | DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), |
| 100 | DMI_MATCH(DMI_PRODUCT_NAME, "TW700") |
| 101 | }, |
| 102 | }, |
| 103 | #endif |
| 104 | {} |
| 105 | }; |
| 106 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 107 | /** |
| 108 | * goodix_i2c_read - read data from a register of the i2c slave device. |
| 109 | * |
| 110 | * @client: i2c device. |
| 111 | * @reg: the register to read from. |
| 112 | * @buf: raw write data buffer. |
| 113 | * @len: length of the buffer to write |
| 114 | */ |
| 115 | static int goodix_i2c_read(struct i2c_client *client, |
Irina Tirdea | 0dfb35b | 2015-06-09 11:01:38 -0700 | [diff] [blame] | 116 | u16 reg, u8 *buf, int len) |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 117 | { |
| 118 | struct i2c_msg msgs[2]; |
| 119 | u16 wbuf = cpu_to_be16(reg); |
| 120 | int ret; |
| 121 | |
| 122 | msgs[0].flags = 0; |
| 123 | msgs[0].addr = client->addr; |
| 124 | msgs[0].len = 2; |
Irina Tirdea | 0dfb35b | 2015-06-09 11:01:38 -0700 | [diff] [blame] | 125 | msgs[0].buf = (u8 *)&wbuf; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 126 | |
| 127 | msgs[1].flags = I2C_M_RD; |
| 128 | msgs[1].addr = client->addr; |
| 129 | msgs[1].len = len; |
| 130 | msgs[1].buf = buf; |
| 131 | |
| 132 | ret = i2c_transfer(client->adapter, msgs, 2); |
| 133 | return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0); |
| 134 | } |
| 135 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 136 | /** |
| 137 | * goodix_i2c_write - write data to a register of the i2c slave device. |
| 138 | * |
| 139 | * @client: i2c device. |
| 140 | * @reg: the register to write to. |
| 141 | * @buf: raw data buffer to write. |
| 142 | * @len: length of the buffer to write |
| 143 | */ |
| 144 | static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf, |
| 145 | unsigned len) |
| 146 | { |
| 147 | u8 *addr_buf; |
| 148 | struct i2c_msg msg; |
| 149 | int ret; |
| 150 | |
| 151 | addr_buf = kmalloc(len + 2, GFP_KERNEL); |
| 152 | if (!addr_buf) |
| 153 | return -ENOMEM; |
| 154 | |
| 155 | addr_buf[0] = reg >> 8; |
| 156 | addr_buf[1] = reg & 0xFF; |
| 157 | memcpy(&addr_buf[2], buf, len); |
| 158 | |
| 159 | msg.flags = 0; |
| 160 | msg.addr = client->addr; |
| 161 | msg.buf = addr_buf; |
| 162 | msg.len = len + 2; |
| 163 | |
| 164 | ret = i2c_transfer(client->adapter, &msg, 1); |
| 165 | kfree(addr_buf); |
| 166 | return ret < 0 ? ret : (ret != 1 ? -EIO : 0); |
| 167 | } |
| 168 | |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 169 | static int goodix_i2c_write_u8(struct i2c_client *client, u16 reg, u8 value) |
| 170 | { |
| 171 | return goodix_i2c_write(client, reg, &value, sizeof(value)); |
| 172 | } |
| 173 | |
Irina Tirdea | a779fbc | 2015-12-17 15:55:21 -0800 | [diff] [blame] | 174 | static int goodix_get_cfg_len(u16 id) |
| 175 | { |
| 176 | switch (id) { |
| 177 | case 911: |
| 178 | case 9271: |
| 179 | case 9110: |
| 180 | case 927: |
| 181 | case 928: |
| 182 | return GOODIX_CONFIG_911_LENGTH; |
| 183 | |
| 184 | case 912: |
| 185 | case 967: |
| 186 | return GOODIX_CONFIG_967_LENGTH; |
| 187 | |
| 188 | default: |
| 189 | return GOODIX_CONFIG_MAX_LENGTH; |
| 190 | } |
| 191 | } |
| 192 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 193 | static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) |
| 194 | { |
| 195 | int touch_num; |
| 196 | int error; |
| 197 | |
| 198 | error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, data, |
| 199 | GOODIX_CONTACT_SIZE + 1); |
| 200 | if (error) { |
| 201 | dev_err(&ts->client->dev, "I2C transfer error: %d\n", error); |
| 202 | return error; |
| 203 | } |
| 204 | |
Paul Cercueil | 5f6f117 | 2015-05-06 16:52:13 -0700 | [diff] [blame] | 205 | if (!(data[0] & 0x80)) |
| 206 | return -EAGAIN; |
| 207 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 208 | touch_num = data[0] & 0x0f; |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 209 | if (touch_num > ts->max_touch_num) |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 210 | return -EPROTO; |
| 211 | |
| 212 | if (touch_num > 1) { |
| 213 | data += 1 + GOODIX_CONTACT_SIZE; |
| 214 | error = goodix_i2c_read(ts->client, |
| 215 | GOODIX_READ_COOR_ADDR + |
| 216 | 1 + GOODIX_CONTACT_SIZE, |
| 217 | data, |
| 218 | GOODIX_CONTACT_SIZE * (touch_num - 1)); |
| 219 | if (error) |
| 220 | return error; |
| 221 | } |
| 222 | |
| 223 | return touch_num; |
| 224 | } |
| 225 | |
| 226 | static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) |
| 227 | { |
| 228 | int id = coor_data[0] & 0x0F; |
| 229 | int input_x = get_unaligned_le16(&coor_data[1]); |
| 230 | int input_y = get_unaligned_le16(&coor_data[3]); |
| 231 | int input_w = get_unaligned_le16(&coor_data[5]); |
| 232 | |
Bastien Nocera | 8b5a359 | 2015-07-24 09:08:53 -0700 | [diff] [blame] | 233 | if (ts->rotated_screen) { |
| 234 | input_x = ts->abs_x_max - input_x; |
| 235 | input_y = ts->abs_y_max - input_y; |
| 236 | } |
| 237 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 238 | input_mt_slot(ts->input_dev, id); |
| 239 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); |
| 240 | input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); |
| 241 | input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, input_y); |
| 242 | input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); |
| 243 | input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * goodix_process_events - Process incoming events |
| 248 | * |
| 249 | * @ts: our goodix_ts_data pointer |
| 250 | * |
| 251 | * Called when the IRQ is triggered. Read the current device state, and push |
| 252 | * the input events to the user space. |
| 253 | */ |
| 254 | static void goodix_process_events(struct goodix_ts_data *ts) |
| 255 | { |
Irina Tirdea | 0e0432f | 2015-06-09 11:03:15 -0700 | [diff] [blame] | 256 | u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 257 | int touch_num; |
| 258 | int i; |
| 259 | |
| 260 | touch_num = goodix_ts_read_input_report(ts, point_data); |
| 261 | if (touch_num < 0) |
| 262 | return; |
| 263 | |
| 264 | for (i = 0; i < touch_num; i++) |
| 265 | goodix_ts_report_touch(ts, |
| 266 | &point_data[1 + GOODIX_CONTACT_SIZE * i]); |
| 267 | |
| 268 | input_mt_sync_frame(ts->input_dev); |
| 269 | input_sync(ts->input_dev); |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * goodix_ts_irq_handler - The IRQ handler |
| 274 | * |
| 275 | * @irq: interrupt number. |
| 276 | * @dev_id: private data pointer. |
| 277 | */ |
| 278 | static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id) |
| 279 | { |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 280 | struct goodix_ts_data *ts = dev_id; |
| 281 | |
| 282 | goodix_process_events(ts); |
| 283 | |
Irina Tirdea | 5d655b3 | 2015-12-17 16:47:42 -0800 | [diff] [blame^] | 284 | if (goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0) < 0) |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 285 | dev_err(&ts->client->dev, "I2C write end_cmd error\n"); |
| 286 | |
| 287 | return IRQ_HANDLED; |
| 288 | } |
| 289 | |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 290 | static void goodix_free_irq(struct goodix_ts_data *ts) |
| 291 | { |
| 292 | devm_free_irq(&ts->client->dev, ts->client->irq, ts); |
| 293 | } |
| 294 | |
| 295 | static int goodix_request_irq(struct goodix_ts_data *ts) |
| 296 | { |
| 297 | return devm_request_threaded_irq(&ts->client->dev, ts->client->irq, |
| 298 | NULL, goodix_ts_irq_handler, |
| 299 | ts->irq_flags, ts->client->name, ts); |
| 300 | } |
| 301 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 302 | /** |
| 303 | * goodix_check_cfg - Checks if config fw is valid |
| 304 | * |
| 305 | * @ts: goodix_ts_data pointer |
| 306 | * @cfg: firmware config data |
| 307 | */ |
| 308 | static int goodix_check_cfg(struct goodix_ts_data *ts, |
| 309 | const struct firmware *cfg) |
| 310 | { |
| 311 | int i, raw_cfg_len; |
| 312 | u8 check_sum = 0; |
| 313 | |
| 314 | if (cfg->size > GOODIX_CONFIG_MAX_LENGTH) { |
| 315 | dev_err(&ts->client->dev, |
| 316 | "The length of the config fw is not correct"); |
| 317 | return -EINVAL; |
| 318 | } |
| 319 | |
| 320 | raw_cfg_len = cfg->size - 2; |
| 321 | for (i = 0; i < raw_cfg_len; i++) |
| 322 | check_sum += cfg->data[i]; |
| 323 | check_sum = (~check_sum) + 1; |
| 324 | if (check_sum != cfg->data[raw_cfg_len]) { |
| 325 | dev_err(&ts->client->dev, |
| 326 | "The checksum of the config fw is not correct"); |
| 327 | return -EINVAL; |
| 328 | } |
| 329 | |
| 330 | if (cfg->data[raw_cfg_len + 1] != 1) { |
| 331 | dev_err(&ts->client->dev, |
| 332 | "Config fw must have Config_Fresh register set"); |
| 333 | return -EINVAL; |
| 334 | } |
| 335 | |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * goodix_send_cfg - Write fw config to device |
| 341 | * |
| 342 | * @ts: goodix_ts_data pointer |
| 343 | * @cfg: config firmware to write to device |
| 344 | */ |
| 345 | static int goodix_send_cfg(struct goodix_ts_data *ts, |
| 346 | const struct firmware *cfg) |
| 347 | { |
| 348 | int error; |
| 349 | |
| 350 | error = goodix_check_cfg(ts, cfg); |
| 351 | if (error) |
| 352 | return error; |
| 353 | |
| 354 | error = goodix_i2c_write(ts->client, GOODIX_REG_CONFIG_DATA, cfg->data, |
| 355 | cfg->size); |
| 356 | if (error) { |
| 357 | dev_err(&ts->client->dev, "Failed to write config data: %d", |
| 358 | error); |
| 359 | return error; |
| 360 | } |
| 361 | dev_dbg(&ts->client->dev, "Config sent successfully."); |
| 362 | |
| 363 | /* Let the firmware reconfigure itself, so sleep for 10ms */ |
| 364 | usleep_range(10000, 11000); |
| 365 | |
| 366 | return 0; |
| 367 | } |
| 368 | |
Irina Tirdea | ec6e1b4 | 2015-12-17 15:57:34 -0800 | [diff] [blame] | 369 | static int goodix_int_sync(struct goodix_ts_data *ts) |
| 370 | { |
| 371 | int error; |
| 372 | |
| 373 | error = gpiod_direction_output(ts->gpiod_int, 0); |
| 374 | if (error) |
| 375 | return error; |
| 376 | |
| 377 | msleep(50); /* T5: 50ms */ |
| 378 | |
| 379 | error = gpiod_direction_input(ts->gpiod_int); |
| 380 | if (error) |
| 381 | return error; |
| 382 | |
| 383 | return 0; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * goodix_reset - Reset device during power on |
| 388 | * |
| 389 | * @ts: goodix_ts_data pointer |
| 390 | */ |
| 391 | static int goodix_reset(struct goodix_ts_data *ts) |
| 392 | { |
| 393 | int error; |
| 394 | |
| 395 | /* begin select I2C slave addr */ |
| 396 | error = gpiod_direction_output(ts->gpiod_rst, 0); |
| 397 | if (error) |
| 398 | return error; |
| 399 | |
| 400 | msleep(20); /* T2: > 10ms */ |
| 401 | |
| 402 | /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */ |
| 403 | error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14); |
| 404 | if (error) |
| 405 | return error; |
| 406 | |
| 407 | usleep_range(100, 2000); /* T3: > 100us */ |
| 408 | |
| 409 | error = gpiod_direction_output(ts->gpiod_rst, 1); |
| 410 | if (error) |
| 411 | return error; |
| 412 | |
| 413 | usleep_range(6000, 10000); /* T4: > 5ms */ |
| 414 | |
| 415 | /* end select I2C slave addr */ |
| 416 | error = gpiod_direction_input(ts->gpiod_rst); |
| 417 | if (error) |
| 418 | return error; |
| 419 | |
| 420 | error = goodix_int_sync(ts); |
| 421 | if (error) |
| 422 | return error; |
| 423 | |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * goodix_get_gpio_config - Get GPIO config from ACPI/DT |
| 429 | * |
| 430 | * @ts: goodix_ts_data pointer |
| 431 | */ |
| 432 | static int goodix_get_gpio_config(struct goodix_ts_data *ts) |
| 433 | { |
| 434 | int error; |
| 435 | struct device *dev; |
| 436 | struct gpio_desc *gpiod; |
| 437 | |
| 438 | if (!ts->client) |
| 439 | return -EINVAL; |
| 440 | dev = &ts->client->dev; |
| 441 | |
| 442 | /* Get the interrupt GPIO pin number */ |
| 443 | gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN); |
| 444 | if (IS_ERR(gpiod)) { |
| 445 | error = PTR_ERR(gpiod); |
| 446 | if (error != -EPROBE_DEFER) |
| 447 | dev_dbg(dev, "Failed to get %s GPIO: %d\n", |
| 448 | GOODIX_GPIO_INT_NAME, error); |
| 449 | return error; |
| 450 | } |
| 451 | |
| 452 | ts->gpiod_int = gpiod; |
| 453 | |
| 454 | /* Get the reset line GPIO pin number */ |
| 455 | gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN); |
| 456 | if (IS_ERR(gpiod)) { |
| 457 | error = PTR_ERR(gpiod); |
| 458 | if (error != -EPROBE_DEFER) |
| 459 | dev_dbg(dev, "Failed to get %s GPIO: %d\n", |
| 460 | GOODIX_GPIO_RST_NAME, error); |
| 461 | return error; |
| 462 | } |
| 463 | |
| 464 | ts->gpiod_rst = gpiod; |
| 465 | |
| 466 | return 0; |
| 467 | } |
| 468 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 469 | /** |
| 470 | * goodix_read_config - Read the embedded configuration of the panel |
| 471 | * |
| 472 | * @ts: our goodix_ts_data pointer |
| 473 | * |
| 474 | * Must be called during probe |
| 475 | */ |
| 476 | static void goodix_read_config(struct goodix_ts_data *ts) |
| 477 | { |
| 478 | u8 config[GOODIX_CONFIG_MAX_LENGTH]; |
| 479 | int error; |
| 480 | |
| 481 | error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA, |
Irina Tirdea | a779fbc | 2015-12-17 15:55:21 -0800 | [diff] [blame] | 482 | config, ts->cfg_len); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 483 | if (error) { |
| 484 | dev_warn(&ts->client->dev, |
| 485 | "Error reading config (%d), using defaults\n", |
| 486 | error); |
| 487 | ts->abs_x_max = GOODIX_MAX_WIDTH; |
| 488 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
| 489 | ts->int_trigger_type = GOODIX_INT_TRIGGER; |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 490 | ts->max_touch_num = GOODIX_MAX_CONTACTS; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 491 | return; |
| 492 | } |
| 493 | |
| 494 | ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); |
| 495 | ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 496 | ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; |
| 497 | ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; |
| 498 | if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 499 | dev_err(&ts->client->dev, |
| 500 | "Invalid config, using defaults\n"); |
| 501 | ts->abs_x_max = GOODIX_MAX_WIDTH; |
| 502 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 503 | ts->max_touch_num = GOODIX_MAX_CONTACTS; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 504 | } |
Bastien Nocera | 8b5a359 | 2015-07-24 09:08:53 -0700 | [diff] [blame] | 505 | |
| 506 | ts->rotated_screen = dmi_check_system(rotated_screen); |
| 507 | if (ts->rotated_screen) |
| 508 | dev_dbg(&ts->client->dev, |
| 509 | "Applying '180 degrees rotated screen' quirk\n"); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 510 | } |
| 511 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 512 | /** |
| 513 | * goodix_read_version - Read goodix touchscreen version |
| 514 | * |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 515 | * @ts: our goodix_ts_data pointer |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 516 | */ |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 517 | static int goodix_read_version(struct goodix_ts_data *ts) |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 518 | { |
| 519 | int error; |
| 520 | u8 buf[6]; |
Irina Tirdea | e70b030 | 2015-06-09 11:04:40 -0700 | [diff] [blame] | 521 | char id_str[5]; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 522 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 523 | error = goodix_i2c_read(ts->client, GOODIX_REG_ID, buf, sizeof(buf)); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 524 | if (error) { |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 525 | dev_err(&ts->client->dev, "read version failed: %d\n", error); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 526 | return error; |
| 527 | } |
| 528 | |
Irina Tirdea | e70b030 | 2015-06-09 11:04:40 -0700 | [diff] [blame] | 529 | memcpy(id_str, buf, 4); |
| 530 | id_str[4] = 0; |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 531 | if (kstrtou16(id_str, 10, &ts->id)) |
| 532 | ts->id = 0x1001; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 533 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 534 | ts->version = get_unaligned_le16(&buf[4]); |
Irina Tirdea | e70b030 | 2015-06-09 11:04:40 -0700 | [diff] [blame] | 535 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 536 | dev_info(&ts->client->dev, "ID %d, version: %04x\n", ts->id, |
| 537 | ts->version); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 538 | |
| 539 | return 0; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * goodix_i2c_test - I2C test function to check if the device answers. |
| 544 | * |
| 545 | * @client: the i2c client |
| 546 | */ |
| 547 | static int goodix_i2c_test(struct i2c_client *client) |
| 548 | { |
| 549 | int retry = 0; |
| 550 | int error; |
| 551 | u8 test; |
| 552 | |
| 553 | while (retry++ < 2) { |
| 554 | error = goodix_i2c_read(client, GOODIX_REG_CONFIG_DATA, |
| 555 | &test, 1); |
| 556 | if (!error) |
| 557 | return 0; |
| 558 | |
| 559 | dev_err(&client->dev, "i2c test failed attempt %d: %d\n", |
| 560 | retry, error); |
| 561 | msleep(20); |
| 562 | } |
| 563 | |
| 564 | return error; |
| 565 | } |
| 566 | |
| 567 | /** |
| 568 | * goodix_request_input_dev - Allocate, populate and register the input device |
| 569 | * |
| 570 | * @ts: our goodix_ts_data pointer |
| 571 | * |
| 572 | * Must be called during probe |
| 573 | */ |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 574 | static int goodix_request_input_dev(struct goodix_ts_data *ts) |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 575 | { |
| 576 | int error; |
| 577 | |
| 578 | ts->input_dev = devm_input_allocate_device(&ts->client->dev); |
| 579 | if (!ts->input_dev) { |
| 580 | dev_err(&ts->client->dev, "Failed to allocate input device."); |
| 581 | return -ENOMEM; |
| 582 | } |
| 583 | |
Irina Tirdea | 0dfb35b | 2015-06-09 11:01:38 -0700 | [diff] [blame] | 584 | input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, |
| 585 | 0, ts->abs_x_max, 0, 0); |
| 586 | input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, |
| 587 | 0, ts->abs_y_max, 0, 0); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 588 | input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); |
| 589 | input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); |
| 590 | |
Aleksei Mamlin | a7ac7c9 | 2015-03-06 16:38:16 -0800 | [diff] [blame] | 591 | input_mt_init_slots(ts->input_dev, ts->max_touch_num, |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 592 | INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); |
| 593 | |
| 594 | ts->input_dev->name = "Goodix Capacitive TouchScreen"; |
| 595 | ts->input_dev->phys = "input/ts"; |
| 596 | ts->input_dev->id.bustype = BUS_I2C; |
| 597 | ts->input_dev->id.vendor = 0x0416; |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 598 | ts->input_dev->id.product = ts->id; |
| 599 | ts->input_dev->id.version = ts->version; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 600 | |
| 601 | error = input_register_device(ts->input_dev); |
| 602 | if (error) { |
| 603 | dev_err(&ts->client->dev, |
| 604 | "Failed to register input device: %d", error); |
| 605 | return error; |
| 606 | } |
| 607 | |
| 608 | return 0; |
| 609 | } |
| 610 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 611 | /** |
| 612 | * goodix_configure_dev - Finish device initialization |
| 613 | * |
| 614 | * @ts: our goodix_ts_data pointer |
| 615 | * |
| 616 | * Must be called from probe to finish initialization of the device. |
| 617 | * Contains the common initialization code for both devices that |
| 618 | * declare gpio pins and devices that do not. It is either called |
| 619 | * directly from probe or from request_firmware_wait callback. |
| 620 | */ |
| 621 | static int goodix_configure_dev(struct goodix_ts_data *ts) |
| 622 | { |
| 623 | int error; |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 624 | |
| 625 | goodix_read_config(ts); |
| 626 | |
| 627 | error = goodix_request_input_dev(ts); |
| 628 | if (error) |
| 629 | return error; |
| 630 | |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 631 | ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT; |
| 632 | error = goodix_request_irq(ts); |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 633 | if (error) { |
| 634 | dev_err(&ts->client->dev, "request IRQ failed: %d\n", error); |
| 635 | return error; |
| 636 | } |
| 637 | |
| 638 | return 0; |
| 639 | } |
| 640 | |
| 641 | /** |
| 642 | * goodix_config_cb - Callback to finish device init |
| 643 | * |
| 644 | * @ts: our goodix_ts_data pointer |
| 645 | * |
| 646 | * request_firmware_wait callback that finishes |
| 647 | * initialization of the device. |
| 648 | */ |
| 649 | static void goodix_config_cb(const struct firmware *cfg, void *ctx) |
| 650 | { |
| 651 | struct goodix_ts_data *ts = ctx; |
| 652 | int error; |
| 653 | |
| 654 | if (cfg) { |
| 655 | /* send device configuration to the firmware */ |
| 656 | error = goodix_send_cfg(ts, cfg); |
| 657 | if (error) |
| 658 | goto err_release_cfg; |
| 659 | } |
| 660 | |
| 661 | goodix_configure_dev(ts); |
| 662 | |
| 663 | err_release_cfg: |
| 664 | release_firmware(cfg); |
| 665 | complete_all(&ts->firmware_loading_complete); |
| 666 | } |
| 667 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 668 | static int goodix_ts_probe(struct i2c_client *client, |
| 669 | const struct i2c_device_id *id) |
| 670 | { |
| 671 | struct goodix_ts_data *ts; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 672 | int error; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 673 | |
| 674 | dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr); |
| 675 | |
| 676 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
| 677 | dev_err(&client->dev, "I2C check functionality failed.\n"); |
| 678 | return -ENXIO; |
| 679 | } |
| 680 | |
| 681 | ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); |
| 682 | if (!ts) |
| 683 | return -ENOMEM; |
| 684 | |
| 685 | ts->client = client; |
| 686 | i2c_set_clientdata(client, ts); |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 687 | init_completion(&ts->firmware_loading_complete); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 688 | |
Irina Tirdea | ec6e1b4 | 2015-12-17 15:57:34 -0800 | [diff] [blame] | 689 | error = goodix_get_gpio_config(ts); |
| 690 | if (error) |
| 691 | return error; |
| 692 | |
| 693 | if (ts->gpiod_int && ts->gpiod_rst) { |
| 694 | /* reset the controller */ |
| 695 | error = goodix_reset(ts); |
| 696 | if (error) { |
| 697 | dev_err(&client->dev, "Controller reset failed.\n"); |
| 698 | return error; |
| 699 | } |
| 700 | } |
| 701 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 702 | error = goodix_i2c_test(client); |
| 703 | if (error) { |
| 704 | dev_err(&client->dev, "I2C communication failure: %d\n", error); |
| 705 | return error; |
| 706 | } |
| 707 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 708 | error = goodix_read_version(ts); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 709 | if (error) { |
| 710 | dev_err(&client->dev, "Read version failed.\n"); |
| 711 | return error; |
| 712 | } |
| 713 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 714 | ts->cfg_len = goodix_get_cfg_len(ts->id); |
Irina Tirdea | a779fbc | 2015-12-17 15:55:21 -0800 | [diff] [blame] | 715 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 716 | if (ts->gpiod_int && ts->gpiod_rst) { |
| 717 | /* update device config */ |
| 718 | ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL, |
| 719 | "goodix_%d_cfg.bin", ts->id); |
| 720 | if (!ts->cfg_name) |
| 721 | return -ENOMEM; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 722 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 723 | error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name, |
| 724 | &client->dev, GFP_KERNEL, ts, |
| 725 | goodix_config_cb); |
| 726 | if (error) { |
| 727 | dev_err(&client->dev, |
| 728 | "Failed to invoke firmware loader: %d\n", |
| 729 | error); |
| 730 | return error; |
| 731 | } |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 732 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 733 | return 0; |
| 734 | } else { |
| 735 | error = goodix_configure_dev(ts); |
| 736 | if (error) |
| 737 | return error; |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 738 | } |
| 739 | |
| 740 | return 0; |
| 741 | } |
| 742 | |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 743 | static int goodix_ts_remove(struct i2c_client *client) |
| 744 | { |
| 745 | struct goodix_ts_data *ts = i2c_get_clientdata(client); |
| 746 | |
| 747 | if (ts->gpiod_int && ts->gpiod_rst) |
| 748 | wait_for_completion(&ts->firmware_loading_complete); |
| 749 | |
| 750 | return 0; |
| 751 | } |
| 752 | |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 753 | static int __maybe_unused goodix_suspend(struct device *dev) |
| 754 | { |
| 755 | struct i2c_client *client = to_i2c_client(dev); |
| 756 | struct goodix_ts_data *ts = i2c_get_clientdata(client); |
| 757 | int error; |
| 758 | |
| 759 | /* We need gpio pins to suspend/resume */ |
| 760 | if (!ts->gpiod_int || !ts->gpiod_rst) |
| 761 | return 0; |
| 762 | |
| 763 | wait_for_completion(&ts->firmware_loading_complete); |
| 764 | |
| 765 | /* Free IRQ as IRQ pin is used as output in the suspend sequence */ |
| 766 | goodix_free_irq(ts); |
| 767 | |
| 768 | /* Output LOW on the INT pin for 5 ms */ |
| 769 | error = gpiod_direction_output(ts->gpiod_int, 0); |
| 770 | if (error) { |
| 771 | goodix_request_irq(ts); |
| 772 | return error; |
| 773 | } |
| 774 | |
| 775 | usleep_range(5000, 6000); |
| 776 | |
| 777 | error = goodix_i2c_write_u8(ts->client, GOODIX_REG_COMMAND, |
| 778 | GOODIX_CMD_SCREEN_OFF); |
| 779 | if (error) { |
| 780 | dev_err(&ts->client->dev, "Screen off command failed\n"); |
| 781 | gpiod_direction_input(ts->gpiod_int); |
| 782 | goodix_request_irq(ts); |
| 783 | return -EAGAIN; |
| 784 | } |
| 785 | |
| 786 | /* |
| 787 | * The datasheet specifies that the interval between sending screen-off |
| 788 | * command and wake-up should be longer than 58 ms. To avoid waking up |
| 789 | * sooner, delay 58ms here. |
| 790 | */ |
| 791 | msleep(58); |
| 792 | return 0; |
| 793 | } |
| 794 | |
| 795 | static int __maybe_unused goodix_resume(struct device *dev) |
| 796 | { |
| 797 | struct i2c_client *client = to_i2c_client(dev); |
| 798 | struct goodix_ts_data *ts = i2c_get_clientdata(client); |
| 799 | int error; |
| 800 | |
| 801 | if (!ts->gpiod_int || !ts->gpiod_rst) |
| 802 | return 0; |
| 803 | |
| 804 | /* |
| 805 | * Exit sleep mode by outputting HIGH level to INT pin |
| 806 | * for 2ms~5ms. |
| 807 | */ |
| 808 | error = gpiod_direction_output(ts->gpiod_int, 1); |
| 809 | if (error) |
| 810 | return error; |
| 811 | |
| 812 | usleep_range(2000, 5000); |
| 813 | |
| 814 | error = goodix_int_sync(ts); |
| 815 | if (error) |
| 816 | return error; |
| 817 | |
| 818 | error = goodix_request_irq(ts); |
| 819 | if (error) |
| 820 | return error; |
| 821 | |
| 822 | return 0; |
| 823 | } |
| 824 | |
| 825 | static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume); |
| 826 | |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 827 | static const struct i2c_device_id goodix_ts_id[] = { |
| 828 | { "GDIX1001:00", 0 }, |
| 829 | { } |
| 830 | }; |
Javier Martinez Canillas | 2e9e910 | 2015-07-30 10:38:52 -0700 | [diff] [blame] | 831 | MODULE_DEVICE_TABLE(i2c, goodix_ts_id); |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 832 | |
Aleksei Mamlin | 771d8f1 | 2015-03-06 16:43:38 -0800 | [diff] [blame] | 833 | #ifdef CONFIG_ACPI |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 834 | static const struct acpi_device_id goodix_acpi_match[] = { |
| 835 | { "GDIX1001", 0 }, |
| 836 | { } |
| 837 | }; |
| 838 | MODULE_DEVICE_TABLE(acpi, goodix_acpi_match); |
Aleksei Mamlin | 771d8f1 | 2015-03-06 16:43:38 -0800 | [diff] [blame] | 839 | #endif |
| 840 | |
| 841 | #ifdef CONFIG_OF |
| 842 | static const struct of_device_id goodix_of_match[] = { |
| 843 | { .compatible = "goodix,gt911" }, |
| 844 | { .compatible = "goodix,gt9110" }, |
| 845 | { .compatible = "goodix,gt912" }, |
| 846 | { .compatible = "goodix,gt927" }, |
| 847 | { .compatible = "goodix,gt9271" }, |
| 848 | { .compatible = "goodix,gt928" }, |
| 849 | { .compatible = "goodix,gt967" }, |
| 850 | { } |
| 851 | }; |
| 852 | MODULE_DEVICE_TABLE(of, goodix_of_match); |
| 853 | #endif |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 854 | |
| 855 | static struct i2c_driver goodix_ts_driver = { |
| 856 | .probe = goodix_ts_probe, |
Irina Tirdea | 68caf858 | 2015-12-17 16:05:42 -0800 | [diff] [blame] | 857 | .remove = goodix_ts_remove, |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 858 | .id_table = goodix_ts_id, |
| 859 | .driver = { |
| 860 | .name = "Goodix-TS", |
Aleksei Mamlin | 771d8f1 | 2015-03-06 16:43:38 -0800 | [diff] [blame] | 861 | .acpi_match_table = ACPI_PTR(goodix_acpi_match), |
| 862 | .of_match_table = of_match_ptr(goodix_of_match), |
Irina Tirdea | 5ab09d6 | 2015-12-17 16:43:39 -0800 | [diff] [blame] | 863 | .pm = &goodix_pm_ops, |
Bastien Nocera | ca96ea8 | 2014-10-31 09:26:16 -0700 | [diff] [blame] | 864 | }, |
| 865 | }; |
| 866 | module_i2c_driver(goodix_ts_driver); |
| 867 | |
| 868 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
| 869 | MODULE_AUTHOR("Bastien Nocera <hadess@hadess.net>"); |
| 870 | MODULE_DESCRIPTION("Goodix touchscreen driver"); |
| 871 | MODULE_LICENSE("GPL v2"); |