tps6586x.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /*
  2. * Core driver for TI TPS6586x PMIC family
  3. *
  4. * Copyright (c) 2010 CompuLab Ltd.
  5. * Mike Rapoport <mike@compulab.co.il>
  6. *
  7. * Based on da903x.c.
  8. * Copyright (C) 2008 Compulab, Ltd.
  9. * Mike Rapoport <mike@compulab.co.il>
  10. * Copyright (C) 2006-2008 Marvell International Ltd.
  11. * Eric Miao <eric.miao@marvell.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/interrupt.h>
  18. #include <linux/irq.h>
  19. #include <linux/kernel.h>
  20. #include <linux/module.h>
  21. #include <linux/mutex.h>
  22. #include <linux/slab.h>
  23. #include <linux/gpio.h>
  24. #include <linux/i2c.h>
  25. #include <linux/mfd/core.h>
  26. #include <linux/mfd/tps6586x.h>
  27. /* GPIO control registers */
  28. #define TPS6586X_GPIOSET1 0x5d
  29. #define TPS6586X_GPIOSET2 0x5e
  30. /* interrupt control registers */
  31. #define TPS6586X_INT_ACK1 0xb5
  32. #define TPS6586X_INT_ACK2 0xb6
  33. #define TPS6586X_INT_ACK3 0xb7
  34. #define TPS6586X_INT_ACK4 0xb8
  35. /* interrupt mask registers */
  36. #define TPS6586X_INT_MASK1 0xb0
  37. #define TPS6586X_INT_MASK2 0xb1
  38. #define TPS6586X_INT_MASK3 0xb2
  39. #define TPS6586X_INT_MASK4 0xb3
  40. #define TPS6586X_INT_MASK5 0xb4
  41. /* device id */
  42. #define TPS6586X_VERSIONCRC 0xcd
  43. struct tps6586x_irq_data {
  44. u8 mask_reg;
  45. u8 mask_mask;
  46. };
  47. #define TPS6586X_IRQ(_reg, _mask) \
  48. { \
  49. .mask_reg = (_reg) - TPS6586X_INT_MASK1, \
  50. .mask_mask = (_mask), \
  51. }
  52. static const struct tps6586x_irq_data tps6586x_irqs[] = {
  53. [TPS6586X_INT_PLDO_0] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 0),
  54. [TPS6586X_INT_PLDO_1] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 1),
  55. [TPS6586X_INT_PLDO_2] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 2),
  56. [TPS6586X_INT_PLDO_3] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 3),
  57. [TPS6586X_INT_PLDO_4] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 4),
  58. [TPS6586X_INT_PLDO_5] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 5),
  59. [TPS6586X_INT_PLDO_6] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 6),
  60. [TPS6586X_INT_PLDO_7] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 7),
  61. [TPS6586X_INT_COMP_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 1 << 0),
  62. [TPS6586X_INT_ADC] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 1),
  63. [TPS6586X_INT_PLDO_8] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 2),
  64. [TPS6586X_INT_PLDO_9] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 3),
  65. [TPS6586X_INT_PSM_0] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 4),
  66. [TPS6586X_INT_PSM_1] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 5),
  67. [TPS6586X_INT_PSM_2] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 6),
  68. [TPS6586X_INT_PSM_3] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 7),
  69. [TPS6586X_INT_RTC_ALM1] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 4),
  70. [TPS6586X_INT_ACUSB_OVP] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 0x03),
  71. [TPS6586X_INT_USB_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 2),
  72. [TPS6586X_INT_AC_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 3),
  73. [TPS6586X_INT_BAT_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 1 << 0),
  74. [TPS6586X_INT_CHG_STAT] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 0xfc),
  75. [TPS6586X_INT_CHG_TEMP] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 0x06),
  76. [TPS6586X_INT_PP] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 0xf0),
  77. [TPS6586X_INT_RESUME] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 5),
  78. [TPS6586X_INT_LOW_SYS] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 6),
  79. [TPS6586X_INT_RTC_ALM2] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 1 << 1),
  80. };
  81. struct tps6586x {
  82. struct mutex lock;
  83. struct device *dev;
  84. struct i2c_client *client;
  85. struct gpio_chip gpio;
  86. struct irq_chip irq_chip;
  87. struct mutex irq_lock;
  88. int irq_base;
  89. u32 irq_en;
  90. u8 mask_cache[5];
  91. u8 mask_reg[5];
  92. };
  93. static inline int __tps6586x_read(struct i2c_client *client,
  94. int reg, uint8_t *val)
  95. {
  96. int ret;
  97. ret = i2c_smbus_read_byte_data(client, reg);
  98. if (ret < 0) {
  99. dev_err(&client->dev, "failed reading at 0x%02x\n", reg);
  100. return ret;
  101. }
  102. *val = (uint8_t)ret;
  103. return 0;
  104. }
  105. static inline int __tps6586x_reads(struct i2c_client *client, int reg,
  106. int len, uint8_t *val)
  107. {
  108. int ret;
  109. ret = i2c_smbus_read_i2c_block_data(client, reg, len, val);
  110. if (ret < 0) {
  111. dev_err(&client->dev, "failed reading from 0x%02x\n", reg);
  112. return ret;
  113. }
  114. return 0;
  115. }
  116. static inline int __tps6586x_write(struct i2c_client *client,
  117. int reg, uint8_t val)
  118. {
  119. int ret;
  120. ret = i2c_smbus_write_byte_data(client, reg, val);
  121. if (ret < 0) {
  122. dev_err(&client->dev, "failed writing 0x%02x to 0x%02x\n",
  123. val, reg);
  124. return ret;
  125. }
  126. return 0;
  127. }
  128. static inline int __tps6586x_writes(struct i2c_client *client, int reg,
  129. int len, uint8_t *val)
  130. {
  131. int ret, i;
  132. for (i = 0; i < len; i++) {
  133. ret = __tps6586x_write(client, reg + i, *(val + i));
  134. if (ret < 0)
  135. return ret;
  136. }
  137. return 0;
  138. }
  139. int tps6586x_write(struct device *dev, int reg, uint8_t val)
  140. {
  141. return __tps6586x_write(to_i2c_client(dev), reg, val);
  142. }
  143. EXPORT_SYMBOL_GPL(tps6586x_write);
  144. int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val)
  145. {
  146. return __tps6586x_writes(to_i2c_client(dev), reg, len, val);
  147. }
  148. EXPORT_SYMBOL_GPL(tps6586x_writes);
  149. int tps6586x_read(struct device *dev, int reg, uint8_t *val)
  150. {
  151. return __tps6586x_read(to_i2c_client(dev), reg, val);
  152. }
  153. EXPORT_SYMBOL_GPL(tps6586x_read);
  154. int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val)
  155. {
  156. return __tps6586x_reads(to_i2c_client(dev), reg, len, val);
  157. }
  158. EXPORT_SYMBOL_GPL(tps6586x_reads);
  159. int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
  160. {
  161. struct tps6586x *tps6586x = dev_get_drvdata(dev);
  162. uint8_t reg_val;
  163. int ret = 0;
  164. mutex_lock(&tps6586x->lock);
  165. ret = __tps6586x_read(to_i2c_client(dev), reg, &reg_val);
  166. if (ret)
  167. goto out;
  168. if ((reg_val & bit_mask) != bit_mask) {
  169. reg_val |= bit_mask;
  170. ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val);
  171. }
  172. out:
  173. mutex_unlock(&tps6586x->lock);
  174. return ret;
  175. }
  176. EXPORT_SYMBOL_GPL(tps6586x_set_bits);
  177. int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask)
  178. {
  179. struct tps6586x *tps6586x = dev_get_drvdata(dev);
  180. uint8_t reg_val;
  181. int ret = 0;
  182. mutex_lock(&tps6586x->lock);
  183. ret = __tps6586x_read(to_i2c_client(dev), reg, &reg_val);
  184. if (ret)
  185. goto out;
  186. if (reg_val & bit_mask) {
  187. reg_val &= ~bit_mask;
  188. ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val);
  189. }
  190. out:
  191. mutex_unlock(&tps6586x->lock);
  192. return ret;
  193. }
  194. EXPORT_SYMBOL_GPL(tps6586x_clr_bits);
  195. int tps6586x_update(struct device *dev, int reg, uint8_t val, uint8_t mask)
  196. {
  197. struct tps6586x *tps6586x = dev_get_drvdata(dev);
  198. uint8_t reg_val;
  199. int ret = 0;
  200. mutex_lock(&tps6586x->lock);
  201. ret = __tps6586x_read(tps6586x->client, reg, &reg_val);
  202. if (ret)
  203. goto out;
  204. if ((reg_val & mask) != val) {
  205. reg_val = (reg_val & ~mask) | val;
  206. ret = __tps6586x_write(tps6586x->client, reg, reg_val);
  207. }
  208. out:
  209. mutex_unlock(&tps6586x->lock);
  210. return ret;
  211. }
  212. EXPORT_SYMBOL_GPL(tps6586x_update);
  213. static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset)
  214. {
  215. struct tps6586x *tps6586x = container_of(gc, struct tps6586x, gpio);
  216. uint8_t val;
  217. int ret;
  218. ret = __tps6586x_read(tps6586x->client, TPS6586X_GPIOSET2, &val);
  219. if (ret)
  220. return ret;
  221. return !!(val & (1 << offset));
  222. }
  223. static void tps6586x_gpio_set(struct gpio_chip *chip, unsigned offset,
  224. int value)
  225. {
  226. struct tps6586x *tps6586x = container_of(chip, struct tps6586x, gpio);
  227. tps6586x_update(tps6586x->dev, TPS6586X_GPIOSET2,
  228. value << offset, 1 << offset);
  229. }
  230. static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset,
  231. int value)
  232. {
  233. struct tps6586x *tps6586x = container_of(gc, struct tps6586x, gpio);
  234. uint8_t val, mask;
  235. tps6586x_gpio_set(gc, offset, value);
  236. val = 0x1 << (offset * 2);
  237. mask = 0x3 << (offset * 2);
  238. return tps6586x_update(tps6586x->dev, TPS6586X_GPIOSET1, val, mask);
  239. }
  240. static int tps6586x_gpio_init(struct tps6586x *tps6586x, int gpio_base)
  241. {
  242. if (!gpio_base)
  243. return 0;
  244. tps6586x->gpio.owner = THIS_MODULE;
  245. tps6586x->gpio.label = tps6586x->client->name;
  246. tps6586x->gpio.dev = tps6586x->dev;
  247. tps6586x->gpio.base = gpio_base;
  248. tps6586x->gpio.ngpio = 4;
  249. tps6586x->gpio.can_sleep = 1;
  250. /* FIXME: add handling of GPIOs as dedicated inputs */
  251. tps6586x->gpio.direction_output = tps6586x_gpio_output;
  252. tps6586x->gpio.set = tps6586x_gpio_set;
  253. tps6586x->gpio.get = tps6586x_gpio_get;
  254. return gpiochip_add(&tps6586x->gpio);
  255. }
  256. static int __remove_subdev(struct device *dev, void *unused)
  257. {
  258. platform_device_unregister(to_platform_device(dev));
  259. return 0;
  260. }
  261. static int tps6586x_remove_subdevs(struct tps6586x *tps6586x)
  262. {
  263. return device_for_each_child(tps6586x->dev, NULL, __remove_subdev);
  264. }
  265. static void tps6586x_irq_lock(struct irq_data *data)
  266. {
  267. struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data);
  268. mutex_lock(&tps6586x->irq_lock);
  269. }
  270. static void tps6586x_irq_enable(struct irq_data *irq_data)
  271. {
  272. struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
  273. unsigned int __irq = irq_data->irq - tps6586x->irq_base;
  274. const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq];
  275. tps6586x->mask_reg[data->mask_reg] &= ~data->mask_mask;
  276. tps6586x->irq_en |= (1 << __irq);
  277. }
  278. static void tps6586x_irq_disable(struct irq_data *irq_data)
  279. {
  280. struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
  281. unsigned int __irq = irq_data->irq - tps6586x->irq_base;
  282. const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq];
  283. tps6586x->mask_reg[data->mask_reg] |= data->mask_mask;
  284. tps6586x->irq_en &= ~(1 << __irq);
  285. }
  286. static void tps6586x_irq_sync_unlock(struct irq_data *data)
  287. {
  288. struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data);
  289. int i;
  290. for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) {
  291. if (tps6586x->mask_reg[i] != tps6586x->mask_cache[i]) {
  292. if (!WARN_ON(tps6586x_write(tps6586x->dev,
  293. TPS6586X_INT_MASK1 + i,
  294. tps6586x->mask_reg[i])))
  295. tps6586x->mask_cache[i] = tps6586x->mask_reg[i];
  296. }
  297. }
  298. mutex_unlock(&tps6586x->irq_lock);
  299. }
  300. static irqreturn_t tps6586x_irq(int irq, void *data)
  301. {
  302. struct tps6586x *tps6586x = data;
  303. u32 acks;
  304. int ret = 0;
  305. ret = tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1,
  306. sizeof(acks), (uint8_t *)&acks);
  307. if (ret < 0) {
  308. dev_err(tps6586x->dev, "failed to read interrupt status\n");
  309. return IRQ_NONE;
  310. }
  311. acks = le32_to_cpu(acks);
  312. while (acks) {
  313. int i = __ffs(acks);
  314. if (tps6586x->irq_en & (1 << i))
  315. handle_nested_irq(tps6586x->irq_base + i);
  316. acks &= ~(1 << i);
  317. }
  318. return IRQ_HANDLED;
  319. }
  320. static int __devinit tps6586x_irq_init(struct tps6586x *tps6586x, int irq,
  321. int irq_base)
  322. {
  323. int i, ret;
  324. u8 tmp[4];
  325. if (!irq_base) {
  326. dev_warn(tps6586x->dev, "No interrupt support on IRQ base\n");
  327. return -EINVAL;
  328. }
  329. mutex_init(&tps6586x->irq_lock);
  330. for (i = 0; i < 5; i++) {
  331. tps6586x->mask_cache[i] = 0xff;
  332. tps6586x->mask_reg[i] = 0xff;
  333. tps6586x_write(tps6586x->dev, TPS6586X_INT_MASK1 + i, 0xff);
  334. }
  335. tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1, sizeof(tmp), tmp);
  336. tps6586x->irq_base = irq_base;
  337. tps6586x->irq_chip.name = "tps6586x";
  338. tps6586x->irq_chip.irq_enable = tps6586x_irq_enable;
  339. tps6586x->irq_chip.irq_disable = tps6586x_irq_disable;
  340. tps6586x->irq_chip.irq_bus_lock = tps6586x_irq_lock;
  341. tps6586x->irq_chip.irq_bus_sync_unlock = tps6586x_irq_sync_unlock;
  342. for (i = 0; i < ARRAY_SIZE(tps6586x_irqs); i++) {
  343. int __irq = i + tps6586x->irq_base;
  344. irq_set_chip_data(__irq, tps6586x);
  345. irq_set_chip_and_handler(__irq, &tps6586x->irq_chip,
  346. handle_simple_irq);
  347. irq_set_nested_thread(__irq, 1);
  348. #ifdef CONFIG_ARM
  349. set_irq_flags(__irq, IRQF_VALID);
  350. #endif
  351. }
  352. ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT,
  353. "tps6586x", tps6586x);
  354. if (!ret) {
  355. device_init_wakeup(tps6586x->dev, 1);
  356. enable_irq_wake(irq);
  357. }
  358. return ret;
  359. }
  360. static int __devinit tps6586x_add_subdevs(struct tps6586x *tps6586x,
  361. struct tps6586x_platform_data *pdata)
  362. {
  363. struct tps6586x_subdev_info *subdev;
  364. struct platform_device *pdev;
  365. int i, ret = 0;
  366. for (i = 0; i < pdata->num_subdevs; i++) {
  367. subdev = &pdata->subdevs[i];
  368. pdev = platform_device_alloc(subdev->name, subdev->id);
  369. if (!pdev) {
  370. ret = -ENOMEM;
  371. goto failed;
  372. }
  373. pdev->dev.parent = tps6586x->dev;
  374. pdev->dev.platform_data = subdev->platform_data;
  375. ret = platform_device_add(pdev);
  376. if (ret) {
  377. platform_device_put(pdev);
  378. goto failed;
  379. }
  380. }
  381. return 0;
  382. failed:
  383. tps6586x_remove_subdevs(tps6586x);
  384. return ret;
  385. }
  386. static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
  387. const struct i2c_device_id *id)
  388. {
  389. struct tps6586x_platform_data *pdata = client->dev.platform_data;
  390. struct tps6586x *tps6586x;
  391. int ret;
  392. if (!pdata) {
  393. dev_err(&client->dev, "tps6586x requires platform data\n");
  394. return -ENOTSUPP;
  395. }
  396. ret = i2c_smbus_read_byte_data(client, TPS6586X_VERSIONCRC);
  397. if (ret < 0) {
  398. dev_err(&client->dev, "Chip ID read failed: %d\n", ret);
  399. return -EIO;
  400. }
  401. dev_info(&client->dev, "VERSIONCRC is %02x\n", ret);
  402. tps6586x = kzalloc(sizeof(struct tps6586x), GFP_KERNEL);
  403. if (tps6586x == NULL)
  404. return -ENOMEM;
  405. tps6586x->client = client;
  406. tps6586x->dev = &client->dev;
  407. i2c_set_clientdata(client, tps6586x);
  408. mutex_init(&tps6586x->lock);
  409. if (client->irq) {
  410. ret = tps6586x_irq_init(tps6586x, client->irq,
  411. pdata->irq_base);
  412. if (ret) {
  413. dev_err(&client->dev, "IRQ init failed: %d\n", ret);
  414. goto err_irq_init;
  415. }
  416. }
  417. ret = tps6586x_gpio_init(tps6586x, pdata->gpio_base);
  418. if (ret) {
  419. dev_err(&client->dev, "GPIO registration failed: %d\n", ret);
  420. goto err_gpio_init;
  421. }
  422. ret = tps6586x_add_subdevs(tps6586x, pdata);
  423. if (ret) {
  424. dev_err(&client->dev, "add devices failed: %d\n", ret);
  425. goto err_add_devs;
  426. }
  427. return 0;
  428. err_add_devs:
  429. if (pdata->gpio_base) {
  430. ret = gpiochip_remove(&tps6586x->gpio);
  431. if (ret)
  432. dev_err(&client->dev, "Can't remove gpio chip: %d\n",
  433. ret);
  434. }
  435. err_gpio_init:
  436. if (client->irq)
  437. free_irq(client->irq, tps6586x);
  438. err_irq_init:
  439. kfree(tps6586x);
  440. return ret;
  441. }
  442. static int __devexit tps6586x_i2c_remove(struct i2c_client *client)
  443. {
  444. struct tps6586x *tps6586x = i2c_get_clientdata(client);
  445. struct tps6586x_platform_data *pdata = client->dev.platform_data;
  446. int ret;
  447. if (client->irq)
  448. free_irq(client->irq, tps6586x);
  449. if (pdata->gpio_base) {
  450. ret = gpiochip_remove(&tps6586x->gpio);
  451. if (ret)
  452. dev_err(&client->dev, "Can't remove gpio chip: %d\n",
  453. ret);
  454. }
  455. tps6586x_remove_subdevs(tps6586x);
  456. kfree(tps6586x);
  457. return 0;
  458. }
  459. static const struct i2c_device_id tps6586x_id_table[] = {
  460. { "tps6586x", 0 },
  461. { },
  462. };
  463. MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
  464. static struct i2c_driver tps6586x_driver = {
  465. .driver = {
  466. .name = "tps6586x",
  467. .owner = THIS_MODULE,
  468. },
  469. .probe = tps6586x_i2c_probe,
  470. .remove = __devexit_p(tps6586x_i2c_remove),
  471. .id_table = tps6586x_id_table,
  472. };
  473. static int __init tps6586x_init(void)
  474. {
  475. return i2c_add_driver(&tps6586x_driver);
  476. }
  477. subsys_initcall(tps6586x_init);
  478. static void __exit tps6586x_exit(void)
  479. {
  480. i2c_del_driver(&tps6586x_driver);
  481. }
  482. module_exit(tps6586x_exit);
  483. MODULE_DESCRIPTION("TPS6586X core driver");
  484. MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
  485. MODULE_LICENSE("GPL");