board-mop500-regulators.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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>
  7. * Bengt Jonsson <bengt.g.jonsson@stericsson.com>
  8. *
  9. * MOP500 board specific initialization for regulators
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/regulator/machine.h>
  13. #include <linux/regulator/ab8500.h>
  14. #include <mach/id.h> /* to identify older boards for fixes */
  15. #include "board-mop500-regulators.h"
  16. static struct regulator_consumer_supply gpio_en_3v3_consumers[] = {
  17. REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
  18. };
  19. struct regulator_init_data gpio_en_3v3_regulator = {
  20. .constraints = {
  21. .name = "EN-3V3",
  22. .min_uV = 3300000,
  23. .max_uV = 3300000,
  24. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  25. },
  26. .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers),
  27. .consumer_supplies = gpio_en_3v3_consumers,
  28. };
  29. /*
  30. * TPS61052 regulator
  31. */
  32. static struct regulator_consumer_supply tps61052_vaudio_consumers[] = {
  33. /*
  34. * Boost converter supply to raise voltage on audio speaker, this
  35. * is actually connected to three pins, VInVhfL (left amplifier)
  36. * VInVhfR (right amplifier) and VIntDClassInt - all three must
  37. * be connected to the same voltage.
  38. */
  39. REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"),
  40. };
  41. struct regulator_init_data tps61052_regulator = {
  42. .constraints = {
  43. .name = "vaudio-hf",
  44. .min_uV = 4500000,
  45. .max_uV = 4500000,
  46. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  47. },
  48. .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers),
  49. .consumer_supplies = tps61052_vaudio_consumers,
  50. };
  51. static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
  52. /* Main display, u8500 R3 uib */
  53. REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
  54. /* Main display, u8500 uib and ST uib */
  55. REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"),
  56. /* Secondary display, ST uib */
  57. REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"),
  58. /* SFH7741 proximity sensor */
  59. REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
  60. /* BH1780GLS ambient light sensor */
  61. REGULATOR_SUPPLY("vcc", "2-0029"),
  62. /* lsm303dlh accelerometer */
  63. REGULATOR_SUPPLY("vdd", "3-0018"),
  64. /* lsm303dlhc accelerometer */
  65. REGULATOR_SUPPLY("vdd", "2-0019"),
  66. /* lsm303dlh magnetometer */
  67. REGULATOR_SUPPLY("vdd", "2-001e"),
  68. /* Rohm BU21013 Touchscreen devices */
  69. REGULATOR_SUPPLY("avdd", "3-005c"),
  70. REGULATOR_SUPPLY("avdd", "3-005d"),
  71. /* Synaptics RMI4 Touchscreen device */
  72. REGULATOR_SUPPLY("vdd", "3-004b"),
  73. /* L3G4200D Gyroscope device */
  74. REGULATOR_SUPPLY("vdd", "2-0068"),
  75. /* Ambient light sensor device */
  76. REGULATOR_SUPPLY("vdd", "3-0029"),
  77. /* Pressure sensor device */
  78. REGULATOR_SUPPLY("vdd", "2-005c"),
  79. /* Cypress TrueTouch Touchscreen device */
  80. REGULATOR_SUPPLY("vcpin", "spi8.0"),
  81. /* Camera device */
  82. REGULATOR_SUPPLY("vaux12v5", "mmio_camera"),
  83. };
  84. static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
  85. /* On-board eMMC power */
  86. REGULATOR_SUPPLY("vmmc", "sdi4"),
  87. /* AB8500 audio codec */
  88. REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
  89. };
  90. static struct regulator_consumer_supply ab8500_vaux3_consumers[] = {
  91. /* External MMC slot power */
  92. REGULATOR_SUPPLY("vmmc", "sdi0"),
  93. };
  94. static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
  95. /* TV-out DENC supply */
  96. REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
  97. /* Internal general-purpose ADC */
  98. REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
  99. };
  100. static struct regulator_consumer_supply ab8500_vaud_consumers[] = {
  101. /* AB8500 audio-codec main supply */
  102. REGULATOR_SUPPLY("vaud", "ab8500-codec.0"),
  103. };
  104. static struct regulator_consumer_supply ab8500_vamic1_consumers[] = {
  105. /* AB8500 audio-codec Mic1 supply */
  106. REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"),
  107. };
  108. static struct regulator_consumer_supply ab8500_vamic2_consumers[] = {
  109. /* AB8500 audio-codec Mic2 supply */
  110. REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"),
  111. };
  112. static struct regulator_consumer_supply ab8500_vdmic_consumers[] = {
  113. /* AB8500 audio-codec DMic supply */
  114. REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"),
  115. };
  116. static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
  117. /* SoC core supply, no device */
  118. REGULATOR_SUPPLY("v-intcore", NULL),
  119. /* USB Transceiver */
  120. REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
  121. };
  122. static struct regulator_consumer_supply ab8500_vana_consumers[] = {
  123. /* External displays, connector on board, 1v8 power supply */
  124. REGULATOR_SUPPLY("vsmps2", "mcde.0"),
  125. };
  126. /* ab8500 regulator register initialization */
  127. static struct ab8500_regulator_reg_init ab8500_reg_init[] = {
  128. /*
  129. * VanaRequestCtrl = HP/LP depending on VxRequest
  130. * VextSupply1RequestCtrl = HP/LP depending on VxRequest
  131. */
  132. INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00),
  133. /*
  134. * VextSupply2RequestCtrl = HP/LP depending on VxRequest
  135. * VextSupply3RequestCtrl = HP/LP depending on VxRequest
  136. * Vaux1RequestCtrl = HP/LP depending on VxRequest
  137. * Vaux2RequestCtrl = HP/LP depending on VxRequest
  138. */
  139. INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00),
  140. /*
  141. * Vaux3RequestCtrl = HP/LP depending on VxRequest
  142. * SwHPReq = Control through SWValid disabled
  143. */
  144. INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00),
  145. /*
  146. * VanaSysClkReq1HPValid = disabled
  147. * Vaux1SysClkReq1HPValid = disabled
  148. * Vaux2SysClkReq1HPValid = disabled
  149. * Vaux3SysClkReq1HPValid = disabled
  150. */
  151. INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
  152. /*
  153. * VextSupply1SysClkReq1HPValid = disabled
  154. * VextSupply2SysClkReq1HPValid = disabled
  155. * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled
  156. */
  157. INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40),
  158. /*
  159. * VanaHwHPReq1Valid = disabled
  160. * Vaux1HwHPreq1Valid = disabled
  161. * Vaux2HwHPReq1Valid = disabled
  162. * Vaux3HwHPReqValid = disabled
  163. */
  164. INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00),
  165. /*
  166. * VextSupply1HwHPReq1Valid = disabled
  167. * VextSupply2HwHPReq1Valid = disabled
  168. * VextSupply3HwHPReq1Valid = disabled
  169. */
  170. INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00),
  171. /*
  172. * VanaHwHPReq2Valid = disabled
  173. * Vaux1HwHPReq2Valid = disabled
  174. * Vaux2HwHPReq2Valid = disabled
  175. * Vaux3HwHPReq2Valid = disabled
  176. */
  177. INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00),
  178. /*
  179. * VextSupply1HwHPReq2Valid = disabled
  180. * VextSupply2HwHPReq2Valid = disabled
  181. * VextSupply3HwHPReq2Valid = HWReq2 controlled
  182. */
  183. INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04),
  184. /*
  185. * VanaSwHPReqValid = disabled
  186. * Vaux1SwHPReqValid = disabled
  187. */
  188. INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00),
  189. /*
  190. * Vaux2SwHPReqValid = disabled
  191. * Vaux3SwHPReqValid = disabled
  192. * VextSupply1SwHPReqValid = disabled
  193. * VextSupply2SwHPReqValid = disabled
  194. * VextSupply3SwHPReqValid = disabled
  195. */
  196. INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00),
  197. /*
  198. * SysClkReq2Valid1 = SysClkReq2 controlled
  199. * SysClkReq3Valid1 = disabled
  200. * SysClkReq4Valid1 = SysClkReq4 controlled
  201. * SysClkReq5Valid1 = disabled
  202. * SysClkReq6Valid1 = SysClkReq6 controlled
  203. * SysClkReq7Valid1 = disabled
  204. * SysClkReq8Valid1 = disabled
  205. */
  206. INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a),
  207. /*
  208. * SysClkReq2Valid2 = disabled
  209. * SysClkReq3Valid2 = disabled
  210. * SysClkReq4Valid2 = disabled
  211. * SysClkReq5Valid2 = disabled
  212. * SysClkReq6Valid2 = SysClkReq6 controlled
  213. * SysClkReq7Valid2 = disabled
  214. * SysClkReq8Valid2 = disabled
  215. */
  216. INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20),
  217. /*
  218. * VTVoutEna = disabled
  219. * Vintcore12Ena = disabled
  220. * Vintcore12Sel = 1.25 V
  221. * Vintcore12LP = inactive (HP)
  222. * VTVoutLP = inactive (HP)
  223. */
  224. INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10),
  225. /*
  226. * VaudioEna = disabled
  227. * VdmicEna = disabled
  228. * Vamic1Ena = disabled
  229. * Vamic2Ena = disabled
  230. */
  231. INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00),
  232. /*
  233. * Vamic1_dzout = high-Z when Vamic1 is disabled
  234. * Vamic2_dzout = high-Z when Vamic2 is disabled
  235. */
  236. INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00),
  237. /*
  238. * VPll = Hw controlled (NOTE! PRCMU bits)
  239. * VanaRegu = force off
  240. */
  241. INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02),
  242. /*
  243. * VrefDDREna = disabled
  244. * VrefDDRSleepMode = inactive (no pulldown)
  245. */
  246. INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00),
  247. /*
  248. * VextSupply1Regu = force LP
  249. * VextSupply2Regu = force OFF
  250. * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP)
  251. * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
  252. * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
  253. */
  254. INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13),
  255. /*
  256. * Vaux1Regu = force HP
  257. * Vaux2Regu = force off
  258. */
  259. INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01),
  260. /*
  261. * Vaux3Regu = force off
  262. */
  263. INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00),
  264. /*
  265. * Vaux1Sel = 2.5 V
  266. */
  267. INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x08),
  268. /*
  269. * Vaux2Sel = 2.9 V
  270. */
  271. INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d),
  272. /*
  273. * Vaux3Sel = 2.91 V
  274. */
  275. INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07),
  276. /*
  277. * VextSupply12LP = disabled (no LP)
  278. */
  279. INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00),
  280. /*
  281. * Vaux1Disch = short discharge time
  282. * Vaux2Disch = short discharge time
  283. * Vaux3Disch = short discharge time
  284. * Vintcore12Disch = short discharge time
  285. * VTVoutDisch = short discharge time
  286. * VaudioDisch = short discharge time
  287. */
  288. INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00),
  289. /*
  290. * VanaDisch = short discharge time
  291. * VdmicPullDownEna = pulldown disabled when Vdmic is disabled
  292. * VdmicDisch = short discharge time
  293. */
  294. INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00),
  295. };
  296. /* AB8500 regulators */
  297. static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
  298. /* supplies to the display/camera */
  299. [AB8500_LDO_AUX1] = {
  300. .constraints = {
  301. .name = "V-DISPLAY",
  302. .min_uV = 2500000,
  303. .max_uV = 2900000,
  304. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  305. REGULATOR_CHANGE_STATUS,
  306. .boot_on = 1, /* display is on at boot */
  307. /*
  308. * This voltage cannot be disabled right now because
  309. * it is somehow affecting the external MMC
  310. * functionality, though that typically will use
  311. * AUX3.
  312. */
  313. .always_on = 1,
  314. },
  315. .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
  316. .consumer_supplies = ab8500_vaux1_consumers,
  317. },
  318. /* supplies to the on-board eMMC */
  319. [AB8500_LDO_AUX2] = {
  320. .constraints = {
  321. .name = "V-eMMC1",
  322. .min_uV = 1100000,
  323. .max_uV = 3300000,
  324. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  325. REGULATOR_CHANGE_STATUS,
  326. },
  327. .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
  328. .consumer_supplies = ab8500_vaux2_consumers,
  329. },
  330. /* supply for VAUX3, supplies to SDcard slots */
  331. [AB8500_LDO_AUX3] = {
  332. .constraints = {
  333. .name = "V-MMC-SD",
  334. .min_uV = 1100000,
  335. .max_uV = 3300000,
  336. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  337. REGULATOR_CHANGE_STATUS,
  338. },
  339. .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
  340. .consumer_supplies = ab8500_vaux3_consumers,
  341. },
  342. /* supply for tvout, gpadc, TVOUT LDO */
  343. [AB8500_LDO_TVOUT] = {
  344. .constraints = {
  345. .name = "V-TVOUT",
  346. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  347. },
  348. .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers),
  349. .consumer_supplies = ab8500_vtvout_consumers,
  350. },
  351. /* supply for ab8500-vaudio, VAUDIO LDO */
  352. [AB8500_LDO_AUDIO] = {
  353. .constraints = {
  354. .name = "V-AUD",
  355. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  356. },
  357. .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers),
  358. .consumer_supplies = ab8500_vaud_consumers,
  359. },
  360. /* supply for v-anamic1 VAMic1-LDO */
  361. [AB8500_LDO_ANAMIC1] = {
  362. .constraints = {
  363. .name = "V-AMIC1",
  364. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  365. },
  366. .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
  367. .consumer_supplies = ab8500_vamic1_consumers,
  368. },
  369. /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
  370. [AB8500_LDO_ANAMIC2] = {
  371. .constraints = {
  372. .name = "V-AMIC2",
  373. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  374. },
  375. .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
  376. .consumer_supplies = ab8500_vamic2_consumers,
  377. },
  378. /* supply for v-dmic, VDMIC LDO */
  379. [AB8500_LDO_DMIC] = {
  380. .constraints = {
  381. .name = "V-DMIC",
  382. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  383. },
  384. .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers),
  385. .consumer_supplies = ab8500_vdmic_consumers,
  386. },
  387. /* supply for v-intcore12, VINTCORE12 LDO */
  388. [AB8500_LDO_INTCORE] = {
  389. .constraints = {
  390. .name = "V-INTCORE",
  391. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  392. },
  393. .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
  394. .consumer_supplies = ab8500_vintcore_consumers,
  395. },
  396. /* supply for U8500 CSI/DSI, VANA LDO */
  397. [AB8500_LDO_ANA] = {
  398. .constraints = {
  399. .name = "V-CSI/DSI",
  400. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  401. },
  402. .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
  403. .consumer_supplies = ab8500_vana_consumers,
  404. },
  405. };
  406. /* supply for VextSupply3 */
  407. static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = {
  408. /* SIM supply for 3 V SIM cards */
  409. REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
  410. };
  411. /* extended configuration for VextSupply2, only used for HREFP_V20 boards */
  412. static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = {
  413. .hwreq = true,
  414. };
  415. /*
  416. * AB8500 external regulators
  417. */
  418. static struct regulator_init_data ab8500_ext_regulators[] = {
  419. /* fixed Vbat supplies VSMPS1_EXT_1V8 */
  420. [AB8500_EXT_SUPPLY1] = {
  421. .constraints = {
  422. .name = "ab8500-ext-supply1",
  423. .min_uV = 1800000,
  424. .max_uV = 1800000,
  425. .initial_mode = REGULATOR_MODE_IDLE,
  426. .boot_on = 1,
  427. .always_on = 1,
  428. },
  429. },
  430. /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */
  431. [AB8500_EXT_SUPPLY2] = {
  432. .constraints = {
  433. .name = "ab8500-ext-supply2",
  434. .min_uV = 1360000,
  435. .max_uV = 1360000,
  436. },
  437. },
  438. /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */
  439. [AB8500_EXT_SUPPLY3] = {
  440. .constraints = {
  441. .name = "ab8500-ext-supply3",
  442. .min_uV = 3400000,
  443. .max_uV = 3400000,
  444. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  445. .boot_on = 1,
  446. },
  447. .num_consumer_supplies =
  448. ARRAY_SIZE(ab8500_ext_supply3_consumers),
  449. .consumer_supplies = ab8500_ext_supply3_consumers,
  450. },
  451. };
  452. struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
  453. .reg_init = ab8500_reg_init,
  454. .num_reg_init = ARRAY_SIZE(ab8500_reg_init),
  455. .regulator = ab8500_regulators,
  456. .num_regulator = ARRAY_SIZE(ab8500_regulators),
  457. .ext_regulator = ab8500_ext_regulators,
  458. .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators),
  459. };
  460. static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
  461. {
  462. int i;
  463. for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) {
  464. if (ab8500_reg_init[i].id == id) {
  465. u8 initval = ab8500_reg_init[i].value;
  466. initval = (initval & ~mask) | (value & mask);
  467. ab8500_reg_init[i].value = initval;
  468. BUG_ON(mask & ~ab8500_reg_init[i].mask);
  469. return;
  470. }
  471. }
  472. BUG_ON(1);
  473. }
  474. void mop500_regulator_init(void)
  475. {
  476. struct regulator_init_data *regulator;
  477. /*
  478. * Handle VextSupply1 on older boards than HREFP_V22_V1x
  479. * (turn off in suspend)
  480. */
  481. if (cpu_is_u8500v20() || cpu_is_u8500v21()) {
  482. /* disable VextSupply1 in suspend */
  483. regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY1];
  484. regulator->constraints.state_mem.disabled = 1;
  485. regulator->constraints.state_standby.disabled = 1;
  486. }
  487. /*
  488. * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
  489. * all HREFP_V20 boards)
  490. */
  491. if (cpu_is_u8500v20()) {
  492. /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */
  493. ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
  494. /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
  495. ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
  496. 0x20, 0x20);
  497. /* VextSupply2 = force HP at initialization */
  498. ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
  499. /* enable VextSupply2 during platform active */
  500. regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
  501. regulator->constraints.always_on = 1;
  502. /* disable VextSupply2 in suspend */
  503. regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
  504. regulator->constraints.state_mem.disabled = 1;
  505. regulator->constraints.state_standby.disabled = 1;
  506. /* enable VextSupply2 HW control (used in suspend) */
  507. regulator->driver_data = (void *)&ab8500_ext_supply2;
  508. }
  509. }