ab8500.c 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211
  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. * @is_enabled: status of regulator (on/off)
  48. * @load_lp_uA: maximum load in idle (low power) mode
  49. * @update_bank: bank to control on/off
  50. * @update_reg: register to control on/off
  51. * @update_mask: mask to enable/disable and set mode of regulator
  52. * @update_val: bits holding the regulator current mode
  53. * @update_val_idle: bits to enable the regulator in idle (low power) mode
  54. * @update_val_normal: bits to enable the regulator in normal (high power) mode
  55. * @mode_bank: bank with location of mode register
  56. * @mode_reg: mode register
  57. * @mode_mask: mask for setting mode
  58. * @mode_val_idle: mode setting for low power
  59. * @mode_val_normal: mode setting for normal power
  60. * @voltage_bank: bank to control regulator voltage
  61. * @voltage_reg: register to control regulator voltage
  62. * @voltage_mask: mask to control regulator voltage
  63. * @voltage_shift: shift to control regulator voltage
  64. */
  65. struct ab8500_regulator_info {
  66. struct device *dev;
  67. struct regulator_desc desc;
  68. struct regulator_dev *regulator;
  69. struct ab8500_shared_mode *shared_mode;
  70. bool is_enabled;
  71. int load_lp_uA;
  72. u8 update_bank;
  73. u8 update_reg;
  74. u8 update_mask;
  75. u8 update_val;
  76. u8 update_val_idle;
  77. u8 update_val_normal;
  78. u8 mode_bank;
  79. u8 mode_reg;
  80. u8 mode_mask;
  81. u8 mode_val_idle;
  82. u8 mode_val_normal;
  83. u8 voltage_bank;
  84. u8 voltage_reg;
  85. u8 voltage_mask;
  86. u8 voltage_shift;
  87. struct {
  88. u8 voltage_limit;
  89. u8 voltage_bank;
  90. u8 voltage_reg;
  91. u8 voltage_mask;
  92. u8 voltage_shift;
  93. } expand_register;
  94. };
  95. /* voltage tables for the vauxn/vintcore supplies */
  96. static const unsigned int ldo_vauxn_voltages[] = {
  97. 1100000,
  98. 1200000,
  99. 1300000,
  100. 1400000,
  101. 1500000,
  102. 1800000,
  103. 1850000,
  104. 1900000,
  105. 2500000,
  106. 2650000,
  107. 2700000,
  108. 2750000,
  109. 2800000,
  110. 2900000,
  111. 3000000,
  112. 3300000,
  113. };
  114. static const unsigned int ldo_vaux3_voltages[] = {
  115. 1200000,
  116. 1500000,
  117. 1800000,
  118. 2100000,
  119. 2500000,
  120. 2750000,
  121. 2790000,
  122. 2910000,
  123. };
  124. static const unsigned int ldo_vaux56_voltages[] = {
  125. 1800000,
  126. 1050000,
  127. 1100000,
  128. 1200000,
  129. 1500000,
  130. 2200000,
  131. 2500000,
  132. 2790000,
  133. };
  134. static const unsigned int ldo_vaux3_ab8540_voltages[] = {
  135. 1200000,
  136. 1500000,
  137. 1800000,
  138. 2100000,
  139. 2500000,
  140. 2750000,
  141. 2790000,
  142. 2910000,
  143. 3050000,
  144. };
  145. static const unsigned int ldo_vintcore_voltages[] = {
  146. 1200000,
  147. 1225000,
  148. 1250000,
  149. 1275000,
  150. 1300000,
  151. 1325000,
  152. 1350000,
  153. };
  154. static const unsigned int ldo_sdio_voltages[] = {
  155. 1160000,
  156. 1050000,
  157. 1100000,
  158. 1500000,
  159. 1800000,
  160. 2200000,
  161. 2910000,
  162. 3050000,
  163. };
  164. static const unsigned int fixed_1200000_voltage[] = {
  165. 1200000,
  166. };
  167. static const unsigned int fixed_1800000_voltage[] = {
  168. 1800000,
  169. };
  170. static const unsigned int fixed_2000000_voltage[] = {
  171. 2000000,
  172. };
  173. static const unsigned int fixed_2050000_voltage[] = {
  174. 2050000,
  175. };
  176. static const unsigned int fixed_3300000_voltage[] = {
  177. 3300000,
  178. };
  179. static const unsigned int ldo_vana_voltages[] = {
  180. 1050000,
  181. 1075000,
  182. 1100000,
  183. 1125000,
  184. 1150000,
  185. 1175000,
  186. 1200000,
  187. 1225000,
  188. };
  189. static const unsigned int ldo_vaudio_voltages[] = {
  190. 2000000,
  191. 2100000,
  192. 2200000,
  193. 2300000,
  194. 2400000,
  195. 2500000,
  196. 2600000,
  197. 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */
  198. };
  199. static const unsigned int ldo_vdmic_voltages[] = {
  200. 1800000,
  201. 1900000,
  202. 2000000,
  203. 2850000,
  204. };
  205. static DEFINE_MUTEX(shared_mode_mutex);
  206. static struct ab8500_shared_mode ldo_anamic1_shared;
  207. static struct ab8500_shared_mode ldo_anamic2_shared;
  208. static struct ab8500_shared_mode ab8540_ldo_anamic1_shared;
  209. static struct ab8500_shared_mode ab8540_ldo_anamic2_shared;
  210. static int ab8500_regulator_enable(struct regulator_dev *rdev)
  211. {
  212. int ret;
  213. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  214. if (info == NULL) {
  215. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  216. return -EINVAL;
  217. }
  218. ret = abx500_mask_and_set_register_interruptible(info->dev,
  219. info->update_bank, info->update_reg,
  220. info->update_mask, info->update_val);
  221. if (ret < 0) {
  222. dev_err(rdev_get_dev(rdev),
  223. "couldn't set enable bits for regulator\n");
  224. return ret;
  225. }
  226. info->is_enabled = true;
  227. dev_vdbg(rdev_get_dev(rdev),
  228. "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
  229. info->desc.name, info->update_bank, info->update_reg,
  230. info->update_mask, info->update_val);
  231. return ret;
  232. }
  233. static int ab8500_regulator_disable(struct regulator_dev *rdev)
  234. {
  235. int ret;
  236. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  237. if (info == NULL) {
  238. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  239. return -EINVAL;
  240. }
  241. ret = abx500_mask_and_set_register_interruptible(info->dev,
  242. info->update_bank, info->update_reg,
  243. info->update_mask, 0x0);
  244. if (ret < 0) {
  245. dev_err(rdev_get_dev(rdev),
  246. "couldn't set disable bits for regulator\n");
  247. return ret;
  248. }
  249. info->is_enabled = false;
  250. dev_vdbg(rdev_get_dev(rdev),
  251. "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
  252. info->desc.name, info->update_bank, info->update_reg,
  253. info->update_mask, 0x0);
  254. return ret;
  255. }
  256. static unsigned int ab8500_regulator_get_optimum_mode(
  257. struct regulator_dev *rdev, int input_uV,
  258. int output_uV, int load_uA)
  259. {
  260. unsigned int mode;
  261. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  262. if (info == NULL) {
  263. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  264. return -EINVAL;
  265. }
  266. if (load_uA <= info->load_lp_uA)
  267. mode = REGULATOR_MODE_IDLE;
  268. else
  269. mode = REGULATOR_MODE_NORMAL;
  270. return mode;
  271. }
  272. static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
  273. unsigned int mode)
  274. {
  275. int ret = 0;
  276. u8 bank;
  277. u8 reg;
  278. u8 mask;
  279. u8 val;
  280. bool dmr = false; /* Dedicated mode register */
  281. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  282. if (info == NULL) {
  283. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  284. return -EINVAL;
  285. }
  286. if (info->shared_mode) {
  287. /*
  288. * Special case where mode is shared between two regulators.
  289. */
  290. struct ab8500_shared_mode *sm = info->shared_mode;
  291. mutex_lock(&shared_mode_mutex);
  292. if (mode == REGULATOR_MODE_IDLE) {
  293. sm->lp_mode_req = true; /* Low power mode requested */
  294. if (!((sm->shared_regulator)->
  295. shared_mode->lp_mode_req)) {
  296. mutex_unlock(&shared_mode_mutex);
  297. return 0; /* Other regulator prevent LP mode */
  298. }
  299. } else {
  300. sm->lp_mode_req = false;
  301. }
  302. }
  303. if (info->mode_mask) {
  304. /* Dedicated register for handling mode */
  305. dmr = true;
  306. switch (mode) {
  307. case REGULATOR_MODE_NORMAL:
  308. val = info->mode_val_normal;
  309. break;
  310. case REGULATOR_MODE_IDLE:
  311. val = info->mode_val_idle;
  312. break;
  313. default:
  314. if (info->shared_mode)
  315. mutex_unlock(&shared_mode_mutex);
  316. return -EINVAL;
  317. }
  318. bank = info->mode_bank;
  319. reg = info->mode_reg;
  320. mask = info->mode_mask;
  321. } else {
  322. /* Mode register same as enable register */
  323. switch (mode) {
  324. case REGULATOR_MODE_NORMAL:
  325. info->update_val = info->update_val_normal;
  326. val = info->update_val_normal;
  327. break;
  328. case REGULATOR_MODE_IDLE:
  329. info->update_val = info->update_val_idle;
  330. val = info->update_val_idle;
  331. break;
  332. default:
  333. if (info->shared_mode)
  334. mutex_unlock(&shared_mode_mutex);
  335. return -EINVAL;
  336. }
  337. bank = info->update_bank;
  338. reg = info->update_reg;
  339. mask = info->update_mask;
  340. }
  341. if (info->is_enabled || dmr) {
  342. ret = abx500_mask_and_set_register_interruptible(info->dev,
  343. bank, reg, mask, val);
  344. if (ret < 0)
  345. dev_err(rdev_get_dev(rdev),
  346. "couldn't set regulator mode\n");
  347. dev_vdbg(rdev_get_dev(rdev),
  348. "%s-set_mode (bank, reg, mask, value): "
  349. "0x%x, 0x%x, 0x%x, 0x%x\n",
  350. info->desc.name, bank, reg,
  351. mask, val);
  352. }
  353. if (info->shared_mode)
  354. mutex_unlock(&shared_mode_mutex);
  355. return ret;
  356. }
  357. static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
  358. {
  359. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  360. int ret;
  361. u8 val;
  362. u8 val_normal;
  363. u8 val_idle;
  364. if (info == NULL) {
  365. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  366. return -EINVAL;
  367. }
  368. /* Need special handling for shared mode */
  369. if (info->shared_mode) {
  370. if (info->shared_mode->lp_mode_req)
  371. return REGULATOR_MODE_IDLE;
  372. else
  373. return REGULATOR_MODE_NORMAL;
  374. }
  375. if (info->mode_mask) {
  376. /* Dedicated register for handling mode */
  377. ret = abx500_get_register_interruptible(info->dev,
  378. info->mode_bank, info->mode_reg, &val);
  379. val = val & info->mode_mask;
  380. val_normal = info->mode_val_normal;
  381. val_idle = info->mode_val_idle;
  382. } else {
  383. /* Mode register same as enable register */
  384. val = info->update_val;
  385. val_normal = info->update_val_normal;
  386. val_idle = info->update_val_idle;
  387. }
  388. if (val == val_normal)
  389. ret = REGULATOR_MODE_NORMAL;
  390. else if (val == val_idle)
  391. ret = REGULATOR_MODE_IDLE;
  392. else
  393. ret = -EINVAL;
  394. return ret;
  395. }
  396. static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
  397. {
  398. int ret;
  399. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  400. u8 regval;
  401. if (info == NULL) {
  402. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  403. return -EINVAL;
  404. }
  405. ret = abx500_get_register_interruptible(info->dev,
  406. info->update_bank, info->update_reg, &regval);
  407. if (ret < 0) {
  408. dev_err(rdev_get_dev(rdev),
  409. "couldn't read 0x%x register\n", info->update_reg);
  410. return ret;
  411. }
  412. dev_vdbg(rdev_get_dev(rdev),
  413. "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  414. " 0x%x\n",
  415. info->desc.name, info->update_bank, info->update_reg,
  416. info->update_mask, regval);
  417. if (regval & info->update_mask)
  418. info->is_enabled = true;
  419. else
  420. info->is_enabled = false;
  421. return info->is_enabled;
  422. }
  423. static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
  424. {
  425. int ret, val;
  426. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  427. u8 regval;
  428. if (info == NULL) {
  429. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  430. return -EINVAL;
  431. }
  432. ret = abx500_get_register_interruptible(info->dev,
  433. info->voltage_bank, info->voltage_reg, &regval);
  434. if (ret < 0) {
  435. dev_err(rdev_get_dev(rdev),
  436. "couldn't read voltage reg for regulator\n");
  437. return ret;
  438. }
  439. dev_vdbg(rdev_get_dev(rdev),
  440. "%s-get_voltage (bank, reg, mask, shift, value): "
  441. "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
  442. info->desc.name, info->voltage_bank,
  443. info->voltage_reg, info->voltage_mask,
  444. info->voltage_shift, regval);
  445. val = regval & info->voltage_mask;
  446. return val >> info->voltage_shift;
  447. }
  448. static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
  449. {
  450. int ret, val;
  451. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  452. u8 regval, regval_expand;
  453. if (info == NULL) {
  454. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  455. return -EINVAL;
  456. }
  457. ret = abx500_get_register_interruptible(info->dev,
  458. info->voltage_bank, info->voltage_reg, &regval);
  459. if (ret < 0) {
  460. dev_err(rdev_get_dev(rdev),
  461. "couldn't read voltage reg for regulator\n");
  462. return ret;
  463. }
  464. ret = abx500_get_register_interruptible(info->dev,
  465. info->expand_register.voltage_bank,
  466. info->expand_register.voltage_reg, &regval_expand);
  467. if (ret < 0) {
  468. dev_err(rdev_get_dev(rdev),
  469. "couldn't read voltage reg for regulator\n");
  470. return ret;
  471. }
  472. dev_vdbg(rdev_get_dev(rdev),
  473. "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  474. " 0x%x\n",
  475. info->desc.name, info->voltage_bank, info->voltage_reg,
  476. info->voltage_mask, regval);
  477. dev_vdbg(rdev_get_dev(rdev),
  478. "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  479. " 0x%x\n",
  480. info->desc.name, info->expand_register.voltage_bank,
  481. info->expand_register.voltage_reg,
  482. info->expand_register.voltage_mask, regval_expand);
  483. if (regval_expand&(info->expand_register.voltage_mask))
  484. /* Vaux3 has a different layout */
  485. val = info->expand_register.voltage_limit;
  486. else
  487. val = (regval & info->voltage_mask) >> info->voltage_shift;
  488. return val;
  489. }
  490. static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
  491. unsigned selector)
  492. {
  493. int ret;
  494. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  495. u8 regval;
  496. if (info == NULL) {
  497. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  498. return -EINVAL;
  499. }
  500. /* set the registers for the request */
  501. regval = (u8)selector << info->voltage_shift;
  502. ret = abx500_mask_and_set_register_interruptible(info->dev,
  503. info->voltage_bank, info->voltage_reg,
  504. info->voltage_mask, regval);
  505. if (ret < 0)
  506. dev_err(rdev_get_dev(rdev),
  507. "couldn't set voltage reg for regulator\n");
  508. dev_vdbg(rdev_get_dev(rdev),
  509. "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  510. " 0x%x\n",
  511. info->desc.name, info->voltage_bank, info->voltage_reg,
  512. info->voltage_mask, regval);
  513. return ret;
  514. }
  515. static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev,
  516. unsigned selector)
  517. {
  518. int ret;
  519. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  520. u8 regval;
  521. if (info == NULL) {
  522. dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
  523. return -EINVAL;
  524. }
  525. if (selector >= info->expand_register.voltage_limit) {
  526. /* Vaux3 bit4 has different layout */
  527. regval = (u8)selector << info->expand_register.voltage_shift;
  528. ret = abx500_mask_and_set_register_interruptible(info->dev,
  529. info->expand_register.voltage_bank,
  530. info->expand_register.voltage_reg,
  531. info->expand_register.voltage_mask,
  532. regval);
  533. } else {
  534. /* set the registers for the request */
  535. regval = (u8)selector << info->voltage_shift;
  536. ret = abx500_mask_and_set_register_interruptible(info->dev,
  537. info->voltage_bank, info->voltage_reg,
  538. info->voltage_mask, regval);
  539. }
  540. if (ret < 0)
  541. dev_err(rdev_get_dev(rdev),
  542. "couldn't set voltage reg for regulator\n");
  543. dev_vdbg(rdev_get_dev(rdev),
  544. "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
  545. " 0x%x\n",
  546. info->desc.name, info->voltage_bank, info->voltage_reg,
  547. info->voltage_mask, regval);
  548. return ret;
  549. }
  550. static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
  551. unsigned int old_sel,
  552. unsigned int new_sel)
  553. {
  554. struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
  555. return info->delay;
  556. }
  557. static struct regulator_ops ab8500_regulator_volt_mode_ops = {
  558. .enable = ab8500_regulator_enable,
  559. .disable = ab8500_regulator_disable,
  560. .is_enabled = ab8500_regulator_is_enabled,
  561. .get_optimum_mode = ab8500_regulator_get_optimum_mode,
  562. .set_mode = ab8500_regulator_set_mode,
  563. .get_mode = ab8500_regulator_get_mode,
  564. .get_voltage_sel = ab8500_regulator_get_voltage_sel,
  565. .set_voltage_sel = ab8500_regulator_set_voltage_sel,
  566. .list_voltage = regulator_list_voltage_table,
  567. };
  568. static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = {
  569. .enable = ab8500_regulator_enable,
  570. .disable = ab8500_regulator_disable,
  571. .get_optimum_mode = ab8500_regulator_get_optimum_mode,
  572. .set_mode = ab8500_regulator_set_mode,
  573. .get_mode = ab8500_regulator_get_mode,
  574. .is_enabled = ab8500_regulator_is_enabled,
  575. .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel,
  576. .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel,
  577. .list_voltage = regulator_list_voltage_table,
  578. .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
  579. };
  580. static struct regulator_ops ab8500_regulator_volt_ops = {
  581. .enable = ab8500_regulator_enable,
  582. .disable = ab8500_regulator_disable,
  583. .is_enabled = ab8500_regulator_is_enabled,
  584. .get_voltage_sel = ab8500_regulator_get_voltage_sel,
  585. .set_voltage_sel = ab8500_regulator_set_voltage_sel,
  586. .list_voltage = regulator_list_voltage_table,
  587. .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
  588. };
  589. static struct regulator_ops ab8500_regulator_mode_ops = {
  590. .enable = ab8500_regulator_enable,
  591. .disable = ab8500_regulator_disable,
  592. .is_enabled = ab8500_regulator_is_enabled,
  593. .get_optimum_mode = ab8500_regulator_get_optimum_mode,
  594. .set_mode = ab8500_regulator_set_mode,
  595. .get_mode = ab8500_regulator_get_mode,
  596. .list_voltage = regulator_list_voltage_linear,
  597. };
  598. static struct regulator_ops ab8500_regulator_ops = {
  599. .enable = ab8500_regulator_enable,
  600. .disable = ab8500_regulator_disable,
  601. .is_enabled = ab8500_regulator_is_enabled,
  602. .list_voltage = regulator_list_voltage_linear,
  603. };
  604. static struct regulator_ops ab8500_regulator_anamic_mode_ops = {
  605. .enable = ab8500_regulator_enable,
  606. .disable = ab8500_regulator_disable,
  607. .is_enabled = ab8500_regulator_is_enabled,
  608. .set_mode = ab8500_regulator_set_mode,
  609. .get_mode = ab8500_regulator_get_mode,
  610. .list_voltage = regulator_list_voltage_table,
  611. };
  612. /* AB8500 regulator information */
  613. static struct ab8500_regulator_info
  614. ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
  615. /*
  616. * Variable Voltage Regulators
  617. * name, min mV, max mV,
  618. * update bank, reg, mask, enable val
  619. * volt bank, reg, mask
  620. */
  621. [AB8500_LDO_AUX1] = {
  622. .desc = {
  623. .name = "LDO-AUX1",
  624. .ops = &ab8500_regulator_volt_mode_ops,
  625. .type = REGULATOR_VOLTAGE,
  626. .id = AB8500_LDO_AUX1,
  627. .owner = THIS_MODULE,
  628. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  629. .volt_table = ldo_vauxn_voltages,
  630. .enable_time = 200,
  631. },
  632. .load_lp_uA = 5000,
  633. .update_bank = 0x04,
  634. .update_reg = 0x09,
  635. .update_mask = 0x03,
  636. .update_val = 0x01,
  637. .update_val_idle = 0x03,
  638. .update_val_normal = 0x01,
  639. .voltage_bank = 0x04,
  640. .voltage_reg = 0x1f,
  641. .voltage_mask = 0x0f,
  642. },
  643. [AB8500_LDO_AUX2] = {
  644. .desc = {
  645. .name = "LDO-AUX2",
  646. .ops = &ab8500_regulator_volt_mode_ops,
  647. .type = REGULATOR_VOLTAGE,
  648. .id = AB8500_LDO_AUX2,
  649. .owner = THIS_MODULE,
  650. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  651. .volt_table = ldo_vauxn_voltages,
  652. .enable_time = 200,
  653. },
  654. .load_lp_uA = 5000,
  655. .update_bank = 0x04,
  656. .update_reg = 0x09,
  657. .update_mask = 0x0c,
  658. .update_val = 0x04,
  659. .update_val_idle = 0x0c,
  660. .update_val_normal = 0x04,
  661. .voltage_bank = 0x04,
  662. .voltage_reg = 0x20,
  663. .voltage_mask = 0x0f,
  664. },
  665. [AB8500_LDO_AUX3] = {
  666. .desc = {
  667. .name = "LDO-AUX3",
  668. .ops = &ab8500_regulator_volt_mode_ops,
  669. .type = REGULATOR_VOLTAGE,
  670. .id = AB8500_LDO_AUX3,
  671. .owner = THIS_MODULE,
  672. .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
  673. .volt_table = ldo_vaux3_voltages,
  674. .enable_time = 450,
  675. },
  676. .load_lp_uA = 5000,
  677. .update_bank = 0x04,
  678. .update_reg = 0x0a,
  679. .update_mask = 0x03,
  680. .update_val = 0x01,
  681. .update_val_idle = 0x03,
  682. .update_val_normal = 0x01,
  683. .voltage_bank = 0x04,
  684. .voltage_reg = 0x21,
  685. .voltage_mask = 0x07,
  686. },
  687. [AB8500_LDO_INTCORE] = {
  688. .desc = {
  689. .name = "LDO-INTCORE",
  690. .ops = &ab8500_regulator_volt_mode_ops,
  691. .type = REGULATOR_VOLTAGE,
  692. .id = AB8500_LDO_INTCORE,
  693. .owner = THIS_MODULE,
  694. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  695. .volt_table = ldo_vintcore_voltages,
  696. .enable_time = 750,
  697. },
  698. .load_lp_uA = 5000,
  699. .update_bank = 0x03,
  700. .update_reg = 0x80,
  701. .update_mask = 0x44,
  702. .update_val = 0x44,
  703. .update_val_idle = 0x44,
  704. .update_val_normal = 0x04,
  705. .voltage_bank = 0x03,
  706. .voltage_reg = 0x80,
  707. .voltage_mask = 0x38,
  708. .voltage_shift = 3,
  709. },
  710. /*
  711. * Fixed Voltage Regulators
  712. * name, fixed mV,
  713. * update bank, reg, mask, enable val
  714. */
  715. [AB8500_LDO_TVOUT] = {
  716. .desc = {
  717. .name = "LDO-TVOUT",
  718. .ops = &ab8500_regulator_mode_ops,
  719. .type = REGULATOR_VOLTAGE,
  720. .id = AB8500_LDO_TVOUT,
  721. .owner = THIS_MODULE,
  722. .n_voltages = 1,
  723. .volt_table = fixed_2000000_voltage,
  724. .enable_time = 500,
  725. },
  726. .load_lp_uA = 1000,
  727. .update_bank = 0x03,
  728. .update_reg = 0x80,
  729. .update_mask = 0x82,
  730. .update_val = 0x02,
  731. .update_val_idle = 0x82,
  732. .update_val_normal = 0x02,
  733. },
  734. [AB8500_LDO_AUDIO] = {
  735. .desc = {
  736. .name = "LDO-AUDIO",
  737. .ops = &ab8500_regulator_ops,
  738. .type = REGULATOR_VOLTAGE,
  739. .id = AB8500_LDO_AUDIO,
  740. .owner = THIS_MODULE,
  741. .n_voltages = 1,
  742. .enable_time = 140,
  743. .volt_table = fixed_2000000_voltage,
  744. },
  745. .update_bank = 0x03,
  746. .update_reg = 0x83,
  747. .update_mask = 0x02,
  748. .update_val = 0x02,
  749. },
  750. [AB8500_LDO_ANAMIC1] = {
  751. .desc = {
  752. .name = "LDO-ANAMIC1",
  753. .ops = &ab8500_regulator_ops,
  754. .type = REGULATOR_VOLTAGE,
  755. .id = AB8500_LDO_ANAMIC1,
  756. .owner = THIS_MODULE,
  757. .n_voltages = 1,
  758. .enable_time = 500,
  759. .volt_table = fixed_2050000_voltage,
  760. },
  761. .update_bank = 0x03,
  762. .update_reg = 0x83,
  763. .update_mask = 0x08,
  764. .update_val = 0x08,
  765. },
  766. [AB8500_LDO_ANAMIC2] = {
  767. .desc = {
  768. .name = "LDO-ANAMIC2",
  769. .ops = &ab8500_regulator_ops,
  770. .type = REGULATOR_VOLTAGE,
  771. .id = AB8500_LDO_ANAMIC2,
  772. .owner = THIS_MODULE,
  773. .n_voltages = 1,
  774. .enable_time = 500,
  775. .volt_table = fixed_2050000_voltage,
  776. },
  777. .update_bank = 0x03,
  778. .update_reg = 0x83,
  779. .update_mask = 0x10,
  780. .update_val = 0x10,
  781. },
  782. [AB8500_LDO_DMIC] = {
  783. .desc = {
  784. .name = "LDO-DMIC",
  785. .ops = &ab8500_regulator_ops,
  786. .type = REGULATOR_VOLTAGE,
  787. .id = AB8500_LDO_DMIC,
  788. .owner = THIS_MODULE,
  789. .n_voltages = 1,
  790. .enable_time = 420,
  791. .volt_table = fixed_1800000_voltage,
  792. },
  793. .update_bank = 0x03,
  794. .update_reg = 0x83,
  795. .update_mask = 0x04,
  796. .update_val = 0x04,
  797. },
  798. /*
  799. * Regulators with fixed voltage and normal/idle modes
  800. */
  801. [AB8500_LDO_ANA] = {
  802. .desc = {
  803. .name = "LDO-ANA",
  804. .ops = &ab8500_regulator_mode_ops,
  805. .type = REGULATOR_VOLTAGE,
  806. .id = AB8500_LDO_ANA,
  807. .owner = THIS_MODULE,
  808. .n_voltages = 1,
  809. .enable_time = 140,
  810. .volt_table = fixed_1200000_voltage,
  811. },
  812. .load_lp_uA = 1000,
  813. .update_bank = 0x04,
  814. .update_reg = 0x06,
  815. .update_mask = 0x0c,
  816. .update_val = 0x04,
  817. .update_val_idle = 0x0c,
  818. .update_val_normal = 0x04,
  819. },
  820. };
  821. /* AB8505 regulator information */
  822. static struct ab8500_regulator_info
  823. ab8505_regulator_info[AB8505_NUM_REGULATORS] = {
  824. /*
  825. * Variable Voltage Regulators
  826. * name, min mV, max mV,
  827. * update bank, reg, mask, enable val
  828. * volt bank, reg, mask, table, table length
  829. */
  830. [AB8505_LDO_AUX1] = {
  831. .desc = {
  832. .name = "LDO-AUX1",
  833. .ops = &ab8500_regulator_volt_mode_ops,
  834. .type = REGULATOR_VOLTAGE,
  835. .id = AB8505_LDO_AUX1,
  836. .owner = THIS_MODULE,
  837. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  838. .volt_table = ldo_vauxn_voltages,
  839. },
  840. .load_lp_uA = 5000,
  841. .update_bank = 0x04,
  842. .update_reg = 0x09,
  843. .update_mask = 0x03,
  844. .update_val = 0x01,
  845. .update_val_idle = 0x03,
  846. .update_val_normal = 0x01,
  847. .voltage_bank = 0x04,
  848. .voltage_reg = 0x1f,
  849. .voltage_mask = 0x0f,
  850. },
  851. [AB8505_LDO_AUX2] = {
  852. .desc = {
  853. .name = "LDO-AUX2",
  854. .ops = &ab8500_regulator_volt_mode_ops,
  855. .type = REGULATOR_VOLTAGE,
  856. .id = AB8505_LDO_AUX2,
  857. .owner = THIS_MODULE,
  858. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  859. .volt_table = ldo_vauxn_voltages,
  860. },
  861. .load_lp_uA = 5000,
  862. .update_bank = 0x04,
  863. .update_reg = 0x09,
  864. .update_mask = 0x0c,
  865. .update_val = 0x04,
  866. .update_val_idle = 0x0c,
  867. .update_val_normal = 0x04,
  868. .voltage_bank = 0x04,
  869. .voltage_reg = 0x20,
  870. .voltage_mask = 0x0f,
  871. },
  872. [AB8505_LDO_AUX3] = {
  873. .desc = {
  874. .name = "LDO-AUX3",
  875. .ops = &ab8500_regulator_volt_mode_ops,
  876. .type = REGULATOR_VOLTAGE,
  877. .id = AB8505_LDO_AUX3,
  878. .owner = THIS_MODULE,
  879. .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
  880. .volt_table = ldo_vaux3_voltages,
  881. },
  882. .load_lp_uA = 5000,
  883. .update_bank = 0x04,
  884. .update_reg = 0x0a,
  885. .update_mask = 0x03,
  886. .update_val = 0x01,
  887. .update_val_idle = 0x03,
  888. .update_val_normal = 0x01,
  889. .voltage_bank = 0x04,
  890. .voltage_reg = 0x21,
  891. .voltage_mask = 0x07,
  892. },
  893. [AB8505_LDO_AUX4] = {
  894. .desc = {
  895. .name = "LDO-AUX4",
  896. .ops = &ab8500_regulator_volt_mode_ops,
  897. .type = REGULATOR_VOLTAGE,
  898. .id = AB8505_LDO_AUX4,
  899. .owner = THIS_MODULE,
  900. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  901. .volt_table = ldo_vauxn_voltages,
  902. },
  903. .load_lp_uA = 5000,
  904. /* values for Vaux4Regu register */
  905. .update_bank = 0x04,
  906. .update_reg = 0x2e,
  907. .update_mask = 0x03,
  908. .update_val = 0x01,
  909. .update_val_idle = 0x03,
  910. .update_val_normal = 0x01,
  911. /* values for Vaux4SEL register */
  912. .voltage_bank = 0x04,
  913. .voltage_reg = 0x2f,
  914. .voltage_mask = 0x0f,
  915. },
  916. [AB8505_LDO_AUX5] = {
  917. .desc = {
  918. .name = "LDO-AUX5",
  919. .ops = &ab8500_regulator_volt_mode_ops,
  920. .type = REGULATOR_VOLTAGE,
  921. .id = AB8505_LDO_AUX5,
  922. .owner = THIS_MODULE,
  923. .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
  924. .volt_table = ldo_vaux56_voltages,
  925. },
  926. .load_lp_uA = 2000,
  927. /* values for CtrlVaux5 register */
  928. .update_bank = 0x01,
  929. .update_reg = 0x55,
  930. .update_mask = 0x18,
  931. .update_val = 0x10,
  932. .update_val_idle = 0x18,
  933. .update_val_normal = 0x10,
  934. .voltage_bank = 0x01,
  935. .voltage_reg = 0x55,
  936. .voltage_mask = 0x07,
  937. },
  938. [AB8505_LDO_AUX6] = {
  939. .desc = {
  940. .name = "LDO-AUX6",
  941. .ops = &ab8500_regulator_volt_mode_ops,
  942. .type = REGULATOR_VOLTAGE,
  943. .id = AB8505_LDO_AUX6,
  944. .owner = THIS_MODULE,
  945. .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
  946. .volt_table = ldo_vaux56_voltages,
  947. },
  948. .load_lp_uA = 2000,
  949. /* values for CtrlVaux6 register */
  950. .update_bank = 0x01,
  951. .update_reg = 0x56,
  952. .update_mask = 0x18,
  953. .update_val = 0x10,
  954. .update_val_idle = 0x18,
  955. .update_val_normal = 0x10,
  956. .voltage_bank = 0x01,
  957. .voltage_reg = 0x56,
  958. .voltage_mask = 0x07,
  959. },
  960. [AB8505_LDO_INTCORE] = {
  961. .desc = {
  962. .name = "LDO-INTCORE",
  963. .ops = &ab8500_regulator_volt_mode_ops,
  964. .type = REGULATOR_VOLTAGE,
  965. .id = AB8505_LDO_INTCORE,
  966. .owner = THIS_MODULE,
  967. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  968. .volt_table = ldo_vintcore_voltages,
  969. },
  970. .load_lp_uA = 5000,
  971. .update_bank = 0x03,
  972. .update_reg = 0x80,
  973. .update_mask = 0x44,
  974. .update_val = 0x04,
  975. .update_val_idle = 0x44,
  976. .update_val_normal = 0x04,
  977. .voltage_bank = 0x03,
  978. .voltage_reg = 0x80,
  979. .voltage_mask = 0x38,
  980. .voltage_shift = 3,
  981. },
  982. /*
  983. * Fixed Voltage Regulators
  984. * name, fixed mV,
  985. * update bank, reg, mask, enable val
  986. */
  987. [AB8505_LDO_ADC] = {
  988. .desc = {
  989. .name = "LDO-ADC",
  990. .ops = &ab8500_regulator_mode_ops,
  991. .type = REGULATOR_VOLTAGE,
  992. .id = AB8505_LDO_ADC,
  993. .owner = THIS_MODULE,
  994. .n_voltages = 1,
  995. .volt_table = fixed_2000000_voltage,
  996. },
  997. .delay = 10000,
  998. .load_lp_uA = 1000,
  999. .update_bank = 0x03,
  1000. .update_reg = 0x80,
  1001. .update_mask = 0x82,
  1002. .update_val = 0x02,
  1003. .update_val_idle = 0x82,
  1004. .update_val_normal = 0x02,
  1005. },
  1006. [AB8505_LDO_USB] = {
  1007. .desc = {
  1008. .name = "LDO-USB",
  1009. .ops = &ab8500_regulator_mode_ops,
  1010. .type = REGULATOR_VOLTAGE,
  1011. .id = AB8505_LDO_USB,
  1012. .owner = THIS_MODULE,
  1013. .n_voltages = 1,
  1014. .volt_table = fixed_3300000_voltage,
  1015. },
  1016. .update_bank = 0x03,
  1017. .update_reg = 0x82,
  1018. .update_mask = 0x03,
  1019. .update_val = 0x01,
  1020. .update_val_idle = 0x03,
  1021. .update_val_normal = 0x01,
  1022. },
  1023. [AB8505_LDO_AUDIO] = {
  1024. .desc = {
  1025. .name = "LDO-AUDIO",
  1026. .ops = &ab8500_regulator_volt_ops,
  1027. .type = REGULATOR_VOLTAGE,
  1028. .id = AB8505_LDO_AUDIO,
  1029. .owner = THIS_MODULE,
  1030. .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages),
  1031. .volt_table = ldo_vaudio_voltages,
  1032. },
  1033. .update_bank = 0x03,
  1034. .update_reg = 0x83,
  1035. .update_mask = 0x02,
  1036. .update_val = 0x02,
  1037. .voltage_bank = 0x01,
  1038. .voltage_reg = 0x57,
  1039. .voltage_mask = 0x7,
  1040. .voltage_shift = 4,
  1041. .voltages = ldo_vaudio_voltages,
  1042. .voltages_len = ARRAY_SIZE(ldo_vaudio_voltages),
  1043. },
  1044. [AB8505_LDO_ANAMIC1] = {
  1045. .desc = {
  1046. .name = "LDO-ANAMIC1",
  1047. .ops = &ab8500_regulator_anamic_mode_ops,
  1048. .type = REGULATOR_VOLTAGE,
  1049. .id = AB8505_LDO_ANAMIC1,
  1050. .owner = THIS_MODULE,
  1051. .n_voltages = 1,
  1052. .volt_table = fixed_2050000_voltage,
  1053. },
  1054. .shared_mode = &ldo_anamic1_shared,
  1055. .update_bank = 0x03,
  1056. .update_reg = 0x83,
  1057. .update_mask = 0x08,
  1058. .update_val = 0x08,
  1059. .mode_bank = 0x01,
  1060. .mode_reg = 0x54,
  1061. .mode_mask = 0x04,
  1062. .mode_val_idle = 0x04,
  1063. .mode_val_normal = 0x00,
  1064. },
  1065. [AB8505_LDO_ANAMIC2] = {
  1066. .desc = {
  1067. .name = "LDO-ANAMIC2",
  1068. .ops = &ab8500_regulator_anamic_mode_ops,
  1069. .type = REGULATOR_VOLTAGE,
  1070. .id = AB8505_LDO_ANAMIC2,
  1071. .owner = THIS_MODULE,
  1072. .n_voltages = 1,
  1073. .volt_table = fixed_2050000_voltage,
  1074. },
  1075. .shared_mode = &ldo_anamic2_shared,
  1076. .update_bank = 0x03,
  1077. .update_reg = 0x83,
  1078. .update_mask = 0x10,
  1079. .update_val = 0x10,
  1080. .mode_bank = 0x01,
  1081. .mode_reg = 0x54,
  1082. .mode_mask = 0x04,
  1083. .mode_val_idle = 0x04,
  1084. .mode_val_normal = 0x00,
  1085. },
  1086. [AB8505_LDO_AUX8] = {
  1087. .desc = {
  1088. .name = "LDO-AUX8",
  1089. .ops = &ab8500_regulator_ops,
  1090. .type = REGULATOR_VOLTAGE,
  1091. .id = AB8505_LDO_AUX8,
  1092. .owner = THIS_MODULE,
  1093. .n_voltages = 1,
  1094. .volt_table = fixed_1800000_voltage,
  1095. },
  1096. .update_bank = 0x03,
  1097. .update_reg = 0x83,
  1098. .update_mask = 0x04,
  1099. .update_val = 0x04,
  1100. },
  1101. /*
  1102. * Regulators with fixed voltage and normal/idle modes
  1103. */
  1104. [AB8505_LDO_ANA] = {
  1105. .desc = {
  1106. .name = "LDO-ANA",
  1107. .ops = &ab8500_regulator_volt_mode_ops,
  1108. .type = REGULATOR_VOLTAGE,
  1109. .id = AB8505_LDO_ANA,
  1110. .owner = THIS_MODULE,
  1111. .n_voltages = ARRAY_SIZE(ldo_vana_voltages),
  1112. .volt_table = ldo_vana_voltages,
  1113. },
  1114. .load_lp_uA = 1000,
  1115. .update_bank = 0x04,
  1116. .update_reg = 0x06,
  1117. .update_mask = 0x0c,
  1118. .update_val = 0x04,
  1119. .update_val_idle = 0x0c,
  1120. .update_val_normal = 0x04,
  1121. .voltage_bank = 0x04,
  1122. .voltage_reg = 0x29,
  1123. .voltage_mask = 0x7,
  1124. .voltages = ldo_vana_voltages,
  1125. .voltages_len = ARRAY_SIZE(ldo_vana_voltages),
  1126. },
  1127. };
  1128. /* AB9540 regulator information */
  1129. static struct ab8500_regulator_info
  1130. ab9540_regulator_info[AB9540_NUM_REGULATORS] = {
  1131. /*
  1132. * Variable Voltage Regulators
  1133. * name, min mV, max mV,
  1134. * update bank, reg, mask, enable val
  1135. * volt bank, reg, mask, table, table length
  1136. */
  1137. [AB9540_LDO_AUX1] = {
  1138. .desc = {
  1139. .name = "LDO-AUX1",
  1140. .ops = &ab8500_regulator_volt_mode_ops,
  1141. .type = REGULATOR_VOLTAGE,
  1142. .id = AB9540_LDO_AUX1,
  1143. .owner = THIS_MODULE,
  1144. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1145. .volt_table = ldo_vauxn_voltages,
  1146. },
  1147. .load_lp_uA = 5000,
  1148. .update_bank = 0x04,
  1149. .update_reg = 0x09,
  1150. .update_mask = 0x03,
  1151. .update_val = 0x01,
  1152. .update_val_idle = 0x03,
  1153. .update_val_normal = 0x01,
  1154. .voltage_bank = 0x04,
  1155. .voltage_reg = 0x1f,
  1156. .voltage_mask = 0x0f,
  1157. },
  1158. [AB9540_LDO_AUX2] = {
  1159. .desc = {
  1160. .name = "LDO-AUX2",
  1161. .ops = &ab8500_regulator_volt_mode_ops,
  1162. .type = REGULATOR_VOLTAGE,
  1163. .id = AB9540_LDO_AUX2,
  1164. .owner = THIS_MODULE,
  1165. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1166. .volt_table = ldo_vauxn_voltages,
  1167. },
  1168. .load_lp_uA = 5000,
  1169. .update_bank = 0x04,
  1170. .update_reg = 0x09,
  1171. .update_mask = 0x0c,
  1172. .update_val = 0x04,
  1173. .update_val_idle = 0x0c,
  1174. .update_val_normal = 0x04,
  1175. .voltage_bank = 0x04,
  1176. .voltage_reg = 0x20,
  1177. .voltage_mask = 0x0f,
  1178. },
  1179. [AB9540_LDO_AUX3] = {
  1180. .desc = {
  1181. .name = "LDO-AUX3",
  1182. .ops = &ab8500_regulator_volt_mode_ops,
  1183. .type = REGULATOR_VOLTAGE,
  1184. .id = AB9540_LDO_AUX3,
  1185. .owner = THIS_MODULE,
  1186. .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
  1187. .volt_table = ldo_vaux3_voltages,
  1188. },
  1189. .load_lp_uA = 5000,
  1190. .update_bank = 0x04,
  1191. .update_reg = 0x0a,
  1192. .update_mask = 0x03,
  1193. .update_val = 0x01,
  1194. .update_val_idle = 0x03,
  1195. .update_val_normal = 0x01,
  1196. .voltage_bank = 0x04,
  1197. .voltage_reg = 0x21,
  1198. .voltage_mask = 0x07,
  1199. },
  1200. [AB9540_LDO_AUX4] = {
  1201. .desc = {
  1202. .name = "LDO-AUX4",
  1203. .ops = &ab8500_regulator_volt_mode_ops,
  1204. .type = REGULATOR_VOLTAGE,
  1205. .id = AB9540_LDO_AUX4,
  1206. .owner = THIS_MODULE,
  1207. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1208. .volt_table = ldo_vauxn_voltages,
  1209. },
  1210. .load_lp_uA = 5000,
  1211. /* values for Vaux4Regu register */
  1212. .update_bank = 0x04,
  1213. .update_reg = 0x2e,
  1214. .update_mask = 0x03,
  1215. .update_val = 0x01,
  1216. .update_val_idle = 0x03,
  1217. .update_val_normal = 0x01,
  1218. /* values for Vaux4SEL register */
  1219. .voltage_bank = 0x04,
  1220. .voltage_reg = 0x2f,
  1221. .voltage_mask = 0x0f,
  1222. },
  1223. [AB9540_LDO_INTCORE] = {
  1224. .desc = {
  1225. .name = "LDO-INTCORE",
  1226. .ops = &ab8500_regulator_volt_mode_ops,
  1227. .type = REGULATOR_VOLTAGE,
  1228. .id = AB9540_LDO_INTCORE,
  1229. .owner = THIS_MODULE,
  1230. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  1231. .volt_table = ldo_vintcore_voltages,
  1232. },
  1233. .load_lp_uA = 5000,
  1234. .update_bank = 0x03,
  1235. .update_reg = 0x80,
  1236. .update_mask = 0x44,
  1237. .update_val = 0x44,
  1238. .update_val_idle = 0x44,
  1239. .update_val_normal = 0x04,
  1240. .voltage_bank = 0x03,
  1241. .voltage_reg = 0x80,
  1242. .voltage_mask = 0x38,
  1243. .voltage_shift = 3,
  1244. },
  1245. /*
  1246. * Fixed Voltage Regulators
  1247. * name, fixed mV,
  1248. * update bank, reg, mask, enable val
  1249. */
  1250. [AB9540_LDO_TVOUT] = {
  1251. .desc = {
  1252. .name = "LDO-TVOUT",
  1253. .ops = &ab8500_regulator_mode_ops,
  1254. .type = REGULATOR_VOLTAGE,
  1255. .id = AB9540_LDO_TVOUT,
  1256. .owner = THIS_MODULE,
  1257. .n_voltages = 1,
  1258. .volt_table = fixed_2000000_voltage,
  1259. },
  1260. .delay = 10000,
  1261. .load_lp_uA = 1000,
  1262. .update_bank = 0x03,
  1263. .update_reg = 0x80,
  1264. .update_mask = 0x82,
  1265. .update_val = 0x02,
  1266. .update_val_idle = 0x82,
  1267. .update_val_normal = 0x02,
  1268. },
  1269. [AB9540_LDO_USB] = {
  1270. .desc = {
  1271. .name = "LDO-USB",
  1272. .ops = &ab8500_regulator_ops,
  1273. .type = REGULATOR_VOLTAGE,
  1274. .id = AB9540_LDO_USB,
  1275. .owner = THIS_MODULE,
  1276. .n_voltages = 1,
  1277. .volt_table = fixed_3300000_voltage,
  1278. },
  1279. .update_bank = 0x03,
  1280. .update_reg = 0x82,
  1281. .update_mask = 0x03,
  1282. .update_val = 0x01,
  1283. .update_val_idle = 0x03,
  1284. .update_val_normal = 0x01,
  1285. },
  1286. [AB9540_LDO_AUDIO] = {
  1287. .desc = {
  1288. .name = "LDO-AUDIO",
  1289. .ops = &ab8500_regulator_ops,
  1290. .type = REGULATOR_VOLTAGE,
  1291. .id = AB9540_LDO_AUDIO,
  1292. .owner = THIS_MODULE,
  1293. .n_voltages = 1,
  1294. .volt_table = fixed_2000000_voltage,
  1295. },
  1296. .update_bank = 0x03,
  1297. .update_reg = 0x83,
  1298. .update_mask = 0x02,
  1299. .update_val = 0x02,
  1300. },
  1301. [AB9540_LDO_ANAMIC1] = {
  1302. .desc = {
  1303. .name = "LDO-ANAMIC1",
  1304. .ops = &ab8500_regulator_ops,
  1305. .type = REGULATOR_VOLTAGE,
  1306. .id = AB9540_LDO_ANAMIC1,
  1307. .owner = THIS_MODULE,
  1308. .n_voltages = 1,
  1309. .volt_table = fixed_2050000_voltage,
  1310. },
  1311. .update_bank = 0x03,
  1312. .update_reg = 0x83,
  1313. .update_mask = 0x08,
  1314. .update_val = 0x08,
  1315. },
  1316. [AB9540_LDO_ANAMIC2] = {
  1317. .desc = {
  1318. .name = "LDO-ANAMIC2",
  1319. .ops = &ab8500_regulator_ops,
  1320. .type = REGULATOR_VOLTAGE,
  1321. .id = AB9540_LDO_ANAMIC2,
  1322. .owner = THIS_MODULE,
  1323. .n_voltages = 1,
  1324. .volt_table = fixed_2050000_voltage,
  1325. },
  1326. .update_bank = 0x03,
  1327. .update_reg = 0x83,
  1328. .update_mask = 0x10,
  1329. .update_val = 0x10,
  1330. },
  1331. [AB9540_LDO_DMIC] = {
  1332. .desc = {
  1333. .name = "LDO-DMIC",
  1334. .ops = &ab8500_regulator_ops,
  1335. .type = REGULATOR_VOLTAGE,
  1336. .id = AB9540_LDO_DMIC,
  1337. .owner = THIS_MODULE,
  1338. .n_voltages = 1,
  1339. .volt_table = fixed_1800000_voltage,
  1340. },
  1341. .update_bank = 0x03,
  1342. .update_reg = 0x83,
  1343. .update_mask = 0x04,
  1344. .update_val = 0x04,
  1345. },
  1346. /*
  1347. * Regulators with fixed voltage and normal/idle modes
  1348. */
  1349. [AB9540_LDO_ANA] = {
  1350. .desc = {
  1351. .name = "LDO-ANA",
  1352. .ops = &ab8500_regulator_mode_ops,
  1353. .type = REGULATOR_VOLTAGE,
  1354. .id = AB9540_LDO_ANA,
  1355. .owner = THIS_MODULE,
  1356. .n_voltages = 1,
  1357. .volt_table = fixed_1200000_voltage,
  1358. },
  1359. .load_lp_uA = 1000,
  1360. .update_bank = 0x04,
  1361. .update_reg = 0x06,
  1362. .update_mask = 0x0c,
  1363. .update_val = 0x08,
  1364. .update_val_idle = 0x0c,
  1365. .update_val_normal = 0x08,
  1366. },
  1367. };
  1368. /* AB8540 regulator information */
  1369. static struct ab8500_regulator_info
  1370. ab8540_regulator_info[AB8540_NUM_REGULATORS] = {
  1371. /*
  1372. * Variable Voltage Regulators
  1373. * name, min mV, max mV,
  1374. * update bank, reg, mask, enable val
  1375. * volt bank, reg, mask, table, table length
  1376. */
  1377. [AB8540_LDO_AUX1] = {
  1378. .desc = {
  1379. .name = "LDO-AUX1",
  1380. .ops = &ab8500_regulator_volt_mode_ops,
  1381. .type = REGULATOR_VOLTAGE,
  1382. .id = AB8540_LDO_AUX1,
  1383. .owner = THIS_MODULE,
  1384. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1385. .volt_table = ldo_vauxn_voltages,
  1386. },
  1387. .load_lp_uA = 5000,
  1388. .update_bank = 0x04,
  1389. .update_reg = 0x09,
  1390. .update_mask = 0x03,
  1391. .update_val = 0x01,
  1392. .update_val_idle = 0x03,
  1393. .update_val_normal = 0x01,
  1394. .voltage_bank = 0x04,
  1395. .voltage_reg = 0x1f,
  1396. .voltage_mask = 0x0f,
  1397. },
  1398. [AB8540_LDO_AUX2] = {
  1399. .desc = {
  1400. .name = "LDO-AUX2",
  1401. .ops = &ab8500_regulator_volt_mode_ops,
  1402. .type = REGULATOR_VOLTAGE,
  1403. .id = AB8540_LDO_AUX2,
  1404. .owner = THIS_MODULE,
  1405. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1406. .volt_table = ldo_vauxn_voltages,
  1407. },
  1408. .load_lp_uA = 5000,
  1409. .update_bank = 0x04,
  1410. .update_reg = 0x09,
  1411. .update_mask = 0x0c,
  1412. .update_val = 0x04,
  1413. .update_val_idle = 0x0c,
  1414. .update_val_normal = 0x04,
  1415. .voltage_bank = 0x04,
  1416. .voltage_reg = 0x20,
  1417. .voltage_mask = 0x0f,
  1418. },
  1419. [AB8540_LDO_AUX3] = {
  1420. .desc = {
  1421. .name = "LDO-AUX3",
  1422. .ops = &ab8540_aux3_regulator_volt_mode_ops,
  1423. .type = REGULATOR_VOLTAGE,
  1424. .id = AB8540_LDO_AUX3,
  1425. .owner = THIS_MODULE,
  1426. .n_voltages = ARRAY_SIZE(ldo_vaux3_ab8540_voltages),
  1427. .volt_table = ldo_vaux3_ab8540_voltages,
  1428. },
  1429. .load_lp_uA = 5000,
  1430. .update_bank = 0x04,
  1431. .update_reg = 0x0a,
  1432. .update_mask = 0x03,
  1433. .update_val = 0x01,
  1434. .update_val_idle = 0x03,
  1435. .update_val_normal = 0x01,
  1436. .voltage_bank = 0x04,
  1437. .voltage_reg = 0x21,
  1438. .voltage_mask = 0x07,
  1439. .expand_register = {
  1440. .voltage_limit = 8,
  1441. .voltage_bank = 0x04,
  1442. .voltage_reg = 0x01,
  1443. .voltage_mask = 0x10,
  1444. .voltage_shift = 1,
  1445. }
  1446. },
  1447. [AB8540_LDO_AUX4] = {
  1448. .desc = {
  1449. .name = "LDO-AUX4",
  1450. .ops = &ab8500_regulator_volt_mode_ops,
  1451. .type = REGULATOR_VOLTAGE,
  1452. .id = AB8540_LDO_AUX4,
  1453. .owner = THIS_MODULE,
  1454. .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
  1455. .volt_table = ldo_vauxn_voltages,
  1456. },
  1457. .load_lp_uA = 5000,
  1458. /* values for Vaux4Regu register */
  1459. .update_bank = 0x04,
  1460. .update_reg = 0x2e,
  1461. .update_mask = 0x03,
  1462. .update_val = 0x01,
  1463. .update_val_idle = 0x03,
  1464. .update_val_normal = 0x01,
  1465. /* values for Vaux4SEL register */
  1466. .voltage_bank = 0x04,
  1467. .voltage_reg = 0x2f,
  1468. .voltage_mask = 0x0f,
  1469. },
  1470. [AB8540_LDO_INTCORE] = {
  1471. .desc = {
  1472. .name = "LDO-INTCORE",
  1473. .ops = &ab8500_regulator_volt_mode_ops,
  1474. .type = REGULATOR_VOLTAGE,
  1475. .id = AB8540_LDO_INTCORE,
  1476. .owner = THIS_MODULE,
  1477. .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
  1478. .volt_table = ldo_vintcore_voltages,
  1479. },
  1480. .load_lp_uA = 5000,
  1481. .update_bank = 0x03,
  1482. .update_reg = 0x80,
  1483. .update_mask = 0x44,
  1484. .update_val = 0x44,
  1485. .update_val_idle = 0x44,
  1486. .update_val_normal = 0x04,
  1487. .voltage_bank = 0x03,
  1488. .voltage_reg = 0x80,
  1489. .voltage_mask = 0x38,
  1490. .voltage_shift = 3,
  1491. },
  1492. /*
  1493. * Fixed Voltage Regulators
  1494. * name, fixed mV,
  1495. * update bank, reg, mask, enable val
  1496. */
  1497. [AB8540_LDO_TVOUT] = {
  1498. .desc = {
  1499. .name = "LDO-TVOUT",
  1500. .ops = &ab8500_regulator_mode_ops,
  1501. .type = REGULATOR_VOLTAGE,
  1502. .id = AB8540_LDO_TVOUT,
  1503. .owner = THIS_MODULE,
  1504. .n_voltages = 1,
  1505. },
  1506. .delay = 10000,
  1507. .load_lp_uA = 1000,
  1508. .update_bank = 0x03,
  1509. .update_reg = 0x80,
  1510. .update_mask = 0x82,
  1511. .update_val = 0x02,
  1512. .update_val_idle = 0x82,
  1513. .update_val_normal = 0x02,
  1514. },
  1515. [AB8540_LDO_AUDIO] = {
  1516. .desc = {
  1517. .name = "LDO-AUDIO",
  1518. .ops = &ab8500_regulator_ops,
  1519. .type = REGULATOR_VOLTAGE,
  1520. .id = AB8540_LDO_AUDIO,
  1521. .owner = THIS_MODULE,
  1522. .n_voltages = 1,
  1523. .volt_table = fixed_2000000_voltage,
  1524. },
  1525. .update_bank = 0x03,
  1526. .update_reg = 0x83,
  1527. .update_mask = 0x02,
  1528. .update_val = 0x02,
  1529. },
  1530. [AB8540_LDO_ANAMIC1] = {
  1531. .desc = {
  1532. .name = "LDO-ANAMIC1",
  1533. .ops = &ab8500_regulator_anamic_mode_ops,
  1534. .type = REGULATOR_VOLTAGE,
  1535. .id = AB8540_LDO_ANAMIC1,
  1536. .owner = THIS_MODULE,
  1537. .n_voltages = 1,
  1538. .volt_table = fixed_2050000_voltage,
  1539. },
  1540. .shared_mode = &ab8540_ldo_anamic1_shared,
  1541. .update_bank = 0x03,
  1542. .update_reg = 0x83,
  1543. .update_mask = 0x08,
  1544. .update_val = 0x08,
  1545. .mode_bank = 0x03,
  1546. .mode_reg = 0x83,
  1547. .mode_mask = 0x20,
  1548. .mode_val_idle = 0x20,
  1549. .mode_val_normal = 0x00,
  1550. },
  1551. [AB8540_LDO_ANAMIC2] = {
  1552. .desc = {
  1553. .name = "LDO-ANAMIC2",
  1554. .ops = &ab8500_regulator_anamic_mode_ops,
  1555. .type = REGULATOR_VOLTAGE,
  1556. .id = AB8540_LDO_ANAMIC2,
  1557. .owner = THIS_MODULE,
  1558. .n_voltages = 1,
  1559. .volt_table = fixed_2050000_voltage,
  1560. },
  1561. .shared_mode = &ab8540_ldo_anamic2_shared,
  1562. .update_bank = 0x03,
  1563. .update_reg = 0x83,
  1564. .update_mask = 0x10,
  1565. .update_val = 0x10,
  1566. .mode_bank = 0x03,
  1567. .mode_reg = 0x83,
  1568. .mode_mask = 0x20,
  1569. .mode_val_idle = 0x20,
  1570. .mode_val_normal = 0x00,
  1571. },
  1572. [AB8540_LDO_DMIC] = {
  1573. .desc = {
  1574. .name = "LDO-DMIC",
  1575. .ops = &ab8500_regulator_volt_mode_ops,
  1576. .type = REGULATOR_VOLTAGE,
  1577. .id = AB8540_LDO_DMIC,
  1578. .owner = THIS_MODULE,
  1579. .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages),
  1580. },
  1581. .load_lp_uA = 1000,
  1582. .update_bank = 0x03,
  1583. .update_reg = 0x83,
  1584. .update_mask = 0x04,
  1585. .update_val = 0x04,
  1586. .voltage_bank = 0x03,
  1587. .voltage_reg = 0x83,
  1588. .voltage_mask = 0xc0,
  1589. .voltages = ldo_vdmic_voltages,
  1590. .voltages_len = ARRAY_SIZE(ldo_vdmic_voltages),
  1591. },
  1592. /*
  1593. * Regulators with fixed voltage and normal/idle modes
  1594. */
  1595. [AB8540_LDO_ANA] = {
  1596. .desc = {
  1597. .name = "LDO-ANA",
  1598. .ops = &ab8500_regulator_mode_ops,
  1599. .type = REGULATOR_VOLTAGE,
  1600. .id = AB8540_LDO_ANA,
  1601. .owner = THIS_MODULE,
  1602. .n_voltages = 1,
  1603. .volt_table = fixed_1200000_voltage,
  1604. },
  1605. .load_lp_uA = 1000,
  1606. .update_bank = 0x04,
  1607. .update_reg = 0x06,
  1608. .update_mask = 0x0c,
  1609. .update_val = 0x04,
  1610. .update_val_idle = 0x0c,
  1611. .update_val_normal = 0x04,
  1612. },
  1613. [AB8540_LDO_SDIO] = {
  1614. .desc = {
  1615. .name = "LDO-SDIO",
  1616. .ops = &ab8500_regulator_volt_mode_ops,
  1617. .type = REGULATOR_VOLTAGE,
  1618. .id = AB8540_LDO_SDIO,
  1619. .owner = THIS_MODULE,
  1620. .n_voltages = ARRAY_SIZE(ldo_sdio_voltages),
  1621. .volt_table = ldo_sdio_voltages,
  1622. },
  1623. .load_lp_uA = 5000,
  1624. .update_bank = 0x03,
  1625. .update_reg = 0x88,
  1626. .update_mask = 0x30,
  1627. .update_val = 0x10,
  1628. .update_val_idle = 0x30,
  1629. .update_val_normal = 0x10,
  1630. .voltage_bank = 0x03,
  1631. .voltage_reg = 0x88,
  1632. .voltage_mask = 0x07,
  1633. },
  1634. };
  1635. static struct ab8500_shared_mode ldo_anamic1_shared = {
  1636. .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2],
  1637. };
  1638. static struct ab8500_shared_mode ldo_anamic2_shared = {
  1639. .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1],
  1640. };
  1641. static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = {
  1642. .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2],
  1643. };
  1644. static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = {
  1645. .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1],
  1646. };
  1647. struct ab8500_reg_init {
  1648. u8 bank;
  1649. u8 addr;
  1650. u8 mask;
  1651. };
  1652. #define REG_INIT(_id, _bank, _addr, _mask) \
  1653. [_id] = { \
  1654. .bank = _bank, \
  1655. .addr = _addr, \
  1656. .mask = _mask, \
  1657. }
  1658. /* AB8500 register init */
  1659. static struct ab8500_reg_init ab8500_reg_init[] = {
  1660. /*
  1661. * 0x30, VanaRequestCtrl
  1662. * 0xc0, VextSupply1RequestCtrl
  1663. */
  1664. REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0),
  1665. /*
  1666. * 0x03, VextSupply2RequestCtrl
  1667. * 0x0c, VextSupply3RequestCtrl
  1668. * 0x30, Vaux1RequestCtrl
  1669. * 0xc0, Vaux2RequestCtrl
  1670. */
  1671. REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
  1672. /*
  1673. * 0x03, Vaux3RequestCtrl
  1674. * 0x04, SwHPReq
  1675. */
  1676. REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  1677. /*
  1678. * 0x08, VanaSysClkReq1HPValid
  1679. * 0x20, Vaux1SysClkReq1HPValid
  1680. * 0x40, Vaux2SysClkReq1HPValid
  1681. * 0x80, Vaux3SysClkReq1HPValid
  1682. */
  1683. REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
  1684. /*
  1685. * 0x10, VextSupply1SysClkReq1HPValid
  1686. * 0x20, VextSupply2SysClkReq1HPValid
  1687. * 0x40, VextSupply3SysClkReq1HPValid
  1688. */
  1689. REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
  1690. /*
  1691. * 0x08, VanaHwHPReq1Valid
  1692. * 0x20, Vaux1HwHPReq1Valid
  1693. * 0x40, Vaux2HwHPReq1Valid
  1694. * 0x80, Vaux3HwHPReq1Valid
  1695. */
  1696. REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
  1697. /*
  1698. * 0x01, VextSupply1HwHPReq1Valid
  1699. * 0x02, VextSupply2HwHPReq1Valid
  1700. * 0x04, VextSupply3HwHPReq1Valid
  1701. */
  1702. REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
  1703. /*
  1704. * 0x08, VanaHwHPReq2Valid
  1705. * 0x20, Vaux1HwHPReq2Valid
  1706. * 0x40, Vaux2HwHPReq2Valid
  1707. * 0x80, Vaux3HwHPReq2Valid
  1708. */
  1709. REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
  1710. /*
  1711. * 0x01, VextSupply1HwHPReq2Valid
  1712. * 0x02, VextSupply2HwHPReq2Valid
  1713. * 0x04, VextSupply3HwHPReq2Valid
  1714. */
  1715. REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
  1716. /*
  1717. * 0x20, VanaSwHPReqValid
  1718. * 0x80, Vaux1SwHPReqValid
  1719. */
  1720. REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
  1721. /*
  1722. * 0x01, Vaux2SwHPReqValid
  1723. * 0x02, Vaux3SwHPReqValid
  1724. * 0x04, VextSupply1SwHPReqValid
  1725. * 0x08, VextSupply2SwHPReqValid
  1726. * 0x10, VextSupply3SwHPReqValid
  1727. */
  1728. REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
  1729. /*
  1730. * 0x02, SysClkReq2Valid1
  1731. * 0x04, SysClkReq3Valid1
  1732. * 0x08, SysClkReq4Valid1
  1733. * 0x10, SysClkReq5Valid1
  1734. * 0x20, SysClkReq6Valid1
  1735. * 0x40, SysClkReq7Valid1
  1736. * 0x80, SysClkReq8Valid1
  1737. */
  1738. REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
  1739. /*
  1740. * 0x02, SysClkReq2Valid2
  1741. * 0x04, SysClkReq3Valid2
  1742. * 0x08, SysClkReq4Valid2
  1743. * 0x10, SysClkReq5Valid2
  1744. * 0x20, SysClkReq6Valid2
  1745. * 0x40, SysClkReq7Valid2
  1746. * 0x80, SysClkReq8Valid2
  1747. */
  1748. REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
  1749. /*
  1750. * 0x02, VTVoutEna
  1751. * 0x04, Vintcore12Ena
  1752. * 0x38, Vintcore12Sel
  1753. * 0x40, Vintcore12LP
  1754. * 0x80, VTVoutLP
  1755. */
  1756. REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe),
  1757. /*
  1758. * 0x02, VaudioEna
  1759. * 0x04, VdmicEna
  1760. * 0x08, Vamic1Ena
  1761. * 0x10, Vamic2Ena
  1762. */
  1763. REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
  1764. /*
  1765. * 0x01, Vamic1_dzout
  1766. * 0x02, Vamic2_dzout
  1767. */
  1768. REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  1769. /*
  1770. * 0x03, VpllRegu (NOTE! PRCMU register bits)
  1771. * 0x0c, VanaRegu
  1772. */
  1773. REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  1774. /*
  1775. * 0x01, VrefDDREna
  1776. * 0x02, VrefDDRSleepMode
  1777. */
  1778. REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03),
  1779. /*
  1780. * 0x03, VextSupply1Regu
  1781. * 0x0c, VextSupply2Regu
  1782. * 0x30, VextSupply3Regu
  1783. * 0x40, ExtSupply2Bypass
  1784. * 0x80, ExtSupply3Bypass
  1785. */
  1786. REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  1787. /*
  1788. * 0x03, Vaux1Regu
  1789. * 0x0c, Vaux2Regu
  1790. */
  1791. REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
  1792. /*
  1793. * 0x03, Vaux3Regu
  1794. */
  1795. REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
  1796. /*
  1797. * 0x0f, Vaux1Sel
  1798. */
  1799. REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
  1800. /*
  1801. * 0x0f, Vaux2Sel
  1802. */
  1803. REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
  1804. /*
  1805. * 0x07, Vaux3Sel
  1806. */
  1807. REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
  1808. /*
  1809. * 0x01, VextSupply12LP
  1810. */
  1811. REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
  1812. /*
  1813. * 0x04, Vaux1Disch
  1814. * 0x08, Vaux2Disch
  1815. * 0x10, Vaux3Disch
  1816. * 0x20, Vintcore12Disch
  1817. * 0x40, VTVoutDisch
  1818. * 0x80, VaudioDisch
  1819. */
  1820. REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
  1821. /*
  1822. * 0x02, VanaDisch
  1823. * 0x04, VdmicPullDownEna
  1824. * 0x10, VdmicDisch
  1825. */
  1826. REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
  1827. };
  1828. /* AB8505 register init */
  1829. static struct ab8500_reg_init ab8505_reg_init[] = {
  1830. /*
  1831. * 0x03, VarmRequestCtrl
  1832. * 0x0c, VsmpsCRequestCtrl
  1833. * 0x30, VsmpsARequestCtrl
  1834. * 0xc0, VsmpsBRequestCtrl
  1835. */
  1836. REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
  1837. /*
  1838. * 0x03, VsafeRequestCtrl
  1839. * 0x0c, VpllRequestCtrl
  1840. * 0x30, VanaRequestCtrl
  1841. */
  1842. REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f),
  1843. /*
  1844. * 0x30, Vaux1RequestCtrl
  1845. * 0xc0, Vaux2RequestCtrl
  1846. */
  1847. REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0),
  1848. /*
  1849. * 0x03, Vaux3RequestCtrl
  1850. * 0x04, SwHPReq
  1851. */
  1852. REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  1853. /*
  1854. * 0x01, VsmpsASysClkReq1HPValid
  1855. * 0x02, VsmpsBSysClkReq1HPValid
  1856. * 0x04, VsafeSysClkReq1HPValid
  1857. * 0x08, VanaSysClkReq1HPValid
  1858. * 0x10, VpllSysClkReq1HPValid
  1859. * 0x20, Vaux1SysClkReq1HPValid
  1860. * 0x40, Vaux2SysClkReq1HPValid
  1861. * 0x80, Vaux3SysClkReq1HPValid
  1862. */
  1863. REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
  1864. /*
  1865. * 0x01, VsmpsCSysClkReq1HPValid
  1866. * 0x02, VarmSysClkReq1HPValid
  1867. * 0x04, VbbSysClkReq1HPValid
  1868. * 0x08, VsmpsMSysClkReq1HPValid
  1869. */
  1870. REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f),
  1871. /*
  1872. * 0x01, VsmpsAHwHPReq1Valid
  1873. * 0x02, VsmpsBHwHPReq1Valid
  1874. * 0x04, VsafeHwHPReq1Valid
  1875. * 0x08, VanaHwHPReq1Valid
  1876. * 0x10, VpllHwHPReq1Valid
  1877. * 0x20, Vaux1HwHPReq1Valid
  1878. * 0x40, Vaux2HwHPReq1Valid
  1879. * 0x80, Vaux3HwHPReq1Valid
  1880. */
  1881. REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
  1882. /*
  1883. * 0x08, VsmpsMHwHPReq1Valid
  1884. */
  1885. REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08),
  1886. /*
  1887. * 0x01, VsmpsAHwHPReq2Valid
  1888. * 0x02, VsmpsBHwHPReq2Valid
  1889. * 0x04, VsafeHwHPReq2Valid
  1890. * 0x08, VanaHwHPReq2Valid
  1891. * 0x10, VpllHwHPReq2Valid
  1892. * 0x20, Vaux1HwHPReq2Valid
  1893. * 0x40, Vaux2HwHPReq2Valid
  1894. * 0x80, Vaux3HwHPReq2Valid
  1895. */
  1896. REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
  1897. /*
  1898. * 0x08, VsmpsMHwHPReq2Valid
  1899. */
  1900. REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08),
  1901. /*
  1902. * 0x01, VsmpsCSwHPReqValid
  1903. * 0x02, VarmSwHPReqValid
  1904. * 0x04, VsmpsASwHPReqValid
  1905. * 0x08, VsmpsBSwHPReqValid
  1906. * 0x10, VsafeSwHPReqValid
  1907. * 0x20, VanaSwHPReqValid
  1908. * 0x40, VpllSwHPReqValid
  1909. * 0x80, Vaux1SwHPReqValid
  1910. */
  1911. REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
  1912. /*
  1913. * 0x01, Vaux2SwHPReqValid
  1914. * 0x02, Vaux3SwHPReqValid
  1915. * 0x20, VsmpsMSwHPReqValid
  1916. */
  1917. REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23),
  1918. /*
  1919. * 0x02, SysClkReq2Valid1
  1920. * 0x04, SysClkReq3Valid1
  1921. * 0x08, SysClkReq4Valid1
  1922. */
  1923. REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e),
  1924. /*
  1925. * 0x02, SysClkReq2Valid2
  1926. * 0x04, SysClkReq3Valid2
  1927. * 0x08, SysClkReq4Valid2
  1928. */
  1929. REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e),
  1930. /*
  1931. * 0x01, Vaux4SwHPReqValid
  1932. * 0x02, Vaux4HwHPReq2Valid
  1933. * 0x04, Vaux4HwHPReq1Valid
  1934. * 0x08, Vaux4SysClkReq1HPValid
  1935. */
  1936. REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
  1937. /*
  1938. * 0x02, VadcEna
  1939. * 0x04, VintCore12Ena
  1940. * 0x38, VintCore12Sel
  1941. * 0x40, VintCore12LP
  1942. * 0x80, VadcLP
  1943. */
  1944. REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe),
  1945. /*
  1946. * 0x02, VaudioEna
  1947. * 0x04, VdmicEna
  1948. * 0x08, Vamic1Ena
  1949. * 0x10, Vamic2Ena
  1950. */
  1951. REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
  1952. /*
  1953. * 0x01, Vamic1_dzout
  1954. * 0x02, Vamic2_dzout
  1955. */
  1956. REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  1957. /*
  1958. * 0x03, VsmpsARegu
  1959. * 0x0c, VsmpsASelCtrl
  1960. * 0x10, VsmpsAAutoMode
  1961. * 0x20, VsmpsAPWMMode
  1962. */
  1963. REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f),
  1964. /*
  1965. * 0x03, VsmpsBRegu
  1966. * 0x0c, VsmpsBSelCtrl
  1967. * 0x10, VsmpsBAutoMode
  1968. * 0x20, VsmpsBPWMMode
  1969. */
  1970. REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f),
  1971. /*
  1972. * 0x03, VsafeRegu
  1973. * 0x0c, VsafeSelCtrl
  1974. * 0x10, VsafeAutoMode
  1975. * 0x20, VsafePWMMode
  1976. */
  1977. REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f),
  1978. /*
  1979. * 0x03, VpllRegu (NOTE! PRCMU register bits)
  1980. * 0x0c, VanaRegu
  1981. */
  1982. REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  1983. /*
  1984. * 0x03, VextSupply1Regu
  1985. * 0x0c, VextSupply2Regu
  1986. * 0x30, VextSupply3Regu
  1987. * 0x40, ExtSupply2Bypass
  1988. * 0x80, ExtSupply3Bypass
  1989. */
  1990. REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  1991. /*
  1992. * 0x03, Vaux1Regu
  1993. * 0x0c, Vaux2Regu
  1994. */
  1995. REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f),
  1996. /*
  1997. * 0x0f, Vaux3Regu
  1998. */
  1999. REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
  2000. /*
  2001. * 0x3f, VsmpsASel1
  2002. */
  2003. REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f),
  2004. /*
  2005. * 0x3f, VsmpsASel2
  2006. */
  2007. REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f),
  2008. /*
  2009. * 0x3f, VsmpsASel3
  2010. */
  2011. REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f),
  2012. /*
  2013. * 0x3f, VsmpsBSel1
  2014. */
  2015. REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f),
  2016. /*
  2017. * 0x3f, VsmpsBSel2
  2018. */
  2019. REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f),
  2020. /*
  2021. * 0x3f, VsmpsBSel3
  2022. */
  2023. REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f),
  2024. /*
  2025. * 0x7f, VsafeSel1
  2026. */
  2027. REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f),
  2028. /*
  2029. * 0x3f, VsafeSel2
  2030. */
  2031. REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f),
  2032. /*
  2033. * 0x3f, VsafeSel3
  2034. */
  2035. REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f),
  2036. /*
  2037. * 0x0f, Vaux1Sel
  2038. */
  2039. REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f),
  2040. /*
  2041. * 0x0f, Vaux2Sel
  2042. */
  2043. REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f),
  2044. /*
  2045. * 0x07, Vaux3Sel
  2046. * 0x30, VRF1Sel
  2047. */
  2048. REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
  2049. /*
  2050. * 0x03, Vaux4RequestCtrl
  2051. */
  2052. REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
  2053. /*
  2054. * 0x03, Vaux4Regu
  2055. */
  2056. REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03),
  2057. /*
  2058. * 0x0f, Vaux4Sel
  2059. */
  2060. REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f),
  2061. /*
  2062. * 0x04, Vaux1Disch
  2063. * 0x08, Vaux2Disch
  2064. * 0x10, Vaux3Disch
  2065. * 0x20, Vintcore12Disch
  2066. * 0x40, VTVoutDisch
  2067. * 0x80, VaudioDisch
  2068. */
  2069. REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
  2070. /*
  2071. * 0x02, VanaDisch
  2072. * 0x04, VdmicPullDownEna
  2073. * 0x10, VdmicDisch
  2074. */
  2075. REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
  2076. /*
  2077. * 0x01, Vaux4Disch
  2078. */
  2079. REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
  2080. /*
  2081. * 0x07, Vaux5Sel
  2082. * 0x08, Vaux5LP
  2083. * 0x10, Vaux5Ena
  2084. * 0x20, Vaux5Disch
  2085. * 0x40, Vaux5DisSfst
  2086. * 0x80, Vaux5DisPulld
  2087. */
  2088. REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff),
  2089. /*
  2090. * 0x07, Vaux6Sel
  2091. * 0x08, Vaux6LP
  2092. * 0x10, Vaux6Ena
  2093. * 0x80, Vaux6DisPulld
  2094. */
  2095. REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f),
  2096. };
  2097. /* AB9540 register init */
  2098. static struct ab8500_reg_init ab9540_reg_init[] = {
  2099. /*
  2100. * 0x03, VarmRequestCtrl
  2101. * 0x0c, VapeRequestCtrl
  2102. * 0x30, Vsmps1RequestCtrl
  2103. * 0xc0, Vsmps2RequestCtrl
  2104. */
  2105. REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
  2106. /*
  2107. * 0x03, Vsmps3RequestCtrl
  2108. * 0x0c, VpllRequestCtrl
  2109. * 0x30, VanaRequestCtrl
  2110. * 0xc0, VextSupply1RequestCtrl
  2111. */
  2112. REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
  2113. /*
  2114. * 0x03, VextSupply2RequestCtrl
  2115. * 0x0c, VextSupply3RequestCtrl
  2116. * 0x30, Vaux1RequestCtrl
  2117. * 0xc0, Vaux2RequestCtrl
  2118. */
  2119. REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
  2120. /*
  2121. * 0x03, Vaux3RequestCtrl
  2122. * 0x04, SwHPReq
  2123. */
  2124. REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  2125. /*
  2126. * 0x01, Vsmps1SysClkReq1HPValid
  2127. * 0x02, Vsmps2SysClkReq1HPValid
  2128. * 0x04, Vsmps3SysClkReq1HPValid
  2129. * 0x08, VanaSysClkReq1HPValid
  2130. * 0x10, VpllSysClkReq1HPValid
  2131. * 0x20, Vaux1SysClkReq1HPValid
  2132. * 0x40, Vaux2SysClkReq1HPValid
  2133. * 0x80, Vaux3SysClkReq1HPValid
  2134. */
  2135. REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
  2136. /*
  2137. * 0x01, VapeSysClkReq1HPValid
  2138. * 0x02, VarmSysClkReq1HPValid
  2139. * 0x04, VbbSysClkReq1HPValid
  2140. * 0x08, VmodSysClkReq1HPValid
  2141. * 0x10, VextSupply1SysClkReq1HPValid
  2142. * 0x20, VextSupply2SysClkReq1HPValid
  2143. * 0x40, VextSupply3SysClkReq1HPValid
  2144. */
  2145. REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
  2146. /*
  2147. * 0x01, Vsmps1HwHPReq1Valid
  2148. * 0x02, Vsmps2HwHPReq1Valid
  2149. * 0x04, Vsmps3HwHPReq1Valid
  2150. * 0x08, VanaHwHPReq1Valid
  2151. * 0x10, VpllHwHPReq1Valid
  2152. * 0x20, Vaux1HwHPReq1Valid
  2153. * 0x40, Vaux2HwHPReq1Valid
  2154. * 0x80, Vaux3HwHPReq1Valid
  2155. */
  2156. REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
  2157. /*
  2158. * 0x01, VextSupply1HwHPReq1Valid
  2159. * 0x02, VextSupply2HwHPReq1Valid
  2160. * 0x04, VextSupply3HwHPReq1Valid
  2161. * 0x08, VmodHwHPReq1Valid
  2162. */
  2163. REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f),
  2164. /*
  2165. * 0x01, Vsmps1HwHPReq2Valid
  2166. * 0x02, Vsmps2HwHPReq2Valid
  2167. * 0x03, Vsmps3HwHPReq2Valid
  2168. * 0x08, VanaHwHPReq2Valid
  2169. * 0x10, VpllHwHPReq2Valid
  2170. * 0x20, Vaux1HwHPReq2Valid
  2171. * 0x40, Vaux2HwHPReq2Valid
  2172. * 0x80, Vaux3HwHPReq2Valid
  2173. */
  2174. REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
  2175. /*
  2176. * 0x01, VextSupply1HwHPReq2Valid
  2177. * 0x02, VextSupply2HwHPReq2Valid
  2178. * 0x04, VextSupply3HwHPReq2Valid
  2179. * 0x08, VmodHwHPReq2Valid
  2180. */
  2181. REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f),
  2182. /*
  2183. * 0x01, VapeSwHPReqValid
  2184. * 0x02, VarmSwHPReqValid
  2185. * 0x04, Vsmps1SwHPReqValid
  2186. * 0x08, Vsmps2SwHPReqValid
  2187. * 0x10, Vsmps3SwHPReqValid
  2188. * 0x20, VanaSwHPReqValid
  2189. * 0x40, VpllSwHPReqValid
  2190. * 0x80, Vaux1SwHPReqValid
  2191. */
  2192. REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
  2193. /*
  2194. * 0x01, Vaux2SwHPReqValid
  2195. * 0x02, Vaux3SwHPReqValid
  2196. * 0x04, VextSupply1SwHPReqValid
  2197. * 0x08, VextSupply2SwHPReqValid
  2198. * 0x10, VextSupply3SwHPReqValid
  2199. * 0x20, VmodSwHPReqValid
  2200. */
  2201. REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f),
  2202. /*
  2203. * 0x02, SysClkReq2Valid1
  2204. * ...
  2205. * 0x80, SysClkReq8Valid1
  2206. */
  2207. REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
  2208. /*
  2209. * 0x02, SysClkReq2Valid2
  2210. * ...
  2211. * 0x80, SysClkReq8Valid2
  2212. */
  2213. REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
  2214. /*
  2215. * 0x01, Vaux4SwHPReqValid
  2216. * 0x02, Vaux4HwHPReq2Valid
  2217. * 0x04, Vaux4HwHPReq1Valid
  2218. * 0x08, Vaux4SysClkReq1HPValid
  2219. */
  2220. REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
  2221. /*
  2222. * 0x02, VTVoutEna
  2223. * 0x04, Vintcore12Ena
  2224. * 0x38, Vintcore12Sel
  2225. * 0x40, Vintcore12LP
  2226. * 0x80, VTVoutLP
  2227. */
  2228. REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe),
  2229. /*
  2230. * 0x02, VaudioEna
  2231. * 0x04, VdmicEna
  2232. * 0x08, Vamic1Ena
  2233. * 0x10, Vamic2Ena
  2234. */
  2235. REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
  2236. /*
  2237. * 0x01, Vamic1_dzout
  2238. * 0x02, Vamic2_dzout
  2239. */
  2240. REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  2241. /*
  2242. * 0x03, Vsmps1Regu
  2243. * 0x0c, Vsmps1SelCtrl
  2244. * 0x10, Vsmps1AutoMode
  2245. * 0x20, Vsmps1PWMMode
  2246. */
  2247. REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f),
  2248. /*
  2249. * 0x03, Vsmps2Regu
  2250. * 0x0c, Vsmps2SelCtrl
  2251. * 0x10, Vsmps2AutoMode
  2252. * 0x20, Vsmps2PWMMode
  2253. */
  2254. REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f),
  2255. /*
  2256. * 0x03, Vsmps3Regu
  2257. * 0x0c, Vsmps3SelCtrl
  2258. * NOTE! PRCMU register
  2259. */
  2260. REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f),
  2261. /*
  2262. * 0x03, VpllRegu
  2263. * 0x0c, VanaRegu
  2264. */
  2265. REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  2266. /*
  2267. * 0x03, VextSupply1Regu
  2268. * 0x0c, VextSupply2Regu
  2269. * 0x30, VextSupply3Regu
  2270. * 0x40, ExtSupply2Bypass
  2271. * 0x80, ExtSupply3Bypass
  2272. */
  2273. REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  2274. /*
  2275. * 0x03, Vaux1Regu
  2276. * 0x0c, Vaux2Regu
  2277. */
  2278. REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f),
  2279. /*
  2280. * 0x0c, Vrf1Regu
  2281. * 0x03, Vaux3Regu
  2282. */
  2283. REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
  2284. /*
  2285. * 0x3f, Vsmps1Sel1
  2286. */
  2287. REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
  2288. /*
  2289. * 0x3f, Vsmps1Sel2
  2290. */
  2291. REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
  2292. /*
  2293. * 0x3f, Vsmps1Sel3
  2294. */
  2295. REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
  2296. /*
  2297. * 0x3f, Vsmps2Sel1
  2298. */
  2299. REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
  2300. /*
  2301. * 0x3f, Vsmps2Sel2
  2302. */
  2303. REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
  2304. /*
  2305. * 0x3f, Vsmps2Sel3
  2306. */
  2307. REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
  2308. /*
  2309. * 0x7f, Vsmps3Sel1
  2310. * NOTE! PRCMU register
  2311. */
  2312. REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
  2313. /*
  2314. * 0x7f, Vsmps3Sel2
  2315. * NOTE! PRCMU register
  2316. */
  2317. REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
  2318. /*
  2319. * 0x0f, Vaux1Sel
  2320. */
  2321. REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f),
  2322. /*
  2323. * 0x0f, Vaux2Sel
  2324. */
  2325. REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f),
  2326. /*
  2327. * 0x07, Vaux3Sel
  2328. * 0x30, Vrf1Sel
  2329. */
  2330. REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
  2331. /*
  2332. * 0x01, VextSupply12LP
  2333. */
  2334. REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
  2335. /*
  2336. * 0x03, Vaux4RequestCtrl
  2337. */
  2338. REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
  2339. /*
  2340. * 0x03, Vaux4Regu
  2341. */
  2342. REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03),
  2343. /*
  2344. * 0x08, Vaux4Sel
  2345. */
  2346. REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f),
  2347. /*
  2348. * 0x01, VpllDisch
  2349. * 0x02, Vrf1Disch
  2350. * 0x04, Vaux1Disch
  2351. * 0x08, Vaux2Disch
  2352. * 0x10, Vaux3Disch
  2353. * 0x20, Vintcore12Disch
  2354. * 0x40, VTVoutDisch
  2355. * 0x80, VaudioDisch
  2356. */
  2357. REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
  2358. /*
  2359. * 0x01, VsimDisch
  2360. * 0x02, VanaDisch
  2361. * 0x04, VdmicPullDownEna
  2362. * 0x08, VpllPullDownEna
  2363. * 0x10, VdmicDisch
  2364. */
  2365. REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f),
  2366. /*
  2367. * 0x01, Vaux4Disch
  2368. */
  2369. REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
  2370. };
  2371. /* AB8540 register init */
  2372. static struct ab8500_reg_init ab8540_reg_init[] = {
  2373. /*
  2374. * 0x01, VSimSycClkReq1Valid
  2375. * 0x02, VSimSycClkReq2Valid
  2376. * 0x04, VSimSycClkReq3Valid
  2377. * 0x08, VSimSycClkReq4Valid
  2378. * 0x10, VSimSycClkReq5Valid
  2379. * 0x20, VSimSycClkReq6Valid
  2380. * 0x40, VSimSycClkReq7Valid
  2381. * 0x80, VSimSycClkReq8Valid
  2382. */
  2383. REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff),
  2384. /*
  2385. * 0x03, VarmRequestCtrl
  2386. * 0x0c, VapeRequestCtrl
  2387. * 0x30, Vsmps1RequestCtrl
  2388. * 0xc0, Vsmps2RequestCtrl
  2389. */
  2390. REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
  2391. /*
  2392. * 0x03, Vsmps3RequestCtrl
  2393. * 0x0c, VpllRequestCtrl
  2394. * 0x30, VanaRequestCtrl
  2395. * 0xc0, VextSupply1RequestCtrl
  2396. */
  2397. REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
  2398. /*
  2399. * 0x03, VextSupply2RequestCtrl
  2400. * 0x0c, VextSupply3RequestCtrl
  2401. * 0x30, Vaux1RequestCtrl
  2402. * 0xc0, Vaux2RequestCtrl
  2403. */
  2404. REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
  2405. /*
  2406. * 0x03, Vaux3RequestCtrl
  2407. * 0x04, SwHPReq
  2408. */
  2409. REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
  2410. /*
  2411. * 0x01, Vsmps1SysClkReq1HPValid
  2412. * 0x02, Vsmps2SysClkReq1HPValid
  2413. * 0x04, Vsmps3SysClkReq1HPValid
  2414. * 0x08, VanaSysClkReq1HPValid
  2415. * 0x10, VpllSysClkReq1HPValid
  2416. * 0x20, Vaux1SysClkReq1HPValid
  2417. * 0x40, Vaux2SysClkReq1HPValid
  2418. * 0x80, Vaux3SysClkReq1HPValid
  2419. */
  2420. REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
  2421. /*
  2422. * 0x01, VapeSysClkReq1HPValid
  2423. * 0x02, VarmSysClkReq1HPValid
  2424. * 0x04, VbbSysClkReq1HPValid
  2425. * 0x10, VextSupply1SysClkReq1HPValid
  2426. * 0x20, VextSupply2SysClkReq1HPValid
  2427. * 0x40, VextSupply3SysClkReq1HPValid
  2428. */
  2429. REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77),
  2430. /*
  2431. * 0x01, Vsmps1HwHPReq1Valid
  2432. * 0x02, Vsmps2HwHPReq1Valid
  2433. * 0x04, Vsmps3HwHPReq1Valid
  2434. * 0x08, VanaHwHPReq1Valid
  2435. * 0x10, VpllHwHPReq1Valid
  2436. * 0x20, Vaux1HwHPReq1Valid
  2437. * 0x40, Vaux2HwHPReq1Valid
  2438. * 0x80, Vaux3HwHPReq1Valid
  2439. */
  2440. REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
  2441. /*
  2442. * 0x01, VextSupply1HwHPReq1Valid
  2443. * 0x02, VextSupply2HwHPReq1Valid
  2444. * 0x04, VextSupply3HwHPReq1Valid
  2445. */
  2446. REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
  2447. /*
  2448. * 0x01, Vsmps1HwHPReq2Valid
  2449. * 0x02, Vsmps2HwHPReq2Valid
  2450. * 0x03, Vsmps3HwHPReq2Valid
  2451. * 0x08, VanaHwHPReq2Valid
  2452. * 0x10, VpllHwHPReq2Valid
  2453. * 0x20, Vaux1HwHPReq2Valid
  2454. * 0x40, Vaux2HwHPReq2Valid
  2455. * 0x80, Vaux3HwHPReq2Valid
  2456. */
  2457. REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
  2458. /*
  2459. * 0x01, VextSupply1HwHPReq2Valid
  2460. * 0x02, VextSupply2HwHPReq2Valid
  2461. * 0x04, VextSupply3HwHPReq2Valid
  2462. */
  2463. REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
  2464. /*
  2465. * 0x01, VapeSwHPReqValid
  2466. * 0x02, VarmSwHPReqValid
  2467. * 0x04, Vsmps1SwHPReqValid
  2468. * 0x08, Vsmps2SwHPReqValid
  2469. * 0x10, Vsmps3SwHPReqValid
  2470. * 0x20, VanaSwHPReqValid
  2471. * 0x40, VpllSwHPReqValid
  2472. * 0x80, Vaux1SwHPReqValid
  2473. */
  2474. REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
  2475. /*
  2476. * 0x01, Vaux2SwHPReqValid
  2477. * 0x02, Vaux3SwHPReqValid
  2478. * 0x04, VextSupply1SwHPReqValid
  2479. * 0x08, VextSupply2SwHPReqValid
  2480. * 0x10, VextSupply3SwHPReqValid
  2481. */
  2482. REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
  2483. /*
  2484. * 0x02, SysClkReq2Valid1
  2485. * ...
  2486. * 0x80, SysClkReq8Valid1
  2487. */
  2488. REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff),
  2489. /*
  2490. * 0x02, SysClkReq2Valid2
  2491. * ...
  2492. * 0x80, SysClkReq8Valid2
  2493. */
  2494. REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff),
  2495. /*
  2496. * 0x01, Vaux4SwHPReqValid
  2497. * 0x02, Vaux4HwHPReq2Valid
  2498. * 0x04, Vaux4HwHPReq1Valid
  2499. * 0x08, Vaux4SysClkReq1HPValid
  2500. */
  2501. REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
  2502. /*
  2503. * 0x01, Vaux5SwHPReqValid
  2504. * 0x02, Vaux5HwHPReq2Valid
  2505. * 0x04, Vaux5HwHPReq1Valid
  2506. * 0x08, Vaux5SysClkReq1HPValid
  2507. */
  2508. REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f),
  2509. /*
  2510. * 0x01, Vaux6SwHPReqValid
  2511. * 0x02, Vaux6HwHPReq2Valid
  2512. * 0x04, Vaux6HwHPReq1Valid
  2513. * 0x08, Vaux6SysClkReq1HPValid
  2514. */
  2515. REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f),
  2516. /*
  2517. * 0x01, VclkbSwHPReqValid
  2518. * 0x02, VclkbHwHPReq2Valid
  2519. * 0x04, VclkbHwHPReq1Valid
  2520. * 0x08, VclkbSysClkReq1HPValid
  2521. */
  2522. REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f),
  2523. /*
  2524. * 0x01, Vrf1SwHPReqValid
  2525. * 0x02, Vrf1HwHPReq2Valid
  2526. * 0x04, Vrf1HwHPReq1Valid
  2527. * 0x08, Vrf1SysClkReq1HPValid
  2528. */
  2529. REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f),
  2530. /*
  2531. * 0x02, VTVoutEna
  2532. * 0x04, Vintcore12Ena
  2533. * 0x38, Vintcore12Sel
  2534. * 0x40, Vintcore12LP
  2535. * 0x80, VTVoutLP
  2536. */
  2537. REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe),
  2538. /*
  2539. * 0x02, VaudioEna
  2540. * 0x04, VdmicEna
  2541. * 0x08, Vamic1Ena
  2542. * 0x10, Vamic2Ena
  2543. * 0x20, Vamic12LP
  2544. * 0xC0, VdmicSel
  2545. */
  2546. REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe),
  2547. /*
  2548. * 0x01, Vamic1_dzout
  2549. * 0x02, Vamic2_dzout
  2550. */
  2551. REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
  2552. /*
  2553. * 0x07, VHSICSel
  2554. * 0x08, VHSICOffState
  2555. * 0x10, VHSIEna
  2556. * 0x20, VHSICLP
  2557. */
  2558. REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f),
  2559. /*
  2560. * 0x07, VSDIOSel
  2561. * 0x08, VSDIOOffState
  2562. * 0x10, VSDIOEna
  2563. * 0x20, VSDIOLP
  2564. */
  2565. REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f),
  2566. /*
  2567. * 0x03, Vsmps1Regu
  2568. * 0x0c, Vsmps1SelCtrl
  2569. * 0x10, Vsmps1AutoMode
  2570. * 0x20, Vsmps1PWMMode
  2571. */
  2572. REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f),
  2573. /*
  2574. * 0x03, Vsmps2Regu
  2575. * 0x0c, Vsmps2SelCtrl
  2576. * 0x10, Vsmps2AutoMode
  2577. * 0x20, Vsmps2PWMMode
  2578. */
  2579. REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f),
  2580. /*
  2581. * 0x03, Vsmps3Regu
  2582. * 0x0c, Vsmps3SelCtrl
  2583. * 0x10, Vsmps3AutoMode
  2584. * 0x20, Vsmps3PWMMode
  2585. * NOTE! PRCMU register
  2586. */
  2587. REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f),
  2588. /*
  2589. * 0x03, VpllRegu
  2590. * 0x0c, VanaRegu
  2591. */
  2592. REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
  2593. /*
  2594. * 0x03, VextSupply1Regu
  2595. * 0x0c, VextSupply2Regu
  2596. * 0x30, VextSupply3Regu
  2597. * 0x40, ExtSupply2Bypass
  2598. * 0x80, ExtSupply3Bypass
  2599. */
  2600. REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
  2601. /*
  2602. * 0x03, Vaux1Regu
  2603. * 0x0c, Vaux2Regu
  2604. */
  2605. REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f),
  2606. /*
  2607. * 0x0c, VRF1Regu
  2608. * 0x03, Vaux3Regu
  2609. */
  2610. REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
  2611. /*
  2612. * 0x3f, Vsmps1Sel1
  2613. */
  2614. REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
  2615. /*
  2616. * 0x3f, Vsmps1Sel2
  2617. */
  2618. REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
  2619. /*
  2620. * 0x3f, Vsmps1Sel3
  2621. */
  2622. REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
  2623. /*
  2624. * 0x3f, Vsmps2Sel1
  2625. */
  2626. REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
  2627. /*
  2628. * 0x3f, Vsmps2Sel2
  2629. */
  2630. REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
  2631. /*
  2632. * 0x3f, Vsmps2Sel3
  2633. */
  2634. REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
  2635. /*
  2636. * 0x7f, Vsmps3Sel1
  2637. * NOTE! PRCMU register
  2638. */
  2639. REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
  2640. /*
  2641. * 0x7f, Vsmps3Sel2
  2642. * NOTE! PRCMU register
  2643. */
  2644. REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
  2645. /*
  2646. * 0x0f, Vaux1Sel
  2647. */
  2648. REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f),
  2649. /*
  2650. * 0x0f, Vaux2Sel
  2651. */
  2652. REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f),
  2653. /*
  2654. * 0x07, Vaux3Sel
  2655. * 0x70, Vrf1Sel
  2656. */
  2657. REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77),
  2658. /*
  2659. * 0x01, VextSupply12LP
  2660. */
  2661. REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
  2662. /*
  2663. * 0x07, Vanasel
  2664. * 0x30, Vpllsel
  2665. */
  2666. REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37),
  2667. /*
  2668. * 0x03, Vaux4RequestCtrl
  2669. */
  2670. REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
  2671. /*
  2672. * 0x03, Vaux4Regu
  2673. */
  2674. REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03),
  2675. /*
  2676. * 0x0f, Vaux4Sel
  2677. */
  2678. REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f),
  2679. /*
  2680. * 0x03, Vaux5RequestCtrl
  2681. */
  2682. REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03),
  2683. /*
  2684. * 0x03, Vaux5Regu
  2685. */
  2686. REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03),
  2687. /*
  2688. * 0x3f, Vaux5Sel
  2689. */
  2690. REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f),
  2691. /*
  2692. * 0x03, Vaux6RequestCtrl
  2693. */
  2694. REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03),
  2695. /*
  2696. * 0x03, Vaux6Regu
  2697. */
  2698. REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03),
  2699. /*
  2700. * 0x3f, Vaux6Sel
  2701. */
  2702. REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f),
  2703. /*
  2704. * 0x03, VCLKBRequestCtrl
  2705. */
  2706. REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03),
  2707. /*
  2708. * 0x03, VCLKBRegu
  2709. */
  2710. REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03),
  2711. /*
  2712. * 0x07, VCLKBSel
  2713. */
  2714. REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07),
  2715. /*
  2716. * 0x03, Vrf1RequestCtrl
  2717. */
  2718. REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03),
  2719. /*
  2720. * 0x01, VpllDisch
  2721. * 0x02, Vrf1Disch
  2722. * 0x04, Vaux1Disch
  2723. * 0x08, Vaux2Disch
  2724. * 0x10, Vaux3Disch
  2725. * 0x20, Vintcore12Disch
  2726. * 0x40, VTVoutDisch
  2727. * 0x80, VaudioDisch
  2728. */
  2729. REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
  2730. /*
  2731. * 0x02, VanaDisch
  2732. * 0x04, VdmicPullDownEna
  2733. * 0x08, VpllPullDownEna
  2734. * 0x10, VdmicDisch
  2735. */
  2736. REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e),
  2737. /*
  2738. * 0x01, Vaux4Disch
  2739. */
  2740. REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
  2741. /*
  2742. * 0x01, Vaux5Disch
  2743. * 0x02, Vaux6Disch
  2744. * 0x04, VCLKBDisch
  2745. */
  2746. REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07),
  2747. };
  2748. static int ab8500_regulator_init_registers(struct platform_device *pdev,
  2749. struct ab8500_reg_init *reg_init,
  2750. int id, int mask, int value)
  2751. {
  2752. int err;
  2753. BUG_ON(value & ~mask);
  2754. BUG_ON(mask & ~reg_init[id].mask);
  2755. /* initialize register */
  2756. err = abx500_mask_and_set_register_interruptible(
  2757. &pdev->dev,
  2758. reg_init[id].bank,
  2759. reg_init[id].addr,
  2760. mask, value);
  2761. if (err < 0) {
  2762. dev_err(&pdev->dev,
  2763. "Failed to initialize 0x%02x, 0x%02x.\n",
  2764. reg_init[id].bank,
  2765. reg_init[id].addr);
  2766. return err;
  2767. }
  2768. dev_vdbg(&pdev->dev,
  2769. " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
  2770. reg_init[id].bank,
  2771. reg_init[id].addr,
  2772. mask, value);
  2773. return 0;
  2774. }
  2775. static int ab8500_regulator_register(struct platform_device *pdev,
  2776. struct regulator_init_data *init_data,
  2777. struct ab8500_regulator_info *regulator_info,
  2778. int id, struct device_node *np)
  2779. {
  2780. struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
  2781. struct ab8500_regulator_info *info = NULL;
  2782. struct regulator_config config = { };
  2783. int err;
  2784. /* assign per-regulator data */
  2785. info = &regulator_info[id];
  2786. info->dev = &pdev->dev;
  2787. config.dev = &pdev->dev;
  2788. config.init_data = init_data;
  2789. config.driver_data = info;
  2790. config.of_node = np;
  2791. /* fix for hardware before ab8500v2.0 */
  2792. if (is_ab8500_1p1_or_earlier(ab8500)) {
  2793. if (info->desc.id == AB8500_LDO_AUX3) {
  2794. info->desc.n_voltages =
  2795. ARRAY_SIZE(ldo_vauxn_voltages);
  2796. info->desc.volt_table = ldo_vauxn_voltages;
  2797. info->voltage_mask = 0xf;
  2798. }
  2799. }
  2800. /* register regulator with framework */
  2801. info->regulator = regulator_register(&info->desc, &config);
  2802. if (IS_ERR(info->regulator)) {
  2803. err = PTR_ERR(info->regulator);
  2804. dev_err(&pdev->dev, "failed to register regulator %s\n",
  2805. info->desc.name);
  2806. /* when we fail, un-register all earlier regulators */
  2807. while (--id >= 0) {
  2808. info = &regulator_info[id];
  2809. regulator_unregister(info->regulator);
  2810. }
  2811. return err;
  2812. }
  2813. return 0;
  2814. }
  2815. static struct of_regulator_match ab8500_regulator_match[] = {
  2816. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
  2817. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
  2818. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
  2819. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
  2820. { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
  2821. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
  2822. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
  2823. { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
  2824. { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
  2825. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
  2826. };
  2827. static struct of_regulator_match ab8505_regulator_match[] = {
  2828. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, },
  2829. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, },
  2830. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, },
  2831. { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, },
  2832. { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, },
  2833. { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, },
  2834. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, },
  2835. { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, },
  2836. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, },
  2837. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, },
  2838. { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, },
  2839. { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, },
  2840. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, },
  2841. };
  2842. static struct of_regulator_match ab8540_regulator_match[] = {
  2843. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, },
  2844. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, },
  2845. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, },
  2846. { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, },
  2847. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, },
  2848. { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, },
  2849. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, },
  2850. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, },
  2851. { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, },
  2852. { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, },
  2853. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, },
  2854. { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, },
  2855. };
  2856. static struct of_regulator_match ab9540_regulator_match[] = {
  2857. { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, },
  2858. { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, },
  2859. { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, },
  2860. { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, },
  2861. { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, },
  2862. { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, },
  2863. { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, },
  2864. { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, },
  2865. { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, },
  2866. { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, },
  2867. { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, },
  2868. };
  2869. static int
  2870. ab8500_regulator_of_probe(struct platform_device *pdev,
  2871. struct ab8500_regulator_info *regulator_info,
  2872. int regulator_info_size,
  2873. struct of_regulator_match *match,
  2874. struct device_node *np)
  2875. {
  2876. int err, i;
  2877. for (i = 0; i < regulator_info_size; i++) {
  2878. err = ab8500_regulator_register(
  2879. pdev, match[i].init_data, regulator_info,
  2880. i, match[i].of_node);
  2881. if (err)
  2882. return err;
  2883. }
  2884. return 0;
  2885. }
  2886. static int ab8500_regulator_probe(struct platform_device *pdev)
  2887. {
  2888. struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
  2889. struct device_node *np = pdev->dev.of_node;
  2890. struct of_regulator_match *match;
  2891. struct ab8500_platform_data *ppdata;
  2892. struct ab8500_regulator_platform_data *pdata;
  2893. int i, err;
  2894. struct ab8500_regulator_info *regulator_info;
  2895. int regulator_info_size;
  2896. struct ab8500_reg_init *reg_init;
  2897. int reg_init_size;
  2898. if (is_ab9540(ab8500)) {
  2899. regulator_info = ab9540_regulator_info;
  2900. regulator_info_size = ARRAY_SIZE(ab9540_regulator_info);
  2901. reg_init = ab9540_reg_init;
  2902. reg_init_size = AB9540_NUM_REGULATOR_REGISTERS;
  2903. match = ab9540_regulator_match;
  2904. match_size = ARRAY_SIZE(ab9540_regulator_match)
  2905. } else if (is_ab8505(ab8500)) {
  2906. regulator_info = ab8505_regulator_info;
  2907. regulator_info_size = ARRAY_SIZE(ab8505_regulator_info);
  2908. reg_init = ab8505_reg_init;
  2909. reg_init_size = AB8505_NUM_REGULATOR_REGISTERS;
  2910. } else if (is_ab8540(ab8500)) {
  2911. regulator_info = ab8540_regulator_info;
  2912. regulator_info_size = ARRAY_SIZE(ab8540_regulator_info);
  2913. reg_init = ab8540_reg_init;
  2914. reg_init_size = AB8540_NUM_REGULATOR_REGISTERS;
  2915. } else {
  2916. regulator_info = ab8500_regulator_info;
  2917. regulator_info_size = ARRAY_SIZE(ab8500_regulator_info);
  2918. reg_init = ab8500_reg_init;
  2919. reg_init_size = AB8500_NUM_REGULATOR_REGISTERS;
  2920. match = ab8500_regulator_match;
  2921. match_size = ARRAY_SIZE(ab8500_regulator_match)
  2922. }
  2923. if (np) {
  2924. err = of_regulator_match(&pdev->dev, np, match, match_size);
  2925. if (err < 0) {
  2926. dev_err(&pdev->dev,
  2927. "Error parsing regulator init data: %d\n", err);
  2928. return err;
  2929. }
  2930. err = ab8500_regulator_of_probe(pdev, regulator_info,
  2931. regulator_info_size, match, np);
  2932. return err;
  2933. }
  2934. if (!ab8500) {
  2935. dev_err(&pdev->dev, "null mfd parent\n");
  2936. return -EINVAL;
  2937. }
  2938. ppdata = dev_get_platdata(ab8500->dev);
  2939. if (!ppdata) {
  2940. dev_err(&pdev->dev, "null parent pdata\n");
  2941. return -EINVAL;
  2942. }
  2943. pdata = ppdata->regulator;
  2944. if (!pdata) {
  2945. dev_err(&pdev->dev, "null pdata\n");
  2946. return -EINVAL;
  2947. }
  2948. /* make sure the platform data has the correct size */
  2949. if (pdata->num_regulator != regulator_info_size) {
  2950. dev_err(&pdev->dev, "Configuration error: size mismatch.\n");
  2951. return -EINVAL;
  2952. }
  2953. /* initialize debug (initial state is recorded with this call) */
  2954. err = ab8500_regulator_debug_init(pdev);
  2955. if (err)
  2956. return err;
  2957. /* initialize registers */
  2958. for (i = 0; i < pdata->num_reg_init; i++) {
  2959. int id, mask, value;
  2960. id = pdata->reg_init[i].id;
  2961. mask = pdata->reg_init[i].mask;
  2962. value = pdata->reg_init[i].value;
  2963. /* check for configuration errors */
  2964. BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS);
  2965. err = ab8500_regulator_init_registers(pdev, reg_init, id, mask, value);
  2966. if (err < 0)
  2967. return err;
  2968. }
  2969. if (!is_ab8505(ab8500)) {
  2970. /* register external regulators (before Vaux1, 2 and 3) */
  2971. err = ab8500_ext_regulator_init(pdev);
  2972. if (err)
  2973. return err;
  2974. }
  2975. /* register all regulators */
  2976. for (i = 0; i < regulator_info_size; i++) {
  2977. err = ab8500_regulator_register(pdev, &pdata->regulator[i],
  2978. regulator_info, i, NULL);
  2979. if (err < 0)
  2980. return err;
  2981. }
  2982. return 0;
  2983. }
  2984. static int ab8500_regulator_remove(struct platform_device *pdev)
  2985. {
  2986. int i, err;
  2987. struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
  2988. struct ab8500_regulator_info *regulator_info;
  2989. int regulator_info_size;
  2990. if (is_ab9540(ab8500)) {
  2991. regulator_info = ab9540_regulator_info;
  2992. regulator_info_size = ARRAY_SIZE(ab9540_regulator_info);
  2993. } else if (is_ab8505(ab8500)) {
  2994. regulator_info = ab8505_regulator_info;
  2995. regulator_info_size = ARRAY_SIZE(ab8505_regulator_info);
  2996. } else if (is_ab8540(ab8500)) {
  2997. regulator_info = ab8540_regulator_info;
  2998. regulator_info_size = ARRAY_SIZE(ab8540_regulator_info);
  2999. } else {
  3000. regulator_info = ab8500_regulator_info;
  3001. regulator_info_size = ARRAY_SIZE(ab8500_regulator_info);
  3002. }
  3003. for (i = 0; i < regulator_info_size; i++) {
  3004. struct ab8500_regulator_info *info = NULL;
  3005. info = &regulator_info[i];
  3006. dev_vdbg(rdev_get_dev(info->regulator),
  3007. "%s-remove\n", info->desc.name);
  3008. regulator_unregister(info->regulator);
  3009. }
  3010. if (!is_ab8505(ab8500)) {
  3011. /* remove external regulators (after Vaux1, 2 and 3) */
  3012. err = ab8500_ext_regulator_exit(pdev);
  3013. if (err)
  3014. return err;
  3015. }
  3016. /* remove regulator debug */
  3017. err = ab8500_regulator_debug_exit(pdev);
  3018. if (err)
  3019. return err;
  3020. return 0;
  3021. }
  3022. static struct platform_driver ab8500_regulator_driver = {
  3023. .probe = ab8500_regulator_probe,
  3024. .remove = ab8500_regulator_remove,
  3025. .driver = {
  3026. .name = "ab8500-regulator",
  3027. .owner = THIS_MODULE,
  3028. },
  3029. };
  3030. static int __init ab8500_regulator_init(void)
  3031. {
  3032. int ret;
  3033. ret = platform_driver_register(&ab8500_regulator_driver);
  3034. if (ret != 0)
  3035. pr_err("Failed to register ab8500 regulator: %d\n", ret);
  3036. return ret;
  3037. }
  3038. subsys_initcall(ab8500_regulator_init);
  3039. static void __exit ab8500_regulator_exit(void)
  3040. {
  3041. platform_driver_unregister(&ab8500_regulator_driver);
  3042. }
  3043. module_exit(ab8500_regulator_exit);
  3044. MODULE_LICENSE("GPL v2");
  3045. MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
  3046. MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
  3047. MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
  3048. MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
  3049. MODULE_ALIAS("platform:ab8500-regulator");