nfc_i2c_drv.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2013-2021 NXP
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. ******************************************************************************/
  21. /*
  22. * Copyright (C) 2010 Trusted Logic S.A.
  23. *
  24. * This program is free software; you can redistribute it and/or modify
  25. * it under the terms of the GNU General Public License as published by
  26. * the Free Software Foundation; either version 2 of the License, or
  27. * (at your option) any later version.
  28. *
  29. * This program is distributed in the hope that it will be useful,
  30. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32. * GNU General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU General Public License
  35. * along with this program; if not, write to the Free Software
  36. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  37. */
  38. #include "nfc_common.h"
  39. /**
  40. * i2c_disable_irq()
  41. *
  42. * Check if interrupt is disabled or not
  43. * and disable interrupt
  44. *
  45. * Return: int
  46. */
  47. int i2c_disable_irq(struct nfc_dev *dev)
  48. {
  49. unsigned long flags;
  50. spin_lock_irqsave(&dev->i2c_dev.irq_enabled_lock, flags);
  51. if (dev->i2c_dev.irq_enabled) {
  52. disable_irq_nosync(dev->i2c_dev.client->irq);
  53. dev->i2c_dev.irq_enabled = false;
  54. }
  55. spin_unlock_irqrestore(&dev->i2c_dev.irq_enabled_lock, flags);
  56. return 0;
  57. }
  58. /**
  59. * i2c_enable_irq()
  60. *
  61. * Check if interrupt is enabled or not
  62. * and enable interrupt
  63. *
  64. * Return: int
  65. */
  66. int i2c_enable_irq(struct nfc_dev *dev)
  67. {
  68. unsigned long flags;
  69. spin_lock_irqsave(&dev->i2c_dev.irq_enabled_lock, flags);
  70. if (!dev->i2c_dev.irq_enabled) {
  71. dev->i2c_dev.irq_enabled = true;
  72. enable_irq(dev->i2c_dev.client->irq);
  73. }
  74. spin_unlock_irqrestore(&dev->i2c_dev.irq_enabled_lock, flags);
  75. return 0;
  76. }
  77. static irqreturn_t i2c_irq_handler(int irq, void *dev_id)
  78. {
  79. struct nfc_dev *nfc_dev = dev_id;
  80. struct i2c_dev *i2c_dev = &nfc_dev->i2c_dev;
  81. if (device_may_wakeup(&i2c_dev->client->dev))
  82. pm_wakeup_event(&i2c_dev->client->dev, WAKEUP_SRC_TIMEOUT);
  83. i2c_disable_irq(nfc_dev);
  84. wake_up(&nfc_dev->read_wq);
  85. return IRQ_HANDLED;
  86. }
  87. int i2c_read(struct nfc_dev *nfc_dev, char *buf, size_t count, int timeout)
  88. {
  89. int ret;
  90. struct i2c_dev *i2c_dev = &nfc_dev->i2c_dev;
  91. struct platform_gpio *nfc_gpio = &nfc_dev->configs.gpio;
  92. uint16_t i = 0;
  93. uint16_t disp_len = GET_IPCLOG_MAX_PKT_LEN(count);
  94. pr_debug("%s : reading %zu bytes.\n", __func__, count);
  95. if (timeout > NCI_CMD_RSP_TIMEOUT)
  96. timeout = NCI_CMD_RSP_TIMEOUT;
  97. if (count > MAX_BUFFER_SIZE)
  98. count = MAX_BUFFER_SIZE;
  99. if (!gpio_get_value(nfc_gpio->irq)) {
  100. while (1) {
  101. ret = 0;
  102. if (!i2c_dev->irq_enabled) {
  103. i2c_dev->irq_enabled = true;
  104. enable_irq(i2c_dev->client->irq);
  105. }
  106. if (!gpio_get_value(nfc_gpio->irq)) {
  107. if (timeout) {
  108. ret = wait_event_interruptible_timeout(nfc_dev->read_wq,
  109. !i2c_dev->irq_enabled, msecs_to_jiffies(timeout));
  110. if (ret <= 0) {
  111. pr_err("%s timeout/error in read\n", __func__);
  112. goto err;
  113. }
  114. } else {
  115. ret = wait_event_interruptible(nfc_dev->read_wq,
  116. !i2c_dev->irq_enabled);
  117. if (ret) {
  118. pr_err("%s error wakeup of read wq\n", __func__);
  119. ret = -EINTR;
  120. goto err;
  121. }
  122. }
  123. }
  124. i2c_disable_irq(nfc_dev);
  125. if (gpio_get_value(nfc_gpio->irq))
  126. break;
  127. if (!gpio_get_value(nfc_gpio->ven)) {
  128. pr_info("%s: releasing read\n", __func__);
  129. ret = -EIO;
  130. goto err;
  131. }
  132. pr_warn("%s: spurious interrupt detected\n", __func__);
  133. }
  134. }
  135. memset(buf, 0x00, count);
  136. /* Read data */
  137. ret = i2c_master_recv(nfc_dev->i2c_dev.client, buf, count);
  138. NFCLOG_IPC(nfc_dev, false, "%s of %d bytes, ret %d", __func__, count,
  139. ret);
  140. if (ret <= 0) {
  141. pr_err("%s: returned %d\n", __func__, ret);
  142. goto err;
  143. }
  144. for (i = 0; i < disp_len; i++)
  145. NFCLOG_IPC(nfc_dev, false, " %02x", buf[i]);
  146. /* check if it's response of cold reset command
  147. * NFC HAL process shouldn't receive this data as
  148. * command was esepowermanager
  149. */
  150. if (nfc_dev->cold_reset.rsp_pending && nfc_dev->cold_reset.cmd_buf
  151. && (buf[0] == PROP_NCI_RSP_GID)
  152. && (buf[1] == nfc_dev->cold_reset.cmd_buf[1])) {
  153. read_cold_reset_rsp(nfc_dev, buf);
  154. nfc_dev->cold_reset.rsp_pending = false;
  155. wake_up_interruptible(&nfc_dev->cold_reset.read_wq);
  156. /*
  157. * NFC process doesn't know about cold reset command
  158. * being sent as it was initiated by eSE process
  159. * we shouldn't return any data to NFC process
  160. */
  161. return 0;
  162. }
  163. err:
  164. return ret;
  165. }
  166. int i2c_write(struct nfc_dev *nfc_dev, const char *buf, size_t count,
  167. int max_retry_cnt)
  168. {
  169. int ret = -EINVAL;
  170. int retry_cnt;
  171. uint16_t i = 0;
  172. uint16_t disp_len = GET_IPCLOG_MAX_PKT_LEN(count);
  173. if (count > MAX_DL_BUFFER_SIZE)
  174. count = MAX_DL_BUFFER_SIZE;
  175. pr_debug("%s : writing %zu bytes.\n", __func__, count);
  176. NFCLOG_IPC(nfc_dev, false, "%s sending %d B", __func__, count);
  177. for (i = 0; i < disp_len; i++)
  178. NFCLOG_IPC(nfc_dev, false, " %02x", buf[i]);
  179. for (retry_cnt = 1; retry_cnt <= max_retry_cnt; retry_cnt++) {
  180. ret = i2c_master_send(nfc_dev->i2c_dev.client, buf, count);
  181. NFCLOG_IPC(nfc_dev, false, "%s ret %d", __func__, ret);
  182. if (ret <= 0) {
  183. pr_warn("%s: write failed ret %d, Maybe in Standby Mode - Retry(%d)\n",
  184. __func__, ret, retry_cnt);
  185. usleep_range(WRITE_RETRY_WAIT_TIME_USEC,
  186. WRITE_RETRY_WAIT_TIME_USEC + 100);
  187. } else if (ret != count) {
  188. pr_err("%s: failed to write %d\n", __func__, ret);
  189. ret = -EIO;
  190. } else if (ret == count)
  191. break;
  192. }
  193. return ret;
  194. }
  195. ssize_t nfc_i2c_dev_read(struct file *filp, char __user *buf,
  196. size_t count, loff_t *offset)
  197. {
  198. int ret = 0;
  199. struct nfc_dev *nfc_dev = (struct nfc_dev *)filp->private_data;
  200. if (filp->f_flags & O_NONBLOCK) {
  201. pr_err(":f_flag has O_NONBLOCK. EAGAIN\n");
  202. return -EAGAIN;
  203. }
  204. mutex_lock(&nfc_dev->read_mutex);
  205. ret = i2c_read(nfc_dev, nfc_dev->read_kbuf, count, 0);
  206. if (ret > 0) {
  207. if (copy_to_user(buf, nfc_dev->read_kbuf, ret)) {
  208. pr_warn("%s : failed to copy to user space\n", __func__);
  209. ret = -EFAULT;
  210. }
  211. }
  212. mutex_unlock(&nfc_dev->read_mutex);
  213. return ret;
  214. }
  215. ssize_t nfc_i2c_dev_write(struct file *filp, const char __user *buf,
  216. size_t count, loff_t *offset)
  217. {
  218. int ret;
  219. struct nfc_dev *nfc_dev = (struct nfc_dev *)filp->private_data;
  220. if (count > MAX_DL_BUFFER_SIZE)
  221. count = MAX_DL_BUFFER_SIZE;
  222. if (!nfc_dev)
  223. return -ENODEV;
  224. mutex_lock(&nfc_dev->write_mutex);
  225. if (copy_from_user(nfc_dev->write_kbuf, buf, count)) {
  226. pr_err("%s : failed to copy from user space\n", __func__);
  227. mutex_unlock(&nfc_dev->write_mutex);
  228. return -EFAULT;
  229. }
  230. ret = i2c_write(nfc_dev, nfc_dev->write_kbuf, count, NO_RETRY);
  231. mutex_unlock(&nfc_dev->write_mutex);
  232. return ret;
  233. }
  234. static const struct file_operations nfc_i2c_dev_fops = {
  235. .owner = THIS_MODULE,
  236. .llseek = no_llseek,
  237. .read = nfc_i2c_dev_read,
  238. .write = nfc_i2c_dev_write,
  239. .open = nfc_dev_open,
  240. .release = nfc_dev_close,
  241. .unlocked_ioctl = nfc_dev_ioctl,
  242. };
  243. int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
  244. {
  245. int ret = 0;
  246. struct nfc_dev *nfc_dev = NULL;
  247. struct i2c_dev *i2c_dev = NULL;
  248. struct platform_configs nfc_configs;
  249. struct platform_gpio *nfc_gpio = &nfc_configs.gpio;
  250. pr_debug("%s: enter\n", __func__);
  251. //retrieve details of gpios from dt
  252. ret = nfc_parse_dt(&client->dev, &nfc_configs, PLATFORM_IF_I2C);
  253. if (ret) {
  254. pr_err("%s : failed to parse dt\n", __func__);
  255. goto err;
  256. }
  257. if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
  258. pr_err("%s : need I2C_FUNC_I2C\n", __func__);
  259. ret = -ENODEV;
  260. goto err;
  261. }
  262. nfc_dev = kzalloc(sizeof(struct nfc_dev), GFP_KERNEL);
  263. if (nfc_dev == NULL) {
  264. ret = -ENOMEM;
  265. goto err;
  266. }
  267. nfc_dev->read_kbuf = kzalloc(MAX_BUFFER_SIZE, GFP_DMA | GFP_KERNEL);
  268. if (!nfc_dev->read_kbuf) {
  269. ret = -ENOMEM;
  270. goto err_free_nfc_dev;
  271. }
  272. nfc_dev->write_kbuf = kzalloc(MAX_DL_BUFFER_SIZE, GFP_DMA | GFP_KERNEL);
  273. if (!nfc_dev->write_kbuf) {
  274. ret = -ENOMEM;
  275. goto err_free_read_kbuf;
  276. }
  277. nfc_dev->interface = PLATFORM_IF_I2C;
  278. nfc_dev->nfc_state = NFC_STATE_NCI;
  279. nfc_dev->i2c_dev.client = client;
  280. i2c_dev = &nfc_dev->i2c_dev;
  281. nfc_dev->nfc_read = i2c_read;
  282. nfc_dev->nfc_write = i2c_write;
  283. nfc_dev->nfc_enable_intr = i2c_enable_irq;
  284. nfc_dev->nfc_disable_intr = i2c_disable_irq;
  285. nfc_dev->fw_major_version = 0;
  286. ret = configure_gpio(nfc_gpio->ven, GPIO_OUTPUT);
  287. if (ret) {
  288. pr_err("%s: unable to request nfc reset gpio [%d]\n",
  289. __func__, nfc_gpio->ven);
  290. goto err_free_write_kbuf;
  291. }
  292. ret = configure_gpio(nfc_gpio->irq, GPIO_IRQ);
  293. if (ret <= 0) {
  294. pr_err("%s: unable to request nfc irq gpio [%d]\n",
  295. __func__, nfc_gpio->irq);
  296. goto err_free_ven;
  297. }
  298. client->irq = ret;
  299. ret = configure_gpio(nfc_gpio->dwl_req, GPIO_OUTPUT);
  300. if (ret) {
  301. pr_err("%s: unable to request nfc firm downl gpio [%d]\n",
  302. __func__, nfc_gpio->dwl_req);
  303. //not returning failure here as dwl gpio is a optional gpio for sn220
  304. }
  305. ret = configure_gpio(nfc_gpio->clkreq, GPIO_INPUT);
  306. if (ret) {
  307. pr_err("%s: unable to request nfc clkreq gpio [%d]\n",
  308. __func__, nfc_gpio->clkreq);
  309. goto err_free_dwl_req;
  310. }
  311. /*copy the retrieved gpio details from DT */
  312. memcpy(&nfc_dev->configs, &nfc_configs, sizeof(struct platform_configs));
  313. /* init mutex and queues */
  314. init_waitqueue_head(&nfc_dev->read_wq);
  315. mutex_init(&nfc_dev->read_mutex);
  316. mutex_init(&nfc_dev->write_mutex);
  317. mutex_init(&nfc_dev->dev_ref_mutex);
  318. spin_lock_init(&i2c_dev->irq_enabled_lock);
  319. ret = nfc_misc_register(nfc_dev, &nfc_i2c_dev_fops, DEV_COUNT,
  320. NFC_CHAR_DEV_NAME, CLASS_NAME);
  321. if (ret) {
  322. pr_err("%s: nfc_misc_register failed\n", __func__);
  323. goto err_mutex_destroy;
  324. }
  325. /* interrupt initializations */
  326. pr_info("%s : requesting IRQ %d\n", __func__, client->irq);
  327. i2c_dev->irq_enabled = true;
  328. ret = request_irq(client->irq, i2c_irq_handler,
  329. IRQF_TRIGGER_HIGH, client->name, nfc_dev);
  330. if (ret) {
  331. pr_err("%s: request_irq failed\n", __func__);
  332. goto err_nfc_misc_unregister;
  333. }
  334. i2c_disable_irq(nfc_dev);
  335. i2c_set_clientdata(client, nfc_dev);
  336. ret = nfc_ldo_config(&client->dev, nfc_dev);
  337. if (ret) {
  338. pr_err("LDO config failed\n");
  339. goto err_ldo_config_failed;
  340. }
  341. ret = nfcc_hw_check(nfc_dev);
  342. if (ret || nfc_dev->nfc_state == NFC_STATE_UNKNOWN) {
  343. pr_err("nfc hw check failed ret %d\n", ret);
  344. goto err_nfcc_hw_check;
  345. }
  346. device_init_wakeup(&client->dev, true);
  347. i2c_dev->irq_wake_up = false;
  348. nfc_dev->is_ese_session_active = false;
  349. pr_info("%s success\n", __func__);
  350. return 0;
  351. err_nfcc_hw_check:
  352. if (nfc_dev->reg) {
  353. nfc_ldo_unvote(nfc_dev);
  354. regulator_put(nfc_dev->reg);
  355. }
  356. err_ldo_config_failed:
  357. free_irq(client->irq, nfc_dev);
  358. err_nfc_misc_unregister:
  359. nfc_misc_unregister(nfc_dev, DEV_COUNT);
  360. err_mutex_destroy:
  361. mutex_destroy(&nfc_dev->dev_ref_mutex);
  362. mutex_destroy(&nfc_dev->read_mutex);
  363. mutex_destroy(&nfc_dev->write_mutex);
  364. gpio_free(nfc_gpio->clkreq);
  365. err_free_dwl_req:
  366. if (gpio_is_valid(nfc_gpio->dwl_req))
  367. gpio_free(nfc_gpio->dwl_req);
  368. gpio_free(nfc_gpio->irq);
  369. err_free_ven:
  370. gpio_free(nfc_gpio->ven);
  371. err_free_write_kbuf:
  372. kfree(nfc_dev->write_kbuf);
  373. err_free_read_kbuf:
  374. kfree(nfc_dev->read_kbuf);
  375. err_free_nfc_dev:
  376. kfree(nfc_dev);
  377. err:
  378. pr_err("%s: failed\n", __func__);
  379. return ret;
  380. }
  381. int nfc_i2c_dev_remove(struct i2c_client *client)
  382. {
  383. int ret = 0;
  384. struct nfc_dev *nfc_dev = NULL;
  385. pr_info("%s: remove device\n", __func__);
  386. nfc_dev = i2c_get_clientdata(client);
  387. if (!nfc_dev) {
  388. pr_err("%s: device doesn't exist anymore\n", __func__);
  389. ret = -ENODEV;
  390. return ret;
  391. }
  392. if (nfc_dev->dev_ref_count > 0) {
  393. pr_err("%s: device already in use\n", __func__);
  394. return -EBUSY;
  395. }
  396. gpio_set_value(nfc_dev->configs.gpio.ven, 0);
  397. // HW dependent delay before LDO goes into LPM mode
  398. usleep_range(10000, 10100);
  399. if (nfc_dev->reg) {
  400. nfc_ldo_unvote(nfc_dev);
  401. regulator_put(nfc_dev->reg);
  402. }
  403. device_init_wakeup(&client->dev, false);
  404. free_irq(client->irq, nfc_dev);
  405. nfc_misc_unregister(nfc_dev, DEV_COUNT);
  406. mutex_destroy(&nfc_dev->dev_ref_mutex);
  407. mutex_destroy(&nfc_dev->read_mutex);
  408. mutex_destroy(&nfc_dev->write_mutex);
  409. if (gpio_is_valid(nfc_dev->configs.gpio.clkreq))
  410. gpio_free(nfc_dev->configs.gpio.clkreq);
  411. if (gpio_is_valid(nfc_dev->configs.gpio.dwl_req))
  412. gpio_free(nfc_dev->configs.gpio.dwl_req);
  413. if (gpio_is_valid(nfc_dev->configs.gpio.irq))
  414. gpio_free(nfc_dev->configs.gpio.irq);
  415. if (gpio_is_valid(nfc_dev->configs.gpio.ven))
  416. gpio_free(nfc_dev->configs.gpio.ven);
  417. kfree(nfc_dev->read_kbuf);
  418. kfree(nfc_dev->write_kbuf);
  419. kfree(nfc_dev);
  420. return ret;
  421. }
  422. int nfc_i2c_dev_suspend(struct device *device)
  423. {
  424. struct i2c_client *client = to_i2c_client(device);
  425. struct nfc_dev *nfc_dev = i2c_get_clientdata(client);
  426. struct i2c_dev *i2c_dev = NULL;
  427. if (!nfc_dev) {
  428. pr_err("%s: device doesn't exist anymore\n", __func__);
  429. return -ENODEV;
  430. }
  431. i2c_dev = &nfc_dev->i2c_dev;
  432. NFCLOG_IPC(nfc_dev, false, "%s: irq_enabled = %d", __func__,
  433. i2c_dev->irq_enabled);
  434. if (device_may_wakeup(&client->dev) && i2c_dev->irq_enabled) {
  435. if (!enable_irq_wake(client->irq))
  436. i2c_dev->irq_wake_up = true;
  437. }
  438. return 0;
  439. }
  440. int nfc_i2c_dev_resume(struct device *device)
  441. {
  442. struct i2c_client *client = to_i2c_client(device);
  443. struct nfc_dev *nfc_dev = i2c_get_clientdata(client);
  444. struct i2c_dev *i2c_dev = NULL;
  445. if (!nfc_dev) {
  446. pr_err("%s: device doesn't exist anymore\n", __func__);
  447. return -ENODEV;
  448. }
  449. i2c_dev = &nfc_dev->i2c_dev;
  450. NFCLOG_IPC(nfc_dev, false, "%s: irq_wake_up = %d", __func__,
  451. i2c_dev->irq_wake_up);
  452. if (device_may_wakeup(&client->dev) && i2c_dev->irq_wake_up) {
  453. if (!disable_irq_wake(client->irq))
  454. i2c_dev->irq_wake_up = false;
  455. }
  456. return 0;
  457. }
  458. static const struct i2c_device_id nfc_i2c_dev_id[] = {
  459. {NFC_I2C_DEV_ID, 0},
  460. {}
  461. };
  462. static const struct of_device_id nfc_i2c_dev_match_table[] = {
  463. {.compatible = NFC_I2C_DRV_STR,},
  464. {}
  465. };
  466. static const struct dev_pm_ops nfc_i2c_dev_pm_ops = {
  467. SET_SYSTEM_SLEEP_PM_OPS(nfc_i2c_dev_suspend, nfc_i2c_dev_resume)
  468. };
  469. static struct i2c_driver nfc_i2c_dev_driver = {
  470. .id_table = nfc_i2c_dev_id,
  471. .probe = nfc_i2c_dev_probe,
  472. .remove = nfc_i2c_dev_remove,
  473. .driver = {
  474. .name = NFC_I2C_DRV_STR,
  475. .pm = &nfc_i2c_dev_pm_ops,
  476. .of_match_table = nfc_i2c_dev_match_table,
  477. .probe_type = PROBE_PREFER_ASYNCHRONOUS,
  478. },
  479. };
  480. MODULE_DEVICE_TABLE(of, nfc_i2c_dev_match_table);
  481. static int __init nfc_i2c_dev_init(void)
  482. {
  483. int ret = 0;
  484. ret = i2c_add_driver(&nfc_i2c_dev_driver);
  485. if (ret != 0)
  486. pr_err("NFC I2C add driver error ret %d\n", ret);
  487. return ret;
  488. }
  489. module_init(nfc_i2c_dev_init);
  490. static void __exit nfc_i2c_dev_exit(void)
  491. {
  492. pr_debug("Unloading NFC I2C driver\n");
  493. i2c_del_driver(&nfc_i2c_dev_driver);
  494. }
  495. module_exit(nfc_i2c_dev_exit);
  496. MODULE_DESCRIPTION("QTI NFC I2C driver");
  497. MODULE_LICENSE("GPL v2");