mcp16502.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // MCP16502 PMIC driver
  4. //
  5. // Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries
  6. //
  7. // Author: Andrei Stefanescu <[email protected]>
  8. //
  9. // Inspired from tps65086-regulator.c
  10. #include <linux/gpio.h>
  11. #include <linux/i2c.h>
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/regmap.h>
  17. #include <linux/regulator/driver.h>
  18. #include <linux/suspend.h>
  19. #include <linux/gpio/consumer.h>
  20. #define VDD_LOW_SEL 0x0D
  21. #define VDD_HIGH_SEL 0x3F
  22. #define MCP16502_FLT BIT(7)
  23. #define MCP16502_DVSR GENMASK(3, 2)
  24. #define MCP16502_ENS BIT(0)
  25. /*
  26. * The PMIC has four sets of registers corresponding to four power modes:
  27. * Performance, Active, Low-power, Hibernate.
  28. *
  29. * Registers:
  30. * Each regulator has a register for each power mode. To access a register
  31. * for a specific regulator and mode BASE_* and OFFSET_* need to be added.
  32. *
  33. * Operating modes:
  34. * In order for the PMIC to transition to operating modes it has to be
  35. * controlled via GPIO lines called LPM and HPM.
  36. *
  37. * The registers are fully configurable such that you can put all regulators in
  38. * a low-power state while the PMIC is in Active mode. They are supposed to be
  39. * configured at startup and then simply transition to/from a global low-power
  40. * state by setting the GPIO lpm pin high/low.
  41. *
  42. * This driver keeps the PMIC in Active mode, Low-power state is set for the
  43. * regulators by enabling/disabling operating mode (FPWM or Auto PFM).
  44. *
  45. * The PMIC's Low-power and Hibernate modes are used during standby/suspend.
  46. * To enter standby/suspend the PMIC will go to Low-power mode. From there, it
  47. * will transition to Hibernate when the PWRHLD line is set to low by the MPU.
  48. */
  49. /*
  50. * This function is useful for iterating over all regulators and accessing their
  51. * registers in a generic way or accessing a regulator device by its id.
  52. */
  53. #define MCP16502_REG_BASE(i, r) ((((i) + 1) << 4) + MCP16502_REG_##r)
  54. #define MCP16502_STAT_BASE(i) ((i) + 5)
  55. #define MCP16502_OPMODE_ACTIVE REGULATOR_MODE_NORMAL
  56. #define MCP16502_OPMODE_LPM REGULATOR_MODE_IDLE
  57. #define MCP16502_OPMODE_HIB REGULATOR_MODE_STANDBY
  58. #define MCP16502_MODE_AUTO_PFM 0
  59. #define MCP16502_MODE_FPWM BIT(6)
  60. #define MCP16502_VSEL 0x3F
  61. #define MCP16502_EN BIT(7)
  62. #define MCP16502_MODE BIT(6)
  63. #define MCP16502_MIN_REG 0x0
  64. #define MCP16502_MAX_REG 0x65
  65. /**
  66. * enum mcp16502_reg - MCP16502 regulators's registers
  67. * @MCP16502_REG_A: active state register
  68. * @MCP16502_REG_LPM: low power mode state register
  69. * @MCP16502_REG_HIB: hibernate state register
  70. * @MCP16502_REG_SEQ: startup sequence register
  71. * @MCP16502_REG_CFG: configuration register
  72. */
  73. enum mcp16502_reg {
  74. MCP16502_REG_A,
  75. MCP16502_REG_LPM,
  76. MCP16502_REG_HIB,
  77. MCP16502_REG_HPM,
  78. MCP16502_REG_SEQ,
  79. MCP16502_REG_CFG,
  80. };
  81. /* Ramp delay (uV/us) for buck1, ldo1, ldo2. */
  82. static const unsigned int mcp16502_ramp_b1l12[] = {
  83. 6250, 3125, 2083, 1563
  84. };
  85. /* Ramp delay (uV/us) for buck2, buck3, buck4. */
  86. static const unsigned int mcp16502_ramp_b234[] = {
  87. 3125, 1563, 1042, 781
  88. };
  89. static unsigned int mcp16502_of_map_mode(unsigned int mode)
  90. {
  91. if (mode == REGULATOR_MODE_NORMAL || mode == REGULATOR_MODE_IDLE)
  92. return mode;
  93. return REGULATOR_MODE_INVALID;
  94. }
  95. #define MCP16502_REGULATOR(_name, _id, _ranges, _ops, _ramp_table) \
  96. [_id] = { \
  97. .name = _name, \
  98. .regulators_node = of_match_ptr("regulators"), \
  99. .id = _id, \
  100. .ops = &(_ops), \
  101. .type = REGULATOR_VOLTAGE, \
  102. .owner = THIS_MODULE, \
  103. .n_voltages = MCP16502_VSEL + 1, \
  104. .linear_ranges = _ranges, \
  105. .linear_min_sel = VDD_LOW_SEL, \
  106. .n_linear_ranges = ARRAY_SIZE(_ranges), \
  107. .of_match = of_match_ptr(_name), \
  108. .of_map_mode = mcp16502_of_map_mode, \
  109. .vsel_reg = (((_id) + 1) << 4), \
  110. .vsel_mask = MCP16502_VSEL, \
  111. .enable_reg = (((_id) + 1) << 4), \
  112. .enable_mask = MCP16502_EN, \
  113. .ramp_reg = MCP16502_REG_BASE(_id, CFG), \
  114. .ramp_mask = MCP16502_DVSR, \
  115. .ramp_delay_table = _ramp_table, \
  116. .n_ramp_values = ARRAY_SIZE(_ramp_table), \
  117. }
  118. enum {
  119. BUCK1 = 0,
  120. BUCK2,
  121. BUCK3,
  122. BUCK4,
  123. LDO1,
  124. LDO2,
  125. NUM_REGULATORS
  126. };
  127. /*
  128. * struct mcp16502 - PMIC representation
  129. * @lpm: LPM GPIO descriptor
  130. */
  131. struct mcp16502 {
  132. struct gpio_desc *lpm;
  133. };
  134. /*
  135. * mcp16502_gpio_set_mode() - set the GPIO corresponding value
  136. *
  137. * Used to prepare transitioning into hibernate or resuming from it.
  138. */
  139. static void mcp16502_gpio_set_mode(struct mcp16502 *mcp, int mode)
  140. {
  141. switch (mode) {
  142. case MCP16502_OPMODE_ACTIVE:
  143. gpiod_set_value(mcp->lpm, 0);
  144. break;
  145. case MCP16502_OPMODE_LPM:
  146. case MCP16502_OPMODE_HIB:
  147. gpiod_set_value(mcp->lpm, 1);
  148. break;
  149. default:
  150. pr_err("%s: %d invalid\n", __func__, mode);
  151. }
  152. }
  153. /*
  154. * mcp16502_get_reg() - get the PMIC's state configuration register for opmode
  155. *
  156. * @rdev: the regulator whose register we are searching
  157. * @opmode: the PMIC's operating mode ACTIVE, Low-power, Hibernate
  158. */
  159. static int mcp16502_get_state_reg(struct regulator_dev *rdev, int opmode)
  160. {
  161. switch (opmode) {
  162. case MCP16502_OPMODE_ACTIVE:
  163. return MCP16502_REG_BASE(rdev_get_id(rdev), A);
  164. case MCP16502_OPMODE_LPM:
  165. return MCP16502_REG_BASE(rdev_get_id(rdev), LPM);
  166. case MCP16502_OPMODE_HIB:
  167. return MCP16502_REG_BASE(rdev_get_id(rdev), HIB);
  168. default:
  169. return -EINVAL;
  170. }
  171. }
  172. /*
  173. * mcp16502_get_mode() - return the current operating mode of a regulator
  174. *
  175. * Note: all functions that are not part of entering/exiting standby/suspend
  176. * use the Active mode registers.
  177. *
  178. * Note: this is different from the PMIC's operatig mode, it is the
  179. * MODE bit from the regulator's register.
  180. */
  181. static unsigned int mcp16502_get_mode(struct regulator_dev *rdev)
  182. {
  183. unsigned int val;
  184. int ret, reg;
  185. reg = mcp16502_get_state_reg(rdev, MCP16502_OPMODE_ACTIVE);
  186. if (reg < 0)
  187. return reg;
  188. ret = regmap_read(rdev->regmap, reg, &val);
  189. if (ret)
  190. return ret;
  191. switch (val & MCP16502_MODE) {
  192. case MCP16502_MODE_FPWM:
  193. return REGULATOR_MODE_NORMAL;
  194. case MCP16502_MODE_AUTO_PFM:
  195. return REGULATOR_MODE_IDLE;
  196. default:
  197. return REGULATOR_MODE_INVALID;
  198. }
  199. }
  200. /*
  201. * _mcp16502_set_mode() - helper for set_mode and set_suspend_mode
  202. *
  203. * @rdev: the regulator for which we are setting the mode
  204. * @mode: the regulator's mode (the one from MODE bit)
  205. * @opmode: the PMIC's operating mode: Active/Low-power/Hibernate
  206. */
  207. static int _mcp16502_set_mode(struct regulator_dev *rdev, unsigned int mode,
  208. unsigned int op_mode)
  209. {
  210. int val;
  211. int reg;
  212. reg = mcp16502_get_state_reg(rdev, op_mode);
  213. if (reg < 0)
  214. return reg;
  215. switch (mode) {
  216. case REGULATOR_MODE_NORMAL:
  217. val = MCP16502_MODE_FPWM;
  218. break;
  219. case REGULATOR_MODE_IDLE:
  220. val = MCP16502_MODE_AUTO_PFM;
  221. break;
  222. default:
  223. return -EINVAL;
  224. }
  225. reg = regmap_update_bits(rdev->regmap, reg, MCP16502_MODE, val);
  226. return reg;
  227. }
  228. /*
  229. * mcp16502_set_mode() - regulator_ops set_mode
  230. */
  231. static int mcp16502_set_mode(struct regulator_dev *rdev, unsigned int mode)
  232. {
  233. return _mcp16502_set_mode(rdev, mode, MCP16502_OPMODE_ACTIVE);
  234. }
  235. /*
  236. * mcp16502_get_status() - regulator_ops get_status
  237. */
  238. static int mcp16502_get_status(struct regulator_dev *rdev)
  239. {
  240. int ret;
  241. unsigned int val;
  242. ret = regmap_read(rdev->regmap, MCP16502_STAT_BASE(rdev_get_id(rdev)),
  243. &val);
  244. if (ret)
  245. return ret;
  246. if (val & MCP16502_FLT)
  247. return REGULATOR_STATUS_ERROR;
  248. else if (val & MCP16502_ENS)
  249. return REGULATOR_STATUS_ON;
  250. else if (!(val & MCP16502_ENS))
  251. return REGULATOR_STATUS_OFF;
  252. return REGULATOR_STATUS_UNDEFINED;
  253. }
  254. static int mcp16502_set_voltage_time_sel(struct regulator_dev *rdev,
  255. unsigned int old_sel,
  256. unsigned int new_sel)
  257. {
  258. static const u8 us_ramp[] = { 8, 16, 24, 32 };
  259. int id = rdev_get_id(rdev);
  260. unsigned int uV_delta, val;
  261. int ret;
  262. ret = regmap_read(rdev->regmap, MCP16502_REG_BASE(id, CFG), &val);
  263. if (ret)
  264. return ret;
  265. val = (val & MCP16502_DVSR) >> 2;
  266. uV_delta = abs(new_sel * rdev->desc->linear_ranges->step -
  267. old_sel * rdev->desc->linear_ranges->step);
  268. switch (id) {
  269. case BUCK1:
  270. case LDO1:
  271. case LDO2:
  272. ret = DIV_ROUND_CLOSEST(uV_delta * us_ramp[val],
  273. mcp16502_ramp_b1l12[val]);
  274. break;
  275. case BUCK2:
  276. case BUCK3:
  277. case BUCK4:
  278. ret = DIV_ROUND_CLOSEST(uV_delta * us_ramp[val],
  279. mcp16502_ramp_b234[val]);
  280. break;
  281. default:
  282. return -EINVAL;
  283. }
  284. return ret;
  285. }
  286. #ifdef CONFIG_SUSPEND
  287. /*
  288. * mcp16502_suspend_get_target_reg() - get the reg of the target suspend PMIC
  289. * mode
  290. */
  291. static int mcp16502_suspend_get_target_reg(struct regulator_dev *rdev)
  292. {
  293. switch (pm_suspend_target_state) {
  294. case PM_SUSPEND_STANDBY:
  295. return mcp16502_get_state_reg(rdev, MCP16502_OPMODE_LPM);
  296. case PM_SUSPEND_ON:
  297. case PM_SUSPEND_MEM:
  298. return mcp16502_get_state_reg(rdev, MCP16502_OPMODE_HIB);
  299. default:
  300. dev_err(&rdev->dev, "invalid suspend target: %d\n",
  301. pm_suspend_target_state);
  302. }
  303. return -EINVAL;
  304. }
  305. /*
  306. * mcp16502_set_suspend_voltage() - regulator_ops set_suspend_voltage
  307. */
  308. static int mcp16502_set_suspend_voltage(struct regulator_dev *rdev, int uV)
  309. {
  310. int sel = regulator_map_voltage_linear_range(rdev, uV, uV);
  311. int reg = mcp16502_suspend_get_target_reg(rdev);
  312. if (sel < 0)
  313. return sel;
  314. if (reg < 0)
  315. return reg;
  316. return regmap_update_bits(rdev->regmap, reg, MCP16502_VSEL, sel);
  317. }
  318. /*
  319. * mcp16502_set_suspend_mode() - regulator_ops set_suspend_mode
  320. */
  321. static int mcp16502_set_suspend_mode(struct regulator_dev *rdev,
  322. unsigned int mode)
  323. {
  324. switch (pm_suspend_target_state) {
  325. case PM_SUSPEND_STANDBY:
  326. return _mcp16502_set_mode(rdev, mode, MCP16502_OPMODE_LPM);
  327. case PM_SUSPEND_ON:
  328. case PM_SUSPEND_MEM:
  329. return _mcp16502_set_mode(rdev, mode, MCP16502_OPMODE_HIB);
  330. default:
  331. dev_err(&rdev->dev, "invalid suspend target: %d\n",
  332. pm_suspend_target_state);
  333. }
  334. return -EINVAL;
  335. }
  336. /*
  337. * mcp16502_set_suspend_enable() - regulator_ops set_suspend_enable
  338. */
  339. static int mcp16502_set_suspend_enable(struct regulator_dev *rdev)
  340. {
  341. int reg = mcp16502_suspend_get_target_reg(rdev);
  342. if (reg < 0)
  343. return reg;
  344. return regmap_update_bits(rdev->regmap, reg, MCP16502_EN, MCP16502_EN);
  345. }
  346. /*
  347. * mcp16502_set_suspend_disable() - regulator_ops set_suspend_disable
  348. */
  349. static int mcp16502_set_suspend_disable(struct regulator_dev *rdev)
  350. {
  351. int reg = mcp16502_suspend_get_target_reg(rdev);
  352. if (reg < 0)
  353. return reg;
  354. return regmap_update_bits(rdev->regmap, reg, MCP16502_EN, 0);
  355. }
  356. #endif /* CONFIG_SUSPEND */
  357. static const struct regulator_ops mcp16502_buck_ops = {
  358. .list_voltage = regulator_list_voltage_linear_range,
  359. .map_voltage = regulator_map_voltage_linear_range,
  360. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  361. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  362. .enable = regulator_enable_regmap,
  363. .disable = regulator_disable_regmap,
  364. .is_enabled = regulator_is_enabled_regmap,
  365. .get_status = mcp16502_get_status,
  366. .set_voltage_time_sel = mcp16502_set_voltage_time_sel,
  367. .set_ramp_delay = regulator_set_ramp_delay_regmap,
  368. .set_mode = mcp16502_set_mode,
  369. .get_mode = mcp16502_get_mode,
  370. #ifdef CONFIG_SUSPEND
  371. .set_suspend_voltage = mcp16502_set_suspend_voltage,
  372. .set_suspend_mode = mcp16502_set_suspend_mode,
  373. .set_suspend_enable = mcp16502_set_suspend_enable,
  374. .set_suspend_disable = mcp16502_set_suspend_disable,
  375. #endif /* CONFIG_SUSPEND */
  376. };
  377. /*
  378. * LDOs cannot change operating modes.
  379. */
  380. static const struct regulator_ops mcp16502_ldo_ops = {
  381. .list_voltage = regulator_list_voltage_linear_range,
  382. .map_voltage = regulator_map_voltage_linear_range,
  383. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  384. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  385. .enable = regulator_enable_regmap,
  386. .disable = regulator_disable_regmap,
  387. .is_enabled = regulator_is_enabled_regmap,
  388. .get_status = mcp16502_get_status,
  389. .set_voltage_time_sel = mcp16502_set_voltage_time_sel,
  390. .set_ramp_delay = regulator_set_ramp_delay_regmap,
  391. #ifdef CONFIG_SUSPEND
  392. .set_suspend_voltage = mcp16502_set_suspend_voltage,
  393. .set_suspend_enable = mcp16502_set_suspend_enable,
  394. .set_suspend_disable = mcp16502_set_suspend_disable,
  395. #endif /* CONFIG_SUSPEND */
  396. };
  397. static const struct of_device_id mcp16502_ids[] = {
  398. { .compatible = "microchip,mcp16502", },
  399. {}
  400. };
  401. MODULE_DEVICE_TABLE(of, mcp16502_ids);
  402. static const struct linear_range b1l12_ranges[] = {
  403. REGULATOR_LINEAR_RANGE(1200000, VDD_LOW_SEL, VDD_HIGH_SEL, 50000),
  404. };
  405. static const struct linear_range b234_ranges[] = {
  406. REGULATOR_LINEAR_RANGE(600000, VDD_LOW_SEL, VDD_HIGH_SEL, 25000),
  407. };
  408. static const struct regulator_desc mcp16502_desc[] = {
  409. /* MCP16502_REGULATOR(_name, _id, ranges, regulator_ops, ramp_table) */
  410. MCP16502_REGULATOR("VDD_IO", BUCK1, b1l12_ranges, mcp16502_buck_ops,
  411. mcp16502_ramp_b1l12),
  412. MCP16502_REGULATOR("VDD_DDR", BUCK2, b234_ranges, mcp16502_buck_ops,
  413. mcp16502_ramp_b234),
  414. MCP16502_REGULATOR("VDD_CORE", BUCK3, b234_ranges, mcp16502_buck_ops,
  415. mcp16502_ramp_b234),
  416. MCP16502_REGULATOR("VDD_OTHER", BUCK4, b234_ranges, mcp16502_buck_ops,
  417. mcp16502_ramp_b234),
  418. MCP16502_REGULATOR("LDO1", LDO1, b1l12_ranges, mcp16502_ldo_ops,
  419. mcp16502_ramp_b1l12),
  420. MCP16502_REGULATOR("LDO2", LDO2, b1l12_ranges, mcp16502_ldo_ops,
  421. mcp16502_ramp_b1l12)
  422. };
  423. static const struct regmap_range mcp16502_ranges[] = {
  424. regmap_reg_range(MCP16502_MIN_REG, MCP16502_MAX_REG)
  425. };
  426. static const struct regmap_access_table mcp16502_yes_reg_table = {
  427. .yes_ranges = mcp16502_ranges,
  428. .n_yes_ranges = ARRAY_SIZE(mcp16502_ranges),
  429. };
  430. static const struct regmap_config mcp16502_regmap_config = {
  431. .reg_bits = 8,
  432. .val_bits = 8,
  433. .max_register = MCP16502_MAX_REG,
  434. .cache_type = REGCACHE_NONE,
  435. .rd_table = &mcp16502_yes_reg_table,
  436. .wr_table = &mcp16502_yes_reg_table,
  437. };
  438. static int mcp16502_probe(struct i2c_client *client)
  439. {
  440. struct regulator_config config = { };
  441. struct regulator_dev *rdev;
  442. struct device *dev;
  443. struct mcp16502 *mcp;
  444. struct regmap *rmap;
  445. int i, ret;
  446. dev = &client->dev;
  447. config.dev = dev;
  448. mcp = devm_kzalloc(dev, sizeof(*mcp), GFP_KERNEL);
  449. if (!mcp)
  450. return -ENOMEM;
  451. rmap = devm_regmap_init_i2c(client, &mcp16502_regmap_config);
  452. if (IS_ERR(rmap)) {
  453. ret = PTR_ERR(rmap);
  454. dev_err(dev, "regmap init failed: %d\n", ret);
  455. return ret;
  456. }
  457. i2c_set_clientdata(client, mcp);
  458. config.regmap = rmap;
  459. config.driver_data = mcp;
  460. mcp->lpm = devm_gpiod_get_optional(dev, "lpm", GPIOD_OUT_LOW);
  461. if (IS_ERR(mcp->lpm)) {
  462. dev_err(dev, "failed to get lpm pin: %ld\n", PTR_ERR(mcp->lpm));
  463. return PTR_ERR(mcp->lpm);
  464. }
  465. for (i = 0; i < NUM_REGULATORS; i++) {
  466. rdev = devm_regulator_register(dev, &mcp16502_desc[i], &config);
  467. if (IS_ERR(rdev)) {
  468. dev_err(dev,
  469. "failed to register %s regulator %ld\n",
  470. mcp16502_desc[i].name, PTR_ERR(rdev));
  471. return PTR_ERR(rdev);
  472. }
  473. }
  474. mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_ACTIVE);
  475. return 0;
  476. }
  477. #ifdef CONFIG_PM_SLEEP
  478. static int mcp16502_suspend_noirq(struct device *dev)
  479. {
  480. struct i2c_client *client = to_i2c_client(dev);
  481. struct mcp16502 *mcp = i2c_get_clientdata(client);
  482. mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_LPM);
  483. return 0;
  484. }
  485. static int mcp16502_resume_noirq(struct device *dev)
  486. {
  487. struct i2c_client *client = to_i2c_client(dev);
  488. struct mcp16502 *mcp = i2c_get_clientdata(client);
  489. mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_ACTIVE);
  490. return 0;
  491. }
  492. #endif
  493. #ifdef CONFIG_PM
  494. static const struct dev_pm_ops mcp16502_pm_ops = {
  495. SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mcp16502_suspend_noirq,
  496. mcp16502_resume_noirq)
  497. };
  498. #endif
  499. static const struct i2c_device_id mcp16502_i2c_id[] = {
  500. { "mcp16502", 0 },
  501. { }
  502. };
  503. MODULE_DEVICE_TABLE(i2c, mcp16502_i2c_id);
  504. static struct i2c_driver mcp16502_drv = {
  505. .probe_new = mcp16502_probe,
  506. .driver = {
  507. .name = "mcp16502-regulator",
  508. .of_match_table = of_match_ptr(mcp16502_ids),
  509. #ifdef CONFIG_PM
  510. .pm = &mcp16502_pm_ops,
  511. #endif
  512. },
  513. .id_table = mcp16502_i2c_id,
  514. };
  515. module_i2c_driver(mcp16502_drv);
  516. MODULE_LICENSE("GPL v2");
  517. MODULE_DESCRIPTION("MCP16502 PMIC driver");
  518. MODULE_AUTHOR("Andrei Stefanescu [email protected]");