s2mps11.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. /*
  2. * s2mps11.c
  3. *
  4. * Copyright (c) 2012-2014 Samsung Electronics Co., Ltd
  5. * http://www.samsung.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #include <linux/bug.h>
  19. #include <linux/err.h>
  20. #include <linux/gpio.h>
  21. #include <linux/slab.h>
  22. #include <linux/module.h>
  23. #include <linux/of.h>
  24. #include <linux/regmap.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/regulator/driver.h>
  27. #include <linux/regulator/machine.h>
  28. #include <linux/regulator/of_regulator.h>
  29. #include <linux/of_gpio.h>
  30. #include <linux/mfd/samsung/core.h>
  31. #include <linux/mfd/samsung/s2mps11.h>
  32. #include <linux/mfd/samsung/s2mps14.h>
  33. #include <linux/mfd/samsung/s2mpu02.h>
  34. struct s2mps11_info {
  35. unsigned int rdev_num;
  36. int ramp_delay2;
  37. int ramp_delay34;
  38. int ramp_delay5;
  39. int ramp_delay16;
  40. int ramp_delay7810;
  41. int ramp_delay9;
  42. enum sec_device_type dev_type;
  43. /*
  44. * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode
  45. * was enabled.
  46. */
  47. unsigned long long s2mps14_suspend_state:35;
  48. /* Array of size rdev_num with GPIO-s for external sleep control */
  49. int *ext_control_gpio;
  50. };
  51. static int get_ramp_delay(int ramp_delay)
  52. {
  53. unsigned char cnt = 0;
  54. ramp_delay /= 6250;
  55. while (true) {
  56. ramp_delay = ramp_delay >> 1;
  57. if (ramp_delay == 0)
  58. break;
  59. cnt++;
  60. }
  61. if (cnt > 3)
  62. cnt = 3;
  63. return cnt;
  64. }
  65. static int s2mps11_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
  66. unsigned int old_selector,
  67. unsigned int new_selector)
  68. {
  69. struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
  70. unsigned int ramp_delay = 0;
  71. int old_volt, new_volt;
  72. switch (rdev_get_id(rdev)) {
  73. case S2MPS11_BUCK2:
  74. ramp_delay = s2mps11->ramp_delay2;
  75. break;
  76. case S2MPS11_BUCK3:
  77. case S2MPS11_BUCK4:
  78. ramp_delay = s2mps11->ramp_delay34;
  79. break;
  80. case S2MPS11_BUCK5:
  81. ramp_delay = s2mps11->ramp_delay5;
  82. break;
  83. case S2MPS11_BUCK6:
  84. case S2MPS11_BUCK1:
  85. ramp_delay = s2mps11->ramp_delay16;
  86. break;
  87. case S2MPS11_BUCK7:
  88. case S2MPS11_BUCK8:
  89. case S2MPS11_BUCK10:
  90. ramp_delay = s2mps11->ramp_delay7810;
  91. break;
  92. case S2MPS11_BUCK9:
  93. ramp_delay = s2mps11->ramp_delay9;
  94. }
  95. if (ramp_delay == 0)
  96. ramp_delay = rdev->desc->ramp_delay;
  97. old_volt = rdev->desc->min_uV + (rdev->desc->uV_step * old_selector);
  98. new_volt = rdev->desc->min_uV + (rdev->desc->uV_step * new_selector);
  99. return DIV_ROUND_UP(abs(new_volt - old_volt), ramp_delay);
  100. }
  101. static int s2mps11_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
  102. {
  103. struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
  104. unsigned int ramp_val, ramp_shift, ramp_reg = S2MPS11_REG_RAMP_BUCK;
  105. unsigned int ramp_enable = 1, enable_shift = 0;
  106. int ret;
  107. switch (rdev_get_id(rdev)) {
  108. case S2MPS11_BUCK1:
  109. if (ramp_delay > s2mps11->ramp_delay16)
  110. s2mps11->ramp_delay16 = ramp_delay;
  111. else
  112. ramp_delay = s2mps11->ramp_delay16;
  113. ramp_shift = S2MPS11_BUCK16_RAMP_SHIFT;
  114. break;
  115. case S2MPS11_BUCK2:
  116. enable_shift = S2MPS11_BUCK2_RAMP_EN_SHIFT;
  117. if (!ramp_delay) {
  118. ramp_enable = 0;
  119. break;
  120. }
  121. s2mps11->ramp_delay2 = ramp_delay;
  122. ramp_shift = S2MPS11_BUCK2_RAMP_SHIFT;
  123. ramp_reg = S2MPS11_REG_RAMP;
  124. break;
  125. case S2MPS11_BUCK3:
  126. enable_shift = S2MPS11_BUCK3_RAMP_EN_SHIFT;
  127. if (!ramp_delay) {
  128. ramp_enable = 0;
  129. break;
  130. }
  131. if (ramp_delay > s2mps11->ramp_delay34)
  132. s2mps11->ramp_delay34 = ramp_delay;
  133. else
  134. ramp_delay = s2mps11->ramp_delay34;
  135. ramp_shift = S2MPS11_BUCK34_RAMP_SHIFT;
  136. ramp_reg = S2MPS11_REG_RAMP;
  137. break;
  138. case S2MPS11_BUCK4:
  139. enable_shift = S2MPS11_BUCK4_RAMP_EN_SHIFT;
  140. if (!ramp_delay) {
  141. ramp_enable = 0;
  142. break;
  143. }
  144. if (ramp_delay > s2mps11->ramp_delay34)
  145. s2mps11->ramp_delay34 = ramp_delay;
  146. else
  147. ramp_delay = s2mps11->ramp_delay34;
  148. ramp_shift = S2MPS11_BUCK34_RAMP_SHIFT;
  149. ramp_reg = S2MPS11_REG_RAMP;
  150. break;
  151. case S2MPS11_BUCK5:
  152. s2mps11->ramp_delay5 = ramp_delay;
  153. ramp_shift = S2MPS11_BUCK5_RAMP_SHIFT;
  154. break;
  155. case S2MPS11_BUCK6:
  156. enable_shift = S2MPS11_BUCK6_RAMP_EN_SHIFT;
  157. if (!ramp_delay) {
  158. ramp_enable = 0;
  159. break;
  160. }
  161. if (ramp_delay > s2mps11->ramp_delay16)
  162. s2mps11->ramp_delay16 = ramp_delay;
  163. else
  164. ramp_delay = s2mps11->ramp_delay16;
  165. ramp_shift = S2MPS11_BUCK16_RAMP_SHIFT;
  166. break;
  167. case S2MPS11_BUCK7:
  168. case S2MPS11_BUCK8:
  169. case S2MPS11_BUCK10:
  170. if (ramp_delay > s2mps11->ramp_delay7810)
  171. s2mps11->ramp_delay7810 = ramp_delay;
  172. else
  173. ramp_delay = s2mps11->ramp_delay7810;
  174. ramp_shift = S2MPS11_BUCK7810_RAMP_SHIFT;
  175. break;
  176. case S2MPS11_BUCK9:
  177. s2mps11->ramp_delay9 = ramp_delay;
  178. ramp_shift = S2MPS11_BUCK9_RAMP_SHIFT;
  179. break;
  180. default:
  181. return 0;
  182. }
  183. if (!ramp_enable)
  184. goto ramp_disable;
  185. /* Ramp delay can be enabled/disabled only for buck[2346] */
  186. if ((rdev_get_id(rdev) >= S2MPS11_BUCK2 &&
  187. rdev_get_id(rdev) <= S2MPS11_BUCK4) ||
  188. rdev_get_id(rdev) == S2MPS11_BUCK6) {
  189. ret = regmap_update_bits(rdev->regmap, S2MPS11_REG_RAMP,
  190. 1 << enable_shift, 1 << enable_shift);
  191. if (ret) {
  192. dev_err(&rdev->dev, "failed to enable ramp rate\n");
  193. return ret;
  194. }
  195. }
  196. ramp_val = get_ramp_delay(ramp_delay);
  197. return regmap_update_bits(rdev->regmap, ramp_reg, 0x3 << ramp_shift,
  198. ramp_val << ramp_shift);
  199. ramp_disable:
  200. return regmap_update_bits(rdev->regmap, S2MPS11_REG_RAMP,
  201. 1 << enable_shift, 0);
  202. }
  203. static struct regulator_ops s2mps11_ldo_ops = {
  204. .list_voltage = regulator_list_voltage_linear,
  205. .map_voltage = regulator_map_voltage_linear,
  206. .is_enabled = regulator_is_enabled_regmap,
  207. .enable = regulator_enable_regmap,
  208. .disable = regulator_disable_regmap,
  209. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  210. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  211. .set_voltage_time_sel = regulator_set_voltage_time_sel,
  212. };
  213. static struct regulator_ops s2mps11_buck_ops = {
  214. .list_voltage = regulator_list_voltage_linear,
  215. .map_voltage = regulator_map_voltage_linear,
  216. .is_enabled = regulator_is_enabled_regmap,
  217. .enable = regulator_enable_regmap,
  218. .disable = regulator_disable_regmap,
  219. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  220. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  221. .set_voltage_time_sel = s2mps11_regulator_set_voltage_time_sel,
  222. .set_ramp_delay = s2mps11_set_ramp_delay,
  223. };
  224. #define regulator_desc_s2mps11_ldo(num, step) { \
  225. .name = "LDO"#num, \
  226. .id = S2MPS11_LDO##num, \
  227. .ops = &s2mps11_ldo_ops, \
  228. .type = REGULATOR_VOLTAGE, \
  229. .owner = THIS_MODULE, \
  230. .min_uV = MIN_800_MV, \
  231. .uV_step = step, \
  232. .n_voltages = S2MPS11_LDO_N_VOLTAGES, \
  233. .vsel_reg = S2MPS11_REG_L1CTRL + num - 1, \
  234. .vsel_mask = S2MPS11_LDO_VSEL_MASK, \
  235. .enable_reg = S2MPS11_REG_L1CTRL + num - 1, \
  236. .enable_mask = S2MPS11_ENABLE_MASK \
  237. }
  238. #define regulator_desc_s2mps11_buck1_4(num) { \
  239. .name = "BUCK"#num, \
  240. .id = S2MPS11_BUCK##num, \
  241. .ops = &s2mps11_buck_ops, \
  242. .type = REGULATOR_VOLTAGE, \
  243. .owner = THIS_MODULE, \
  244. .min_uV = MIN_600_MV, \
  245. .uV_step = STEP_6_25_MV, \
  246. .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
  247. .ramp_delay = S2MPS11_RAMP_DELAY, \
  248. .vsel_reg = S2MPS11_REG_B1CTRL2 + (num - 1) * 2, \
  249. .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
  250. .enable_reg = S2MPS11_REG_B1CTRL1 + (num - 1) * 2, \
  251. .enable_mask = S2MPS11_ENABLE_MASK \
  252. }
  253. #define regulator_desc_s2mps11_buck5 { \
  254. .name = "BUCK5", \
  255. .id = S2MPS11_BUCK5, \
  256. .ops = &s2mps11_buck_ops, \
  257. .type = REGULATOR_VOLTAGE, \
  258. .owner = THIS_MODULE, \
  259. .min_uV = MIN_600_MV, \
  260. .uV_step = STEP_6_25_MV, \
  261. .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
  262. .ramp_delay = S2MPS11_RAMP_DELAY, \
  263. .vsel_reg = S2MPS11_REG_B5CTRL2, \
  264. .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
  265. .enable_reg = S2MPS11_REG_B5CTRL1, \
  266. .enable_mask = S2MPS11_ENABLE_MASK \
  267. }
  268. #define regulator_desc_s2mps11_buck6_10(num, min, step) { \
  269. .name = "BUCK"#num, \
  270. .id = S2MPS11_BUCK##num, \
  271. .ops = &s2mps11_buck_ops, \
  272. .type = REGULATOR_VOLTAGE, \
  273. .owner = THIS_MODULE, \
  274. .min_uV = min, \
  275. .uV_step = step, \
  276. .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \
  277. .ramp_delay = S2MPS11_RAMP_DELAY, \
  278. .vsel_reg = S2MPS11_REG_B6CTRL2 + (num - 6) * 2, \
  279. .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
  280. .enable_reg = S2MPS11_REG_B6CTRL1 + (num - 6) * 2, \
  281. .enable_mask = S2MPS11_ENABLE_MASK \
  282. }
  283. static const struct regulator_desc s2mps11_regulators[] = {
  284. regulator_desc_s2mps11_ldo(1, STEP_25_MV),
  285. regulator_desc_s2mps11_ldo(2, STEP_50_MV),
  286. regulator_desc_s2mps11_ldo(3, STEP_50_MV),
  287. regulator_desc_s2mps11_ldo(4, STEP_50_MV),
  288. regulator_desc_s2mps11_ldo(5, STEP_50_MV),
  289. regulator_desc_s2mps11_ldo(6, STEP_25_MV),
  290. regulator_desc_s2mps11_ldo(7, STEP_50_MV),
  291. regulator_desc_s2mps11_ldo(8, STEP_50_MV),
  292. regulator_desc_s2mps11_ldo(9, STEP_50_MV),
  293. regulator_desc_s2mps11_ldo(10, STEP_50_MV),
  294. regulator_desc_s2mps11_ldo(11, STEP_25_MV),
  295. regulator_desc_s2mps11_ldo(12, STEP_50_MV),
  296. regulator_desc_s2mps11_ldo(13, STEP_50_MV),
  297. regulator_desc_s2mps11_ldo(14, STEP_50_MV),
  298. regulator_desc_s2mps11_ldo(15, STEP_50_MV),
  299. regulator_desc_s2mps11_ldo(16, STEP_50_MV),
  300. regulator_desc_s2mps11_ldo(17, STEP_50_MV),
  301. regulator_desc_s2mps11_ldo(18, STEP_50_MV),
  302. regulator_desc_s2mps11_ldo(19, STEP_50_MV),
  303. regulator_desc_s2mps11_ldo(20, STEP_50_MV),
  304. regulator_desc_s2mps11_ldo(21, STEP_50_MV),
  305. regulator_desc_s2mps11_ldo(22, STEP_25_MV),
  306. regulator_desc_s2mps11_ldo(23, STEP_25_MV),
  307. regulator_desc_s2mps11_ldo(24, STEP_50_MV),
  308. regulator_desc_s2mps11_ldo(25, STEP_50_MV),
  309. regulator_desc_s2mps11_ldo(26, STEP_50_MV),
  310. regulator_desc_s2mps11_ldo(27, STEP_25_MV),
  311. regulator_desc_s2mps11_ldo(28, STEP_50_MV),
  312. regulator_desc_s2mps11_ldo(29, STEP_50_MV),
  313. regulator_desc_s2mps11_ldo(30, STEP_50_MV),
  314. regulator_desc_s2mps11_ldo(31, STEP_50_MV),
  315. regulator_desc_s2mps11_ldo(32, STEP_50_MV),
  316. regulator_desc_s2mps11_ldo(33, STEP_50_MV),
  317. regulator_desc_s2mps11_ldo(34, STEP_50_MV),
  318. regulator_desc_s2mps11_ldo(35, STEP_50_MV),
  319. regulator_desc_s2mps11_ldo(36, STEP_50_MV),
  320. regulator_desc_s2mps11_ldo(37, STEP_50_MV),
  321. regulator_desc_s2mps11_ldo(38, STEP_50_MV),
  322. regulator_desc_s2mps11_buck1_4(1),
  323. regulator_desc_s2mps11_buck1_4(2),
  324. regulator_desc_s2mps11_buck1_4(3),
  325. regulator_desc_s2mps11_buck1_4(4),
  326. regulator_desc_s2mps11_buck5,
  327. regulator_desc_s2mps11_buck6_10(6, MIN_600_MV, STEP_6_25_MV),
  328. regulator_desc_s2mps11_buck6_10(7, MIN_600_MV, STEP_6_25_MV),
  329. regulator_desc_s2mps11_buck6_10(8, MIN_600_MV, STEP_6_25_MV),
  330. regulator_desc_s2mps11_buck6_10(9, MIN_3000_MV, STEP_25_MV),
  331. regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
  332. };
  333. static int s2mps14_regulator_enable(struct regulator_dev *rdev)
  334. {
  335. struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
  336. unsigned int val;
  337. switch (s2mps11->dev_type) {
  338. case S2MPS14X:
  339. if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
  340. val = S2MPS14_ENABLE_SUSPEND;
  341. else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)]))
  342. val = S2MPS14_ENABLE_EXT_CONTROL;
  343. else
  344. val = rdev->desc->enable_mask;
  345. break;
  346. case S2MPU02:
  347. if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
  348. val = S2MPU02_ENABLE_SUSPEND;
  349. else
  350. val = rdev->desc->enable_mask;
  351. break;
  352. default:
  353. return -EINVAL;
  354. };
  355. return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
  356. rdev->desc->enable_mask, val);
  357. }
  358. static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
  359. {
  360. int ret;
  361. unsigned int val, state;
  362. struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
  363. int rdev_id = rdev_get_id(rdev);
  364. /* Below LDO should be always on or does not support suspend mode. */
  365. switch (s2mps11->dev_type) {
  366. case S2MPS14X:
  367. switch (rdev_id) {
  368. case S2MPS14_LDO3:
  369. return 0;
  370. default:
  371. state = S2MPS14_ENABLE_SUSPEND;
  372. break;
  373. };
  374. break;
  375. case S2MPU02:
  376. switch (rdev_id) {
  377. case S2MPU02_LDO13:
  378. case S2MPU02_LDO14:
  379. case S2MPU02_LDO15:
  380. case S2MPU02_LDO17:
  381. case S2MPU02_BUCK7:
  382. state = S2MPU02_DISABLE_SUSPEND;
  383. break;
  384. default:
  385. state = S2MPU02_ENABLE_SUSPEND;
  386. break;
  387. };
  388. break;
  389. default:
  390. return -EINVAL;
  391. };
  392. ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
  393. if (ret < 0)
  394. return ret;
  395. s2mps11->s2mps14_suspend_state |= (1 << rdev_get_id(rdev));
  396. /*
  397. * Don't enable suspend mode if regulator is already disabled because
  398. * this would effectively for a short time turn on the regulator after
  399. * resuming.
  400. * However we still want to toggle the suspend_state bit for regulator
  401. * in case if it got enabled before suspending the system.
  402. */
  403. if (!(val & rdev->desc->enable_mask))
  404. return 0;
  405. return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
  406. rdev->desc->enable_mask, state);
  407. }
  408. static struct regulator_ops s2mps14_reg_ops = {
  409. .list_voltage = regulator_list_voltage_linear,
  410. .map_voltage = regulator_map_voltage_linear,
  411. .is_enabled = regulator_is_enabled_regmap,
  412. .enable = s2mps14_regulator_enable,
  413. .disable = regulator_disable_regmap,
  414. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  415. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  416. .set_voltage_time_sel = regulator_set_voltage_time_sel,
  417. .set_suspend_disable = s2mps14_regulator_set_suspend_disable,
  418. };
  419. #define regulator_desc_s2mps14_ldo(num, min, step) { \
  420. .name = "LDO"#num, \
  421. .id = S2MPS14_LDO##num, \
  422. .ops = &s2mps14_reg_ops, \
  423. .type = REGULATOR_VOLTAGE, \
  424. .owner = THIS_MODULE, \
  425. .min_uV = min, \
  426. .uV_step = step, \
  427. .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
  428. .vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \
  429. .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
  430. .enable_reg = S2MPS14_REG_L1CTRL + num - 1, \
  431. .enable_mask = S2MPS14_ENABLE_MASK \
  432. }
  433. #define regulator_desc_s2mps14_buck(num, min, step) { \
  434. .name = "BUCK"#num, \
  435. .id = S2MPS14_BUCK##num, \
  436. .ops = &s2mps14_reg_ops, \
  437. .type = REGULATOR_VOLTAGE, \
  438. .owner = THIS_MODULE, \
  439. .min_uV = min, \
  440. .uV_step = step, \
  441. .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
  442. .linear_min_sel = S2MPS14_BUCK1235_START_SEL, \
  443. .ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \
  444. .vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \
  445. .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
  446. .enable_reg = S2MPS14_REG_B1CTRL1 + (num - 1) * 2, \
  447. .enable_mask = S2MPS14_ENABLE_MASK \
  448. }
  449. static const struct regulator_desc s2mps14_regulators[] = {
  450. regulator_desc_s2mps14_ldo(1, MIN_800_MV, STEP_12_5_MV),
  451. regulator_desc_s2mps14_ldo(2, MIN_800_MV, STEP_12_5_MV),
  452. regulator_desc_s2mps14_ldo(3, MIN_800_MV, STEP_25_MV),
  453. regulator_desc_s2mps14_ldo(4, MIN_800_MV, STEP_25_MV),
  454. regulator_desc_s2mps14_ldo(5, MIN_800_MV, STEP_12_5_MV),
  455. regulator_desc_s2mps14_ldo(6, MIN_800_MV, STEP_12_5_MV),
  456. regulator_desc_s2mps14_ldo(7, MIN_800_MV, STEP_25_MV),
  457. regulator_desc_s2mps14_ldo(8, MIN_1800_MV, STEP_25_MV),
  458. regulator_desc_s2mps14_ldo(9, MIN_800_MV, STEP_12_5_MV),
  459. regulator_desc_s2mps14_ldo(10, MIN_800_MV, STEP_12_5_MV),
  460. regulator_desc_s2mps14_ldo(11, MIN_800_MV, STEP_25_MV),
  461. regulator_desc_s2mps14_ldo(12, MIN_1800_MV, STEP_25_MV),
  462. regulator_desc_s2mps14_ldo(13, MIN_1800_MV, STEP_25_MV),
  463. regulator_desc_s2mps14_ldo(14, MIN_1800_MV, STEP_25_MV),
  464. regulator_desc_s2mps14_ldo(15, MIN_1800_MV, STEP_25_MV),
  465. regulator_desc_s2mps14_ldo(16, MIN_1800_MV, STEP_25_MV),
  466. regulator_desc_s2mps14_ldo(17, MIN_1800_MV, STEP_25_MV),
  467. regulator_desc_s2mps14_ldo(18, MIN_1800_MV, STEP_25_MV),
  468. regulator_desc_s2mps14_ldo(19, MIN_800_MV, STEP_25_MV),
  469. regulator_desc_s2mps14_ldo(20, MIN_800_MV, STEP_25_MV),
  470. regulator_desc_s2mps14_ldo(21, MIN_800_MV, STEP_25_MV),
  471. regulator_desc_s2mps14_ldo(22, MIN_800_MV, STEP_12_5_MV),
  472. regulator_desc_s2mps14_ldo(23, MIN_800_MV, STEP_25_MV),
  473. regulator_desc_s2mps14_ldo(24, MIN_1800_MV, STEP_25_MV),
  474. regulator_desc_s2mps14_ldo(25, MIN_1800_MV, STEP_25_MV),
  475. regulator_desc_s2mps14_buck(1, MIN_600_MV, STEP_6_25_MV),
  476. regulator_desc_s2mps14_buck(2, MIN_600_MV, STEP_6_25_MV),
  477. regulator_desc_s2mps14_buck(3, MIN_600_MV, STEP_6_25_MV),
  478. regulator_desc_s2mps14_buck(4, MIN_1400_MV, STEP_12_5_MV),
  479. regulator_desc_s2mps14_buck(5, MIN_600_MV, STEP_6_25_MV),
  480. };
  481. static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,
  482. struct regulator_dev *rdev)
  483. {
  484. return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
  485. rdev->desc->enable_mask, S2MPS14_ENABLE_EXT_CONTROL);
  486. }
  487. static void s2mps14_pmic_dt_parse_ext_control_gpio(struct platform_device *pdev,
  488. struct of_regulator_match *rdata, struct s2mps11_info *s2mps11)
  489. {
  490. int *gpio = s2mps11->ext_control_gpio;
  491. unsigned int i;
  492. unsigned int valid_regulators[3] = { S2MPS14_LDO10, S2MPS14_LDO11,
  493. S2MPS14_LDO12 };
  494. for (i = 0; i < ARRAY_SIZE(valid_regulators); i++) {
  495. unsigned int reg = valid_regulators[i];
  496. if (!rdata[reg].init_data || !rdata[reg].of_node)
  497. continue;
  498. gpio[reg] = of_get_named_gpio(rdata[reg].of_node,
  499. "samsung,ext-control-gpios", 0);
  500. if (gpio_is_valid(gpio[reg]))
  501. dev_dbg(&pdev->dev, "Using GPIO %d for ext-control over %d/%s\n",
  502. gpio[reg], reg, rdata[reg].name);
  503. }
  504. }
  505. static int s2mps11_pmic_dt_parse(struct platform_device *pdev,
  506. struct of_regulator_match *rdata, struct s2mps11_info *s2mps11)
  507. {
  508. struct device_node *reg_np;
  509. reg_np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
  510. if (!reg_np) {
  511. dev_err(&pdev->dev, "could not find regulators sub-node\n");
  512. return -EINVAL;
  513. }
  514. of_regulator_match(&pdev->dev, reg_np, rdata, s2mps11->rdev_num);
  515. if (s2mps11->dev_type == S2MPS14X)
  516. s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11);
  517. of_node_put(reg_np);
  518. return 0;
  519. }
  520. static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
  521. {
  522. unsigned int ramp_val, ramp_shift, ramp_reg;
  523. switch (rdev_get_id(rdev)) {
  524. case S2MPU02_BUCK1:
  525. ramp_shift = S2MPU02_BUCK1_RAMP_SHIFT;
  526. break;
  527. case S2MPU02_BUCK2:
  528. ramp_shift = S2MPU02_BUCK2_RAMP_SHIFT;
  529. break;
  530. case S2MPU02_BUCK3:
  531. ramp_shift = S2MPU02_BUCK3_RAMP_SHIFT;
  532. break;
  533. case S2MPU02_BUCK4:
  534. ramp_shift = S2MPU02_BUCK4_RAMP_SHIFT;
  535. break;
  536. default:
  537. return 0;
  538. }
  539. ramp_reg = S2MPU02_REG_RAMP1;
  540. ramp_val = get_ramp_delay(ramp_delay);
  541. return regmap_update_bits(rdev->regmap, ramp_reg,
  542. S2MPU02_BUCK1234_RAMP_MASK << ramp_shift,
  543. ramp_val << ramp_shift);
  544. }
  545. static struct regulator_ops s2mpu02_ldo_ops = {
  546. .list_voltage = regulator_list_voltage_linear,
  547. .map_voltage = regulator_map_voltage_linear,
  548. .is_enabled = regulator_is_enabled_regmap,
  549. .enable = s2mps14_regulator_enable,
  550. .disable = regulator_disable_regmap,
  551. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  552. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  553. .set_voltage_time_sel = regulator_set_voltage_time_sel,
  554. .set_suspend_disable = s2mps14_regulator_set_suspend_disable,
  555. };
  556. static struct regulator_ops s2mpu02_buck_ops = {
  557. .list_voltage = regulator_list_voltage_linear,
  558. .map_voltage = regulator_map_voltage_linear,
  559. .is_enabled = regulator_is_enabled_regmap,
  560. .enable = s2mps14_regulator_enable,
  561. .disable = regulator_disable_regmap,
  562. .get_voltage_sel = regulator_get_voltage_sel_regmap,
  563. .set_voltage_sel = regulator_set_voltage_sel_regmap,
  564. .set_voltage_time_sel = regulator_set_voltage_time_sel,
  565. .set_suspend_disable = s2mps14_regulator_set_suspend_disable,
  566. .set_ramp_delay = s2mpu02_set_ramp_delay,
  567. };
  568. #define regulator_desc_s2mpu02_ldo1(num) { \
  569. .name = "LDO"#num, \
  570. .id = S2MPU02_LDO##num, \
  571. .ops = &s2mpu02_ldo_ops, \
  572. .type = REGULATOR_VOLTAGE, \
  573. .owner = THIS_MODULE, \
  574. .min_uV = S2MPU02_LDO_MIN_900MV, \
  575. .uV_step = S2MPU02_LDO_STEP_12_5MV, \
  576. .linear_min_sel = S2MPU02_LDO_GROUP1_START_SEL, \
  577. .n_voltages = S2MPU02_LDO_N_VOLTAGES, \
  578. .vsel_reg = S2MPU02_REG_L1CTRL, \
  579. .vsel_mask = S2MPU02_LDO_VSEL_MASK, \
  580. .enable_reg = S2MPU02_REG_L1CTRL, \
  581. .enable_mask = S2MPU02_ENABLE_MASK \
  582. }
  583. #define regulator_desc_s2mpu02_ldo2(num) { \
  584. .name = "LDO"#num, \
  585. .id = S2MPU02_LDO##num, \
  586. .ops = &s2mpu02_ldo_ops, \
  587. .type = REGULATOR_VOLTAGE, \
  588. .owner = THIS_MODULE, \
  589. .min_uV = S2MPU02_LDO_MIN_1050MV, \
  590. .uV_step = S2MPU02_LDO_STEP_25MV, \
  591. .linear_min_sel = S2MPU02_LDO_GROUP2_START_SEL, \
  592. .n_voltages = S2MPU02_LDO_N_VOLTAGES, \
  593. .vsel_reg = S2MPU02_REG_L2CTRL1, \
  594. .vsel_mask = S2MPU02_LDO_VSEL_MASK, \
  595. .enable_reg = S2MPU02_REG_L2CTRL1, \
  596. .enable_mask = S2MPU02_ENABLE_MASK \
  597. }
  598. #define regulator_desc_s2mpu02_ldo3(num) { \
  599. .name = "LDO"#num, \
  600. .id = S2MPU02_LDO##num, \
  601. .ops = &s2mpu02_ldo_ops, \
  602. .type = REGULATOR_VOLTAGE, \
  603. .owner = THIS_MODULE, \
  604. .min_uV = S2MPU02_LDO_MIN_900MV, \
  605. .uV_step = S2MPU02_LDO_STEP_12_5MV, \
  606. .linear_min_sel = S2MPU02_LDO_GROUP1_START_SEL, \
  607. .n_voltages = S2MPU02_LDO_N_VOLTAGES, \
  608. .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \
  609. .vsel_mask = S2MPU02_LDO_VSEL_MASK, \
  610. .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \
  611. .enable_mask = S2MPU02_ENABLE_MASK \
  612. }
  613. #define regulator_desc_s2mpu02_ldo4(num) { \
  614. .name = "LDO"#num, \
  615. .id = S2MPU02_LDO##num, \
  616. .ops = &s2mpu02_ldo_ops, \
  617. .type = REGULATOR_VOLTAGE, \
  618. .owner = THIS_MODULE, \
  619. .min_uV = S2MPU02_LDO_MIN_1050MV, \
  620. .uV_step = S2MPU02_LDO_STEP_25MV, \
  621. .linear_min_sel = S2MPU02_LDO_GROUP2_START_SEL, \
  622. .n_voltages = S2MPU02_LDO_N_VOLTAGES, \
  623. .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \
  624. .vsel_mask = S2MPU02_LDO_VSEL_MASK, \
  625. .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \
  626. .enable_mask = S2MPU02_ENABLE_MASK \
  627. }
  628. #define regulator_desc_s2mpu02_ldo5(num) { \
  629. .name = "LDO"#num, \
  630. .id = S2MPU02_LDO##num, \
  631. .ops = &s2mpu02_ldo_ops, \
  632. .type = REGULATOR_VOLTAGE, \
  633. .owner = THIS_MODULE, \
  634. .min_uV = S2MPU02_LDO_MIN_1600MV, \
  635. .uV_step = S2MPU02_LDO_STEP_50MV, \
  636. .linear_min_sel = S2MPU02_LDO_GROUP3_START_SEL, \
  637. .n_voltages = S2MPU02_LDO_N_VOLTAGES, \
  638. .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \
  639. .vsel_mask = S2MPU02_LDO_VSEL_MASK, \
  640. .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \
  641. .enable_mask = S2MPU02_ENABLE_MASK \
  642. }
  643. #define regulator_desc_s2mpu02_buck1234(num) { \
  644. .name = "BUCK"#num, \
  645. .id = S2MPU02_BUCK##num, \
  646. .ops = &s2mpu02_buck_ops, \
  647. .type = REGULATOR_VOLTAGE, \
  648. .owner = THIS_MODULE, \
  649. .min_uV = S2MPU02_BUCK1234_MIN_600MV, \
  650. .uV_step = S2MPU02_BUCK1234_STEP_6_25MV, \
  651. .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \
  652. .linear_min_sel = S2MPU02_BUCK1234_START_SEL, \
  653. .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \
  654. .vsel_reg = S2MPU02_REG_B1CTRL2 + (num - 1) * 2, \
  655. .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \
  656. .enable_reg = S2MPU02_REG_B1CTRL1 + (num - 1) * 2, \
  657. .enable_mask = S2MPU02_ENABLE_MASK \
  658. }
  659. #define regulator_desc_s2mpu02_buck5(num) { \
  660. .name = "BUCK"#num, \
  661. .id = S2MPU02_BUCK##num, \
  662. .ops = &s2mpu02_ldo_ops, \
  663. .type = REGULATOR_VOLTAGE, \
  664. .owner = THIS_MODULE, \
  665. .min_uV = S2MPU02_BUCK5_MIN_1081_25MV, \
  666. .uV_step = S2MPU02_BUCK5_STEP_6_25MV, \
  667. .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \
  668. .linear_min_sel = S2MPU02_BUCK5_START_SEL, \
  669. .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \
  670. .vsel_reg = S2MPU02_REG_B5CTRL2, \
  671. .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \
  672. .enable_reg = S2MPU02_REG_B5CTRL1, \
  673. .enable_mask = S2MPU02_ENABLE_MASK \
  674. }
  675. #define regulator_desc_s2mpu02_buck6(num) { \
  676. .name = "BUCK"#num, \
  677. .id = S2MPU02_BUCK##num, \
  678. .ops = &s2mpu02_ldo_ops, \
  679. .type = REGULATOR_VOLTAGE, \
  680. .owner = THIS_MODULE, \
  681. .min_uV = S2MPU02_BUCK6_MIN_1700MV, \
  682. .uV_step = S2MPU02_BUCK6_STEP_2_50MV, \
  683. .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \
  684. .linear_min_sel = S2MPU02_BUCK6_START_SEL, \
  685. .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \
  686. .vsel_reg = S2MPU02_REG_B6CTRL2, \
  687. .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \
  688. .enable_reg = S2MPU02_REG_B6CTRL1, \
  689. .enable_mask = S2MPU02_ENABLE_MASK \
  690. }
  691. #define regulator_desc_s2mpu02_buck7(num) { \
  692. .name = "BUCK"#num, \
  693. .id = S2MPU02_BUCK##num, \
  694. .ops = &s2mpu02_ldo_ops, \
  695. .type = REGULATOR_VOLTAGE, \
  696. .owner = THIS_MODULE, \
  697. .min_uV = S2MPU02_BUCK7_MIN_900MV, \
  698. .uV_step = S2MPU02_BUCK7_STEP_6_25MV, \
  699. .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \
  700. .linear_min_sel = S2MPU02_BUCK7_START_SEL, \
  701. .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \
  702. .vsel_reg = S2MPU02_REG_B7CTRL2, \
  703. .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \
  704. .enable_reg = S2MPU02_REG_B7CTRL1, \
  705. .enable_mask = S2MPU02_ENABLE_MASK \
  706. }
  707. static const struct regulator_desc s2mpu02_regulators[] = {
  708. regulator_desc_s2mpu02_ldo1(1),
  709. regulator_desc_s2mpu02_ldo2(2),
  710. regulator_desc_s2mpu02_ldo4(3),
  711. regulator_desc_s2mpu02_ldo5(4),
  712. regulator_desc_s2mpu02_ldo4(5),
  713. regulator_desc_s2mpu02_ldo3(6),
  714. regulator_desc_s2mpu02_ldo3(7),
  715. regulator_desc_s2mpu02_ldo4(8),
  716. regulator_desc_s2mpu02_ldo5(9),
  717. regulator_desc_s2mpu02_ldo3(10),
  718. regulator_desc_s2mpu02_ldo4(11),
  719. regulator_desc_s2mpu02_ldo5(12),
  720. regulator_desc_s2mpu02_ldo5(13),
  721. regulator_desc_s2mpu02_ldo5(14),
  722. regulator_desc_s2mpu02_ldo5(15),
  723. regulator_desc_s2mpu02_ldo5(16),
  724. regulator_desc_s2mpu02_ldo4(17),
  725. regulator_desc_s2mpu02_ldo5(18),
  726. regulator_desc_s2mpu02_ldo3(19),
  727. regulator_desc_s2mpu02_ldo4(20),
  728. regulator_desc_s2mpu02_ldo5(21),
  729. regulator_desc_s2mpu02_ldo5(22),
  730. regulator_desc_s2mpu02_ldo5(23),
  731. regulator_desc_s2mpu02_ldo4(24),
  732. regulator_desc_s2mpu02_ldo5(25),
  733. regulator_desc_s2mpu02_ldo4(26),
  734. regulator_desc_s2mpu02_ldo5(27),
  735. regulator_desc_s2mpu02_ldo5(28),
  736. regulator_desc_s2mpu02_buck1234(1),
  737. regulator_desc_s2mpu02_buck1234(2),
  738. regulator_desc_s2mpu02_buck1234(3),
  739. regulator_desc_s2mpu02_buck1234(4),
  740. regulator_desc_s2mpu02_buck5(5),
  741. regulator_desc_s2mpu02_buck6(6),
  742. regulator_desc_s2mpu02_buck7(7),
  743. };
  744. static int s2mps11_pmic_probe(struct platform_device *pdev)
  745. {
  746. struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
  747. struct sec_platform_data *pdata = NULL;
  748. struct of_regulator_match *rdata = NULL;
  749. struct regulator_config config = { };
  750. struct s2mps11_info *s2mps11;
  751. int i, ret = 0;
  752. const struct regulator_desc *regulators;
  753. s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info),
  754. GFP_KERNEL);
  755. if (!s2mps11)
  756. return -ENOMEM;
  757. s2mps11->dev_type = platform_get_device_id(pdev)->driver_data;
  758. switch (s2mps11->dev_type) {
  759. case S2MPS11X:
  760. s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
  761. regulators = s2mps11_regulators;
  762. break;
  763. case S2MPS14X:
  764. s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
  765. regulators = s2mps14_regulators;
  766. break;
  767. case S2MPU02:
  768. s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators);
  769. regulators = s2mpu02_regulators;
  770. break;
  771. default:
  772. dev_err(&pdev->dev, "Invalid device type: %u\n",
  773. s2mps11->dev_type);
  774. return -EINVAL;
  775. };
  776. s2mps11->ext_control_gpio = devm_kzalloc(&pdev->dev,
  777. sizeof(*s2mps11->ext_control_gpio) * s2mps11->rdev_num,
  778. GFP_KERNEL);
  779. if (!s2mps11->ext_control_gpio)
  780. return -ENOMEM;
  781. /*
  782. * 0 is a valid GPIO so initialize all GPIO-s to negative value
  783. * to indicate that external control won't be used for this regulator.
  784. */
  785. for (i = 0; i < s2mps11->rdev_num; i++)
  786. s2mps11->ext_control_gpio[i] = -EINVAL;
  787. if (!iodev->dev->of_node) {
  788. if (iodev->pdata) {
  789. pdata = iodev->pdata;
  790. goto common_reg;
  791. } else {
  792. dev_err(pdev->dev.parent,
  793. "Platform data or DT node not supplied\n");
  794. return -ENODEV;
  795. }
  796. }
  797. rdata = kzalloc(sizeof(*rdata) * s2mps11->rdev_num, GFP_KERNEL);
  798. if (!rdata)
  799. return -ENOMEM;
  800. for (i = 0; i < s2mps11->rdev_num; i++)
  801. rdata[i].name = regulators[i].name;
  802. ret = s2mps11_pmic_dt_parse(pdev, rdata, s2mps11);
  803. if (ret)
  804. goto out;
  805. common_reg:
  806. platform_set_drvdata(pdev, s2mps11);
  807. config.dev = &pdev->dev;
  808. config.regmap = iodev->regmap_pmic;
  809. config.driver_data = s2mps11;
  810. config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
  811. for (i = 0; i < s2mps11->rdev_num; i++) {
  812. struct regulator_dev *regulator;
  813. if (pdata) {
  814. config.init_data = pdata->regulators[i].initdata;
  815. config.of_node = pdata->regulators[i].reg_node;
  816. } else {
  817. config.init_data = rdata[i].init_data;
  818. config.of_node = rdata[i].of_node;
  819. }
  820. config.ena_gpio = s2mps11->ext_control_gpio[i];
  821. regulator = devm_regulator_register(&pdev->dev,
  822. &regulators[i], &config);
  823. if (IS_ERR(regulator)) {
  824. ret = PTR_ERR(regulator);
  825. dev_err(&pdev->dev, "regulator init failed for %d\n",
  826. i);
  827. goto out;
  828. }
  829. if (gpio_is_valid(s2mps11->ext_control_gpio[i])) {
  830. ret = s2mps14_pmic_enable_ext_control(s2mps11,
  831. regulator);
  832. if (ret < 0) {
  833. dev_err(&pdev->dev,
  834. "failed to enable GPIO control over %s: %d\n",
  835. regulator->desc->name, ret);
  836. goto out;
  837. }
  838. }
  839. }
  840. out:
  841. kfree(rdata);
  842. return ret;
  843. }
  844. static const struct platform_device_id s2mps11_pmic_id[] = {
  845. { "s2mps11-pmic", S2MPS11X},
  846. { "s2mps14-pmic", S2MPS14X},
  847. { "s2mpu02-pmic", S2MPU02},
  848. { },
  849. };
  850. MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id);
  851. static struct platform_driver s2mps11_pmic_driver = {
  852. .driver = {
  853. .name = "s2mps11-pmic",
  854. .owner = THIS_MODULE,
  855. },
  856. .probe = s2mps11_pmic_probe,
  857. .id_table = s2mps11_pmic_id,
  858. };
  859. static int __init s2mps11_pmic_init(void)
  860. {
  861. return platform_driver_register(&s2mps11_pmic_driver);
  862. }
  863. subsys_initcall(s2mps11_pmic_init);
  864. static void __exit s2mps11_pmic_exit(void)
  865. {
  866. platform_driver_unregister(&s2mps11_pmic_driver);
  867. }
  868. module_exit(s2mps11_pmic_exit);
  869. /* Module information */
  870. MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
  871. MODULE_DESCRIPTION("SAMSUNG S2MPS11/S2MPS14/S2MPU02 Regulator Driver");
  872. MODULE_LICENSE("GPL");