tps65023-regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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(1)
  65. #define TPS65023_REG_CTRL2_DCDC3 BIT(0)
  66. /* LDO_CTRL bitfields */
  67. #define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4)
  68. #define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0x0F << ((ldo_id)*4))
  69. /* Number of step-down converters available */
  70. #define TPS65023_NUM_DCDC 3
  71. /* Number of LDO voltage regulators available */
  72. #define TPS65023_NUM_LDO 2
  73. /* Number of total regulators available */
  74. #define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
  75. /* DCDCs */
  76. #define TPS65023_DCDC_1 0
  77. #define TPS65023_DCDC_2 1
  78. #define TPS65023_DCDC_3 2
  79. /* LDOs */
  80. #define TPS65023_LDO_1 3
  81. #define TPS65023_LDO_2 4
  82. #define TPS65023_MAX_REG_ID TPS65023_LDO_2
  83. /* Supported voltage values for regulators */
  84. static const u16 VCORE_VSEL_table[] = {
  85. 800, 825, 850, 875,
  86. 900, 925, 950, 975,
  87. 1000, 1025, 1050, 1075,
  88. 1100, 1125, 1150, 1175,
  89. 1200, 1225, 1250, 1275,
  90. 1300, 1325, 1350, 1375,
  91. 1400, 1425, 1450, 1475,
  92. 1500, 1525, 1550, 1600,
  93. };
  94. /* Supported voltage values for LDO regulators for tps65020 */
  95. static const u16 TPS65020_LDO1_VSEL_table[] = {
  96. 1000, 1050, 1100, 1300,
  97. 1800, 2500, 3000, 3300,
  98. };
  99. static const u16 TPS65020_LDO2_VSEL_table[] = {
  100. 1000, 1050, 1100, 1300,
  101. 1800, 2500, 3000, 3300,
  102. };
  103. /* Supported voltage values for LDO regulators
  104. * for tps65021 and tps65023 */
  105. static const u16 TPS65023_LDO1_VSEL_table[] = {
  106. 1000, 1100, 1300, 1800,
  107. 2200, 2600, 2800, 3150,
  108. };
  109. static const u16 TPS65023_LDO2_VSEL_table[] = {
  110. 1050, 1200, 1300, 1800,
  111. 2500, 2800, 3000, 3300,
  112. };
  113. /* Regulator specific details */
  114. struct tps_info {
  115. const char *name;
  116. unsigned min_uV;
  117. unsigned max_uV;
  118. bool fixed;
  119. u8 table_len;
  120. const u16 *table;
  121. };
  122. /* PMIC details */
  123. struct tps_pmic {
  124. struct regulator_desc desc[TPS65023_NUM_REGULATOR];
  125. struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
  126. const struct tps_info *info[TPS65023_NUM_REGULATOR];
  127. struct regmap *regmap;
  128. u8 core_regulator;
  129. };
  130. /* Struct passed as driver data */
  131. struct tps_driver_data {
  132. const struct tps_info *info;
  133. u8 core_regulator;
  134. };
  135. static int tps65023_dcdc_is_enabled(struct regulator_dev *dev)
  136. {
  137. struct tps_pmic *tps = rdev_get_drvdata(dev);
  138. int data, dcdc = rdev_get_id(dev);
  139. int ret;
  140. u8 shift;
  141. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  142. return -EINVAL;
  143. shift = TPS65023_NUM_REGULATOR - dcdc;
  144. ret = regmap_read(tps->regmap, TPS65023_REG_REG_CTRL, &data);
  145. if (ret != 0)
  146. return ret;
  147. else
  148. return (data & 1<<shift) ? 1 : 0;
  149. }
  150. static int tps65023_ldo_is_enabled(struct regulator_dev *dev)
  151. {
  152. struct tps_pmic *tps = rdev_get_drvdata(dev);
  153. int data, ldo = rdev_get_id(dev);
  154. int ret;
  155. u8 shift;
  156. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  157. return -EINVAL;
  158. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  159. ret = regmap_read(tps->regmap, TPS65023_REG_REG_CTRL, &data);
  160. if (ret != 0)
  161. return ret;
  162. else
  163. return (data & 1<<shift) ? 1 : 0;
  164. }
  165. static int tps65023_dcdc_enable(struct regulator_dev *dev)
  166. {
  167. struct tps_pmic *tps = rdev_get_drvdata(dev);
  168. int dcdc = rdev_get_id(dev);
  169. u8 shift;
  170. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  171. return -EINVAL;
  172. shift = TPS65023_NUM_REGULATOR - dcdc;
  173. return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 1 << shift);
  174. }
  175. static int tps65023_dcdc_disable(struct regulator_dev *dev)
  176. {
  177. struct tps_pmic *tps = rdev_get_drvdata(dev);
  178. int dcdc = rdev_get_id(dev);
  179. u8 shift;
  180. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  181. return -EINVAL;
  182. shift = TPS65023_NUM_REGULATOR - dcdc;
  183. return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 0);
  184. }
  185. static int tps65023_ldo_enable(struct regulator_dev *dev)
  186. {
  187. struct tps_pmic *tps = rdev_get_drvdata(dev);
  188. int ldo = rdev_get_id(dev);
  189. u8 shift;
  190. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  191. return -EINVAL;
  192. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  193. return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 1 << shift);
  194. }
  195. static int tps65023_ldo_disable(struct regulator_dev *dev)
  196. {
  197. struct tps_pmic *tps = rdev_get_drvdata(dev);
  198. int ldo = rdev_get_id(dev);
  199. u8 shift;
  200. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  201. return -EINVAL;
  202. shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
  203. return regmap_update_bits(tps->regmap, TPS65023_REG_REG_CTRL, 1 << shift, 0);
  204. }
  205. static int tps65023_dcdc_get_voltage(struct regulator_dev *dev)
  206. {
  207. struct tps_pmic *tps = rdev_get_drvdata(dev);
  208. int ret;
  209. int data, dcdc = rdev_get_id(dev);
  210. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  211. return -EINVAL;
  212. if (dcdc == tps->core_regulator) {
  213. ret = regmap_read(tps->regmap, TPS65023_REG_DEF_CORE, &data);
  214. if (ret != 0)
  215. return ret;
  216. data &= (tps->info[dcdc]->table_len - 1);
  217. return tps->info[dcdc]->table[data] * 1000;
  218. } else
  219. return tps->info[dcdc]->min_uV;
  220. }
  221. static int tps65023_dcdc_set_voltage_sel(struct regulator_dev *dev,
  222. unsigned selector)
  223. {
  224. struct tps_pmic *tps = rdev_get_drvdata(dev);
  225. int dcdc = rdev_get_id(dev);
  226. int ret;
  227. if (dcdc != tps->core_regulator)
  228. return -EINVAL;
  229. ret = regmap_write(tps->regmap, TPS65023_REG_DEF_CORE, selector);
  230. if (ret)
  231. goto out;
  232. /* Tell the chip that we have changed the value in DEFCORE
  233. * and its time to update the core voltage
  234. */
  235. ret = regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
  236. TPS65023_REG_CTRL2_GO, TPS65023_REG_CTRL2_GO);
  237. out:
  238. return ret;
  239. }
  240. static int tps65023_ldo_get_voltage(struct regulator_dev *dev)
  241. {
  242. struct tps_pmic *tps = rdev_get_drvdata(dev);
  243. int data, ldo = rdev_get_id(dev);
  244. int ret;
  245. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  246. return -EINVAL;
  247. ret = regmap_read(tps->regmap, TPS65023_REG_LDO_CTRL, &data);
  248. if (ret != 0)
  249. return ret;
  250. data >>= (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1));
  251. data &= (tps->info[ldo]->table_len - 1);
  252. return tps->info[ldo]->table[data] * 1000;
  253. }
  254. static int tps65023_ldo_set_voltage_sel(struct regulator_dev *dev,
  255. unsigned selector)
  256. {
  257. struct tps_pmic *tps = rdev_get_drvdata(dev);
  258. int ldo_index = rdev_get_id(dev) - TPS65023_LDO_1;
  259. return regmap_update_bits(tps->regmap, TPS65023_REG_LDO_CTRL,
  260. TPS65023_LDO_CTRL_LDOx_MASK(ldo_index),
  261. selector << TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_index));
  262. }
  263. static int tps65023_dcdc_list_voltage(struct regulator_dev *dev,
  264. unsigned selector)
  265. {
  266. struct tps_pmic *tps = rdev_get_drvdata(dev);
  267. int dcdc = rdev_get_id(dev);
  268. if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
  269. return -EINVAL;
  270. if (dcdc == tps->core_regulator) {
  271. if (selector >= tps->info[dcdc]->table_len)
  272. return -EINVAL;
  273. else
  274. return tps->info[dcdc]->table[selector] * 1000;
  275. } else
  276. return tps->info[dcdc]->min_uV;
  277. }
  278. static int tps65023_ldo_list_voltage(struct regulator_dev *dev,
  279. unsigned selector)
  280. {
  281. struct tps_pmic *tps = rdev_get_drvdata(dev);
  282. int ldo = rdev_get_id(dev);
  283. if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
  284. return -EINVAL;
  285. if (selector >= tps->info[ldo]->table_len)
  286. return -EINVAL;
  287. else
  288. return tps->info[ldo]->table[selector] * 1000;
  289. }
  290. /* Operations permitted on VDCDCx */
  291. static struct regulator_ops tps65023_dcdc_ops = {
  292. .is_enabled = tps65023_dcdc_is_enabled,
  293. .enable = tps65023_dcdc_enable,
  294. .disable = tps65023_dcdc_disable,
  295. .get_voltage = tps65023_dcdc_get_voltage,
  296. .set_voltage_sel = tps65023_dcdc_set_voltage_sel,
  297. .list_voltage = tps65023_dcdc_list_voltage,
  298. };
  299. /* Operations permitted on LDOx */
  300. static struct regulator_ops tps65023_ldo_ops = {
  301. .is_enabled = tps65023_ldo_is_enabled,
  302. .enable = tps65023_ldo_enable,
  303. .disable = tps65023_ldo_disable,
  304. .get_voltage = tps65023_ldo_get_voltage,
  305. .set_voltage_sel = tps65023_ldo_set_voltage_sel,
  306. .list_voltage = tps65023_ldo_list_voltage,
  307. };
  308. static struct regmap_config tps65023_regmap_config = {
  309. .reg_bits = 8,
  310. .val_bits = 8,
  311. };
  312. static int __devinit tps_65023_probe(struct i2c_client *client,
  313. const struct i2c_device_id *id)
  314. {
  315. const struct tps_driver_data *drv_data = (void *)id->driver_data;
  316. const struct tps_info *info = drv_data->info;
  317. struct regulator_config config = { };
  318. struct regulator_init_data *init_data;
  319. struct regulator_dev *rdev;
  320. struct tps_pmic *tps;
  321. int i;
  322. int error;
  323. if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
  324. return -EIO;
  325. /**
  326. * init_data points to array of regulator_init structures
  327. * coming from the board-evm file.
  328. */
  329. init_data = client->dev.platform_data;
  330. if (!init_data)
  331. return -EIO;
  332. tps = kzalloc(sizeof(*tps), GFP_KERNEL);
  333. if (!tps)
  334. return -ENOMEM;
  335. tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config);
  336. if (IS_ERR(tps->regmap)) {
  337. error = PTR_ERR(tps->regmap);
  338. dev_err(&client->dev, "Failed to allocate register map: %d\n",
  339. error);
  340. goto fail_alloc;
  341. }
  342. /* common for all regulators */
  343. tps->core_regulator = drv_data->core_regulator;
  344. for (i = 0; i < TPS65023_NUM_REGULATOR; i++, info++, init_data++) {
  345. /* Store regulator specific information */
  346. tps->info[i] = info;
  347. tps->desc[i].name = info->name;
  348. tps->desc[i].id = i;
  349. tps->desc[i].n_voltages = info->table_len;
  350. tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
  351. &tps65023_ldo_ops : &tps65023_dcdc_ops);
  352. tps->desc[i].type = REGULATOR_VOLTAGE;
  353. tps->desc[i].owner = THIS_MODULE;
  354. config.dev = &client->dev;
  355. config.init_data = init_data;
  356. config.driver_data = tps;
  357. /* Register the regulators */
  358. rdev = regulator_register(&tps->desc[i], &config);
  359. if (IS_ERR(rdev)) {
  360. dev_err(&client->dev, "failed to register %s\n",
  361. id->name);
  362. error = PTR_ERR(rdev);
  363. goto fail;
  364. }
  365. /* Save regulator for cleanup */
  366. tps->rdev[i] = rdev;
  367. }
  368. i2c_set_clientdata(client, tps);
  369. /* Enable setting output voltage by I2C */
  370. regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
  371. TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ);
  372. return 0;
  373. fail:
  374. while (--i >= 0)
  375. regulator_unregister(tps->rdev[i]);
  376. regmap_exit(tps->regmap);
  377. fail_alloc:
  378. kfree(tps);
  379. return error;
  380. }
  381. static int __devexit tps_65023_remove(struct i2c_client *client)
  382. {
  383. struct tps_pmic *tps = i2c_get_clientdata(client);
  384. int i;
  385. for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
  386. regulator_unregister(tps->rdev[i]);
  387. regmap_exit(tps->regmap);
  388. kfree(tps);
  389. return 0;
  390. }
  391. static const struct tps_info tps65020_regs[] = {
  392. {
  393. .name = "VDCDC1",
  394. .min_uV = 3300000,
  395. .max_uV = 3300000,
  396. .fixed = 1,
  397. },
  398. {
  399. .name = "VDCDC2",
  400. .min_uV = 1800000,
  401. .max_uV = 1800000,
  402. .fixed = 1,
  403. },
  404. {
  405. .name = "VDCDC3",
  406. .min_uV = 800000,
  407. .max_uV = 1600000,
  408. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  409. .table = VCORE_VSEL_table,
  410. },
  411. {
  412. .name = "LDO1",
  413. .min_uV = 1000000,
  414. .max_uV = 3150000,
  415. .table_len = ARRAY_SIZE(TPS65020_LDO1_VSEL_table),
  416. .table = TPS65020_LDO1_VSEL_table,
  417. },
  418. {
  419. .name = "LDO2",
  420. .min_uV = 1050000,
  421. .max_uV = 3300000,
  422. .table_len = ARRAY_SIZE(TPS65020_LDO2_VSEL_table),
  423. .table = TPS65020_LDO2_VSEL_table,
  424. },
  425. };
  426. static const struct tps_info tps65021_regs[] = {
  427. {
  428. .name = "VDCDC1",
  429. .min_uV = 3300000,
  430. .max_uV = 3300000,
  431. .fixed = 1,
  432. },
  433. {
  434. .name = "VDCDC2",
  435. .min_uV = 1800000,
  436. .max_uV = 1800000,
  437. .fixed = 1,
  438. },
  439. {
  440. .name = "VDCDC3",
  441. .min_uV = 800000,
  442. .max_uV = 1600000,
  443. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  444. .table = VCORE_VSEL_table,
  445. },
  446. {
  447. .name = "LDO1",
  448. .min_uV = 1000000,
  449. .max_uV = 3150000,
  450. .table_len = ARRAY_SIZE(TPS65023_LDO1_VSEL_table),
  451. .table = TPS65023_LDO1_VSEL_table,
  452. },
  453. {
  454. .name = "LDO2",
  455. .min_uV = 1050000,
  456. .max_uV = 3300000,
  457. .table_len = ARRAY_SIZE(TPS65023_LDO2_VSEL_table),
  458. .table = TPS65023_LDO2_VSEL_table,
  459. },
  460. };
  461. static const struct tps_info tps65023_regs[] = {
  462. {
  463. .name = "VDCDC1",
  464. .min_uV = 800000,
  465. .max_uV = 1600000,
  466. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  467. .table = VCORE_VSEL_table,
  468. },
  469. {
  470. .name = "VDCDC2",
  471. .min_uV = 3300000,
  472. .max_uV = 3300000,
  473. .fixed = 1,
  474. },
  475. {
  476. .name = "VDCDC3",
  477. .min_uV = 1800000,
  478. .max_uV = 1800000,
  479. .fixed = 1,
  480. },
  481. {
  482. .name = "LDO1",
  483. .min_uV = 1000000,
  484. .max_uV = 3150000,
  485. .table_len = ARRAY_SIZE(TPS65023_LDO1_VSEL_table),
  486. .table = TPS65023_LDO1_VSEL_table,
  487. },
  488. {
  489. .name = "LDO2",
  490. .min_uV = 1050000,
  491. .max_uV = 3300000,
  492. .table_len = ARRAY_SIZE(TPS65023_LDO2_VSEL_table),
  493. .table = TPS65023_LDO2_VSEL_table,
  494. },
  495. };
  496. static struct tps_driver_data tps65020_drv_data = {
  497. .info = tps65020_regs,
  498. .core_regulator = TPS65023_DCDC_3,
  499. };
  500. static struct tps_driver_data tps65021_drv_data = {
  501. .info = tps65021_regs,
  502. .core_regulator = TPS65023_DCDC_3,
  503. };
  504. static struct tps_driver_data tps65023_drv_data = {
  505. .info = tps65023_regs,
  506. .core_regulator = TPS65023_DCDC_1,
  507. };
  508. static const struct i2c_device_id tps_65023_id[] = {
  509. {.name = "tps65023",
  510. .driver_data = (unsigned long) &tps65023_drv_data},
  511. {.name = "tps65021",
  512. .driver_data = (unsigned long) &tps65021_drv_data,},
  513. {.name = "tps65020",
  514. .driver_data = (unsigned long) &tps65020_drv_data},
  515. { },
  516. };
  517. MODULE_DEVICE_TABLE(i2c, tps_65023_id);
  518. static struct i2c_driver tps_65023_i2c_driver = {
  519. .driver = {
  520. .name = "tps65023",
  521. .owner = THIS_MODULE,
  522. },
  523. .probe = tps_65023_probe,
  524. .remove = __devexit_p(tps_65023_remove),
  525. .id_table = tps_65023_id,
  526. };
  527. static int __init tps_65023_init(void)
  528. {
  529. return i2c_add_driver(&tps_65023_i2c_driver);
  530. }
  531. subsys_initcall(tps_65023_init);
  532. static void __exit tps_65023_cleanup(void)
  533. {
  534. i2c_del_driver(&tps_65023_i2c_driver);
  535. }
  536. module_exit(tps_65023_cleanup);
  537. MODULE_AUTHOR("Texas Instruments");
  538. MODULE_DESCRIPTION("TPS65023 voltage regulator driver");
  539. MODULE_LICENSE("GPL v2");