pfuze100_pmic.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2014 Gateworks Corporation
  4. * Tim Harvey <tharvey@gateworks.com>
  5. */
  6. #ifndef __PFUZE100_PMIC_H_
  7. #define __PFUZE100_PMIC_H_
  8. /* Device ID */
  9. enum {PFUZE100 = 0x10, PFUZE200 = 0x11, PFUZE3000 = 0x30};
  10. #define PFUZE100_REGULATOR_DRIVER "pfuze100_regulator"
  11. /* PFUZE100 registers */
  12. enum {
  13. PFUZE100_DEVICEID = 0x00,
  14. PFUZE100_REVID = 0x03,
  15. PFUZE100_FABID = 0x04,
  16. PFUZE100_SW1ABVOL = 0x20,
  17. PFUZE100_SW1ABSTBY = 0x21,
  18. PFUZE100_SW1ABOFF = 0x22,
  19. PFUZE100_SW1ABMODE = 0x23,
  20. PFUZE100_SW1ABCONF = 0x24,
  21. PFUZE100_SW1CVOL = 0x2e,
  22. PFUZE100_SW1CSTBY = 0x2f,
  23. PFUZE100_SW1COFF = 0x30,
  24. PFUZE100_SW1CMODE = 0x31,
  25. PFUZE100_SW1CCONF = 0x32,
  26. PFUZE100_SW2VOL = 0x35,
  27. PFUZE100_SW2STBY = 0x36,
  28. PFUZE100_SW2OFF = 0x37,
  29. PFUZE100_SW2MODE = 0x38,
  30. PFUZE100_SW2CONF = 0x39,
  31. PFUZE100_SW3AVOL = 0x3c,
  32. PFUZE100_SW3ASTBY = 0x3D,
  33. PFUZE100_SW3AOFF = 0x3E,
  34. PFUZE100_SW3AMODE = 0x3F,
  35. PFUZE100_SW3ACONF = 0x40,
  36. PFUZE100_SW3BVOL = 0x43,
  37. PFUZE100_SW3BSTBY = 0x44,
  38. PFUZE100_SW3BOFF = 0x45,
  39. PFUZE100_SW3BMODE = 0x46,
  40. PFUZE100_SW3BCONF = 0x47,
  41. PFUZE100_SW4VOL = 0x4a,
  42. PFUZE100_SW4STBY = 0x4b,
  43. PFUZE100_SW4OFF = 0x4c,
  44. PFUZE100_SW4MODE = 0x4d,
  45. PFUZE100_SW4CONF = 0x4e,
  46. PFUZE100_SWBSTCON1 = 0x66,
  47. PFUZE100_VREFDDRCON = 0x6a,
  48. PFUZE100_VSNVSVOL = 0x6b,
  49. PFUZE100_VGEN1VOL = 0x6c,
  50. PFUZE100_VGEN2VOL = 0x6d,
  51. PFUZE100_VGEN3VOL = 0x6e,
  52. PFUZE100_VGEN4VOL = 0x6f,
  53. PFUZE100_VGEN5VOL = 0x70,
  54. PFUZE100_VGEN6VOL = 0x71,
  55. PFUZE100_NUM_OF_REGS = 0x7f,
  56. };
  57. /* Registor offset based on VOLT register */
  58. #define PFUZE100_VOL_OFFSET 0
  59. #define PFUZE100_STBY_OFFSET 1
  60. #define PFUZE100_OFF_OFFSET 2
  61. #define PFUZE100_MODE_OFFSET 3
  62. #define PFUZE100_CONF_OFFSET 4
  63. /*
  64. * Buck Regulators
  65. */
  66. #define PFUZE100_SW1ABC_SETP(x) ((x - 3000) / 250)
  67. /* SW1A/B/C Output Voltage Configuration */
  68. #define SW1x_0_300V 0
  69. #define SW1x_0_325V 1
  70. #define SW1x_0_350V 2
  71. #define SW1x_0_375V 3
  72. #define SW1x_0_400V 4
  73. #define SW1x_0_425V 5
  74. #define SW1x_0_450V 6
  75. #define SW1x_0_475V 7
  76. #define SW1x_0_500V 8
  77. #define SW1x_0_525V 9
  78. #define SW1x_0_550V 10
  79. #define SW1x_0_575V 11
  80. #define SW1x_0_600V 12
  81. #define SW1x_0_625V 13
  82. #define SW1x_0_650V 14
  83. #define SW1x_0_675V 15
  84. #define SW1x_0_700V 16
  85. #define SW1x_0_725V 17
  86. #define SW1x_0_750V 18
  87. #define SW1x_0_775V 19
  88. #define SW1x_0_800V 20
  89. #define SW1x_0_825V 21
  90. #define SW1x_0_850V 22
  91. #define SW1x_0_875V 23
  92. #define SW1x_0_900V 24
  93. #define SW1x_0_925V 25
  94. #define SW1x_0_950V 26
  95. #define SW1x_0_975V 27
  96. #define SW1x_1_000V 28
  97. #define SW1x_1_025V 29
  98. #define SW1x_1_050V 30
  99. #define SW1x_1_075V 31
  100. #define SW1x_1_100V 32
  101. #define SW1x_1_125V 33
  102. #define SW1x_1_150V 34
  103. #define SW1x_1_175V 35
  104. #define SW1x_1_200V 36
  105. #define SW1x_1_225V 37
  106. #define SW1x_1_250V 38
  107. #define SW1x_1_275V 39
  108. #define SW1x_1_300V 40
  109. #define SW1x_1_325V 41
  110. #define SW1x_1_350V 42
  111. #define SW1x_1_375V 43
  112. #define SW1x_1_400V 44
  113. #define SW1x_1_425V 45
  114. #define SW1x_1_450V 46
  115. #define SW1x_1_475V 47
  116. #define SW1x_1_500V 48
  117. #define SW1x_1_525V 49
  118. #define SW1x_1_550V 50
  119. #define SW1x_1_575V 51
  120. #define SW1x_1_600V 52
  121. #define SW1x_1_625V 53
  122. #define SW1x_1_650V 54
  123. #define SW1x_1_675V 55
  124. #define SW1x_1_700V 56
  125. #define SW1x_1_725V 57
  126. #define SW1x_1_750V 58
  127. #define SW1x_1_775V 59
  128. #define SW1x_1_800V 60
  129. #define SW1x_1_825V 61
  130. #define SW1x_1_850V 62
  131. #define SW1x_1_875V 63
  132. #define SW1x_NORMAL_MASK 0x3f
  133. #define SW1x_STBY_MASK 0x3f
  134. #define SW1x_OFF_MASK 0x3f
  135. #define SW_MODE_MASK 0xf
  136. #define SW_MODE_SHIFT 0
  137. #define SW1xCONF_DVSSPEED_MASK 0xc0
  138. #define SW1xCONF_DVSSPEED_2US 0x00
  139. #define SW1xCONF_DVSSPEED_4US 0x40
  140. #define SW1xCONF_DVSSPEED_8US 0x80
  141. #define SW1xCONF_DVSSPEED_16US 0xc0
  142. /*
  143. * LDO Configuration
  144. */
  145. /* VGEN1/2 Voltage Configuration */
  146. #define LDOA_0_80V 0
  147. #define LDOA_0_85V 1
  148. #define LDOA_0_90V 2
  149. #define LDOA_0_95V 3
  150. #define LDOA_1_00V 4
  151. #define LDOA_1_05V 5
  152. #define LDOA_1_10V 6
  153. #define LDOA_1_15V 7
  154. #define LDOA_1_20V 8
  155. #define LDOA_1_25V 9
  156. #define LDOA_1_30V 10
  157. #define LDOA_1_35V 11
  158. #define LDOA_1_40V 12
  159. #define LDOA_1_45V 13
  160. #define LDOA_1_50V 14
  161. #define LDOA_1_55V 15
  162. /* VGEN3/4/5/6 Voltage Configuration */
  163. #define LDOB_1_80V 0
  164. #define LDOB_1_90V 1
  165. #define LDOB_2_00V 2
  166. #define LDOB_2_10V 3
  167. #define LDOB_2_20V 4
  168. #define LDOB_2_30V 5
  169. #define LDOB_2_40V 6
  170. #define LDOB_2_50V 7
  171. #define LDOB_2_60V 8
  172. #define LDOB_2_70V 9
  173. #define LDOB_2_80V 10
  174. #define LDOB_2_90V 11
  175. #define LDOB_3_00V 12
  176. #define LDOB_3_10V 13
  177. #define LDOB_3_20V 14
  178. #define LDOB_3_30V 15
  179. #define LDO_VOL_MASK 0xf
  180. #define LDO_EN (1 << 4)
  181. #define LDO_MODE_SHIFT 4
  182. #define LDO_MODE_MASK (1 << 4)
  183. #define LDO_MODE_OFF 0
  184. #define LDO_MODE_ON 1
  185. #define VREFDDRCON_EN (1 << 4)
  186. /*
  187. * Boost Regulator
  188. */
  189. /* SWBST Output Voltage */
  190. #define SWBST_5_00V 0
  191. #define SWBST_5_05V 1
  192. #define SWBST_5_10V 2
  193. #define SWBST_5_15V 3
  194. #define SWBST_VOL_MASK 0x3
  195. #define SWBST_MODE_MASK 0xC
  196. #define SWBST_MODE_SHIFT 0x2
  197. #define SWBST_MODE_OFF 0
  198. #define SWBST_MODE_PFM 1
  199. #define SWBST_MODE_AUTO 2
  200. #define SWBST_MODE_APS 3
  201. /*
  202. * Regulator Mode Control
  203. *
  204. * OFF: The regulator is switched off and the output voltage is discharged.
  205. * PFM: In this mode, the regulator is always in PFM mode, which is useful
  206. * at light loads for optimized efficiency.
  207. * PWM: In this mode, the regulator is always in PWM mode operation
  208. * regardless of load conditions.
  209. * APS: In this mode, the regulator moves automatically between pulse
  210. * skipping mode and PWM mode depending on load conditions.
  211. *
  212. * SWxMODE[3:0]
  213. * Normal Mode | Standby Mode | value
  214. * OFF OFF 0x0
  215. * PWM OFF 0x1
  216. * PFM OFF 0x3
  217. * APS OFF 0x4
  218. * PWM PWM 0x5
  219. * PWM APS 0x6
  220. * APS APS 0x8
  221. * APS PFM 0xc
  222. * PWM PFM 0xd
  223. */
  224. #define OFF_OFF 0x0
  225. #define PWM_OFF 0x1
  226. #define PFM_OFF 0x3
  227. #define APS_OFF 0x4
  228. #define PWM_PWM 0x5
  229. #define PWM_APS 0x6
  230. #define APS_APS 0x8
  231. #define APS_PFM 0xc
  232. #define PWM_PFM 0xd
  233. #define SWITCH_SIZE 0x7
  234. int power_pfuze100_init(unsigned char bus);
  235. #endif