tps65023-regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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_init_data *init_data;
  318. struct regulator_dev *rdev;
  319. struct tps_pmic *tps;
  320. int i;
  321. int error;
  322. if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
  323. return -EIO;
  324. /**
  325. * init_data points to array of regulator_init structures
  326. * coming from the board-evm file.
  327. */
  328. init_data = client->dev.platform_data;
  329. if (!init_data)
  330. return -EIO;
  331. tps = kzalloc(sizeof(*tps), GFP_KERNEL);
  332. if (!tps)
  333. return -ENOMEM;
  334. tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config);
  335. if (IS_ERR(tps->regmap)) {
  336. error = PTR_ERR(tps->regmap);
  337. dev_err(&client->dev, "Failed to allocate register map: %d\n",
  338. error);
  339. goto fail_alloc;
  340. }
  341. /* common for all regulators */
  342. tps->core_regulator = drv_data->core_regulator;
  343. for (i = 0; i < TPS65023_NUM_REGULATOR; i++, info++, init_data++) {
  344. /* Store regulator specific information */
  345. tps->info[i] = info;
  346. tps->desc[i].name = info->name;
  347. tps->desc[i].id = i;
  348. tps->desc[i].n_voltages = info->table_len;
  349. tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
  350. &tps65023_ldo_ops : &tps65023_dcdc_ops);
  351. tps->desc[i].type = REGULATOR_VOLTAGE;
  352. tps->desc[i].owner = THIS_MODULE;
  353. /* Register the regulators */
  354. rdev = regulator_register(&tps->desc[i], &client->dev,
  355. init_data, tps, NULL);
  356. if (IS_ERR(rdev)) {
  357. dev_err(&client->dev, "failed to register %s\n",
  358. id->name);
  359. error = PTR_ERR(rdev);
  360. goto fail;
  361. }
  362. /* Save regulator for cleanup */
  363. tps->rdev[i] = rdev;
  364. }
  365. i2c_set_clientdata(client, tps);
  366. /* Enable setting output voltage by I2C */
  367. regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2,
  368. TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ);
  369. return 0;
  370. fail:
  371. while (--i >= 0)
  372. regulator_unregister(tps->rdev[i]);
  373. regmap_exit(tps->regmap);
  374. fail_alloc:
  375. kfree(tps);
  376. return error;
  377. }
  378. static int __devexit tps_65023_remove(struct i2c_client *client)
  379. {
  380. struct tps_pmic *tps = i2c_get_clientdata(client);
  381. int i;
  382. for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
  383. regulator_unregister(tps->rdev[i]);
  384. regmap_exit(tps->regmap);
  385. kfree(tps);
  386. return 0;
  387. }
  388. static const struct tps_info tps65020_regs[] = {
  389. {
  390. .name = "VDCDC1",
  391. .min_uV = 3300000,
  392. .max_uV = 3300000,
  393. .fixed = 1,
  394. },
  395. {
  396. .name = "VDCDC2",
  397. .min_uV = 1800000,
  398. .max_uV = 1800000,
  399. .fixed = 1,
  400. },
  401. {
  402. .name = "VDCDC3",
  403. .min_uV = 800000,
  404. .max_uV = 1600000,
  405. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  406. .table = VCORE_VSEL_table,
  407. },
  408. {
  409. .name = "LDO1",
  410. .min_uV = 1000000,
  411. .max_uV = 3150000,
  412. .table_len = ARRAY_SIZE(TPS65020_LDO1_VSEL_table),
  413. .table = TPS65020_LDO1_VSEL_table,
  414. },
  415. {
  416. .name = "LDO2",
  417. .min_uV = 1050000,
  418. .max_uV = 3300000,
  419. .table_len = ARRAY_SIZE(TPS65020_LDO2_VSEL_table),
  420. .table = TPS65020_LDO2_VSEL_table,
  421. },
  422. };
  423. static const struct tps_info tps65021_regs[] = {
  424. {
  425. .name = "VDCDC1",
  426. .min_uV = 3300000,
  427. .max_uV = 3300000,
  428. .fixed = 1,
  429. },
  430. {
  431. .name = "VDCDC2",
  432. .min_uV = 1800000,
  433. .max_uV = 1800000,
  434. .fixed = 1,
  435. },
  436. {
  437. .name = "VDCDC3",
  438. .min_uV = 800000,
  439. .max_uV = 1600000,
  440. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  441. .table = VCORE_VSEL_table,
  442. },
  443. {
  444. .name = "LDO1",
  445. .min_uV = 1000000,
  446. .max_uV = 3150000,
  447. .table_len = ARRAY_SIZE(TPS65023_LDO1_VSEL_table),
  448. .table = TPS65023_LDO1_VSEL_table,
  449. },
  450. {
  451. .name = "LDO2",
  452. .min_uV = 1050000,
  453. .max_uV = 3300000,
  454. .table_len = ARRAY_SIZE(TPS65023_LDO2_VSEL_table),
  455. .table = TPS65023_LDO2_VSEL_table,
  456. },
  457. };
  458. static const struct tps_info tps65023_regs[] = {
  459. {
  460. .name = "VDCDC1",
  461. .min_uV = 800000,
  462. .max_uV = 1600000,
  463. .table_len = ARRAY_SIZE(VCORE_VSEL_table),
  464. .table = VCORE_VSEL_table,
  465. },
  466. {
  467. .name = "VDCDC2",
  468. .min_uV = 3300000,
  469. .max_uV = 3300000,
  470. .fixed = 1,
  471. },
  472. {
  473. .name = "VDCDC3",
  474. .min_uV = 1800000,
  475. .max_uV = 1800000,
  476. .fixed = 1,
  477. },
  478. {
  479. .name = "LDO1",
  480. .min_uV = 1000000,
  481. .max_uV = 3150000,
  482. .table_len = ARRAY_SIZE(TPS65023_LDO1_VSEL_table),
  483. .table = TPS65023_LDO1_VSEL_table,
  484. },
  485. {
  486. .name = "LDO2",
  487. .min_uV = 1050000,
  488. .max_uV = 3300000,
  489. .table_len = ARRAY_SIZE(TPS65023_LDO2_VSEL_table),
  490. .table = TPS65023_LDO2_VSEL_table,
  491. },
  492. };
  493. static struct tps_driver_data tps65020_drv_data = {
  494. .info = tps65020_regs,
  495. .core_regulator = TPS65023_DCDC_3,
  496. };
  497. static struct tps_driver_data tps65021_drv_data = {
  498. .info = tps65021_regs,
  499. .core_regulator = TPS65023_DCDC_3,
  500. };
  501. static struct tps_driver_data tps65023_drv_data = {
  502. .info = tps65023_regs,
  503. .core_regulator = TPS65023_DCDC_1,
  504. };
  505. static const struct i2c_device_id tps_65023_id[] = {
  506. {.name = "tps65023",
  507. .driver_data = (unsigned long) &tps65023_drv_data},
  508. {.name = "tps65021",
  509. .driver_data = (unsigned long) &tps65021_drv_data,},
  510. {.name = "tps65020",
  511. .driver_data = (unsigned long) &tps65020_drv_data},
  512. { },
  513. };
  514. MODULE_DEVICE_TABLE(i2c, tps_65023_id);
  515. static struct i2c_driver tps_65023_i2c_driver = {
  516. .driver = {
  517. .name = "tps65023",
  518. .owner = THIS_MODULE,
  519. },
  520. .probe = tps_65023_probe,
  521. .remove = __devexit_p(tps_65023_remove),
  522. .id_table = tps_65023_id,
  523. };
  524. static int __init tps_65023_init(void)
  525. {
  526. return i2c_add_driver(&tps_65023_i2c_driver);
  527. }
  528. subsys_initcall(tps_65023_init);
  529. static void __exit tps_65023_cleanup(void)
  530. {
  531. i2c_del_driver(&tps_65023_i2c_driver);
  532. }
  533. module_exit(tps_65023_cleanup);
  534. MODULE_AUTHOR("Texas Instruments");
  535. MODULE_DESCRIPTION("TPS65023 voltage regulator driver");
  536. MODULE_LICENSE("GPL v2");