ab8500.c 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * License Terms: GNU General Public License v2
  5. *
  6. * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
  7. * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
  8. * Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson
  9. *
  10. * AB8500 peripheral regulators
  11. *
  12. * AB8500 supports the following regulators:
  13. * VAUX1/2/3, VINTCORE, VTVOUT, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA
  14. *
  15. * AB8505 supports the following regulators:
  16. * VAUX1/2/3/4/5/6, VINTCORE, VADC, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA
  17. */
  18. #include <linux/init.h>
  19. #include <linux/kernel.h>
  20. #include <linux/module.h>
  21. #include <linux/err.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/mfd/abx500.h>
  24. #include <linux/mfd/abx500/ab8500.h>
  25. #include <linux/of.h>
  26. #include <linux/regulator/of_regulator.h>
  27. #include <linux/regulator/driver.h>
  28. #include <linux/regulator/machine.h>
  29. #include <linux/regulator/ab8500.h>
  30. #include <linux/slab.h>
  31. /**
  32. * struct ab8500_shared_mode - is used when mode is shared between
  33. * two regulators.
  34. * @shared_regulator: pointer to the other sharing regulator
  35. * @lp_mode_req: low power mode requested by this regulator
  36. */
  37. struct ab8500_shared_mode {
  38. struct ab8500_regulator_info *shared_regulator;
  39. bool lp_mode_req;
  40. };
  41. /**
  42. * struct ab8500_regulator_info - ab8500 regulator information
  43. * @dev: device pointer
  44. * @desc: regulator description
  45. * @regulator_dev: regulator device
  46. * @shared_mode: used when mode is shared between two regulators
  47. * @load_lp_uA: maximum load in idle (low power) mode
  48. * @update_bank: bank to control on/off
  49. * @update_reg: register to control on/off
  50. * @update_mask: mask to enable/disable and set mode of regulator
  51. * @update_val: bits holding the regulator current mode
  52. * @update_val_idle: bits to enable the regulator in idle (low power) mode
  53. * @update_val_normal: bits to enable the regulator in normal (high power) mode
  54. * @mode_bank: bank with location of mode register
  55. * @mode_reg: mode register
  56. * @mode_mask: mask for setting mode
  57. * @mode_val_idle: mode setting for low power
  58. * @mode_val_normal: mode setting for normal power
  59. * @voltage_bank: bank to control regulator voltage
  60. * @voltage_reg: register to control regulator voltage
  61. * @voltage_mask: mask to control regulator voltage
  62. */
  63. struct ab8500_regulator_info {
  64. struct device *dev;
  65. struct regulator_desc desc;
  66. struct regulator_dev *regulator;
  67. struct ab8500_shared_mode *shared_mode;
  68. int load_lp_uA;
  69. u8 update_bank;
  70. u8 update_reg;
  71. u8 update_mask;
  72. u8 update_val;
  73. u8 update_val_idle;
  74. u8 update_val_normal;
  75. u8 mode_bank;
  76. u8 mode_reg;
  77. u8 mode_mask;
  78. u8 mode_val_idle;
  79. u8 mode_val_normal;
  80. u8 voltage_bank;
  81. u8 voltage_reg;
  82. u8 voltage_mask;
  83. struct {
  84. u8 voltage_limit;
  85. u8 voltage_bank;
  86. u8 voltage_reg;
  87. u8 voltage_mask;
  88. } expand_register;
  89. };
  90. /* voltage tables for the vauxn/vintcore supplies */
  91. static const unsigned int ldo_vauxn_voltages[] = {
  92. 1100000,
  93. 1200000,
  94. 1300000,
  95. 1400000,
  96. 1500000,
  97. 1800000,
  98. 1850000,
  99. 1900000,
  100. 2500000,
  101. 2650000,
  102. 2700000,
  103. 2750000,
  104. 2800000,
  105. 2900000,
  106. 3000000,
  107. 3300000,
  108. };
  109. static const unsigned int ldo_vaux3_voltages[] = {
  110. 1200000,
  111. 1500000,
  112. 1800000,
  113. 2100000,
  114. 2500000,
  115. 2750000,
  116. 2790000,
  117. 2910000,
  118. };
  119. static const unsigned int ldo_vaux56_voltages[] = {
  120. 1800000,
  121. 1050000,
  122. 1100000,
  123. 1200000,
  124. 1500000,
  125. 2200000,
  126. 2500000,
  127. 2790000,
  128. };
  129. static const unsigned int ldo_vintcore_voltages[] = {
  130. 1200000,
  131. 1225000,
  132. 1250000,
  133. 1275000,
  134. 1300000,
  135. 1325000,
  136. 1350000,
  137. };
  138. static const unsigned int ldo_sdio_voltages[] = {
  139. 1160000,
  140. 1050000,
  141. 1100000,
  142. 1500000,
  143. 1800000,
  144. 2200000,
  145. 2910000,
  146. 3050000,
  147. };
  148. static const unsigned int fixed_1200000_voltage[] = {
  149. 1200000,
  150. };
  151. static const unsigned int fixed_1800000_voltage[] = {
  152. 1800000,
  153. };
  154. static const unsigned int fixed_2000000_voltage[] = {
  155. 2000000,
  156. };
  157. static const unsigned int fixed_2050000_voltage[] = {
  158. 2050000,
  159. };
  160. static const unsigned int fixed_3300000_voltage[] = {
  161. 3300000,
  162. };
  163. static const unsigned int ldo_vana_voltages[] = {
  164. 1050000,
  165. 1075000,
  166. 1100000,
  167. 1125000,
  168. 1150000,
  169. 1175000,
  170. 1200000,
  171. 1225000,
  172. };
  173. static const unsigned int ldo_vaudio_voltages[] = {
  174. 2000000,
  175. 2100000,
  176. 2200000,
  177. 2300000,
  178. 2400000,
  179. 2500000,
  180. 2600000,
  181. 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */
  182. };
  183. static const unsigned int ldo_vdmic_voltages[] = {
  184. 1800000,
  185. 1900000,
  186. 2000000,
  187. 2850000,
  188. };
  189. static DEFINE_MUTEX(shared_mode_mutex);
  190. static struct ab8500_shared_mode ldo_anamic1_shared;
  191. static struct ab8500_shared_mode ldo_anamic2_shared;
  192. static int ab8500_regulator_enable(struct regulator_dev *rdev)
  193. {
  194. int ret;
  195. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  196. if (info == NULL) {
  197. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  198. return -EINVAL;
  199. }
  200. ret = abx500_mask_and_set_register_interruptible(info->dev,
  201. info->update_bank, info->update_reg,
  202. info->update_mask, info->update_val);
  203. if (ret < 0) {
  204. dev_err(rdev_get_dev(rdev),
  205. "couldn't set enable bits for regulator\n");
  206. return ret;
  207. }
  208. dev_vdbg(rdev_get_dev(rdev),
  209. "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
  210. info->desc.name, info->update_bank, info->update_reg,
  211. info->update_mask, info->update_val);
  212. return ret;
  213. }
  214. static int ab8500_regulator_disable(struct regulator_dev *rdev)
  215. {
  216. int ret;
  217. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  218. if (info == NULL) {
  219. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  220. return -EINVAL;
  221. }
  222. ret = abx500_mask_and_set_register_interruptible(info->dev,
  223. info->update_bank, info->update_reg,
  224. info->update_mask, 0x0);
  225. if (ret < 0) {
  226. dev_err(rdev_get_dev(rdev),
  227. "couldn't set disable bits for regulator\n");
  228. return ret;
  229. }
  230. dev_vdbg(rdev_get_dev(rdev),
  231. "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
  232. info->desc.name, info->update_bank, info->update_reg,
  233. info->update_mask, 0x0);
  234. return ret;
  235. }
  236. static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
  237. {
  238. int ret;
  239. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  240. u8 regval;
  241. if (info == NULL) {
  242. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  243. return -EINVAL;
  244. }
  245. ret = abx500_get_register_interruptible(info->dev,
  246. info->update_bank, info->update_reg, &regval);
  247. if (ret < 0) {
  248. dev_err(rdev_get_dev(rdev),
  249. "couldn't read 0x%x register\n", info->update_reg);
  250. return ret;
  251. }
  252. dev_vdbg(rdev_get_dev(rdev),
  253. "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  254. " 0x%x\n",
  255. info->desc.name, info->update_bank, info->update_reg,
  256. info->update_mask, regval);
  257. if (regval & info->update_mask)
  258. return 1;
  259. else
  260. return 0;
  261. }
  262. static unsigned int ab8500_regulator_get_optimum_mode(
  263. struct regulator_dev *rdev, int input_uV,
  264. int output_uV, int load_uA)
  265. {
  266. unsigned int mode;
  267. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  268. if (info == NULL) {
  269. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  270. return -EINVAL;
  271. }
  272. if (load_uA <= info->load_lp_uA)
  273. mode = REGULATOR_MODE_IDLE;
  274. else
  275. mode = REGULATOR_MODE_NORMAL;
  276. return mode;
  277. }
  278. static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
  279. unsigned int mode)
  280. {
  281. int ret = 0;
  282. u8 bank, reg, mask, val;
  283. bool lp_mode_req = false;
  284. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  285. if (info == NULL) {
  286. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  287. return -EINVAL;
  288. }
  289. if (info->mode_mask) {
  290. bank = info->mode_bank;
  291. reg = info->mode_reg;
  292. mask = info->mode_mask;
  293. } else {
  294. bank = info->update_bank;
  295. reg = info->update_reg;
  296. mask = info->update_mask;
  297. }
  298. if (info->shared_mode)
  299. mutex_lock(&shared_mode_mutex);
  300. switch (mode) {
  301. case REGULATOR_MODE_NORMAL:
  302. if (info->shared_mode)
  303. lp_mode_req = false;
  304. if (info->mode_mask)
  305. val = info->mode_val_normal;
  306. else
  307. val = info->update_val_normal;
  308. break;
  309. case REGULATOR_MODE_IDLE:
  310. if (info->shared_mode) {
  311. struct ab8500_regulator_info *shared_regulator;
  312. shared_regulator = info->shared_mode->shared_regulator;
  313. if (!shared_regulator->shared_mode->lp_mode_req) {
  314. /* Other regulator prevent LP mode */
  315. info->shared_mode->lp_mode_req = true;
  316. goto out_unlock;
  317. }
  318. lp_mode_req = true;
  319. }
  320. if (info->mode_mask)
  321. val = info->mode_val_idle;
  322. else
  323. val = info->update_val_idle;
  324. break;
  325. default:
  326. ret = -EINVAL;
  327. goto out_unlock;
  328. }
  329. if (info->mode_mask || ab8500_regulator_is_enabled(rdev)) {
  330. ret = abx500_mask_and_set_register_interruptible(info->dev,
  331. bank, reg, mask, val);
  332. if (ret < 0) {
  333. dev_err(rdev_get_dev(rdev),
  334. "couldn't set regulator mode\n");
  335. goto out_unlock;
  336. }
  337. dev_vdbg(rdev_get_dev(rdev),
  338. "%s-set_mode (bank, reg, mask, value): "
  339. "0x%x, 0x%x, 0x%x, 0x%x\n",
  340. info->desc.name, bank, reg,
  341. mask, val);
  342. }
  343. if (!info->mode_mask)
  344. info->update_val = val;
  345. if (info->shared_mode)
  346. info->shared_mode->lp_mode_req = lp_mode_req;
  347. out_unlock:
  348. if (info->shared_mode)
  349. mutex_unlock(&shared_mode_mutex);
  350. return ret;
  351. }
  352. static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
  353. {
  354. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  355. int ret;
  356. u8 val;
  357. u8 val_normal;
  358. u8 val_idle;
  359. if (info == NULL) {
  360. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  361. return -EINVAL;
  362. }
  363. /* Need special handling for shared mode */
  364. if (info->shared_mode) {
  365. if (info->shared_mode->lp_mode_req)
  366. return REGULATOR_MODE_IDLE;
  367. else
  368. return REGULATOR_MODE_NORMAL;
  369. }
  370. if (info->mode_mask) {
  371. /* Dedicated register for handling mode */
  372. ret = abx500_get_register_interruptible(info->dev,
  373. info->mode_bank, info->mode_reg, &val);
  374. val = val & info->mode_mask;
  375. val_normal = info->mode_val_normal;
  376. val_idle = info->mode_val_idle;
  377. } else {
  378. /* Mode register same as enable register */
  379. val = info->update_val;
  380. val_normal = info->update_val_normal;
  381. val_idle = info->update_val_idle;
  382. }
  383. if (val == val_normal)
  384. ret = REGULATOR_MODE_NORMAL;
  385. else if (val == val_idle)
  386. ret = REGULATOR_MODE_IDLE;
  387. else
  388. ret = -EINVAL;
  389. return ret;
  390. }
  391. static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
  392. {
  393. int ret, voltage_shift;
  394. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  395. u8 regval;
  396. if (info == NULL) {
  397. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  398. return -EINVAL;
  399. }
  400. voltage_shift = ffs(info->voltage_mask) - 1;
  401. ret = abx500_get_register_interruptible(info->dev,
  402. info->voltage_bank, info->voltage_reg, &regval);
  403. if (ret < 0) {
  404. dev_err(rdev_get_dev(rdev),
  405. "couldn't read voltage reg for regulator\n");
  406. return ret;
  407. }
  408. dev_vdbg(rdev_get_dev(rdev),
  409. "%s-get_voltage (bank, reg, mask, shift, value): "
  410. "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
  411. info->desc.name, info->voltage_bank,
  412. info->voltage_reg, info->voltage_mask,
  413. voltage_shift, regval);
  414. return (regval & info->voltage_mask) >> voltage_shift;
  415. }
  416. static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
  417. unsigned selector)
  418. {
  419. int ret, voltage_shift;
  420. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  421. u8 regval;
  422. if (info == NULL) {
  423. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  424. return -EINVAL;
  425. }
  426. voltage_shift = ffs(info->voltage_mask) - 1;
  427. /* set the registers for the request */
  428. regval = (u8)selector << voltage_shift;
  429. ret = abx500_mask_and_set_register_interruptible(info->dev,
  430. info->voltage_bank, info->voltage_reg,
  431. info->voltage_mask, regval);
  432. if (ret < 0)
  433. dev_err(rdev_get_dev(rdev),
  434. "couldn't set voltage reg for regulator\n");
  435. dev_vdbg(rdev_get_dev(rdev),
  436. "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  437. " 0x%x\n",
  438. info->desc.name, info->voltage_bank, info->voltage_reg,
  439. info->voltage_mask, regval);
  440. return ret;
  441. }
  442. static struct regulator_ops ab8500_regulator_volt_mode_ops = {
  443. .enable = ab8500_regulator_enable,
  444. .disable = ab8500_regulator_disable,
  445. .is_enabled = ab8500_regulator_is_enabled,
  446. .get_optimum_mode = ab8500_regulator_get_optimum_mode,
  447. .set_mode = ab8500_regulator_set_mode,
  448. .get_mode = ab8500_regulator_get_mode,
  449. .get_voltage_sel = ab8500_regulator_get_voltage_sel,
  450. .set_voltage_sel = ab8500_regulator_set_voltage_sel,
  451. .list_voltage = regulator_list_voltage_table,
  452. };
  453. static struct regulator_ops ab8500_regulator_volt_ops = {
  454. .enable = ab8500_regulator_enable,
  455. .disable = ab8500_regulator_disable,
  456. .is_enabled = ab8500_regulator_is_enabled,
  457. .get_voltage_sel = ab8500_regulator_get_voltage_sel,
  458. .set_voltage_sel = ab8500_regulator_set_voltage_sel,
  459. .list_voltage = regulator_list_voltage_table,
  460. };
  461. static struct regulator_ops ab8500_regulator_mode_ops = {
  462. .enable = ab8500_regulator_enable,
  463. .disable = ab8500_regulator_disable,
  464. .is_enabled = ab8500_regulator_is_enabled,
  465. .get_optimum_mode = ab8500_regulator_get_optimum_mode,
  466. .set_mode = ab8500_regulator_set_mode,
  467. .get_mode = ab8500_regulator_get_mode,
  468. .list_voltage = regulator_list_voltage_table,
  469. };
  470. static struct regulator_ops ab8500_regulator_ops = {
  471. .enable = ab8500_regulator_enable,
  472. .disable = ab8500_regulator_disable,
  473. .is_enabled = ab8500_regulator_is_enabled,
  474. .list_voltage = regulator_list_voltage_table,
  475. };
  476. static struct regulator_ops ab8500_regulator_anamic_mode_ops = {
  477. .enable = ab8500_regulator_enable,
  478. .disable = ab8500_regulator_disable,
  479. .is_enabled = ab8500_regulator_is_enabled,
  480. .set_mode = ab8500_regulator_set_mode,
  481. .get_mode = ab8500_regulator_get_mode,
  482. .list_voltage = regulator_list_voltage_table,
  483. };
  484. /* AB8500 regulator information */
  485. static struct ab8500_regulator_info
  486. ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
  487. /*
  488. * Variable Voltage Regulators
  489. * name, min mV, max mV,
  490. * update bank, reg, mask, enable val
  491. * volt bank, reg, mask
  492. */
  493. [AB8500_LDO_AUX1] = {
  494. .desc = {
  495. .name = "LDO-AUX1",
  496. .ops = &ab8500_regulator_volt_mode_ops,
  497. .type = REGULATOR_VOLTAGE,
  498. .id = AB8500_LDO_AUX1,
  499. .owner = THIS_MODULE,
  500. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  501. .volt_table = ldo_vauxn_voltages,
  502. .enable_time = 200,
  503. .supply_name = "vin",
  504. },
  505. .load_lp_uA = 5000,
  506. .update_bank = 0x04,
  507. .update_reg = 0x09,
  508. .update_mask = 0x03,
  509. .update_val = 0x01,
  510. .update_val_idle = 0x03,
  511. .update_val_normal = 0x01,
  512. .voltage_bank = 0x04,
  513. .voltage_reg = 0x1f,
  514. .voltage_mask = 0x0f,
  515. },
  516. [AB8500_LDO_AUX2] = {
  517. .desc = {
  518. .name = "LDO-AUX2",
  519. .ops = &ab8500_regulator_volt_mode_ops,
  520. .type = REGULATOR_VOLTAGE,
  521. .id = AB8500_LDO_AUX2,
  522. .owner = THIS_MODULE,
  523. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  524. .volt_table = ldo_vauxn_voltages,
  525. .enable_time = 200,
  526. .supply_name = "vin",
  527. },
  528. .load_lp_uA = 5000,
  529. .update_bank = 0x04,
  530. .update_reg = 0x09,
  531. .update_mask = 0x0c,
  532. .update_val = 0x04,
  533. .update_val_idle = 0x0c,
  534. .update_val_normal = 0x04,
  535. .voltage_bank = 0x04,
  536. .voltage_reg = 0x20,
  537. .voltage_mask = 0x0f,
  538. },
  539. [AB8500_LDO_AUX3] = {
  540. .desc = {
  541. .name = "LDO-AUX3",
  542. .ops = &ab8500_regulator_volt_mode_ops,
  543. .type = REGULATOR_VOLTAGE,
  544. .id = AB8500_LDO_AUX3,
  545. .owner = THIS_MODULE,
  546. .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
  547. .volt_table = ldo_vaux3_voltages,
  548. .enable_time = 450,
  549. .supply_name = "vin",
  550. },
  551. .load_lp_uA = 5000,
  552. .update_bank = 0x04,
  553. .update_reg = 0x0a,
  554. .update_mask = 0x03,
  555. .update_val = 0x01,
  556. .update_val_idle = 0x03,
  557. .update_val_normal = 0x01,
  558. .voltage_bank = 0x04,
  559. .voltage_reg = 0x21,
  560. .voltage_mask = 0x07,
  561. },
  562. [AB8500_LDO_INTCORE] = {
  563. .desc = {
  564. .name = "LDO-INTCORE",
  565. .ops = &ab8500_regulator_volt_mode_ops,
  566. .type = REGULATOR_VOLTAGE,
  567. .id = AB8500_LDO_INTCORE,
  568. .owner = THIS_MODULE,
  569. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  570. .volt_table = ldo_vintcore_voltages,
  571. .enable_time = 750,
  572. },
  573. .load_lp_uA = 5000,
  574. .update_bank = 0x03,
  575. .update_reg = 0x80,
  576. .update_mask = 0x44,
  577. .update_val = 0x44,
  578. .update_val_idle = 0x44,
  579. .update_val_normal = 0x04,
  580. .voltage_bank = 0x03,
  581. .voltage_reg = 0x80,
  582. .voltage_mask = 0x38,
  583. },
  584. /*
  585. * Fixed Voltage Regulators
  586. * name, fixed mV,
  587. * update bank, reg, mask, enable val
  588. */
  589. [AB8500_LDO_TVOUT] = {
  590. .desc = {
  591. .name = "LDO-TVOUT",
  592. .ops = &ab8500_regulator_mode_ops,
  593. .type = REGULATOR_VOLTAGE,
  594. .id = AB8500_LDO_TVOUT,
  595. .owner = THIS_MODULE,
  596. .n_voltages = 1,
  597. .volt_table = fixed_2000000_voltage,
  598. .enable_time = 500,
  599. },
  600. .load_lp_uA = 1000,
  601. .update_bank = 0x03,
  602. .update_reg = 0x80,
  603. .update_mask = 0x82,
  604. .update_val = 0x02,
  605. .update_val_idle = 0x82,
  606. .update_val_normal = 0x02,
  607. },
  608. [AB8500_LDO_AUDIO] = {
  609. .desc = {
  610. .name = "LDO-AUDIO",
  611. .ops = &ab8500_regulator_ops,
  612. .type = REGULATOR_VOLTAGE,
  613. .id = AB8500_LDO_AUDIO,
  614. .owner = THIS_MODULE,
  615. .n_voltages = 1,
  616. .enable_time = 140,
  617. .volt_table = fixed_2000000_voltage,
  618. },
  619. .update_bank = 0x03,
  620. .update_reg = 0x83,
  621. .update_mask = 0x02,
  622. .update_val = 0x02,
  623. },
  624. [AB8500_LDO_ANAMIC1] = {
  625. .desc = {
  626. .name = "LDO-ANAMIC1",
  627. .ops = &ab8500_regulator_ops,
  628. .type = REGULATOR_VOLTAGE,
  629. .id = AB8500_LDO_ANAMIC1,
  630. .owner = THIS_MODULE,
  631. .n_voltages = 1,
  632. .enable_time = 500,
  633. .volt_table = fixed_2050000_voltage,
  634. },
  635. .update_bank = 0x03,
  636. .update_reg = 0x83,
  637. .update_mask = 0x08,
  638. .update_val = 0x08,
  639. },
  640. [AB8500_LDO_ANAMIC2] = {
  641. .desc = {
  642. .name = "LDO-ANAMIC2",
  643. .ops = &ab8500_regulator_ops,
  644. .type = REGULATOR_VOLTAGE,
  645. .id = AB8500_LDO_ANAMIC2,
  646. .owner = THIS_MODULE,
  647. .n_voltages = 1,
  648. .enable_time = 500,
  649. .volt_table = fixed_2050000_voltage,
  650. },
  651. .update_bank = 0x03,
  652. .update_reg = 0x83,
  653. .update_mask = 0x10,
  654. .update_val = 0x10,
  655. },
  656. [AB8500_LDO_DMIC] = {
  657. .desc = {
  658. .name = "LDO-DMIC",
  659. .ops = &ab8500_regulator_ops,
  660. .type = REGULATOR_VOLTAGE,
  661. .id = AB8500_LDO_DMIC,
  662. .owner = THIS_MODULE,
  663. .n_voltages = 1,
  664. .enable_time = 420,
  665. .volt_table = fixed_1800000_voltage,
  666. },
  667. .update_bank = 0x03,
  668. .update_reg = 0x83,
  669. .update_mask = 0x04,
  670. .update_val = 0x04,
  671. },
  672. /*
  673. * Regulators with fixed voltage and normal/idle modes
  674. */
  675. [AB8500_LDO_ANA] = {
  676. .desc = {
  677. .name = "LDO-ANA",
  678. .ops = &ab8500_regulator_mode_ops,
  679. .type = REGULATOR_VOLTAGE,
  680. .id = AB8500_LDO_ANA,
  681. .owner = THIS_MODULE,
  682. .n_voltages = 1,
  683. .enable_time = 140,
  684. .volt_table = fixed_1200000_voltage,
  685. },
  686. .load_lp_uA = 1000,
  687. .update_bank = 0x04,
  688. .update_reg = 0x06,
  689. .update_mask = 0x0c,
  690. .update_val = 0x04,
  691. .update_val_idle = 0x0c,
  692. .update_val_normal = 0x04,
  693. },
  694. };
  695. /* AB8505 regulator information */
  696. static struct ab8500_regulator_info
  697. ab8505_regulator_info[AB8505_NUM_REGULATORS] = {
  698. /*
  699. * Variable Voltage Regulators
  700. * name, min mV, max mV,
  701. * update bank, reg, mask, enable val
  702. * volt bank, reg, mask
  703. */
  704. [AB8505_LDO_AUX1] = {
  705. .desc = {
  706. .name = "LDO-AUX1",
  707. .ops = &ab8500_regulator_volt_mode_ops,
  708. .type = REGULATOR_VOLTAGE,
  709. .id = AB8505_LDO_AUX1,
  710. .owner = THIS_MODULE,
  711. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  712. .volt_table = ldo_vauxn_voltages,
  713. },
  714. .load_lp_uA = 5000,
  715. .update_bank = 0x04,
  716. .update_reg = 0x09,
  717. .update_mask = 0x03,
  718. .update_val = 0x01,
  719. .update_val_idle = 0x03,
  720. .update_val_normal = 0x01,
  721. .voltage_bank = 0x04,
  722. .voltage_reg = 0x1f,
  723. .voltage_mask = 0x0f,
  724. },
  725. [AB8505_LDO_AUX2] = {
  726. .desc = {
  727. .name = "LDO-AUX2",
  728. .ops = &ab8500_regulator_volt_mode_ops,
  729. .type = REGULATOR_VOLTAGE,
  730. .id = AB8505_LDO_AUX2,
  731. .owner = THIS_MODULE,
  732. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  733. .volt_table = ldo_vauxn_voltages,
  734. },
  735. .load_lp_uA = 5000,
  736. .update_bank = 0x04,
  737. .update_reg = 0x09,
  738. .update_mask = 0x0c,
  739. .update_val = 0x04,
  740. .update_val_idle = 0x0c,
  741. .update_val_normal = 0x04,
  742. .voltage_bank = 0x04,
  743. .voltage_reg = 0x20,
  744. .voltage_mask = 0x0f,
  745. },
  746. [AB8505_LDO_AUX3] = {
  747. .desc = {
  748. .name = "LDO-AUX3",
  749. .ops = &ab8500_regulator_volt_mode_ops,
  750. .type = REGULATOR_VOLTAGE,
  751. .id = AB8505_LDO_AUX3,
  752. .owner = THIS_MODULE,
  753. .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
  754. .volt_table = ldo_vaux3_voltages,
  755. },
  756. .load_lp_uA = 5000,
  757. .update_bank = 0x04,
  758. .update_reg = 0x0a,
  759. .update_mask = 0x03,
  760. .update_val = 0x01,
  761. .update_val_idle = 0x03,
  762. .update_val_normal = 0x01,
  763. .voltage_bank = 0x04,
  764. .voltage_reg = 0x21,
  765. .voltage_mask = 0x07,
  766. },
  767. [AB8505_LDO_AUX4] = {
  768. .desc = {
  769. .name = "LDO-AUX4",
  770. .ops = &ab8500_regulator_volt_mode_ops,
  771. .type = REGULATOR_VOLTAGE,
  772. .id = AB8505_LDO_AUX4,
  773. .owner = THIS_MODULE,
  774. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  775. .volt_table = ldo_vauxn_voltages,
  776. },
  777. .load_lp_uA = 5000,
  778. /* values for Vaux4Regu register */
  779. .update_bank = 0x04,
  780. .update_reg = 0x2e,
  781. .update_mask = 0x03,
  782. .update_val = 0x01,
  783. .update_val_idle = 0x03,
  784. .update_val_normal = 0x01,
  785. /* values for Vaux4SEL register */
  786. .voltage_bank = 0x04,
  787. .voltage_reg = 0x2f,
  788. .voltage_mask = 0x0f,
  789. },
  790. [AB8505_LDO_AUX5] = {
  791. .desc = {
  792. .name = "LDO-AUX5",
  793. .ops = &ab8500_regulator_volt_mode_ops,
  794. .type = REGULATOR_VOLTAGE,
  795. .id = AB8505_LDO_AUX5,
  796. .owner = THIS_MODULE,
  797. .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
  798. .volt_table = ldo_vaux56_voltages,
  799. },
  800. .load_lp_uA = 2000,
  801. /* values for CtrlVaux5 register */
  802. .update_bank = 0x01,
  803. .update_reg = 0x55,
  804. .update_mask = 0x18,
  805. .update_val = 0x10,
  806. .update_val_idle = 0x18,
  807. .update_val_normal = 0x10,
  808. .voltage_bank = 0x01,
  809. .voltage_reg = 0x55,
  810. .voltage_mask = 0x07,
  811. },
  812. [AB8505_LDO_AUX6] = {
  813. .desc = {
  814. .name = "LDO-AUX6",
  815. .ops = &ab8500_regulator_volt_mode_ops,
  816. .type = REGULATOR_VOLTAGE,
  817. .id = AB8505_LDO_AUX6,
  818. .owner = THIS_MODULE,
  819. .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
  820. .volt_table = ldo_vaux56_voltages,
  821. },
  822. .load_lp_uA = 2000,
  823. /* values for CtrlVaux6 register */
  824. .update_bank = 0x01,
  825. .update_reg = 0x56,
  826. .update_mask = 0x18,
  827. .update_val = 0x10,
  828. .update_val_idle = 0x18,
  829. .update_val_normal = 0x10,
  830. .voltage_bank = 0x01,
  831. .voltage_reg = 0x56,
  832. .voltage_mask = 0x07,
  833. },
  834. [AB8505_LDO_INTCORE] = {
  835. .desc = {
  836. .name = "LDO-INTCORE",
  837. .ops = &ab8500_regulator_volt_mode_ops,
  838. .type = REGULATOR_VOLTAGE,
  839. .id = AB8505_LDO_INTCORE,
  840. .owner = THIS_MODULE,
  841. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  842. .volt_table = ldo_vintcore_voltages,
  843. },
  844. .load_lp_uA = 5000,
  845. .update_bank = 0x03,
  846. .update_reg = 0x80,
  847. .update_mask = 0x44,
  848. .update_val = 0x04,
  849. .update_val_idle = 0x44,
  850. .update_val_normal = 0x04,
  851. .voltage_bank = 0x03,
  852. .voltage_reg = 0x80,
  853. .voltage_mask = 0x38,
  854. },
  855. /*
  856. * Fixed Voltage Regulators
  857. * name, fixed mV,
  858. * update bank, reg, mask, enable val
  859. */
  860. [AB8505_LDO_ADC] = {
  861. .desc = {
  862. .name = "LDO-ADC",
  863. .ops = &ab8500_regulator_mode_ops,
  864. .type = REGULATOR_VOLTAGE,
  865. .id = AB8505_LDO_ADC,
  866. .owner = THIS_MODULE,
  867. .n_voltages = 1,
  868. .volt_table = fixed_2000000_voltage,
  869. .enable_time = 10000,
  870. },
  871. .load_lp_uA = 1000,
  872. .update_bank = 0x03,
  873. .update_reg = 0x80,
  874. .update_mask = 0x82,
  875. .update_val = 0x02,
  876. .update_val_idle = 0x82,
  877. .update_val_normal = 0x02,
  878. },
  879. [AB8505_LDO_USB] = {
  880. .desc = {
  881. .name = "LDO-USB",
  882. .ops = &ab8500_regulator_mode_ops,
  883. .type = REGULATOR_VOLTAGE,
  884. .id = AB8505_LDO_USB,
  885. .owner = THIS_MODULE,
  886. .n_voltages = 1,
  887. .volt_table = fixed_3300000_voltage,
  888. },
  889. .update_bank = 0x03,
  890. .update_reg = 0x82,
  891. .update_mask = 0x03,
  892. .update_val = 0x01,
  893. .update_val_idle = 0x03,
  894. .update_val_normal = 0x01,
  895. },
  896. [AB8505_LDO_AUDIO] = {
  897. .desc = {
  898. .name = "LDO-AUDIO",
  899. .ops = &ab8500_regulator_volt_ops,
  900. .type = REGULATOR_VOLTAGE,
  901. .id = AB8505_LDO_AUDIO,
  902. .owner = THIS_MODULE,
  903. .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages),
  904. .volt_table = ldo_vaudio_voltages,
  905. },
  906. .update_bank = 0x03,
  907. .update_reg = 0x83,
  908. .update_mask = 0x02,
  909. .update_val = 0x02,
  910. .voltage_bank = 0x01,
  911. .voltage_reg = 0x57,
  912. .voltage_mask = 0x70,
  913. },
  914. [AB8505_LDO_ANAMIC1] = {
  915. .desc = {
  916. .name = "LDO-ANAMIC1",
  917. .ops = &ab8500_regulator_anamic_mode_ops,
  918. .type = REGULATOR_VOLTAGE,
  919. .id = AB8505_LDO_ANAMIC1,
  920. .owner = THIS_MODULE,
  921. .n_voltages = 1,
  922. .volt_table = fixed_2050000_voltage,
  923. },
  924. .shared_mode = &ldo_anamic1_shared,
  925. .update_bank = 0x03,
  926. .update_reg = 0x83,
  927. .update_mask = 0x08,
  928. .update_val = 0x08,
  929. .mode_bank = 0x01,
  930. .mode_reg = 0x54,
  931. .mode_mask = 0x04,
  932. .mode_val_idle = 0x04,
  933. .mode_val_normal = 0x00,
  934. },
  935. [AB8505_LDO_ANAMIC2] = {
  936. .desc = {
  937. .name = "LDO-ANAMIC2",
  938. .ops = &ab8500_regulator_anamic_mode_ops,
  939. .type = REGULATOR_VOLTAGE,
  940. .id = AB8505_LDO_ANAMIC2,
  941. .owner = THIS_MODULE,
  942. .n_voltages = 1,
  943. .volt_table = fixed_2050000_voltage,
  944. },
  945. .shared_mode = &ldo_anamic2_shared,
  946. .update_bank = 0x03,
  947. .update_reg = 0x83,
  948. .update_mask = 0x10,
  949. .update_val = 0x10,
  950. .mode_bank = 0x01,
  951. .mode_reg = 0x54,
  952. .mode_mask = 0x04,
  953. .mode_val_idle = 0x04,
  954. .mode_val_normal = 0x00,
  955. },
  956. [AB8505_LDO_AUX8] = {
  957. .desc = {
  958. .name = "LDO-AUX8",
  959. .ops = &ab8500_regulator_ops,
  960. .type = REGULATOR_VOLTAGE,
  961. .id = AB8505_LDO_AUX8,
  962. .owner = THIS_MODULE,
  963. .n_voltages = 1,
  964. .volt_table = fixed_1800000_voltage,
  965. },
  966. .update_bank = 0x03,
  967. .update_reg = 0x83,
  968. .update_mask = 0x04,
  969. .update_val = 0x04,
  970. },
  971. /*
  972. * Regulators with fixed voltage and normal/idle modes
  973. */
  974. [AB8505_LDO_ANA] = {
  975. .desc = {
  976. .name = "LDO-ANA",
  977. .ops = &ab8500_regulator_volt_mode_ops,
  978. .type = REGULATOR_VOLTAGE,
  979. .id = AB8505_LDO_ANA,
  980. .owner = THIS_MODULE,
  981. .n_voltages = ARRAY_SIZE(ldo_vana_voltages),
  982. .volt_table = ldo_vana_voltages,
  983. },
  984. .load_lp_uA = 1000,
  985. .update_bank = 0x04,
  986. .update_reg = 0x06,
  987. .update_mask = 0x0c,
  988. .update_val = 0x04,
  989. .update_val_idle = 0x0c,
  990. .update_val_normal = 0x04,
  991. .voltage_bank = 0x04,
  992. .voltage_reg = 0x29,
  993. .voltage_mask = 0x7,
  994. },
  995. };
  996. static struct ab8500_shared_mode ldo_anamic1_shared = {
  997. .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2],
  998. };
  999. static struct ab8500_shared_mode ldo_anamic2_shared = {
  1000. .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1],
  1001. };
  1002. struct ab8500_reg_init {
  1003. u8 bank;
  1004. u8 addr;
  1005. u8 mask;
  1006. };
  1007. #define REG_INIT(_id, _bank, _addr, _mask) \
  1008. [_id] = { \
  1009. .bank = _bank, \
  1010. .addr = _addr, \
  1011. .mask = _mask, \
  1012. }
  1013. /* AB8500 register init */
  1014. static struct ab8500_reg_init ab8500_reg_init[] = {
  1015. /*
  1016. * 0x30, VanaRequestCtrl
  1017. * 0xc0, VextSupply1RequestCtrl
  1018. */
  1019. REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0),
  1020. /*
  1021. * 0x03, VextSupply2RequestCtrl
  1022. * 0x0c, VextSupply3RequestCtrl
  1023. * 0x30, Vaux1RequestCtrl
  1024. * 0xc0, Vaux2RequestCtrl
  1025. */
  1026. REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
  1027. /*
  1028. * 0x03, Vaux3RequestCtrl
  1029. * 0x04, SwHPReq
  1030. */
  1031. REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  1032. /*
  1033. * 0x08, VanaSysClkReq1HPValid
  1034. * 0x20, Vaux1SysClkReq1HPValid
  1035. * 0x40, Vaux2SysClkReq1HPValid
  1036. * 0x80, Vaux3SysClkReq1HPValid
  1037. */
  1038. REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
  1039. /*
  1040. * 0x10, VextSupply1SysClkReq1HPValid
  1041. * 0x20, VextSupply2SysClkReq1HPValid
  1042. * 0x40, VextSupply3SysClkReq1HPValid
  1043. */
  1044. REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
  1045. /*
  1046. * 0x08, VanaHwHPReq1Valid
  1047. * 0x20, Vaux1HwHPReq1Valid
  1048. * 0x40, Vaux2HwHPReq1Valid
  1049. * 0x80, Vaux3HwHPReq1Valid
  1050. */
  1051. REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
  1052. /*
  1053. * 0x01, VextSupply1HwHPReq1Valid
  1054. * 0x02, VextSupply2HwHPReq1Valid
  1055. * 0x04, VextSupply3HwHPReq1Valid
  1056. */
  1057. REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
  1058. /*
  1059. * 0x08, VanaHwHPReq2Valid
  1060. * 0x20, Vaux1HwHPReq2Valid
  1061. * 0x40, Vaux2HwHPReq2Valid
  1062. * 0x80, Vaux3HwHPReq2Valid
  1063. */
  1064. REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
  1065. /*
  1066. * 0x01, VextSupply1HwHPReq2Valid
  1067. * 0x02, VextSupply2HwHPReq2Valid
  1068. * 0x04, VextSupply3HwHPReq2Valid
  1069. */
  1070. REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
  1071. /*
  1072. * 0x20, VanaSwHPReqValid
  1073. * 0x80, Vaux1SwHPReqValid
  1074. */
  1075. REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
  1076. /*
  1077. * 0x01, Vaux2SwHPReqValid
  1078. * 0x02, Vaux3SwHPReqValid
  1079. * 0x04, VextSupply1SwHPReqValid
  1080. * 0x08, VextSupply2SwHPReqValid
  1081. * 0x10, VextSupply3SwHPReqValid
  1082. */
  1083. REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
  1084. /*
  1085. * 0x02, SysClkReq2Valid1
  1086. * 0x04, SysClkReq3Valid1
  1087. * 0x08, SysClkReq4Valid1
  1088. * 0x10, SysClkReq5Valid1
  1089. * 0x20, SysClkReq6Valid1
  1090. * 0x40, SysClkReq7Valid1
  1091. * 0x80, SysClkReq8Valid1
  1092. */
  1093. REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
  1094. /*
  1095. * 0x02, SysClkReq2Valid2
  1096. * 0x04, SysClkReq3Valid2
  1097. * 0x08, SysClkReq4Valid2
  1098. * 0x10, SysClkReq5Valid2
  1099. * 0x20, SysClkReq6Valid2
  1100. * 0x40, SysClkReq7Valid2
  1101. * 0x80, SysClkReq8Valid2
  1102. */
  1103. REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
  1104. /*
  1105. * 0x02, VTVoutEna
  1106. * 0x04, Vintcore12Ena
  1107. * 0x38, Vintcore12Sel
  1108. * 0x40, Vintcore12LP
  1109. * 0x80, VTVoutLP
  1110. */
  1111. REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe),
  1112. /*
  1113. * 0x02, VaudioEna
  1114. * 0x04, VdmicEna
  1115. * 0x08, Vamic1Ena
  1116. * 0x10, Vamic2Ena
  1117. */
  1118. REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
  1119. /*
  1120. * 0x01, Vamic1_dzout
  1121. * 0x02, Vamic2_dzout
  1122. */
  1123. REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  1124. /*
  1125. * 0x03, VpllRegu (NOTE! PRCMU register bits)
  1126. * 0x0c, VanaRegu
  1127. */
  1128. REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  1129. /*
  1130. * 0x01, VrefDDREna
  1131. * 0x02, VrefDDRSleepMode
  1132. */
  1133. REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03),
  1134. /*
  1135. * 0x03, VextSupply1Regu
  1136. * 0x0c, VextSupply2Regu
  1137. * 0x30, VextSupply3Regu
  1138. * 0x40, ExtSupply2Bypass
  1139. * 0x80, ExtSupply3Bypass
  1140. */
  1141. REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  1142. /*
  1143. * 0x03, Vaux1Regu
  1144. * 0x0c, Vaux2Regu
  1145. */
  1146. REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
  1147. /*
  1148. * 0x03, Vaux3Regu
  1149. */
  1150. REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
  1151. /*
  1152. * 0x0f, Vaux1Sel
  1153. */
  1154. REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
  1155. /*
  1156. * 0x0f, Vaux2Sel
  1157. */
  1158. REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
  1159. /*
  1160. * 0x07, Vaux3Sel
  1161. */
  1162. REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
  1163. /*
  1164. * 0x01, VextSupply12LP
  1165. */
  1166. REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
  1167. /*
  1168. * 0x04, Vaux1Disch
  1169. * 0x08, Vaux2Disch
  1170. * 0x10, Vaux3Disch
  1171. * 0x20, Vintcore12Disch
  1172. * 0x40, VTVoutDisch
  1173. * 0x80, VaudioDisch
  1174. */
  1175. REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
  1176. /*
  1177. * 0x02, VanaDisch
  1178. * 0x04, VdmicPullDownEna
  1179. * 0x10, VdmicDisch
  1180. */
  1181. REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
  1182. };
  1183. /* AB8505 register init */
  1184. static struct ab8500_reg_init ab8505_reg_init[] = {
  1185. /*
  1186. * 0x03, VarmRequestCtrl
  1187. * 0x0c, VsmpsCRequestCtrl
  1188. * 0x30, VsmpsARequestCtrl
  1189. * 0xc0, VsmpsBRequestCtrl
  1190. */
  1191. REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
  1192. /*
  1193. * 0x03, VsafeRequestCtrl
  1194. * 0x0c, VpllRequestCtrl
  1195. * 0x30, VanaRequestCtrl
  1196. */
  1197. REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f),
  1198. /*
  1199. * 0x30, Vaux1RequestCtrl
  1200. * 0xc0, Vaux2RequestCtrl
  1201. */
  1202. REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0),
  1203. /*
  1204. * 0x03, Vaux3RequestCtrl
  1205. * 0x04, SwHPReq
  1206. */
  1207. REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  1208. /*
  1209. * 0x01, VsmpsASysClkReq1HPValid
  1210. * 0x02, VsmpsBSysClkReq1HPValid
  1211. * 0x04, VsafeSysClkReq1HPValid
  1212. * 0x08, VanaSysClkReq1HPValid
  1213. * 0x10, VpllSysClkReq1HPValid
  1214. * 0x20, Vaux1SysClkReq1HPValid
  1215. * 0x40, Vaux2SysClkReq1HPValid
  1216. * 0x80, Vaux3SysClkReq1HPValid
  1217. */
  1218. REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
  1219. /*
  1220. * 0x01, VsmpsCSysClkReq1HPValid
  1221. * 0x02, VarmSysClkReq1HPValid
  1222. * 0x04, VbbSysClkReq1HPValid
  1223. * 0x08, VsmpsMSysClkReq1HPValid
  1224. */
  1225. REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f),
  1226. /*
  1227. * 0x01, VsmpsAHwHPReq1Valid
  1228. * 0x02, VsmpsBHwHPReq1Valid
  1229. * 0x04, VsafeHwHPReq1Valid
  1230. * 0x08, VanaHwHPReq1Valid
  1231. * 0x10, VpllHwHPReq1Valid
  1232. * 0x20, Vaux1HwHPReq1Valid
  1233. * 0x40, Vaux2HwHPReq1Valid
  1234. * 0x80, Vaux3HwHPReq1Valid
  1235. */
  1236. REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
  1237. /*
  1238. * 0x08, VsmpsMHwHPReq1Valid
  1239. */
  1240. REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08),
  1241. /*
  1242. * 0x01, VsmpsAHwHPReq2Valid
  1243. * 0x02, VsmpsBHwHPReq2Valid
  1244. * 0x04, VsafeHwHPReq2Valid
  1245. * 0x08, VanaHwHPReq2Valid
  1246. * 0x10, VpllHwHPReq2Valid
  1247. * 0x20, Vaux1HwHPReq2Valid
  1248. * 0x40, Vaux2HwHPReq2Valid
  1249. * 0x80, Vaux3HwHPReq2Valid
  1250. */
  1251. REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
  1252. /*
  1253. * 0x08, VsmpsMHwHPReq2Valid
  1254. */
  1255. REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08),
  1256. /*
  1257. * 0x01, VsmpsCSwHPReqValid
  1258. * 0x02, VarmSwHPReqValid
  1259. * 0x04, VsmpsASwHPReqValid
  1260. * 0x08, VsmpsBSwHPReqValid
  1261. * 0x10, VsafeSwHPReqValid
  1262. * 0x20, VanaSwHPReqValid
  1263. * 0x40, VpllSwHPReqValid
  1264. * 0x80, Vaux1SwHPReqValid
  1265. */
  1266. REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
  1267. /*
  1268. * 0x01, Vaux2SwHPReqValid
  1269. * 0x02, Vaux3SwHPReqValid
  1270. * 0x20, VsmpsMSwHPReqValid
  1271. */
  1272. REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23),
  1273. /*
  1274. * 0x02, SysClkReq2Valid1
  1275. * 0x04, SysClkReq3Valid1
  1276. * 0x08, SysClkReq4Valid1
  1277. */
  1278. REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e),
  1279. /*
  1280. * 0x02, SysClkReq2Valid2
  1281. * 0x04, SysClkReq3Valid2
  1282. * 0x08, SysClkReq4Valid2
  1283. */
  1284. REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e),
  1285. /*
  1286. * 0x01, Vaux4SwHPReqValid
  1287. * 0x02, Vaux4HwHPReq2Valid
  1288. * 0x04, Vaux4HwHPReq1Valid
  1289. * 0x08, Vaux4SysClkReq1HPValid
  1290. */
  1291. REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
  1292. /*
  1293. * 0x02, VadcEna
  1294. * 0x04, VintCore12Ena
  1295. * 0x38, VintCore12Sel
  1296. * 0x40, VintCore12LP
  1297. * 0x80, VadcLP
  1298. */
  1299. REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe),
  1300. /*
  1301. * 0x02, VaudioEna
  1302. * 0x04, VdmicEna
  1303. * 0x08, Vamic1Ena
  1304. * 0x10, Vamic2Ena
  1305. */
  1306. REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
  1307. /*
  1308. * 0x01, Vamic1_dzout
  1309. * 0x02, Vamic2_dzout
  1310. */
  1311. REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  1312. /*
  1313. * 0x03, VsmpsARegu
  1314. * 0x0c, VsmpsASelCtrl
  1315. * 0x10, VsmpsAAutoMode
  1316. * 0x20, VsmpsAPWMMode
  1317. */
  1318. REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f),
  1319. /*
  1320. * 0x03, VsmpsBRegu
  1321. * 0x0c, VsmpsBSelCtrl
  1322. * 0x10, VsmpsBAutoMode
  1323. * 0x20, VsmpsBPWMMode
  1324. */
  1325. REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f),
  1326. /*
  1327. * 0x03, VsafeRegu
  1328. * 0x0c, VsafeSelCtrl
  1329. * 0x10, VsafeAutoMode
  1330. * 0x20, VsafePWMMode
  1331. */
  1332. REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f),
  1333. /*
  1334. * 0x03, VpllRegu (NOTE! PRCMU register bits)
  1335. * 0x0c, VanaRegu
  1336. */
  1337. REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  1338. /*
  1339. * 0x03, VextSupply1Regu
  1340. * 0x0c, VextSupply2Regu
  1341. * 0x30, VextSupply3Regu
  1342. * 0x40, ExtSupply2Bypass
  1343. * 0x80, ExtSupply3Bypass
  1344. */
  1345. REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  1346. /*
  1347. * 0x03, Vaux1Regu
  1348. * 0x0c, Vaux2Regu
  1349. */
  1350. REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f),
  1351. /*
  1352. * 0x0f, Vaux3Regu
  1353. */
  1354. REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
  1355. /*
  1356. * 0x3f, VsmpsASel1
  1357. */
  1358. REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f),
  1359. /*
  1360. * 0x3f, VsmpsASel2
  1361. */
  1362. REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f),
  1363. /*
  1364. * 0x3f, VsmpsASel3
  1365. */
  1366. REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f),
  1367. /*
  1368. * 0x3f, VsmpsBSel1
  1369. */
  1370. REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f),
  1371. /*
  1372. * 0x3f, VsmpsBSel2
  1373. */
  1374. REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f),
  1375. /*
  1376. * 0x3f, VsmpsBSel3
  1377. */
  1378. REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f),
  1379. /*
  1380. * 0x7f, VsafeSel1
  1381. */
  1382. REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f),
  1383. /*
  1384. * 0x3f, VsafeSel2
  1385. */
  1386. REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f),
  1387. /*
  1388. * 0x3f, VsafeSel3
  1389. */
  1390. REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f),
  1391. /*
  1392. * 0x0f, Vaux1Sel
  1393. */
  1394. REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f),
  1395. /*
  1396. * 0x0f, Vaux2Sel
  1397. */
  1398. REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f),
  1399. /*
  1400. * 0x07, Vaux3Sel
  1401. * 0x30, VRF1Sel
  1402. */
  1403. REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
  1404. /*
  1405. * 0x03, Vaux4RequestCtrl
  1406. */
  1407. REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
  1408. /*
  1409. * 0x03, Vaux4Regu
  1410. */
  1411. REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03),
  1412. /*
  1413. * 0x0f, Vaux4Sel
  1414. */
  1415. REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f),
  1416. /*
  1417. * 0x04, Vaux1Disch
  1418. * 0x08, Vaux2Disch
  1419. * 0x10, Vaux3Disch
  1420. * 0x20, Vintcore12Disch
  1421. * 0x40, VTVoutDisch
  1422. * 0x80, VaudioDisch
  1423. */
  1424. REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
  1425. /*
  1426. * 0x02, VanaDisch
  1427. * 0x04, VdmicPullDownEna
  1428. * 0x10, VdmicDisch
  1429. */
  1430. REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
  1431. /*
  1432. * 0x01, Vaux4Disch
  1433. */
  1434. REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
  1435. /*
  1436. * 0x07, Vaux5Sel
  1437. * 0x08, Vaux5LP
  1438. * 0x10, Vaux5Ena
  1439. * 0x20, Vaux5Disch
  1440. * 0x40, Vaux5DisSfst
  1441. * 0x80, Vaux5DisPulld
  1442. */
  1443. REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff),
  1444. /*
  1445. * 0x07, Vaux6Sel
  1446. * 0x08, Vaux6LP
  1447. * 0x10, Vaux6Ena
  1448. * 0x80, Vaux6DisPulld
  1449. */
  1450. REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f),
  1451. };
  1452. static struct of_regulator_match ab8500_regulator_match[] = {
  1453. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
  1454. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
  1455. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
  1456. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
  1457. { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
  1458. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
  1459. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
  1460. { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
  1461. { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
  1462. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
  1463. };
  1464. static struct of_regulator_match ab8505_regulator_match[] = {
  1465. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, },
  1466. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, },
  1467. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, },
  1468. { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, },
  1469. { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, },
  1470. { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, },
  1471. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, },
  1472. { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, },
  1473. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, },
  1474. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, },
  1475. { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, },
  1476. { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, },
  1477. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, },
  1478. };
  1479. static struct {
  1480. struct ab8500_regulator_info *info;
  1481. int info_size;
  1482. struct ab8500_reg_init *init;
  1483. int init_size;
  1484. struct of_regulator_match *match;
  1485. int match_size;
  1486. } abx500_regulator;
  1487. static void abx500_get_regulator_info(struct ab8500 *ab8500)
  1488. {
  1489. if (is_ab8505(ab8500)) {
  1490. abx500_regulator.info = ab8505_regulator_info;
  1491. abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info);
  1492. abx500_regulator.init = ab8505_reg_init;
  1493. abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS;
  1494. abx500_regulator.match = ab8505_regulator_match;
  1495. abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match);
  1496. } else {
  1497. abx500_regulator.info = ab8500_regulator_info;
  1498. abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info);
  1499. abx500_regulator.init = ab8500_reg_init;
  1500. abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS;
  1501. abx500_regulator.match = ab8500_regulator_match;
  1502. abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match);
  1503. }
  1504. }
  1505. static int ab8500_regulator_register(struct platform_device *pdev,
  1506. struct regulator_init_data *init_data,
  1507. int id, struct device_node *np)
  1508. {
  1509. struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
  1510. struct ab8500_regulator_info *info = NULL;
  1511. struct regulator_config config = { };
  1512. /* assign per-regulator data */
  1513. info = &abx500_regulator.info[id];
  1514. info->dev = &pdev->dev;
  1515. config.dev = &pdev->dev;
  1516. config.init_data = init_data;
  1517. config.driver_data = info;
  1518. config.of_node = np;
  1519. /* fix for hardware before ab8500v2.0 */
  1520. if (is_ab8500_1p1_or_earlier(ab8500)) {
  1521. if (info->desc.id == AB8500_LDO_AUX3) {
  1522. info->desc.n_voltages =
  1523. ARRAY_SIZE(ldo_vauxn_voltages);
  1524. info->desc.volt_table = ldo_vauxn_voltages;
  1525. info->voltage_mask = 0xf;
  1526. }
  1527. }
  1528. /* register regulator with framework */
  1529. info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
  1530. &config);
  1531. if (IS_ERR(info->regulator)) {
  1532. dev_err(&pdev->dev, "failed to register regulator %s\n",
  1533. info->desc.name);
  1534. return PTR_ERR(info->regulator);
  1535. }
  1536. return 0;
  1537. }
  1538. static int ab8500_regulator_probe(struct platform_device *pdev)
  1539. {
  1540. struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
  1541. struct device_node *np = pdev->dev.of_node;
  1542. struct of_regulator_match *match;
  1543. int err, i;
  1544. if (!ab8500) {
  1545. dev_err(&pdev->dev, "null mfd parent\n");
  1546. return -EINVAL;
  1547. }
  1548. abx500_get_regulator_info(ab8500);
  1549. err = of_regulator_match(&pdev->dev, np,
  1550. abx500_regulator.match,
  1551. abx500_regulator.match_size);
  1552. if (err < 0) {
  1553. dev_err(&pdev->dev,
  1554. "Error parsing regulator init data: %d\n", err);
  1555. return err;
  1556. }
  1557. match = abx500_regulator.match;
  1558. for (i = 0; i < abx500_regulator.info_size; i++) {
  1559. err = ab8500_regulator_register(pdev, match[i].init_data, i,
  1560. match[i].of_node);
  1561. if (err)
  1562. return err;
  1563. }
  1564. return 0;
  1565. }
  1566. static struct platform_driver ab8500_regulator_driver = {
  1567. .probe = ab8500_regulator_probe,
  1568. .driver = {
  1569. .name = "ab8500-regulator",
  1570. },
  1571. };
  1572. static int __init ab8500_regulator_init(void)
  1573. {
  1574. int ret;
  1575. ret = platform_driver_register(&ab8500_regulator_driver);
  1576. if (ret != 0)
  1577. pr_err("Failed to register ab8500 regulator: %d\n", ret);
  1578. return ret;
  1579. }
  1580. subsys_initcall(ab8500_regulator_init);
  1581. static void __exit ab8500_regulator_exit(void)
  1582. {
  1583. platform_driver_unregister(&ab8500_regulator_driver);
  1584. }
  1585. module_exit(ab8500_regulator_exit);
  1586. MODULE_LICENSE("GPL v2");
  1587. MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
  1588. MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
  1589. MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
  1590. MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
  1591. MODULE_ALIAS("platform:ab8500-regulator");