silead.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  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. #include <linux/i2c.h>
  20. #include <linux/module.h>
  21. #include <linux/acpi.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/gpio/consumer.h>
  24. #include <linux/delay.h>
  25. #include <linux/firmware.h>
  26. #include <linux/input.h>
  27. #include <linux/input/mt.h>
  28. #include <linux/input/touchscreen.h>
  29. #include <linux/pm.h>
  30. #include <linux/pm_runtime.h>
  31. #include <linux/irq.h>
  32. #include <linux/regulator/consumer.h>
  33. #include <asm/unaligned.h>
  34. #define SILEAD_TS_NAME "silead_ts"
  35. #define SILEAD_REG_RESET 0xE0
  36. #define SILEAD_REG_DATA 0x80
  37. #define SILEAD_REG_TOUCH_NR 0x80
  38. #define SILEAD_REG_POWER 0xBC
  39. #define SILEAD_REG_CLOCK 0xE4
  40. #define SILEAD_REG_STATUS 0xB0
  41. #define SILEAD_REG_ID 0xFC
  42. #define SILEAD_REG_MEM_CHECK 0xB0
  43. #define SILEAD_STATUS_OK 0x5A5A5A5A
  44. #define SILEAD_TS_DATA_LEN 44
  45. #define SILEAD_CLOCK 0x04
  46. #define SILEAD_CMD_RESET 0x88
  47. #define SILEAD_CMD_START 0x00
  48. #define SILEAD_POINT_DATA_LEN 0x04
  49. #define SILEAD_POINT_Y_OFF 0x00
  50. #define SILEAD_POINT_Y_MSB_OFF 0x01
  51. #define SILEAD_POINT_X_OFF 0x02
  52. #define SILEAD_POINT_X_MSB_OFF 0x03
  53. #define SILEAD_EXTRA_DATA_MASK 0xF0
  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. #define SILEAD_MAX_FINGERS 10
  59. enum silead_ts_power {
  60. SILEAD_POWER_ON = 1,
  61. SILEAD_POWER_OFF = 0
  62. };
  63. struct silead_ts_data {
  64. struct i2c_client *client;
  65. struct gpio_desc *gpio_power;
  66. struct input_dev *input;
  67. struct regulator_bulk_data regulators[2];
  68. char fw_name[64];
  69. struct touchscreen_properties prop;
  70. u32 max_fingers;
  71. u32 chip_id;
  72. struct input_mt_pos pos[SILEAD_MAX_FINGERS];
  73. int slots[SILEAD_MAX_FINGERS];
  74. int id[SILEAD_MAX_FINGERS];
  75. };
  76. struct silead_fw_data {
  77. u32 offset;
  78. u32 val;
  79. };
  80. static int silead_ts_request_input_dev(struct silead_ts_data *data)
  81. {
  82. struct device *dev = &data->client->dev;
  83. int error;
  84. data->input = devm_input_allocate_device(dev);
  85. if (!data->input) {
  86. dev_err(dev,
  87. "Failed to allocate input device\n");
  88. return -ENOMEM;
  89. }
  90. input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0);
  91. input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0);
  92. touchscreen_parse_properties(data->input, true, &data->prop);
  93. input_mt_init_slots(data->input, data->max_fingers,
  94. INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED |
  95. INPUT_MT_TRACK);
  96. if (device_property_read_bool(dev, "silead,home-button"))
  97. input_set_capability(data->input, EV_KEY, KEY_LEFTMETA);
  98. data->input->name = SILEAD_TS_NAME;
  99. data->input->phys = "input/ts";
  100. data->input->id.bustype = BUS_I2C;
  101. error = input_register_device(data->input);
  102. if (error) {
  103. dev_err(dev, "Failed to register input device: %d\n", error);
  104. return error;
  105. }
  106. return 0;
  107. }
  108. static void silead_ts_set_power(struct i2c_client *client,
  109. enum silead_ts_power state)
  110. {
  111. struct silead_ts_data *data = i2c_get_clientdata(client);
  112. if (data->gpio_power) {
  113. gpiod_set_value_cansleep(data->gpio_power, state);
  114. msleep(SILEAD_POWER_SLEEP);
  115. }
  116. }
  117. static void silead_ts_read_data(struct i2c_client *client)
  118. {
  119. struct silead_ts_data *data = i2c_get_clientdata(client);
  120. struct input_dev *input = data->input;
  121. struct device *dev = &client->dev;
  122. u8 *bufp, buf[SILEAD_TS_DATA_LEN];
  123. int touch_nr, softbutton, error, i;
  124. bool softbutton_pressed = false;
  125. error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_DATA,
  126. SILEAD_TS_DATA_LEN, buf);
  127. if (error < 0) {
  128. dev_err(dev, "Data read error %d\n", error);
  129. return;
  130. }
  131. if (buf[0] > data->max_fingers) {
  132. dev_warn(dev, "More touches reported then supported %d > %d\n",
  133. buf[0], data->max_fingers);
  134. buf[0] = data->max_fingers;
  135. }
  136. touch_nr = 0;
  137. bufp = buf + SILEAD_POINT_DATA_LEN;
  138. for (i = 0; i < buf[0]; i++, bufp += SILEAD_POINT_DATA_LEN) {
  139. softbutton = (bufp[SILEAD_POINT_Y_MSB_OFF] &
  140. SILEAD_EXTRA_DATA_MASK) >> 4;
  141. if (softbutton) {
  142. /*
  143. * For now only respond to softbutton == 0x01, some
  144. * tablets *without* a capacative button send 0x04
  145. * when crossing the edges of the screen.
  146. */
  147. if (softbutton == 0x01)
  148. softbutton_pressed = true;
  149. continue;
  150. }
  151. /*
  152. * Bits 4-7 are the touch id, note not all models have
  153. * hardware touch ids so atm we don't use these.
  154. */
  155. data->id[touch_nr] = (bufp[SILEAD_POINT_X_MSB_OFF] &
  156. SILEAD_EXTRA_DATA_MASK) >> 4;
  157. touchscreen_set_mt_pos(&data->pos[touch_nr], &data->prop,
  158. get_unaligned_le16(&bufp[SILEAD_POINT_X_OFF]) & 0xfff,
  159. get_unaligned_le16(&bufp[SILEAD_POINT_Y_OFF]) & 0xfff);
  160. touch_nr++;
  161. }
  162. input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0);
  163. for (i = 0; i < touch_nr; i++) {
  164. input_mt_slot(input, data->slots[i]);
  165. input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
  166. input_report_abs(input, ABS_MT_POSITION_X, data->pos[i].x);
  167. input_report_abs(input, ABS_MT_POSITION_Y, data->pos[i].y);
  168. dev_dbg(dev, "x=%d y=%d hw_id=%d sw_id=%d\n", data->pos[i].x,
  169. data->pos[i].y, data->id[i], data->slots[i]);
  170. }
  171. input_mt_sync_frame(input);
  172. input_report_key(input, KEY_LEFTMETA, softbutton_pressed);
  173. input_sync(input);
  174. }
  175. static int silead_ts_init(struct i2c_client *client)
  176. {
  177. struct silead_ts_data *data = i2c_get_clientdata(client);
  178. int error;
  179. error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
  180. SILEAD_CMD_RESET);
  181. if (error)
  182. goto i2c_write_err;
  183. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  184. error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR,
  185. data->max_fingers);
  186. if (error)
  187. goto i2c_write_err;
  188. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  189. error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
  190. SILEAD_CLOCK);
  191. if (error)
  192. goto i2c_write_err;
  193. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  194. error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
  195. SILEAD_CMD_START);
  196. if (error)
  197. goto i2c_write_err;
  198. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  199. return 0;
  200. i2c_write_err:
  201. dev_err(&client->dev, "Registers clear error %d\n", error);
  202. return error;
  203. }
  204. static int silead_ts_reset(struct i2c_client *client)
  205. {
  206. int error;
  207. error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
  208. SILEAD_CMD_RESET);
  209. if (error)
  210. goto i2c_write_err;
  211. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  212. error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK,
  213. SILEAD_CLOCK);
  214. if (error)
  215. goto i2c_write_err;
  216. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  217. error = i2c_smbus_write_byte_data(client, SILEAD_REG_POWER,
  218. SILEAD_CMD_START);
  219. if (error)
  220. goto i2c_write_err;
  221. usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
  222. return 0;
  223. i2c_write_err:
  224. dev_err(&client->dev, "Chip reset error %d\n", error);
  225. return error;
  226. }
  227. static int silead_ts_startup(struct i2c_client *client)
  228. {
  229. int error;
  230. error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 0x00);
  231. if (error) {
  232. dev_err(&client->dev, "Startup error %d\n", error);
  233. return error;
  234. }
  235. msleep(SILEAD_STARTUP_SLEEP);
  236. return 0;
  237. }
  238. static int silead_ts_load_fw(struct i2c_client *client)
  239. {
  240. struct device *dev = &client->dev;
  241. struct silead_ts_data *data = i2c_get_clientdata(client);
  242. unsigned int fw_size, i;
  243. const struct firmware *fw;
  244. struct silead_fw_data *fw_data;
  245. int error;
  246. dev_dbg(dev, "Firmware file name: %s", data->fw_name);
  247. error = request_firmware(&fw, data->fw_name, dev);
  248. if (error) {
  249. dev_err(dev, "Firmware request error %d\n", error);
  250. return error;
  251. }
  252. fw_size = fw->size / sizeof(*fw_data);
  253. fw_data = (struct silead_fw_data *)fw->data;
  254. for (i = 0; i < fw_size; i++) {
  255. error = i2c_smbus_write_i2c_block_data(client,
  256. fw_data[i].offset,
  257. 4,
  258. (u8 *)&fw_data[i].val);
  259. if (error) {
  260. dev_err(dev, "Firmware load error %d\n", error);
  261. break;
  262. }
  263. }
  264. release_firmware(fw);
  265. return error ?: 0;
  266. }
  267. static u32 silead_ts_get_status(struct i2c_client *client)
  268. {
  269. int error;
  270. __le32 status;
  271. error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_STATUS,
  272. sizeof(status), (u8 *)&status);
  273. if (error < 0) {
  274. dev_err(&client->dev, "Status read error %d\n", error);
  275. return error;
  276. }
  277. return le32_to_cpu(status);
  278. }
  279. static int silead_ts_get_id(struct i2c_client *client)
  280. {
  281. struct silead_ts_data *data = i2c_get_clientdata(client);
  282. __le32 chip_id;
  283. int error;
  284. error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_ID,
  285. sizeof(chip_id), (u8 *)&chip_id);
  286. if (error < 0)
  287. return error;
  288. data->chip_id = le32_to_cpu(chip_id);
  289. dev_info(&client->dev, "Silead chip ID: 0x%8X", data->chip_id);
  290. return 0;
  291. }
  292. static int silead_ts_setup(struct i2c_client *client)
  293. {
  294. int error;
  295. u32 status;
  296. /*
  297. * Some buggy BIOS-es bring up the chip in a stuck state where it
  298. * blocks the I2C bus. The following steps are necessary to
  299. * unstuck the chip / bus:
  300. * 1. Turn off the Silead chip.
  301. * 2. Try to do an I2C transfer with the chip, this will fail in
  302. * response to which the I2C-bus-driver will call:
  303. * i2c_recover_bus() which will unstuck the I2C-bus. Note the
  304. * unstuck-ing of the I2C bus only works if we first drop the
  305. * chip off the bus by turning it off.
  306. * 3. Turn the chip back on.
  307. *
  308. * On the x86/ACPI systems were this problem is seen, step 1. and
  309. * 3. require making ACPI calls and dealing with ACPI Power
  310. * Resources. The workaround below runtime-suspends the chip to
  311. * turn it off, leaving it up to the ACPI subsystem to deal with
  312. * this.
  313. */
  314. if (device_property_read_bool(&client->dev,
  315. "silead,stuck-controller-bug")) {
  316. pm_runtime_set_active(&client->dev);
  317. pm_runtime_enable(&client->dev);
  318. pm_runtime_allow(&client->dev);
  319. pm_runtime_suspend(&client->dev);
  320. dev_warn(&client->dev, FW_BUG "Stuck I2C bus: please ignore the next 'controller timed out' error\n");
  321. silead_ts_get_id(client);
  322. /* The forbid will also resume the device */
  323. pm_runtime_forbid(&client->dev);
  324. pm_runtime_disable(&client->dev);
  325. }
  326. silead_ts_set_power(client, SILEAD_POWER_OFF);
  327. silead_ts_set_power(client, SILEAD_POWER_ON);
  328. error = silead_ts_get_id(client);
  329. if (error) {
  330. dev_err(&client->dev, "Chip ID read error %d\n", error);
  331. return error;
  332. }
  333. error = silead_ts_init(client);
  334. if (error)
  335. return error;
  336. error = silead_ts_reset(client);
  337. if (error)
  338. return error;
  339. error = silead_ts_load_fw(client);
  340. if (error)
  341. return error;
  342. error = silead_ts_startup(client);
  343. if (error)
  344. return error;
  345. status = silead_ts_get_status(client);
  346. if (status != SILEAD_STATUS_OK) {
  347. dev_err(&client->dev,
  348. "Initialization error, status: 0x%X\n", status);
  349. return -ENODEV;
  350. }
  351. return 0;
  352. }
  353. static irqreturn_t silead_ts_threaded_irq_handler(int irq, void *id)
  354. {
  355. struct silead_ts_data *data = id;
  356. struct i2c_client *client = data->client;
  357. silead_ts_read_data(client);
  358. return IRQ_HANDLED;
  359. }
  360. static void silead_ts_read_props(struct i2c_client *client)
  361. {
  362. struct silead_ts_data *data = i2c_get_clientdata(client);
  363. struct device *dev = &client->dev;
  364. const char *str;
  365. int error;
  366. error = device_property_read_u32(dev, "silead,max-fingers",
  367. &data->max_fingers);
  368. if (error) {
  369. dev_dbg(dev, "Max fingers read error %d\n", error);
  370. data->max_fingers = 5; /* Most devices handle up-to 5 fingers */
  371. }
  372. error = device_property_read_string(dev, "firmware-name", &str);
  373. if (!error)
  374. snprintf(data->fw_name, sizeof(data->fw_name),
  375. "silead/%s", str);
  376. else
  377. dev_dbg(dev, "Firmware file name read error. Using default.");
  378. }
  379. #ifdef CONFIG_ACPI
  380. static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
  381. const struct i2c_device_id *id)
  382. {
  383. const struct acpi_device_id *acpi_id;
  384. struct device *dev = &data->client->dev;
  385. int i;
  386. if (ACPI_HANDLE(dev)) {
  387. acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
  388. if (!acpi_id)
  389. return -ENODEV;
  390. snprintf(data->fw_name, sizeof(data->fw_name),
  391. "silead/%s.fw", acpi_id->id);
  392. for (i = 0; i < strlen(data->fw_name); i++)
  393. data->fw_name[i] = tolower(data->fw_name[i]);
  394. } else {
  395. snprintf(data->fw_name, sizeof(data->fw_name),
  396. "silead/%s.fw", id->name);
  397. }
  398. return 0;
  399. }
  400. #else
  401. static int silead_ts_set_default_fw_name(struct silead_ts_data *data,
  402. const struct i2c_device_id *id)
  403. {
  404. snprintf(data->fw_name, sizeof(data->fw_name),
  405. "silead/%s.fw", id->name);
  406. return 0;
  407. }
  408. #endif
  409. static void silead_disable_regulator(void *arg)
  410. {
  411. struct silead_ts_data *data = arg;
  412. regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
  413. }
  414. static int silead_ts_probe(struct i2c_client *client,
  415. const struct i2c_device_id *id)
  416. {
  417. struct silead_ts_data *data;
  418. struct device *dev = &client->dev;
  419. int error;
  420. if (!i2c_check_functionality(client->adapter,
  421. I2C_FUNC_I2C |
  422. I2C_FUNC_SMBUS_READ_I2C_BLOCK |
  423. I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
  424. dev_err(dev, "I2C functionality check failed\n");
  425. return -ENXIO;
  426. }
  427. data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
  428. if (!data)
  429. return -ENOMEM;
  430. i2c_set_clientdata(client, data);
  431. data->client = client;
  432. error = silead_ts_set_default_fw_name(data, id);
  433. if (error)
  434. return error;
  435. silead_ts_read_props(client);
  436. /* We must have the IRQ provided by DT or ACPI subsytem */
  437. if (client->irq <= 0)
  438. return -ENODEV;
  439. data->regulators[0].supply = "vddio";
  440. data->regulators[1].supply = "avdd";
  441. error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators),
  442. data->regulators);
  443. if (error)
  444. return error;
  445. /*
  446. * Enable regulators at probe and disable them at remove, we need
  447. * to keep the chip powered otherwise it forgets its firmware.
  448. */
  449. error = regulator_bulk_enable(ARRAY_SIZE(data->regulators),
  450. data->regulators);
  451. if (error)
  452. return error;
  453. error = devm_add_action_or_reset(dev, silead_disable_regulator, data);
  454. if (error)
  455. return error;
  456. /* Power GPIO pin */
  457. data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
  458. if (IS_ERR(data->gpio_power)) {
  459. if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
  460. dev_err(dev, "Shutdown GPIO request failed\n");
  461. return PTR_ERR(data->gpio_power);
  462. }
  463. error = silead_ts_setup(client);
  464. if (error)
  465. return error;
  466. error = silead_ts_request_input_dev(data);
  467. if (error)
  468. return error;
  469. error = devm_request_threaded_irq(dev, client->irq,
  470. NULL, silead_ts_threaded_irq_handler,
  471. IRQF_ONESHOT, client->name, data);
  472. if (error) {
  473. if (error != -EPROBE_DEFER)
  474. dev_err(dev, "IRQ request failed %d\n", error);
  475. return error;
  476. }
  477. return 0;
  478. }
  479. static int __maybe_unused silead_ts_suspend(struct device *dev)
  480. {
  481. struct i2c_client *client = to_i2c_client(dev);
  482. disable_irq(client->irq);
  483. silead_ts_set_power(client, SILEAD_POWER_OFF);
  484. return 0;
  485. }
  486. static int __maybe_unused silead_ts_resume(struct device *dev)
  487. {
  488. struct i2c_client *client = to_i2c_client(dev);
  489. bool second_try = false;
  490. int error, status;
  491. silead_ts_set_power(client, SILEAD_POWER_ON);
  492. retry:
  493. error = silead_ts_reset(client);
  494. if (error)
  495. return error;
  496. if (second_try) {
  497. error = silead_ts_load_fw(client);
  498. if (error)
  499. return error;
  500. }
  501. error = silead_ts_startup(client);
  502. if (error)
  503. return error;
  504. status = silead_ts_get_status(client);
  505. if (status != SILEAD_STATUS_OK) {
  506. if (!second_try) {
  507. second_try = true;
  508. dev_dbg(dev, "Reloading firmware after unsuccessful resume\n");
  509. goto retry;
  510. }
  511. dev_err(dev, "Resume error, status: 0x%02x\n", status);
  512. return -ENODEV;
  513. }
  514. enable_irq(client->irq);
  515. return 0;
  516. }
  517. static SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume);
  518. static const struct i2c_device_id silead_ts_id[] = {
  519. { "gsl1680", 0 },
  520. { "gsl1688", 0 },
  521. { "gsl3670", 0 },
  522. { "gsl3675", 0 },
  523. { "gsl3692", 0 },
  524. { "mssl1680", 0 },
  525. { }
  526. };
  527. MODULE_DEVICE_TABLE(i2c, silead_ts_id);
  528. #ifdef CONFIG_ACPI
  529. static const struct acpi_device_id silead_ts_acpi_match[] = {
  530. { "GSL1680", 0 },
  531. { "GSL1688", 0 },
  532. { "GSL3670", 0 },
  533. { "GSL3675", 0 },
  534. { "GSL3692", 0 },
  535. { "MSSL1680", 0 },
  536. { "MSSL0001", 0 },
  537. { "MSSL0002", 0 },
  538. { "MSSL0017", 0 },
  539. { }
  540. };
  541. MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match);
  542. #endif
  543. #ifdef CONFIG_OF
  544. static const struct of_device_id silead_ts_of_match[] = {
  545. { .compatible = "silead,gsl1680" },
  546. { .compatible = "silead,gsl1688" },
  547. { .compatible = "silead,gsl3670" },
  548. { .compatible = "silead,gsl3675" },
  549. { .compatible = "silead,gsl3692" },
  550. { },
  551. };
  552. MODULE_DEVICE_TABLE(of, silead_ts_of_match);
  553. #endif
  554. static struct i2c_driver silead_ts_driver = {
  555. .probe = silead_ts_probe,
  556. .id_table = silead_ts_id,
  557. .driver = {
  558. .name = SILEAD_TS_NAME,
  559. .acpi_match_table = ACPI_PTR(silead_ts_acpi_match),
  560. .of_match_table = of_match_ptr(silead_ts_of_match),
  561. .pm = &silead_ts_pm,
  562. },
  563. };
  564. module_i2c_driver(silead_ts_driver);
  565. MODULE_AUTHOR("Robert Dolca <robert.dolca@intel.com>");
  566. MODULE_DESCRIPTION("Silead I2C touchscreen driver");
  567. MODULE_LICENSE("GPL");