tps65023-regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * tps65023-regulator.c
  3. *
  4. * Supports TPS65023 Regulator
  5. *
  6. * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation version 2.
  11. *
  12. * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
  13. * whether express or implied; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/module.h>
  19. #include <linux/init.h>
  20. #include <linux/err.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/regulator/driver.h>
  23. #include <linux/regulator/machine.h>
  24. #include <linux/i2c.h>
  25. #include <linux/delay.h>
  26. #include <linux/slab.h>
  27. #include <linux/regmap.h>
  28. /* Register definitions */
  29. #define TPS65023_REG_VERSION 0
  30. #define TPS65023_REG_PGOODZ 1
  31. #define TPS65023_REG_MASK 2
  32. #define TPS65023_REG_REG_CTRL 3
  33. #define TPS65023_REG_CON_CTRL 4
  34. #define TPS65023_REG_CON_CTRL2 5
  35. #define TPS65023_REG_DEF_CORE 6
  36. #define TPS65023_REG_DEFSLEW 7
  37. #define TPS65023_REG_LDO_CTRL 8
  38. /* PGOODZ bitfields */
  39. #define TPS65023_PGOODZ_PWRFAILZ BIT(7)
  40. #define TPS65023_PGOODZ_LOWBATTZ BIT(6)
  41. #define TPS65023_PGOODZ_VDCDC1 BIT(5)
  42. #define TPS65023_PGOODZ_VDCDC2 BIT(4)
  43. #define TPS65023_PGOODZ_VDCDC3 BIT(3)
  44. #define TPS65023_PGOODZ_LDO2 BIT(2)
  45. #define TPS65023_PGOODZ_LDO1 BIT(1)
  46. /* MASK bitfields */
  47. #define TPS65023_MASK_PWRFAILZ BIT(7)
  48. #define TPS65023_MASK_LOWBATTZ BIT(6)
  49. #define TPS65023_MASK_VDCDC1 BIT(5)
  50. #define TPS65023_MASK_VDCDC2 BIT(4)
  51. #define TPS65023_MASK_VDCDC3 BIT(3)
  52. #define TPS65023_MASK_LDO2 BIT(2)
  53. #define TPS65023_MASK_LDO1 BIT(1)
  54. /* REG_CTRL bitfields */
  55. #define TPS65023_REG_CTRL_VDCDC1_EN BIT(5)
  56. #define TPS65023_REG_CTRL_VDCDC2_EN BIT(4)
  57. #define TPS65023_REG_CTRL_VDCDC3_EN BIT(3)
  58. #define TPS65023_REG_CTRL_LDO2_EN BIT(2)
  59. #define TPS65023_REG_CTRL_LDO1_EN BIT(1)
  60. /* REG_CTRL2 bitfields */
  61. #define TPS65023_REG_CTRL2_GO BIT(7)
  62. #define TPS65023_REG_CTRL2_CORE_ADJ BIT(6)
  63. #define TPS65023_REG_CTRL2_DCDC2 BIT(2)
  64. #define TPS65023_REG_CTRL2_DCDC1 BIT(2)
  65. #define TPS65023_REG_CTRL2_DCDC3 BIT(0)
  66. /* REG_CTRL2 bitfields */
  67. #define TPS65023_REG_CTRL2_GO BIT(7)
  68. #define TPS65023_REG_CTRL2_CORE_ADJ BIT(6)
  69. #define TPS65023_REG_CTRL2_DCDC2 BIT(2)
  70. #define TPS65023_REG_CTRL2_DCDC1 BIT(1)
  71. #define TPS65023_REG_CTRL2_DCDC3 BIT(0)
  72. /* LDO_CTRL bitfields */
  73. #define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4)
  74. #define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0xF0 >> ((ldo_id)*4))
  75. /* Number of step-down converters available */
  76. #define TPS65023_NUM_DCDC 3
  77. /* Number of LDO voltage regulators available */
  78. #define TPS65023_NUM_LDO 2
  79. /* Number of total regulators available */
  80. #define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
  81. /* DCDCs */
  82. #define TPS65023_DCDC_1 0
  83. #define TPS65023_DCDC_2 1
  84. #define TPS65023_DCDC_3 2
  85. /* LDOs */
  86. #define TPS65023_LDO_1 3
  87. #define TPS65023_LDO_2 4
  88. #define TPS65023_MAX_REG_ID TPS65023_LDO_2
  89. /* Supported voltage values for regulators */
  90. static const u16 VDCDC1_VSEL_table[] = {
  91. 800, 825, 850, 875,
  92. 900, 925, 950, 975,
  93. 1000, 1025, 1050, 1075,
  94. 1100, 1125, 1150, 1175,
  95. 1200, 1225, 1250, 1275,
  96. 1300, 1325, 1350, 1375,
  97. 1400, 1425, 1450, 1475,
  98. 1500, 1525, 1550, 1600,
  99. };
  100. static const u16 LDO1_VSEL_table[] = {
  101. 1000, 1100, 1300, 1800,
  102. 2200, 2600, 2800, 3150,
  103. };
  104. static const u16 LDO2_VSEL_table[] = {
  105. 1050, 1200, 1300, 1800,
  106. 2500, 2800, 3000, 3300,
  107. };
  108. static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
  109. 0, 0, ARRAY_SIZE(LDO1_VSEL_table),
  110. ARRAY_SIZE(LDO2_VSEL_table)};
  111. /* Regulator specific details */
  112. struct tps_info {
  113. const char *name;
  114. unsigned min_uV;
  115. unsigned max_uV;
  116. bool fixed;
  117. u8 table_len;
  118. const u16 *table;
  119. };
  120. /* PMIC details */
  121. struct tps_pmic {
  122. struct regulator_desc desc[TPS65023_NUM_REGULATOR];
  123. struct i2c_client *client;
  124. struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
  125. const struct tps_info *info[TPS65023_NUM_REGULATOR];
  126. struct regmap *regmap;
  127. };
  128. static int tps_65023_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
  129. {
  130. return regmap_update_bits(tps->regmap, reg, mask, mask);
  131. }
  132. static int tps_65023_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
  133. {
  134. return regmap_update_bits(tps->regmap, reg, mask, 0);
  135. }
  136. static int tps_65023_reg_read(struct tps_pmic *tps, u8 reg)
  137. {
  138. unsigned int val;
  139. int ret;
  140. ret = regmap_read(tps->regmap, reg, &val);
  141. if (ret != 0)
  142. return ret;
  143. else
  144. return val;
  145. }
  146. static int tps_65023_reg_write(struct tps_pmic *tps, u8 reg, u8 val)
  147. {
  148. return regmap_write(tps->regmap, reg, val);
  149. }
  150. static int tps65023_dcdc_is_enabled(struct regulator_dev *dev)
  151. {
  152. struct tps_pmic *tps = rdev_get_drvdata(dev);
  153. int data, dcdc = rdev_get_id(dev);
  154. u8 shift;
  155. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  156. return -EINVAL;
  157. shift = TPS65023_NUM_REGULATOR - dcdc;
  158. data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
  159. if (data < 0)
  160. return data;
  161. else
  162. return (data & 1<<shift) ? 1 : 0;
  163. }
  164. static int tps65023_ldo_is_enabled(struct regulator_dev *dev)
  165. {
  166. struct tps_pmic *tps = rdev_get_drvdata(dev);
  167. int data, ldo = rdev_get_id(dev);
  168. u8 shift;
  169. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  170. return -EINVAL;
  171. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  172. data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
  173. if (data < 0)
  174. return data;
  175. else
  176. return (data & 1<<shift) ? 1 : 0;
  177. }
  178. static int tps65023_dcdc_enable(struct regulator_dev *dev)
  179. {
  180. struct tps_pmic *tps = rdev_get_drvdata(dev);
  181. int dcdc = rdev_get_id(dev);
  182. u8 shift;
  183. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  184. return -EINVAL;
  185. shift = TPS65023_NUM_REGULATOR - dcdc;
  186. return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
  187. }
  188. static int tps65023_dcdc_disable(struct regulator_dev *dev)
  189. {
  190. struct tps_pmic *tps = rdev_get_drvdata(dev);
  191. int dcdc = rdev_get_id(dev);
  192. u8 shift;
  193. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  194. return -EINVAL;
  195. shift = TPS65023_NUM_REGULATOR - dcdc;
  196. return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
  197. }
  198. static int tps65023_ldo_enable(struct regulator_dev *dev)
  199. {
  200. struct tps_pmic *tps = rdev_get_drvdata(dev);
  201. int ldo = rdev_get_id(dev);
  202. u8 shift;
  203. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  204. return -EINVAL;
  205. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  206. return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
  207. }
  208. static int tps65023_ldo_disable(struct regulator_dev *dev)
  209. {
  210. struct tps_pmic *tps = rdev_get_drvdata(dev);
  211. int ldo = rdev_get_id(dev);
  212. u8 shift;
  213. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  214. return -EINVAL;
  215. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  216. return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
  217. }
  218. static int tps65023_dcdc_get_voltage(struct regulator_dev *dev)
  219. {
  220. struct tps_pmic *tps = rdev_get_drvdata(dev);
  221. int data, dcdc = rdev_get_id(dev);
  222. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  223. return -EINVAL;
  224. if (dcdc == TPS65023_DCDC_1) {
  225. data = tps_65023_reg_read(tps, TPS65023_REG_DEF_CORE);
  226. if (data < 0)
  227. return data;
  228. data &= (tps->info[dcdc]->table_len - 1);
  229. return tps->info[dcdc]->table[data] * 1000;
  230. } else
  231. return tps->info[dcdc]->min_uV;
  232. }
  233. static int tps65023_dcdc_set_voltage(struct regulator_dev *dev,
  234. int min_uV, int max_uV,
  235. unsigned *selector)
  236. {
  237. struct tps_pmic *tps = rdev_get_drvdata(dev);
  238. int dcdc = rdev_get_id(dev);
  239. int vsel;
  240. if (dcdc != TPS65023_DCDC_1)
  241. return -EINVAL;
  242. if (min_uV < tps->info[dcdc]->min_uV
  243. || min_uV > tps->info[dcdc]->max_uV)
  244. return -EINVAL;
  245. if (max_uV < tps->info[dcdc]->min_uV
  246. || max_uV > tps->info[dcdc]->max_uV)
  247. return -EINVAL;
  248. for (vsel = 0; vsel < tps->info[dcdc]->table_len; vsel++) {
  249. int mV = tps->info[dcdc]->table[vsel];
  250. int uV = mV * 1000;
  251. /* Break at the first in-range value */
  252. if (min_uV <= uV && uV <= max_uV)
  253. break;
  254. }
  255. *selector = vsel;
  256. /* write to the register in case we found a match */
  257. if (vsel == tps->info[dcdc]->table_len)
  258. return -EINVAL;
  259. else
  260. return tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel);
  261. }
  262. static int tps65023_ldo_get_voltage(struct regulator_dev *dev)
  263. {
  264. struct tps_pmic *tps = rdev_get_drvdata(dev);
  265. int data, ldo = rdev_get_id(dev);
  266. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  267. return -EINVAL;
  268. data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
  269. if (data < 0)
  270. return data;
  271. data >>= (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1));
  272. data &= (tps->info[ldo]->table_len - 1);
  273. return tps->info[ldo]->table[data] * 1000;
  274. }
  275. static int tps65023_ldo_set_voltage(struct regulator_dev *dev,
  276. int min_uV, int max_uV, unsigned *selector)
  277. {
  278. struct tps_pmic *tps = rdev_get_drvdata(dev);
  279. int data, vsel, ldo = rdev_get_id(dev);
  280. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  281. return -EINVAL;
  282. if (min_uV < tps->info[ldo]->min_uV || min_uV > tps->info[ldo]->max_uV)
  283. return -EINVAL;
  284. if (max_uV < tps->info[ldo]->min_uV || max_uV > tps->info[ldo]->max_uV)
  285. return -EINVAL;
  286. for (vsel = 0; vsel < tps->info[ldo]->table_len; vsel++) {
  287. int mV = tps->info[ldo]->table[vsel];
  288. int uV = mV * 1000;
  289. /* Break at the first in-range value */
  290. if (min_uV <= uV && uV <= max_uV)
  291. break;
  292. }
  293. if (vsel == tps->info[ldo]->table_len)
  294. return -EINVAL;
  295. *selector = vsel;
  296. data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
  297. if (data < 0)
  298. return data;
  299. data &= TPS65023_LDO_CTRL_LDOx_MASK(ldo - TPS65023_LDO_1);
  300. data |= (vsel << (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1)));
  301. return tps_65023_reg_write(tps, TPS65023_REG_LDO_CTRL, data);
  302. }
  303. static int tps65023_dcdc_list_voltage(struct regulator_dev *dev,
  304. unsigned selector)
  305. {
  306. struct tps_pmic *tps = rdev_get_drvdata(dev);
  307. int dcdc = rdev_get_id(dev);
  308. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  309. return -EINVAL;
  310. if (dcdc == TPS65023_DCDC_1) {
  311. if (selector >= tps->info[dcdc]->table_len)
  312. return -EINVAL;
  313. else
  314. return tps->info[dcdc]->table[selector] * 1000;
  315. } else
  316. return tps->info[dcdc]->min_uV;
  317. }
  318. static int tps65023_ldo_list_voltage(struct regulator_dev *dev,
  319. unsigned selector)
  320. {
  321. struct tps_pmic *tps = rdev_get_drvdata(dev);
  322. int ldo = rdev_get_id(dev);
  323. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  324. return -EINVAL;
  325. if (selector >= tps->info[ldo]->table_len)
  326. return -EINVAL;
  327. else
  328. return tps->info[ldo]->table[selector] * 1000;
  329. }
  330. /* Operations permitted on VDCDCx */
  331. static struct regulator_ops tps65023_dcdc_ops = {
  332. .is_enabled = tps65023_dcdc_is_enabled,
  333. .enable = tps65023_dcdc_enable,
  334. .disable = tps65023_dcdc_disable,
  335. .get_voltage = tps65023_dcdc_get_voltage,
  336. .set_voltage = tps65023_dcdc_set_voltage,
  337. .list_voltage = tps65023_dcdc_list_voltage,
  338. };
  339. /* Operations permitted on LDOx */
  340. static struct regulator_ops tps65023_ldo_ops = {
  341. .is_enabled = tps65023_ldo_is_enabled,
  342. .enable = tps65023_ldo_enable,
  343. .disable = tps65023_ldo_disable,
  344. .get_voltage = tps65023_ldo_get_voltage,
  345. .set_voltage = tps65023_ldo_set_voltage,
  346. .list_voltage = tps65023_ldo_list_voltage,
  347. };
  348. static struct regmap_config tps65023_regmap_config = {
  349. .reg_bits = 8,
  350. .val_bits = 8,
  351. };
  352. static int __devinit tps_65023_probe(struct i2c_client *client,
  353. const struct i2c_device_id *id)
  354. {
  355. const struct tps_info *info = (void *)id->driver_data;
  356. struct regulator_init_data *init_data;
  357. struct regulator_dev *rdev;
  358. struct tps_pmic *tps;
  359. int i;
  360. int error;
  361. if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
  362. return -EIO;
  363. /**
  364. * init_data points to array of regulator_init structures
  365. * coming from the board-evm file.
  366. */
  367. init_data = client->dev.platform_data;
  368. if (!init_data)
  369. return -EIO;
  370. tps = kzalloc(sizeof(*tps), GFP_KERNEL);
  371. if (!tps)
  372. return -ENOMEM;
  373. tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config);
  374. if (IS_ERR(tps->regmap)) {
  375. error = PTR_ERR(tps->regmap);
  376. dev_err(&client->dev, "Failed to allocate register map: %d\n",
  377. error);
  378. goto fail_alloc;
  379. }
  380. /* common for all regulators */
  381. tps->client = client;
  382. for (i = 0; i < TPS65023_NUM_REGULATOR; i++, info++, init_data++) {
  383. /* Store regulator specific information */
  384. tps->info[i] = info;
  385. tps->desc[i].name = info->name;
  386. tps->desc[i].id = i;
  387. tps->desc[i].n_voltages = num_voltages[i];
  388. tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
  389. &tps65023_ldo_ops : &tps65023_dcdc_ops);
  390. tps->desc[i].type = REGULATOR_VOLTAGE;
  391. tps->desc[i].owner = THIS_MODULE;
  392. /* Register the regulators */
  393. rdev = regulator_register(&tps->desc[i], &client->dev,
  394. init_data, tps);
  395. if (IS_ERR(rdev)) {
  396. dev_err(&client->dev, "failed to register %s\n",
  397. id->name);
  398. error = PTR_ERR(rdev);
  399. goto fail;
  400. }
  401. /* Save regulator for cleanup */
  402. tps->rdev[i] = rdev;
  403. }
  404. i2c_set_clientdata(client, tps);
  405. /* Enable setting output voltage by I2C */
  406. tps_65023_clear_bits(tps, TPS65023_REG_CON_CTRL2,
  407. TPS65023_REG_CTRL2_CORE_ADJ);
  408. /* Enable setting output voltage by I2C */
  409. tps_65023_clear_bits(tps, TPS65023_REG_CON_CTRL2,
  410. TPS65023_REG_CTRL2_CORE_ADJ);
  411. return 0;
  412. fail:
  413. while (--i >= 0)
  414. regulator_unregister(tps->rdev[i]);
  415. regmap_exit(tps->regmap);
  416. fail_alloc:
  417. kfree(tps);
  418. return error;
  419. }
  420. /**
  421. * tps_65023_remove - TPS65023 driver i2c remove handler
  422. * @client: i2c driver client device structure
  423. *
  424. * Unregister TPS driver as an i2c client device driver
  425. */
  426. static int __devexit tps_65023_remove(struct i2c_client *client)
  427. {
  428. struct tps_pmic *tps = i2c_get_clientdata(client);
  429. int i;
  430. for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
  431. regulator_unregister(tps->rdev[i]);
  432. regmap_exit(tps->regmap);
  433. kfree(tps);
  434. return 0;
  435. }
  436. static const struct tps_info tps65023_regs[] = {
  437. {
  438. .name = "VDCDC1",
  439. .min_uV = 800000,
  440. .max_uV = 1600000,
  441. .table_len = ARRAY_SIZE(VDCDC1_VSEL_table),
  442. .table = VDCDC1_VSEL_table,
  443. },
  444. {
  445. .name = "VDCDC2",
  446. .min_uV = 3300000,
  447. .max_uV = 3300000,
  448. .fixed = 1,
  449. },
  450. {
  451. .name = "VDCDC3",
  452. .min_uV = 1800000,
  453. .max_uV = 1800000,
  454. .fixed = 1,
  455. },
  456. {
  457. .name = "LDO1",
  458. .min_uV = 1000000,
  459. .max_uV = 3150000,
  460. .table_len = ARRAY_SIZE(LDO1_VSEL_table),
  461. .table = LDO1_VSEL_table,
  462. },
  463. {
  464. .name = "LDO2",
  465. .min_uV = 1050000,
  466. .max_uV = 3300000,
  467. .table_len = ARRAY_SIZE(LDO2_VSEL_table),
  468. .table = LDO2_VSEL_table,
  469. },
  470. };
  471. static const struct i2c_device_id tps_65023_id[] = {
  472. {.name = "tps65023",
  473. .driver_data = (unsigned long) tps65023_regs,},
  474. {.name = "tps65021",
  475. .driver_data = (unsigned long) tps65023_regs,},
  476. { },
  477. };
  478. MODULE_DEVICE_TABLE(i2c, tps_65023_id);
  479. static struct i2c_driver tps_65023_i2c_driver = {
  480. .driver = {
  481. .name = "tps65023",
  482. .owner = THIS_MODULE,
  483. },
  484. .probe = tps_65023_probe,
  485. .remove = __devexit_p(tps_65023_remove),
  486. .id_table = tps_65023_id,
  487. };
  488. /**
  489. * tps_65023_init
  490. *
  491. * Module init function
  492. */
  493. static int __init tps_65023_init(void)
  494. {
  495. return i2c_add_driver(&tps_65023_i2c_driver);
  496. }
  497. subsys_initcall(tps_65023_init);
  498. /**
  499. * tps_65023_cleanup
  500. *
  501. * Module exit function
  502. */
  503. static void __exit tps_65023_cleanup(void)
  504. {
  505. i2c_del_driver(&tps_65023_i2c_driver);
  506. }
  507. module_exit(tps_65023_cleanup);
  508. MODULE_AUTHOR("Texas Instruments");
  509. MODULE_DESCRIPTION("TPS65023 voltage regulator driver");
  510. MODULE_LICENSE("GPL v2");