fsa4480-i2c.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <linux/power_supply.h>
  9. #include <linux/regmap.h>
  10. #include <linux/i2c.h>
  11. #include <linux/mutex.h>
  12. #include <linux/usb/typec.h>
  13. #include <linux/usb/ucsi_glink.h>
  14. #include <linux/soc/qcom/fsa4480-i2c.h>
  15. #include <linux/iio/consumer.h>
  16. #include <linux/qti-regmap-debugfs.h>
  17. #define FSA4480_I2C_NAME "fsa4480-driver"
  18. #define FSA4480_SWITCH_SETTINGS 0x04
  19. #define FSA4480_SWITCH_CONTROL 0x05
  20. #define FSA4480_SWITCH_STATUS1 0x07
  21. #define FSA4480_SLOW_L 0x08
  22. #define FSA4480_SLOW_R 0x09
  23. #define FSA4480_SLOW_MIC 0x0A
  24. #define FSA4480_SLOW_SENSE 0x0B
  25. #define FSA4480_SLOW_GND 0x0C
  26. #define FSA4480_DELAY_L_R 0x0D
  27. #define FSA4480_DELAY_L_MIC 0x0E
  28. #define FSA4480_DELAY_L_SENSE 0x0F
  29. #define FSA4480_DELAY_L_AGND 0x10
  30. #define FSA4480_RESET 0x1E
  31. struct fsa4480_priv {
  32. struct regmap *regmap;
  33. struct device *dev;
  34. struct power_supply *usb_psy;
  35. struct notifier_block nb;
  36. struct iio_channel *iio_ch;
  37. atomic_t usbc_mode;
  38. struct work_struct usbc_analog_work;
  39. struct blocking_notifier_head fsa4480_notifier;
  40. struct mutex notification_lock;
  41. u32 use_powersupply;
  42. };
  43. struct fsa4480_reg_val {
  44. u16 reg;
  45. u8 val;
  46. };
  47. static const struct regmap_config fsa4480_regmap_config = {
  48. .reg_bits = 8,
  49. .val_bits = 8,
  50. .max_register = FSA4480_RESET,
  51. };
  52. static const struct fsa4480_reg_val fsa_reg_i2c_defaults[] = {
  53. {FSA4480_SLOW_L, 0x00},
  54. {FSA4480_SLOW_R, 0x00},
  55. {FSA4480_SLOW_MIC, 0x00},
  56. {FSA4480_SLOW_SENSE, 0x00},
  57. {FSA4480_SLOW_GND, 0x00},
  58. {FSA4480_DELAY_L_R, 0x00},
  59. {FSA4480_DELAY_L_MIC, 0x00},
  60. {FSA4480_DELAY_L_SENSE, 0x00},
  61. {FSA4480_DELAY_L_AGND, 0x09},
  62. {FSA4480_SWITCH_SETTINGS, 0x98},
  63. };
  64. static void fsa4480_usbc_update_settings(struct fsa4480_priv *fsa_priv,
  65. u32 switch_control, u32 switch_enable)
  66. {
  67. u32 prev_control, prev_enable;
  68. if (!fsa_priv->regmap) {
  69. dev_err(fsa_priv->dev, "%s: regmap invalid\n", __func__);
  70. return;
  71. }
  72. regmap_read(fsa_priv->regmap, FSA4480_SWITCH_CONTROL, &prev_control);
  73. regmap_read(fsa_priv->regmap, FSA4480_SWITCH_SETTINGS, &prev_enable);
  74. if (prev_control == switch_control && prev_enable == switch_enable) {
  75. dev_dbg(fsa_priv->dev, "%s: settings unchanged\n", __func__);
  76. return;
  77. }
  78. regmap_write(fsa_priv->regmap, FSA4480_SWITCH_SETTINGS, 0x80);
  79. regmap_write(fsa_priv->regmap, FSA4480_SWITCH_CONTROL, switch_control);
  80. /* FSA4480 chip hardware requirement */
  81. usleep_range(50, 55);
  82. regmap_write(fsa_priv->regmap, FSA4480_SWITCH_SETTINGS, switch_enable);
  83. }
  84. static int fsa4480_usbc_event_changed_psupply(struct fsa4480_priv *fsa_priv,
  85. unsigned long evt, void *ptr)
  86. {
  87. struct device *dev = NULL;
  88. if (!fsa_priv)
  89. return -EINVAL;
  90. dev = fsa_priv->dev;
  91. if (!dev)
  92. return -EINVAL;
  93. dev_dbg(dev, "%s: queueing usbc_analog_work\n",
  94. __func__);
  95. pm_stay_awake(fsa_priv->dev);
  96. queue_work(system_freezable_wq, &fsa_priv->usbc_analog_work);
  97. return 0;
  98. }
  99. static int fsa4480_usbc_event_changed_ucsi(struct fsa4480_priv *fsa_priv,
  100. unsigned long evt, void *ptr)
  101. {
  102. struct device *dev;
  103. enum typec_accessory acc = ((struct ucsi_glink_constat_info *)ptr)->acc;
  104. if (!fsa_priv)
  105. return -EINVAL;
  106. dev = fsa_priv->dev;
  107. if (!dev)
  108. return -EINVAL;
  109. dev_dbg(dev, "%s: USB change event received, supply mode %d, usbc mode %ld, expected %d\n",
  110. __func__, acc, fsa_priv->usbc_mode.counter,
  111. TYPEC_ACCESSORY_AUDIO);
  112. switch (acc) {
  113. case TYPEC_ACCESSORY_AUDIO:
  114. case TYPEC_ACCESSORY_NONE:
  115. if (atomic_read(&(fsa_priv->usbc_mode)) == acc)
  116. break; /* filter notifications received before */
  117. atomic_set(&(fsa_priv->usbc_mode), acc);
  118. dev_dbg(dev, "%s: queueing usbc_analog_work\n",
  119. __func__);
  120. pm_stay_awake(fsa_priv->dev);
  121. queue_work(system_freezable_wq, &fsa_priv->usbc_analog_work);
  122. break;
  123. default:
  124. break;
  125. }
  126. return 0;
  127. }
  128. static int fsa4480_usbc_event_changed(struct notifier_block *nb_ptr,
  129. unsigned long evt, void *ptr)
  130. {
  131. struct fsa4480_priv *fsa_priv =
  132. container_of(nb_ptr, struct fsa4480_priv, nb);
  133. struct device *dev;
  134. if (!fsa_priv)
  135. return -EINVAL;
  136. dev = fsa_priv->dev;
  137. if (!dev)
  138. return -EINVAL;
  139. if (fsa_priv->use_powersupply)
  140. return fsa4480_usbc_event_changed_psupply(fsa_priv, evt, ptr);
  141. else
  142. return fsa4480_usbc_event_changed_ucsi(fsa_priv, evt, ptr);
  143. }
  144. static int fsa4480_usbc_analog_setup_switches_psupply(
  145. struct fsa4480_priv *fsa_priv)
  146. {
  147. int rc = 0;
  148. union power_supply_propval mode;
  149. struct device *dev;
  150. if (!fsa_priv)
  151. return -EINVAL;
  152. dev = fsa_priv->dev;
  153. if (!dev)
  154. return -EINVAL;
  155. rc = iio_read_channel_processed(fsa_priv->iio_ch, &mode.intval);
  156. mutex_lock(&fsa_priv->notification_lock);
  157. /* get latest mode again within locked context */
  158. if (rc < 0) {
  159. dev_err(dev, "%s: Unable to read USB TYPEC_MODE: %d\n",
  160. __func__, rc);
  161. goto done;
  162. }
  163. dev_dbg(dev, "%s: setting GPIOs active = %d rcvd intval 0x%X\n",
  164. __func__, mode.intval != TYPEC_ACCESSORY_NONE, mode.intval);
  165. atomic_set(&(fsa_priv->usbc_mode), mode.intval);
  166. switch (mode.intval) {
  167. /* add all modes FSA should notify for in here */
  168. case TYPEC_ACCESSORY_AUDIO:
  169. /* activate switches */
  170. fsa4480_usbc_update_settings(fsa_priv, 0x00, 0x9F);
  171. /* notify call chain on event */
  172. blocking_notifier_call_chain(&fsa_priv->fsa4480_notifier,
  173. mode.intval, NULL);
  174. break;
  175. case TYPEC_ACCESSORY_NONE:
  176. /* notify call chain on event */
  177. blocking_notifier_call_chain(&fsa_priv->fsa4480_notifier,
  178. TYPEC_ACCESSORY_NONE, NULL);
  179. /* deactivate switches */
  180. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  181. break;
  182. default:
  183. /* ignore other usb connection modes */
  184. break;
  185. }
  186. done:
  187. mutex_unlock(&fsa_priv->notification_lock);
  188. return rc;
  189. }
  190. static int fsa4480_usbc_analog_setup_switches_ucsi(
  191. struct fsa4480_priv *fsa_priv)
  192. {
  193. int rc = 0;
  194. int mode;
  195. struct device *dev;
  196. if (!fsa_priv)
  197. return -EINVAL;
  198. dev = fsa_priv->dev;
  199. if (!dev)
  200. return -EINVAL;
  201. mutex_lock(&fsa_priv->notification_lock);
  202. /* get latest mode again within locked context */
  203. mode = atomic_read(&(fsa_priv->usbc_mode));
  204. dev_dbg(dev, "%s: setting GPIOs active = %d\n",
  205. __func__, mode != TYPEC_ACCESSORY_NONE);
  206. switch (mode) {
  207. /* add all modes FSA should notify for in here */
  208. case TYPEC_ACCESSORY_AUDIO:
  209. /* activate switches */
  210. fsa4480_usbc_update_settings(fsa_priv, 0x00, 0x9F);
  211. /* notify call chain on event */
  212. blocking_notifier_call_chain(&fsa_priv->fsa4480_notifier,
  213. mode, NULL);
  214. break;
  215. case TYPEC_ACCESSORY_NONE:
  216. /* notify call chain on event */
  217. blocking_notifier_call_chain(&fsa_priv->fsa4480_notifier,
  218. TYPEC_ACCESSORY_NONE, NULL);
  219. /* deactivate switches */
  220. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  221. break;
  222. default:
  223. /* ignore other usb connection modes */
  224. break;
  225. }
  226. mutex_unlock(&fsa_priv->notification_lock);
  227. return rc;
  228. }
  229. static int fsa4480_usbc_analog_setup_switches(struct fsa4480_priv *fsa_priv)
  230. {
  231. if (fsa_priv->use_powersupply)
  232. return fsa4480_usbc_analog_setup_switches_psupply(fsa_priv);
  233. else
  234. return fsa4480_usbc_analog_setup_switches_ucsi(fsa_priv);
  235. }
  236. /*
  237. * fsa4480_reg_notifier - register notifier block with fsa driver
  238. *
  239. * @nb - notifier block of fsa4480
  240. * @node - phandle node to fsa4480 device
  241. *
  242. * Returns 0 on success, or error code
  243. */
  244. int fsa4480_reg_notifier(struct notifier_block *nb,
  245. struct device_node *node)
  246. {
  247. int rc = 0;
  248. struct i2c_client *client = of_find_i2c_device_by_node(node);
  249. struct fsa4480_priv *fsa_priv;
  250. if (!client)
  251. return -EINVAL;
  252. fsa_priv = (struct fsa4480_priv *)i2c_get_clientdata(client);
  253. if (!fsa_priv)
  254. return -EINVAL;
  255. rc = blocking_notifier_chain_register
  256. (&fsa_priv->fsa4480_notifier, nb);
  257. dev_dbg(fsa_priv->dev, "%s: registered notifier for %s\n",
  258. __func__, node->name);
  259. if (rc)
  260. return rc;
  261. /*
  262. * as part of the init sequence check if there is a connected
  263. * USB C analog adapter
  264. */
  265. if (atomic_read(&(fsa_priv->usbc_mode)) == TYPEC_ACCESSORY_AUDIO) {
  266. dev_dbg(fsa_priv->dev, "%s: analog adapter already inserted\n",
  267. __func__);
  268. rc = fsa4480_usbc_analog_setup_switches(fsa_priv);
  269. }
  270. return rc;
  271. }
  272. EXPORT_SYMBOL_GPL(fsa4480_reg_notifier);
  273. /*
  274. * fsa4480_unreg_notifier - unregister notifier block with fsa driver
  275. *
  276. * @nb - notifier block of fsa4480
  277. * @node - phandle node to fsa4480 device
  278. *
  279. * Returns 0 on pass, or error code
  280. */
  281. int fsa4480_unreg_notifier(struct notifier_block *nb,
  282. struct device_node *node)
  283. {
  284. int rc = 0;
  285. struct i2c_client *client = of_find_i2c_device_by_node(node);
  286. struct fsa4480_priv *fsa_priv;
  287. struct device *dev;
  288. union power_supply_propval mode;
  289. if (!client)
  290. return -EINVAL;
  291. fsa_priv = (struct fsa4480_priv *)i2c_get_clientdata(client);
  292. if (!fsa_priv)
  293. return -EINVAL;
  294. if (fsa_priv->use_powersupply) {
  295. dev = fsa_priv->dev;
  296. if (!dev)
  297. return -EINVAL;
  298. mutex_lock(&fsa_priv->notification_lock);
  299. /* get latest mode within locked context */
  300. rc = iio_read_channel_processed(fsa_priv->iio_ch, &mode.intval);
  301. if (rc < 0) {
  302. dev_dbg(dev, "%s: Unable to read USB TYPEC_MODE: %d\n",
  303. __func__, rc);
  304. mutex_unlock(&fsa_priv->notification_lock);
  305. return rc;
  306. }
  307. /* Do not reset switch settings for usb digital hs */
  308. if (mode.intval == TYPEC_ACCESSORY_AUDIO)
  309. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  310. rc = blocking_notifier_chain_unregister
  311. (&fsa_priv->fsa4480_notifier, nb);
  312. mutex_unlock(&fsa_priv->notification_lock);
  313. } else {
  314. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  315. rc = blocking_notifier_chain_unregister
  316. (&fsa_priv->fsa4480_notifier, nb);
  317. }
  318. return rc;
  319. }
  320. EXPORT_SYMBOL_GPL(fsa4480_unreg_notifier);
  321. static int fsa4480_validate_display_port_settings(struct fsa4480_priv *fsa_priv)
  322. {
  323. u32 switch_status = 0;
  324. regmap_read(fsa_priv->regmap, FSA4480_SWITCH_STATUS1, &switch_status);
  325. if ((switch_status != 0x23) && (switch_status != 0x1C)) {
  326. pr_err("AUX SBU1/2 switch status is invalid = %u\n",
  327. switch_status);
  328. return -EIO;
  329. }
  330. return 0;
  331. }
  332. /*
  333. * fsa4480_switch_event - configure FSA switch position based on event
  334. *
  335. * @node - phandle node to fsa4480 device
  336. * @event - fsa_function enum
  337. *
  338. * Returns int on whether the switch happened or not
  339. */
  340. int fsa4480_switch_event(struct device_node *node,
  341. enum fsa_function event)
  342. {
  343. int switch_control = 0;
  344. struct i2c_client *client = of_find_i2c_device_by_node(node);
  345. struct fsa4480_priv *fsa_priv;
  346. if (!client)
  347. return -EINVAL;
  348. fsa_priv = (struct fsa4480_priv *)i2c_get_clientdata(client);
  349. if (!fsa_priv)
  350. return -EINVAL;
  351. if (!fsa_priv->regmap)
  352. return -EINVAL;
  353. switch (event) {
  354. case FSA_MIC_GND_SWAP:
  355. regmap_read(fsa_priv->regmap, FSA4480_SWITCH_CONTROL,
  356. &switch_control);
  357. if ((switch_control & 0x07) == 0x07)
  358. switch_control = 0x0;
  359. else
  360. switch_control = 0x7;
  361. fsa4480_usbc_update_settings(fsa_priv, switch_control, 0x9F);
  362. break;
  363. case FSA_USBC_ORIENTATION_CC1:
  364. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0xF8);
  365. return fsa4480_validate_display_port_settings(fsa_priv);
  366. case FSA_USBC_ORIENTATION_CC2:
  367. fsa4480_usbc_update_settings(fsa_priv, 0x78, 0xF8);
  368. return fsa4480_validate_display_port_settings(fsa_priv);
  369. case FSA_USBC_DISPLAYPORT_DISCONNECTED:
  370. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  371. break;
  372. default:
  373. break;
  374. }
  375. return 0;
  376. }
  377. EXPORT_SYMBOL_GPL(fsa4480_switch_event);
  378. static void fsa4480_usbc_analog_work_fn(struct work_struct *work)
  379. {
  380. struct fsa4480_priv *fsa_priv =
  381. container_of(work, struct fsa4480_priv, usbc_analog_work);
  382. if (!fsa_priv) {
  383. pr_err("%s: fsa container invalid\n", __func__);
  384. return;
  385. }
  386. fsa4480_usbc_analog_setup_switches(fsa_priv);
  387. pm_relax(fsa_priv->dev);
  388. }
  389. static void fsa4480_update_reg_defaults(struct regmap *regmap)
  390. {
  391. u8 i;
  392. for (i = 0; i < ARRAY_SIZE(fsa_reg_i2c_defaults); i++)
  393. regmap_write(regmap, fsa_reg_i2c_defaults[i].reg,
  394. fsa_reg_i2c_defaults[i].val);
  395. }
  396. static int fsa4480_probe(struct i2c_client *i2c,
  397. const struct i2c_device_id *id)
  398. {
  399. struct fsa4480_priv *fsa_priv;
  400. u32 use_powersupply = 0;
  401. int rc = 0;
  402. fsa_priv = devm_kzalloc(&i2c->dev, sizeof(*fsa_priv),
  403. GFP_KERNEL);
  404. if (!fsa_priv)
  405. return -ENOMEM;
  406. memset(fsa_priv, 0, sizeof(struct fsa4480_priv));
  407. fsa_priv->dev = &i2c->dev;
  408. fsa_priv->regmap = devm_regmap_init_i2c(i2c, &fsa4480_regmap_config);
  409. if (IS_ERR_OR_NULL(fsa_priv->regmap)) {
  410. dev_err(fsa_priv->dev, "%s: Failed to initialize regmap: %d\n",
  411. __func__, rc);
  412. if (!fsa_priv->regmap) {
  413. rc = -EINVAL;
  414. goto err_data;
  415. }
  416. rc = PTR_ERR(fsa_priv->regmap);
  417. goto err_data;
  418. }
  419. fsa4480_update_reg_defaults(fsa_priv->regmap);
  420. devm_regmap_qti_debugfs_register(fsa_priv->dev, fsa_priv->regmap);
  421. fsa_priv->nb.notifier_call = fsa4480_usbc_event_changed;
  422. fsa_priv->nb.priority = 0;
  423. rc = of_property_read_u32(fsa_priv->dev->of_node,
  424. "qcom,use-power-supply", &use_powersupply);
  425. if (rc || use_powersupply == 0) {
  426. dev_dbg(fsa_priv->dev,
  427. "%s: Looking up %s property failed or disabled\n",
  428. __func__, "qcom,use-power-supply");
  429. fsa_priv->use_powersupply = 0;
  430. rc = register_ucsi_glink_notifier(&fsa_priv->nb);
  431. if (rc) {
  432. dev_err(fsa_priv->dev,
  433. "%s: ucsi glink notifier registration failed: %d\n",
  434. __func__, rc);
  435. goto err_data;
  436. }
  437. } else {
  438. fsa_priv->use_powersupply = 1;
  439. fsa_priv->usb_psy = power_supply_get_by_name("usb");
  440. if (!fsa_priv->usb_psy) {
  441. rc = -EPROBE_DEFER;
  442. dev_dbg(fsa_priv->dev,
  443. "%s: could not get USB psy info: %d\n",
  444. __func__, rc);
  445. goto err_data;
  446. }
  447. fsa_priv->iio_ch = iio_channel_get(fsa_priv->dev, "typec_mode");
  448. if (!fsa_priv->iio_ch) {
  449. dev_err(fsa_priv->dev,
  450. "%s: iio_channel_get failed for typec_mode\n",
  451. __func__);
  452. goto err_supply;
  453. }
  454. rc = power_supply_reg_notifier(&fsa_priv->nb);
  455. if (rc) {
  456. dev_err(fsa_priv->dev,
  457. "%s: power supply reg failed: %d\n",
  458. __func__, rc);
  459. goto err_supply;
  460. }
  461. }
  462. mutex_init(&fsa_priv->notification_lock);
  463. i2c_set_clientdata(i2c, fsa_priv);
  464. INIT_WORK(&fsa_priv->usbc_analog_work,
  465. fsa4480_usbc_analog_work_fn);
  466. BLOCKING_INIT_NOTIFIER_HEAD(&fsa_priv->fsa4480_notifier);
  467. return 0;
  468. err_supply:
  469. power_supply_put(fsa_priv->usb_psy);
  470. err_data:
  471. return rc;
  472. }
  473. static void fsa4480_remove(struct i2c_client *i2c)
  474. {
  475. struct fsa4480_priv *fsa_priv =
  476. (struct fsa4480_priv *)i2c_get_clientdata(i2c);
  477. if (!fsa_priv)
  478. return;
  479. if (fsa_priv->use_powersupply) {
  480. /* deregister from PMI */
  481. power_supply_unreg_notifier(&fsa_priv->nb);
  482. power_supply_put(fsa_priv->usb_psy);
  483. } else {
  484. unregister_ucsi_glink_notifier(&fsa_priv->nb);
  485. }
  486. fsa4480_usbc_update_settings(fsa_priv, 0x18, 0x98);
  487. cancel_work_sync(&fsa_priv->usbc_analog_work);
  488. pm_relax(fsa_priv->dev);
  489. mutex_destroy(&fsa_priv->notification_lock);
  490. dev_set_drvdata(&i2c->dev, NULL);
  491. }
  492. static const struct of_device_id fsa4480_i2c_dt_match[] = {
  493. {
  494. .compatible = "qcom,fsa4480-i2c",
  495. },
  496. {}
  497. };
  498. static struct i2c_driver fsa4480_i2c_driver = {
  499. .driver = {
  500. .name = FSA4480_I2C_NAME,
  501. .of_match_table = fsa4480_i2c_dt_match,
  502. .probe_type = PROBE_PREFER_ASYNCHRONOUS,
  503. },
  504. .probe = fsa4480_probe,
  505. .remove = fsa4480_remove,
  506. };
  507. static int __init fsa4480_init(void)
  508. {
  509. int rc;
  510. rc = i2c_add_driver(&fsa4480_i2c_driver);
  511. if (rc)
  512. pr_err("fsa4480: Failed to register I2C driver: %d\n", rc);
  513. return rc;
  514. }
  515. module_init(fsa4480_init);
  516. static void __exit fsa4480_exit(void)
  517. {
  518. i2c_del_driver(&fsa4480_i2c_driver);
  519. }
  520. module_exit(fsa4480_exit);
  521. MODULE_DESCRIPTION("FSA4480 I2C driver");
  522. MODULE_LICENSE("GPL");