s2mpu02.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * s2mpu02.h
  3. *
  4. * Copyright (c) 2014 Samsung Electronics Co., Ltd
  5. * http://www.samsung.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef __LINUX_MFD_S2MPU02_H
  19. #define __LINUX_MFD_S2MPU02_H
  20. /* S2MPU02 registers */
  21. enum S2MPU02_reg {
  22. S2MPU02_REG_ID,
  23. S2MPU02_REG_INT1,
  24. S2MPU02_REG_INT2,
  25. S2MPU02_REG_INT3,
  26. S2MPU02_REG_INT1M,
  27. S2MPU02_REG_INT2M,
  28. S2MPU02_REG_INT3M,
  29. S2MPU02_REG_ST1,
  30. S2MPU02_REG_ST2,
  31. S2MPU02_REG_PWRONSRC,
  32. S2MPU02_REG_OFFSRC,
  33. S2MPU02_REG_BU_CHG,
  34. S2MPU02_REG_RTCCTRL,
  35. S2MPU02_REG_PMCTRL1,
  36. S2MPU02_REG_RSVD1,
  37. S2MPU02_REG_RSVD2,
  38. S2MPU02_REG_RSVD3,
  39. S2MPU02_REG_RSVD4,
  40. S2MPU02_REG_RSVD5,
  41. S2MPU02_REG_RSVD6,
  42. S2MPU02_REG_RSVD7,
  43. S2MPU02_REG_WRSTEN,
  44. S2MPU02_REG_RSVD8,
  45. S2MPU02_REG_RSVD9,
  46. S2MPU02_REG_RSVD10,
  47. S2MPU02_REG_B1CTRL1,
  48. S2MPU02_REG_B1CTRL2,
  49. S2MPU02_REG_B2CTRL1,
  50. S2MPU02_REG_B2CTRL2,
  51. S2MPU02_REG_B3CTRL1,
  52. S2MPU02_REG_B3CTRL2,
  53. S2MPU02_REG_B4CTRL1,
  54. S2MPU02_REG_B4CTRL2,
  55. S2MPU02_REG_B5CTRL1,
  56. S2MPU02_REG_B5CTRL2,
  57. S2MPU02_REG_B5CTRL3,
  58. S2MPU02_REG_B5CTRL4,
  59. S2MPU02_REG_B5CTRL5,
  60. S2MPU02_REG_B6CTRL1,
  61. S2MPU02_REG_B6CTRL2,
  62. S2MPU02_REG_B7CTRL1,
  63. S2MPU02_REG_B7CTRL2,
  64. S2MPU02_REG_RAMP1,
  65. S2MPU02_REG_RAMP2,
  66. S2MPU02_REG_L1CTRL,
  67. S2MPU02_REG_L2CTRL1,
  68. S2MPU02_REG_L2CTRL2,
  69. S2MPU02_REG_L2CTRL3,
  70. S2MPU02_REG_L2CTRL4,
  71. S2MPU02_REG_L3CTRL,
  72. S2MPU02_REG_L4CTRL,
  73. S2MPU02_REG_L5CTRL,
  74. S2MPU02_REG_L6CTRL,
  75. S2MPU02_REG_L7CTRL,
  76. S2MPU02_REG_L8CTRL,
  77. S2MPU02_REG_L9CTRL,
  78. S2MPU02_REG_L10CTRL,
  79. S2MPU02_REG_L11CTRL,
  80. S2MPU02_REG_L12CTRL,
  81. S2MPU02_REG_L13CTRL,
  82. S2MPU02_REG_L14CTRL,
  83. S2MPU02_REG_L15CTRL,
  84. S2MPU02_REG_L16CTRL,
  85. S2MPU02_REG_L17CTRL,
  86. S2MPU02_REG_L18CTRL,
  87. S2MPU02_REG_L19CTRL,
  88. S2MPU02_REG_L20CTRL,
  89. S2MPU02_REG_L21CTRL,
  90. S2MPU02_REG_L22CTRL,
  91. S2MPU02_REG_L23CTRL,
  92. S2MPU02_REG_L24CTRL,
  93. S2MPU02_REG_L25CTRL,
  94. S2MPU02_REG_L26CTRL,
  95. S2MPU02_REG_L27CTRL,
  96. S2MPU02_REG_L28CTRL,
  97. S2MPU02_REG_LDODSCH1,
  98. S2MPU02_REG_LDODSCH2,
  99. S2MPU02_REG_LDODSCH3,
  100. S2MPU02_REG_LDODSCH4,
  101. S2MPU02_REG_SELMIF,
  102. S2MPU02_REG_RSVD11,
  103. S2MPU02_REG_RSVD12,
  104. S2MPU02_REG_RSVD13,
  105. S2MPU02_REG_DVSSEL,
  106. S2MPU02_REG_DVSPTR,
  107. S2MPU02_REG_DVSDATA,
  108. };
  109. /* S2MPU02 regulator ids */
  110. enum S2MPU02_regulators {
  111. S2MPU02_LDO1,
  112. S2MPU02_LDO2,
  113. S2MPU02_LDO3,
  114. S2MPU02_LDO4,
  115. S2MPU02_LDO5,
  116. S2MPU02_LDO6,
  117. S2MPU02_LDO7,
  118. S2MPU02_LDO8,
  119. S2MPU02_LDO9,
  120. S2MPU02_LDO10,
  121. S2MPU02_LDO11,
  122. S2MPU02_LDO12,
  123. S2MPU02_LDO13,
  124. S2MPU02_LDO14,
  125. S2MPU02_LDO15,
  126. S2MPU02_LDO16,
  127. S2MPU02_LDO17,
  128. S2MPU02_LDO18,
  129. S2MPU02_LDO19,
  130. S2MPU02_LDO20,
  131. S2MPU02_LDO21,
  132. S2MPU02_LDO22,
  133. S2MPU02_LDO23,
  134. S2MPU02_LDO24,
  135. S2MPU02_LDO25,
  136. S2MPU02_LDO26,
  137. S2MPU02_LDO27,
  138. S2MPU02_LDO28,
  139. S2MPU02_BUCK1,
  140. S2MPU02_BUCK2,
  141. S2MPU02_BUCK3,
  142. S2MPU02_BUCK4,
  143. S2MPU02_BUCK5,
  144. S2MPU02_BUCK6,
  145. S2MPU02_BUCK7,
  146. S2MPU02_REGULATOR_MAX,
  147. };
  148. /* Regulator constraints for BUCKx */
  149. #define S2MPU02_BUCK1234_MIN_600MV 600000
  150. #define S2MPU02_BUCK5_MIN_1081_25MV 1081250
  151. #define S2MPU02_BUCK6_MIN_1700MV 1700000
  152. #define S2MPU02_BUCK7_MIN_900MV 900000
  153. #define S2MPU02_BUCK1234_STEP_6_25MV 6250
  154. #define S2MPU02_BUCK5_STEP_6_25MV 6250
  155. #define S2MPU02_BUCK6_STEP_2_50MV 2500
  156. #define S2MPU02_BUCK7_STEP_6_25MV 6250
  157. #define S2MPU02_BUCK1234_START_SEL 0x00
  158. #define S2MPU02_BUCK5_START_SEL 0x4D
  159. #define S2MPU02_BUCK6_START_SEL 0x28
  160. #define S2MPU02_BUCK7_START_SEL 0x30
  161. #define S2MPU02_BUCK_RAMP_DELAY 12500
  162. /* Regulator constraints for different types of LDOx */
  163. #define S2MPU02_LDO_MIN_900MV 900000
  164. #define S2MPU02_LDO_MIN_1050MV 1050000
  165. #define S2MPU02_LDO_MIN_1600MV 1600000
  166. #define S2MPU02_LDO_STEP_12_5MV 12500
  167. #define S2MPU02_LDO_STEP_25MV 25000
  168. #define S2MPU02_LDO_STEP_50MV 50000
  169. #define S2MPU02_LDO_GROUP1_START_SEL 0x8
  170. #define S2MPU02_LDO_GROUP2_START_SEL 0xA
  171. #define S2MPU02_LDO_GROUP3_START_SEL 0x10
  172. #define S2MPU02_LDO_VSEL_MASK 0x3F
  173. #define S2MPU02_BUCK_VSEL_MASK 0xFF
  174. #define S2MPU02_ENABLE_MASK (0x03 << S2MPU02_ENABLE_SHIFT)
  175. #define S2MPU02_ENABLE_SHIFT 6
  176. /* On/Off controlled by PWREN */
  177. #define S2MPU02_ENABLE_SUSPEND (0x01 << S2MPU02_ENABLE_SHIFT)
  178. #define S2MPU02_DISABLE_SUSPEND (0x11 << S2MPU02_ENABLE_SHIFT)
  179. #define S2MPU02_LDO_N_VOLTAGES (S2MPU02_LDO_VSEL_MASK + 1)
  180. #define S2MPU02_BUCK_N_VOLTAGES (S2MPU02_BUCK_VSEL_MASK + 1)
  181. /* RAMP delay for BUCK1234*/
  182. #define S2MPU02_BUCK1_RAMP_SHIFT 6
  183. #define S2MPU02_BUCK2_RAMP_SHIFT 4
  184. #define S2MPU02_BUCK3_RAMP_SHIFT 2
  185. #define S2MPU02_BUCK4_RAMP_SHIFT 0
  186. #define S2MPU02_BUCK1234_RAMP_MASK 0x3
  187. #endif /* __LINUX_MFD_S2MPU02_H */