pv88080-regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. // SPDX-License-Identifier: GPL-2.0+
  2. //
  3. // pv88080-regulator.c - Regulator device driver for PV88080
  4. // Copyright (C) 2016 Powerventure Semiconductor Ltd.
  5. #include <linux/err.h>
  6. #include <linux/i2c.h>
  7. #include <linux/mod_devicetable.h>
  8. #include <linux/module.h>
  9. #include <linux/of.h>
  10. #include <linux/init.h>
  11. #include <linux/slab.h>
  12. #include <linux/regulator/driver.h>
  13. #include <linux/regulator/machine.h>
  14. #include <linux/regmap.h>
  15. #include <linux/irq.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/regulator/of_regulator.h>
  18. #include "pv88080-regulator.h"
  19. #define PV88080_MAX_REGULATORS 4
  20. /* PV88080 REGULATOR IDs */
  21. enum {
  22. /* BUCKs */
  23. PV88080_ID_BUCK1,
  24. PV88080_ID_BUCK2,
  25. PV88080_ID_BUCK3,
  26. PV88080_ID_HVBUCK,
  27. };
  28. struct pv88080_regulator {
  29. struct regulator_desc desc;
  30. unsigned int mode_reg;
  31. unsigned int conf2;
  32. unsigned int conf5;
  33. };
  34. struct pv88080 {
  35. struct device *dev;
  36. struct regmap *regmap;
  37. struct regulator_dev *rdev[PV88080_MAX_REGULATORS];
  38. unsigned long type;
  39. const struct pv88080_compatible_regmap *regmap_config;
  40. };
  41. struct pv88080_buck_voltage {
  42. int min_uV;
  43. int max_uV;
  44. int uV_step;
  45. };
  46. struct pv88080_buck_regmap {
  47. /* REGS */
  48. int buck_enable_reg;
  49. int buck_vsel_reg;
  50. int buck_mode_reg;
  51. int buck_limit_reg;
  52. int buck_vdac_range_reg;
  53. int buck_vrange_gain_reg;
  54. /* MASKS */
  55. int buck_enable_mask;
  56. int buck_vsel_mask;
  57. int buck_limit_mask;
  58. };
  59. struct pv88080_compatible_regmap {
  60. /* BUCK1, 2, 3 */
  61. struct pv88080_buck_regmap buck_regmap[PV88080_MAX_REGULATORS-1];
  62. /* HVBUCK */
  63. int hvbuck_enable_reg;
  64. int hvbuck_vsel_reg;
  65. int hvbuck_enable_mask;
  66. int hvbuck_vsel_mask;
  67. };
  68. static const struct regmap_config pv88080_regmap_config = {
  69. .reg_bits = 8,
  70. .val_bits = 8,
  71. };
  72. /* Current limits array (in uA) for BUCK1, BUCK2, BUCK3.
  73. * Entry indexes corresponds to register values.
  74. */
  75. static const unsigned int pv88080_buck1_limits[] = {
  76. 3230000, 5130000, 6960000, 8790000
  77. };
  78. static const unsigned int pv88080_buck23_limits[] = {
  79. 1496000, 2393000, 3291000, 4189000
  80. };
  81. static const struct pv88080_buck_voltage pv88080_buck_vol[2] = {
  82. {
  83. .min_uV = 600000,
  84. .max_uV = 1393750,
  85. .uV_step = 6250,
  86. },
  87. {
  88. .min_uV = 1400000,
  89. .max_uV = 2193750,
  90. .uV_step = 6250,
  91. },
  92. };
  93. static const struct pv88080_compatible_regmap pv88080_aa_regs = {
  94. /* BUCK1 */
  95. .buck_regmap[0] = {
  96. .buck_enable_reg = PV88080AA_REG_BUCK1_CONF0,
  97. .buck_vsel_reg = PV88080AA_REG_BUCK1_CONF0,
  98. .buck_mode_reg = PV88080AA_REG_BUCK1_CONF1,
  99. .buck_limit_reg = PV88080AA_REG_BUCK1_CONF1,
  100. .buck_vdac_range_reg = PV88080AA_REG_BUCK1_CONF2,
  101. .buck_vrange_gain_reg = PV88080AA_REG_BUCK1_CONF5,
  102. .buck_enable_mask = PV88080_BUCK1_EN,
  103. .buck_vsel_mask = PV88080_VBUCK1_MASK,
  104. .buck_limit_mask = PV88080_BUCK1_ILIM_MASK,
  105. },
  106. /* BUCK2 */
  107. .buck_regmap[1] = {
  108. .buck_enable_reg = PV88080AA_REG_BUCK2_CONF0,
  109. .buck_vsel_reg = PV88080AA_REG_BUCK2_CONF0,
  110. .buck_mode_reg = PV88080AA_REG_BUCK2_CONF1,
  111. .buck_limit_reg = PV88080AA_REG_BUCK2_CONF1,
  112. .buck_vdac_range_reg = PV88080AA_REG_BUCK2_CONF2,
  113. .buck_vrange_gain_reg = PV88080AA_REG_BUCK2_CONF5,
  114. .buck_enable_mask = PV88080_BUCK2_EN,
  115. .buck_vsel_mask = PV88080_VBUCK2_MASK,
  116. .buck_limit_mask = PV88080_BUCK2_ILIM_MASK,
  117. },
  118. /* BUCK3 */
  119. .buck_regmap[2] = {
  120. .buck_enable_reg = PV88080AA_REG_BUCK3_CONF0,
  121. .buck_vsel_reg = PV88080AA_REG_BUCK3_CONF0,
  122. .buck_mode_reg = PV88080AA_REG_BUCK3_CONF1,
  123. .buck_limit_reg = PV88080AA_REG_BUCK3_CONF1,
  124. .buck_vdac_range_reg = PV88080AA_REG_BUCK3_CONF2,
  125. .buck_vrange_gain_reg = PV88080AA_REG_BUCK3_CONF5,
  126. .buck_enable_mask = PV88080_BUCK3_EN,
  127. .buck_vsel_mask = PV88080_VBUCK3_MASK,
  128. .buck_limit_mask = PV88080_BUCK3_ILIM_MASK,
  129. },
  130. /* HVBUCK */
  131. .hvbuck_enable_reg = PV88080AA_REG_HVBUCK_CONF2,
  132. .hvbuck_vsel_reg = PV88080AA_REG_HVBUCK_CONF1,
  133. .hvbuck_enable_mask = PV88080_HVBUCK_EN,
  134. .hvbuck_vsel_mask = PV88080_VHVBUCK_MASK,
  135. };
  136. static const struct pv88080_compatible_regmap pv88080_ba_regs = {
  137. /* BUCK1 */
  138. .buck_regmap[0] = {
  139. .buck_enable_reg = PV88080BA_REG_BUCK1_CONF0,
  140. .buck_vsel_reg = PV88080BA_REG_BUCK1_CONF0,
  141. .buck_mode_reg = PV88080BA_REG_BUCK1_CONF1,
  142. .buck_limit_reg = PV88080BA_REG_BUCK1_CONF1,
  143. .buck_vdac_range_reg = PV88080BA_REG_BUCK1_CONF2,
  144. .buck_vrange_gain_reg = PV88080BA_REG_BUCK1_CONF5,
  145. .buck_enable_mask = PV88080_BUCK1_EN,
  146. .buck_vsel_mask = PV88080_VBUCK1_MASK,
  147. .buck_limit_mask = PV88080_BUCK1_ILIM_MASK,
  148. },
  149. /* BUCK2 */
  150. .buck_regmap[1] = {
  151. .buck_enable_reg = PV88080BA_REG_BUCK2_CONF0,
  152. .buck_vsel_reg = PV88080BA_REG_BUCK2_CONF0,
  153. .buck_mode_reg = PV88080BA_REG_BUCK2_CONF1,
  154. .buck_limit_reg = PV88080BA_REG_BUCK2_CONF1,
  155. .buck_vdac_range_reg = PV88080BA_REG_BUCK2_CONF2,
  156. .buck_vrange_gain_reg = PV88080BA_REG_BUCK2_CONF5,
  157. .buck_enable_mask = PV88080_BUCK2_EN,
  158. .buck_vsel_mask = PV88080_VBUCK2_MASK,
  159. .buck_limit_mask = PV88080_BUCK2_ILIM_MASK,
  160. },
  161. /* BUCK3 */
  162. .buck_regmap[2] = {
  163. .buck_enable_reg = PV88080BA_REG_BUCK3_CONF0,
  164. .buck_vsel_reg = PV88080BA_REG_BUCK3_CONF0,
  165. .buck_mode_reg = PV88080BA_REG_BUCK3_CONF1,
  166. .buck_limit_reg = PV88080BA_REG_BUCK3_CONF1,
  167. .buck_vdac_range_reg = PV88080BA_REG_BUCK3_CONF2,
  168. .buck_vrange_gain_reg = PV88080BA_REG_BUCK3_CONF5,
  169. .buck_enable_mask = PV88080_BUCK3_EN,
  170. .buck_vsel_mask = PV88080_VBUCK3_MASK,
  171. .buck_limit_mask = PV88080_BUCK3_ILIM_MASK,
  172. },
  173. /* HVBUCK */
  174. .hvbuck_enable_reg = PV88080BA_REG_HVBUCK_CONF2,
  175. .hvbuck_vsel_reg = PV88080BA_REG_HVBUCK_CONF1,
  176. .hvbuck_enable_mask = PV88080_HVBUCK_EN,
  177. .hvbuck_vsel_mask = PV88080_VHVBUCK_MASK,
  178. };
  179. static unsigned int pv88080_buck_get_mode(struct regulator_dev *rdev)
  180. {
  181. struct pv88080_regulator *info = rdev_get_drvdata(rdev);
  182. unsigned int data;
  183. int ret, mode = 0;
  184. ret = regmap_read(rdev->regmap, info->mode_reg, &data);
  185. if (ret < 0)
  186. return ret;
  187. switch (data & PV88080_BUCK1_MODE_MASK) {
  188. case PV88080_BUCK_MODE_SYNC:
  189. mode = REGULATOR_MODE_FAST;
  190. break;
  191. case PV88080_BUCK_MODE_AUTO:
  192. mode = REGULATOR_MODE_NORMAL;
  193. break;
  194. case PV88080_BUCK_MODE_SLEEP:
  195. mode = REGULATOR_MODE_STANDBY;
  196. break;
  197. default:
  198. return -EINVAL;
  199. }
  200. return mode;
  201. }
  202. static int pv88080_buck_set_mode(struct regulator_dev *rdev,
  203. unsigned int mode)
  204. {
  205. struct pv88080_regulator *info = rdev_get_drvdata(rdev);
  206. int val = 0;
  207. switch (mode) {
  208. case REGULATOR_MODE_FAST:
  209. val = PV88080_BUCK_MODE_SYNC;
  210. break;
  211. case REGULATOR_MODE_NORMAL:
  212. val = PV88080_BUCK_MODE_AUTO;
  213. break;
  214. case REGULATOR_MODE_STANDBY:
  215. val = PV88080_BUCK_MODE_SLEEP;
  216. break;
  217. default:
  218. return -EINVAL;
  219. }
  220. return regmap_update_bits(rdev->regmap, info->mode_reg,
  221. PV88080_BUCK1_MODE_MASK, val);
  222. }
  223. static const struct regulator_ops pv88080_buck_ops = {
  224. .get_mode = pv88080_buck_get_mode,
  225. .set_mode = pv88080_buck_set_mode,
  226. .enable = regulator_enable_regmap,
  227. .disable = regulator_disable_regmap,
  228. .is_enabled = regulator_is_enabled_regmap,
  229. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  230. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  231. .list_voltage = regulator_list_voltage_linear,
  232. .set_current_limit = regulator_set_current_limit_regmap,
  233. .get_current_limit = regulator_get_current_limit_regmap,
  234. };
  235. static const struct regulator_ops pv88080_hvbuck_ops = {
  236. .enable = regulator_enable_regmap,
  237. .disable = regulator_disable_regmap,
  238. .is_enabled = regulator_is_enabled_regmap,
  239. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  240. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  241. .list_voltage = regulator_list_voltage_linear,
  242. };
  243. #define PV88080_BUCK(chip, regl_name, min, step, max, limits_array) \
  244. {\
  245. .desc = {\
  246. .id = chip##_ID_##regl_name,\
  247. .name = __stringify(chip##_##regl_name),\
  248. .of_match = of_match_ptr(#regl_name),\
  249. .regulators_node = of_match_ptr("regulators"),\
  250. .type = REGULATOR_VOLTAGE,\
  251. .owner = THIS_MODULE,\
  252. .ops = &pv88080_buck_ops,\
  253. .min_uV = min, \
  254. .uV_step = step, \
  255. .n_voltages = ((max) - (min))/(step) + 1, \
  256. .curr_table = limits_array, \
  257. .n_current_limits = ARRAY_SIZE(limits_array), \
  258. },\
  259. }
  260. #define PV88080_HVBUCK(chip, regl_name, min, step, max) \
  261. {\
  262. .desc = {\
  263. .id = chip##_ID_##regl_name,\
  264. .name = __stringify(chip##_##regl_name),\
  265. .of_match = of_match_ptr(#regl_name),\
  266. .regulators_node = of_match_ptr("regulators"),\
  267. .type = REGULATOR_VOLTAGE,\
  268. .owner = THIS_MODULE,\
  269. .ops = &pv88080_hvbuck_ops,\
  270. .min_uV = min, \
  271. .uV_step = step, \
  272. .n_voltages = ((max) - (min))/(step) + 1, \
  273. },\
  274. }
  275. static struct pv88080_regulator pv88080_regulator_info[] = {
  276. PV88080_BUCK(PV88080, BUCK1, 600000, 6250, 1393750,
  277. pv88080_buck1_limits),
  278. PV88080_BUCK(PV88080, BUCK2, 600000, 6250, 1393750,
  279. pv88080_buck23_limits),
  280. PV88080_BUCK(PV88080, BUCK3, 600000, 6250, 1393750,
  281. pv88080_buck23_limits),
  282. PV88080_HVBUCK(PV88080, HVBUCK, 0, 5000, 1275000),
  283. };
  284. static irqreturn_t pv88080_irq_handler(int irq, void *data)
  285. {
  286. struct pv88080 *chip = data;
  287. int i, reg_val, err, ret = IRQ_NONE;
  288. err = regmap_read(chip->regmap, PV88080_REG_EVENT_A, &reg_val);
  289. if (err < 0)
  290. goto error_i2c;
  291. if (reg_val & PV88080_E_VDD_FLT) {
  292. for (i = 0; i < PV88080_MAX_REGULATORS; i++) {
  293. if (chip->rdev[i] != NULL)
  294. regulator_notifier_call_chain(chip->rdev[i],
  295. REGULATOR_EVENT_UNDER_VOLTAGE,
  296. NULL);
  297. }
  298. err = regmap_write(chip->regmap, PV88080_REG_EVENT_A,
  299. PV88080_E_VDD_FLT);
  300. if (err < 0)
  301. goto error_i2c;
  302. ret = IRQ_HANDLED;
  303. }
  304. if (reg_val & PV88080_E_OVER_TEMP) {
  305. for (i = 0; i < PV88080_MAX_REGULATORS; i++) {
  306. if (chip->rdev[i] != NULL)
  307. regulator_notifier_call_chain(chip->rdev[i],
  308. REGULATOR_EVENT_OVER_TEMP,
  309. NULL);
  310. }
  311. err = regmap_write(chip->regmap, PV88080_REG_EVENT_A,
  312. PV88080_E_OVER_TEMP);
  313. if (err < 0)
  314. goto error_i2c;
  315. ret = IRQ_HANDLED;
  316. }
  317. return ret;
  318. error_i2c:
  319. dev_err(chip->dev, "I2C error : %d\n", err);
  320. return IRQ_NONE;
  321. }
  322. /*
  323. * I2C driver interface functions
  324. */
  325. static int pv88080_i2c_probe(struct i2c_client *i2c)
  326. {
  327. struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev);
  328. struct pv88080 *chip;
  329. const struct pv88080_compatible_regmap *regmap_config;
  330. struct regulator_config config = { };
  331. int i, error, ret;
  332. unsigned int conf2, conf5;
  333. chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88080), GFP_KERNEL);
  334. if (!chip)
  335. return -ENOMEM;
  336. chip->dev = &i2c->dev;
  337. chip->regmap = devm_regmap_init_i2c(i2c, &pv88080_regmap_config);
  338. if (IS_ERR(chip->regmap)) {
  339. error = PTR_ERR(chip->regmap);
  340. dev_err(chip->dev, "Failed to allocate register map: %d\n",
  341. error);
  342. return error;
  343. }
  344. chip->regmap_config = i2c_get_match_data(i2c);
  345. if (!chip->regmap_config)
  346. return -ENODEV;
  347. i2c_set_clientdata(i2c, chip);
  348. if (i2c->irq != 0) {
  349. ret = regmap_write(chip->regmap, PV88080_REG_MASK_A, 0xFF);
  350. if (ret < 0) {
  351. dev_err(chip->dev,
  352. "Failed to mask A reg: %d\n", ret);
  353. return ret;
  354. }
  355. ret = regmap_write(chip->regmap, PV88080_REG_MASK_B, 0xFF);
  356. if (ret < 0) {
  357. dev_err(chip->dev,
  358. "Failed to mask B reg: %d\n", ret);
  359. return ret;
  360. }
  361. ret = regmap_write(chip->regmap, PV88080_REG_MASK_C, 0xFF);
  362. if (ret < 0) {
  363. dev_err(chip->dev,
  364. "Failed to mask C reg: %d\n", ret);
  365. return ret;
  366. }
  367. ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
  368. pv88080_irq_handler,
  369. IRQF_TRIGGER_LOW|IRQF_ONESHOT,
  370. "pv88080", chip);
  371. if (ret != 0) {
  372. dev_err(chip->dev, "Failed to request IRQ: %d\n",
  373. i2c->irq);
  374. return ret;
  375. }
  376. ret = regmap_update_bits(chip->regmap, PV88080_REG_MASK_A,
  377. PV88080_M_VDD_FLT | PV88080_M_OVER_TEMP, 0);
  378. if (ret < 0) {
  379. dev_err(chip->dev,
  380. "Failed to update mask reg: %d\n", ret);
  381. return ret;
  382. }
  383. } else {
  384. dev_warn(chip->dev, "No IRQ configured\n");
  385. }
  386. regmap_config = chip->regmap_config;
  387. config.dev = chip->dev;
  388. config.regmap = chip->regmap;
  389. /* Registeration for BUCK1, 2, 3 */
  390. for (i = 0; i < PV88080_MAX_REGULATORS-1; i++) {
  391. if (init_data)
  392. config.init_data = &init_data[i];
  393. pv88080_regulator_info[i].desc.csel_reg
  394. = regmap_config->buck_regmap[i].buck_limit_reg;
  395. pv88080_regulator_info[i].desc.csel_mask
  396. = regmap_config->buck_regmap[i].buck_limit_mask;
  397. pv88080_regulator_info[i].mode_reg
  398. = regmap_config->buck_regmap[i].buck_mode_reg;
  399. pv88080_regulator_info[i].conf2
  400. = regmap_config->buck_regmap[i].buck_vdac_range_reg;
  401. pv88080_regulator_info[i].conf5
  402. = regmap_config->buck_regmap[i].buck_vrange_gain_reg;
  403. pv88080_regulator_info[i].desc.enable_reg
  404. = regmap_config->buck_regmap[i].buck_enable_reg;
  405. pv88080_regulator_info[i].desc.enable_mask
  406. = regmap_config->buck_regmap[i].buck_enable_mask;
  407. pv88080_regulator_info[i].desc.vsel_reg
  408. = regmap_config->buck_regmap[i].buck_vsel_reg;
  409. pv88080_regulator_info[i].desc.vsel_mask
  410. = regmap_config->buck_regmap[i].buck_vsel_mask;
  411. ret = regmap_read(chip->regmap,
  412. pv88080_regulator_info[i].conf2, &conf2);
  413. if (ret < 0)
  414. return ret;
  415. conf2 = ((conf2 >> PV88080_BUCK_VDAC_RANGE_SHIFT) &
  416. PV88080_BUCK_VDAC_RANGE_MASK);
  417. ret = regmap_read(chip->regmap,
  418. pv88080_regulator_info[i].conf5, &conf5);
  419. if (ret < 0)
  420. return ret;
  421. conf5 = ((conf5 >> PV88080_BUCK_VRANGE_GAIN_SHIFT) &
  422. PV88080_BUCK_VRANGE_GAIN_MASK);
  423. pv88080_regulator_info[i].desc.min_uV =
  424. pv88080_buck_vol[conf2].min_uV * (conf5+1);
  425. pv88080_regulator_info[i].desc.uV_step =
  426. pv88080_buck_vol[conf2].uV_step * (conf5+1);
  427. pv88080_regulator_info[i].desc.n_voltages =
  428. ((pv88080_buck_vol[conf2].max_uV * (conf5+1))
  429. - (pv88080_regulator_info[i].desc.min_uV))
  430. /(pv88080_regulator_info[i].desc.uV_step) + 1;
  431. config.driver_data = (void *)&pv88080_regulator_info[i];
  432. chip->rdev[i] = devm_regulator_register(chip->dev,
  433. &pv88080_regulator_info[i].desc, &config);
  434. if (IS_ERR(chip->rdev[i])) {
  435. dev_err(chip->dev,
  436. "Failed to register PV88080 regulator\n");
  437. return PTR_ERR(chip->rdev[i]);
  438. }
  439. }
  440. pv88080_regulator_info[PV88080_ID_HVBUCK].desc.enable_reg
  441. = regmap_config->hvbuck_enable_reg;
  442. pv88080_regulator_info[PV88080_ID_HVBUCK].desc.enable_mask
  443. = regmap_config->hvbuck_enable_mask;
  444. pv88080_regulator_info[PV88080_ID_HVBUCK].desc.vsel_reg
  445. = regmap_config->hvbuck_vsel_reg;
  446. pv88080_regulator_info[PV88080_ID_HVBUCK].desc.vsel_mask
  447. = regmap_config->hvbuck_vsel_mask;
  448. /* Registeration for HVBUCK */
  449. if (init_data)
  450. config.init_data = &init_data[PV88080_ID_HVBUCK];
  451. config.driver_data = (void *)&pv88080_regulator_info[PV88080_ID_HVBUCK];
  452. chip->rdev[PV88080_ID_HVBUCK] = devm_regulator_register(chip->dev,
  453. &pv88080_regulator_info[PV88080_ID_HVBUCK].desc, &config);
  454. if (IS_ERR(chip->rdev[PV88080_ID_HVBUCK])) {
  455. dev_err(chip->dev, "Failed to register PV88080 regulator\n");
  456. return PTR_ERR(chip->rdev[PV88080_ID_HVBUCK]);
  457. }
  458. return 0;
  459. }
  460. static const struct of_device_id pv88080_dt_ids[] = {
  461. { .compatible = "pvs,pv88080", .data = &pv88080_aa_regs },
  462. { .compatible = "pvs,pv88080-aa", .data = &pv88080_aa_regs },
  463. { .compatible = "pvs,pv88080-ba", .data = &pv88080_ba_regs },
  464. {}
  465. };
  466. MODULE_DEVICE_TABLE(of, pv88080_dt_ids);
  467. static const struct i2c_device_id pv88080_i2c_id[] = {
  468. { "pv88080", (kernel_ulong_t)&pv88080_aa_regs },
  469. { "pv88080-aa", (kernel_ulong_t)&pv88080_aa_regs },
  470. { "pv88080-ba", (kernel_ulong_t)&pv88080_ba_regs },
  471. {}
  472. };
  473. MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id);
  474. static struct i2c_driver pv88080_regulator_driver = {
  475. .driver = {
  476. .name = "pv88080",
  477. .probe_type = PROBE_PREFER_ASYNCHRONOUS,
  478. .of_match_table = pv88080_dt_ids,
  479. },
  480. .probe = pv88080_i2c_probe,
  481. .id_table = pv88080_i2c_id,
  482. };
  483. module_i2c_driver(pv88080_regulator_driver);
  484. MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
  485. MODULE_DESCRIPTION("Regulator device driver for Powerventure PV88080");
  486. MODULE_LICENSE("GPL");