da9210-regulator.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /*
  2. * da9210-regulator.h - Regulator definitions for DA9210
  3. * Copyright (C) 2013 Dialog Semiconductor Ltd.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef __DA9210_REGISTERS_H__
  21. #define __DA9210_REGISTERS_H__
  22. struct da9210_pdata {
  23. struct regulator_init_data da9210_constraints;
  24. };
  25. /* Page selection */
  26. #define DA9210_REG_PAGE_CON 0x00
  27. /* System Control and Event Registers */
  28. #define DA9210_REG_STATUS_A 0x50
  29. #define DA9210_REG_STATUS_B 0x51
  30. #define DA9210_REG_EVENT_A 0x52
  31. #define DA9210_REG_EVENT_B 0x53
  32. #define DA9210_REG_MASK_A 0x54
  33. #define DA9210_REG_MASK_B 0x55
  34. #define DA9210_REG_CONTROL_A 0x56
  35. /* GPIO Control Registers */
  36. #define DA9210_REG_GPIO_0_1 0x58
  37. #define DA9210_REG_GPIO_2_3 0x59
  38. #define DA9210_REG_GPIO_4_5 0x5A
  39. #define DA9210_REG_GPIO_6 0x5B
  40. /* Regulator Registers */
  41. #define DA9210_REG_BUCK_CONT 0x5D
  42. #define DA9210_REG_BUCK_ILIM 0xD0
  43. #define DA9210_REG_BUCK_CONF1 0xD1
  44. #define DA9210_REG_BUCK_CONF2 0xD2
  45. #define DA9210_REG_VBACK_AUTO 0xD4
  46. #define DA9210_REG_VBACK_BASE 0xD5
  47. #define DA9210_REG_VBACK_MAX_DVC_IF 0xD6
  48. #define DA9210_REG_VBACK_DVC 0xD7
  49. #define DA9210_REG_VBUCK_A 0xD8
  50. #define DA9210_REG_VBUCK_B 0xD9
  51. /* I2C Interface Settings */
  52. #define DA9210_REG_INTERFACE 0x105
  53. /* OTP */
  54. #define DA9210_REG_OPT_COUNT 0x140
  55. #define DA9210_REG_OPT_ADDR 0x141
  56. #define DA9210_REG_OPT_DATA 0x142
  57. /* Customer Trim and Configuration */
  58. #define DA9210_REG_CONFIG_A 0x143
  59. #define DA9210_REG_CONFIG_B 0x144
  60. #define DA9210_REG_CONFIG_C 0x145
  61. #define DA9210_REG_CONFIG_D 0x146
  62. #define DA9210_REG_CONFIG_E 0x147
  63. /*
  64. * Registers bits
  65. */
  66. /* DA9210_REG_PAGE_CON (addr=0x00) */
  67. #define DA9210_PEG_PAGE_SHIFT 0
  68. #define DA9210_REG_PAGE_MASK 0x0F
  69. /* On I2C registers 0x00 - 0xFF */
  70. #define DA9210_REG_PAGE0 0
  71. /* On I2C registers 0x100 - 0x1FF */
  72. #define DA9210_REG_PAGE2 2
  73. #define DA9210_PAGE_WRITE_MODE 0x00
  74. #define DA9210_REPEAT_WRITE_MODE 0x40
  75. #define DA9210_PAGE_REVERT 0x80
  76. /* DA9210_REG_STATUS_A (addr=0x50) */
  77. #define DA9210_GPI0 0x01
  78. #define DA9210_GPI1 0x02
  79. #define DA9210_GPI2 0x04
  80. #define DA9210_GPI3 0x08
  81. #define DA9210_GPI4 0x10
  82. #define DA9210_GPI5 0x20
  83. #define DA9210_GPI6 0x40
  84. /* DA9210_REG_EVENT_A (addr=0x52) */
  85. #define DA9210_E_GPI0 0x01
  86. #define DA9210_E_GPI1 0x02
  87. #define DA9210_E_GPI2 0x04
  88. #define DA9210_E_GPI3 0x08
  89. #define DA9210_E_GPI4 0x10
  90. #define DA9210_E_GPI5 0x20
  91. #define DA9210_E_GPI6 0x40
  92. /* DA9210_REG_EVENT_B (addr=0x53) */
  93. #define DA9210_E_OVCURR 0x01
  94. #define DA9210_E_NPWRGOOD 0x02
  95. #define DA9210_E_TEMP_WARN 0x04
  96. #define DA9210_E_TEMP_CRIT 0x08
  97. #define DA9210_E_VMAX 0x10
  98. /* DA9210_REG_MASK_A (addr=0x54) */
  99. #define DA9210_M_GPI0 0x01
  100. #define DA9210_M_GPI1 0x02
  101. #define DA9210_M_GPI2 0x04
  102. #define DA9210_M_GPI3 0x08
  103. #define DA9210_M_GPI4 0x10
  104. #define DA9210_M_GPI5 0x20
  105. #define DA9210_M_GPI6 0x40
  106. /* DA9210_REG_MASK_B (addr=0x55) */
  107. #define DA9210_M_OVCURR 0x01
  108. #define DA9210_M_NPWRGOOD 0x02
  109. #define DA9210_M_TEMP_WARN 0x04
  110. #define DA9210_M_TEMP_CRIT 0x08
  111. #define DA9210_M_VMAX 0x10
  112. /* DA9210_REG_CONTROL_A (addr=0x56) */
  113. #define DA9210_DEBOUNCING_SHIFT 0
  114. #define DA9210_DEBOUNCING_MASK 0x07
  115. #define DA9210_SLEW_RATE_SHIFT 3
  116. #define DA9210_SLEW_RATE_MASK 0x18
  117. #define DA9210_V_LOCK 0x20
  118. /* DA9210_REG_GPIO_0_1 (addr=0x58) */
  119. #define DA9210_GPIO0_PIN_SHIFT 0
  120. #define DA9210_GPIO0_PIN_MASK 0x03
  121. #define DA9210_GPIO0_PIN_GPI 0x00
  122. #define DA9210_GPIO0_PIN_GPO_OD 0x02
  123. #define DA9210_GPIO0_PIN_GPO 0x03
  124. #define DA9210_GPIO0_TYPE 0x04
  125. #define DA9210_GPIO0_TYPE_GPI 0x00
  126. #define DA9210_GPIO0_TYPE_GPO 0x04
  127. #define DA9210_GPIO0_MODE 0x08
  128. #define DA9210_GPIO1_PIN_SHIFT 4
  129. #define DA9210_GPIO1_PIN_MASK 0x30
  130. #define DA9210_GPIO1_PIN_GPI 0x00
  131. #define DA9210_GPIO1_PIN_VERROR 0x10
  132. #define DA9210_GPIO1_PIN_GPO_OD 0x20
  133. #define DA9210_GPIO1_PIN_GPO 0x30
  134. #define DA9210_GPIO1_TYPE_SHIFT 0x40
  135. #define DA9210_GPIO1_TYPE_GPI 0x00
  136. #define DA9210_GPIO1_TYPE_GPO 0x40
  137. #define DA9210_GPIO1_MODE 0x80
  138. /* DA9210_REG_GPIO_2_3 (addr=0x59) */
  139. #define DA9210_GPIO2_PIN_SHIFT 0
  140. #define DA9210_GPIO2_PIN_MASK 0x03
  141. #define DA9210_GPIO2_PIN_GPI 0x00
  142. #define DA9210_GPIO5_PIN_BUCK_CLK 0x10
  143. #define DA9210_GPIO2_PIN_GPO_OD 0x02
  144. #define DA9210_GPIO2_PIN_GPO 0x03
  145. #define DA9210_GPIO2_TYPE 0x04
  146. #define DA9210_GPIO2_TYPE_GPI 0x00
  147. #define DA9210_GPIO2_TYPE_GPO 0x04
  148. #define DA9210_GPIO2_MODE 0x08
  149. #define DA9210_GPIO3_PIN_SHIFT 4
  150. #define DA9210_GPIO3_PIN_MASK 0x30
  151. #define DA9210_GPIO3_PIN_GPI 0x00
  152. #define DA9210_GPIO3_PIN_IERROR 0x10
  153. #define DA9210_GPIO3_PIN_GPO_OD 0x20
  154. #define DA9210_GPIO3_PIN_GPO 0x30
  155. #define DA9210_GPIO3_TYPE_SHIFT 0x40
  156. #define DA9210_GPIO3_TYPE_GPI 0x00
  157. #define DA9210_GPIO3_TYPE_GPO 0x40
  158. #define DA9210_GPIO3_MODE 0x80
  159. /* DA9210_REG_GPIO_4_5 (addr=0x5A) */
  160. #define DA9210_GPIO4_PIN_SHIFT 0
  161. #define DA9210_GPIO4_PIN_MASK 0x03
  162. #define DA9210_GPIO4_PIN_GPI 0x00
  163. #define DA9210_GPIO4_PIN_GPO_OD 0x02
  164. #define DA9210_GPIO4_PIN_GPO 0x03
  165. #define DA9210_GPIO4_TYPE 0x04
  166. #define DA9210_GPIO4_TYPE_GPI 0x00
  167. #define DA9210_GPIO4_TYPE_GPO 0x04
  168. #define DA9210_GPIO4_MODE 0x08
  169. #define DA9210_GPIO5_PIN_SHIFT 4
  170. #define DA9210_GPIO5_PIN_MASK 0x30
  171. #define DA9210_GPIO5_PIN_GPI 0x00
  172. #define DA9210_GPIO5_PIN_INTERFACE 0x01
  173. #define DA9210_GPIO5_PIN_GPO_OD 0x20
  174. #define DA9210_GPIO5_PIN_GPO 0x30
  175. #define DA9210_GPIO5_TYPE_SHIFT 0x40
  176. #define DA9210_GPIO5_TYPE_GPI 0x00
  177. #define DA9210_GPIO5_TYPE_GPO 0x40
  178. #define DA9210_GPIO5_MODE 0x80
  179. /* DA9210_REG_GPIO_6 (addr=0x5B) */
  180. #define DA9210_GPIO6_PIN_SHIFT 0
  181. #define DA9210_GPIO6_PIN_MASK 0x03
  182. #define DA9210_GPIO6_PIN_GPI 0x00
  183. #define DA9210_GPIO6_PIN_INTERFACE 0x01
  184. #define DA9210_GPIO6_PIN_GPO_OD 0x02
  185. #define DA9210_GPIO6_PIN_GPO 0x03
  186. #define DA9210_GPIO6_TYPE 0x04
  187. #define DA9210_GPIO6_TYPE_GPI 0x00
  188. #define DA9210_GPIO6_TYPE_GPO 0x04
  189. #define DA9210_GPIO6_MODE 0x08
  190. /* DA9210_REG_BUCK_CONT (addr=0x5D) */
  191. #define DA9210_BUCK_EN 0x01
  192. #define DA9210_BUCK_GPI_SHIFT 1
  193. #define DA9210_BUCK_GPI_MASK 0x06
  194. #define DA9210_BUCK_GPI_OFF 0x00
  195. #define DA9210_BUCK_GPI_GPIO0 0x02
  196. #define DA9210_BUCK_GPI_GPIO3 0x04
  197. #define DA9210_BUCK_GPI_GPIO4 0x06
  198. #define DA9210_BUCK_PD_DIS 0x08
  199. #define DA9210_VBUCK_SEL 0x10
  200. #define DA9210_VBUCK_SEL_A 0x00
  201. #define DA9210_VBUCK_SEL_B 0x10
  202. #define DA9210_VBUCK_GPI_SHIFT 5
  203. #define DA9210_VBUCK_GPI_MASK 0x60
  204. #define DA9210_VBUCK_GPI_OFF 0x00
  205. #define DA9210_VBUCK_GPI_GPIO0 0x20
  206. #define DA9210_VBUCK_GPI_GPIO3 0x40
  207. #define DA9210_VBUCK_GPI_GPIO4 0x60
  208. #define DA9210_DVC_CTRL_EN 0x80
  209. /* DA9210_REG_BUCK_ILIM (addr=0xD0) */
  210. #define DA9210_BUCK_ILIM_SHIFT 0
  211. #define DA9210_BUCK_ILIM_MASK 0x0F
  212. #define DA9210_BUCK_IALARM 0x10
  213. /* DA9210_REG_BUCK_CONF1 (addr=0xD1) */
  214. #define DA9210_BUCK_MODE_SHIFT 0
  215. #define DA9210_BUCK_MODE_MASK 0x03
  216. #define DA9210_BUCK_MODE_MANUAL 0x00
  217. #define DA9210_BUCK_MODE_SLEEP 0x01
  218. #define DA9210_BUCK_MODE_SYNC 0x02
  219. #define DA9210_BUCK_MODE_AUTO 0x03
  220. #define DA9210_STARTUP_CTRL_SHIFT 2
  221. #define DA9210_STARTUP_CTRL_MASK 0x1C
  222. #define DA9210_PWR_DOWN_CTRL_SHIFT 5
  223. #define DA9210_PWR_DOWN_CTRL_MASK 0xE0
  224. /* DA9210_REG_BUCK_CONF2 (addr=0xD2) */
  225. #define DA9210_PHASE_SEL_SHIFT 0
  226. #define DA9210_PHASE_SEL_MASK 0x03
  227. #define DA9210_FREQ_SEL 0x40
  228. /* DA9210_REG_BUCK_AUTO (addr=0xD4) */
  229. #define DA9210_VBUCK_AUTO_SHIFT 0
  230. #define DA9210_VBUCK_AUTO_MASK 0x7F
  231. /* DA9210_REG_BUCK_BASE (addr=0xD5) */
  232. #define DA9210_VBUCK_BASE_SHIFT 0
  233. #define DA9210_VBUCK_BASE_MASK 0x7F
  234. /* DA9210_REG_VBUCK_MAX_DVC_IF (addr=0xD6) */
  235. #define DA9210_VBUCK_MAX_SHIFT 0
  236. #define DA9210_VBUCK_MAX_MASK 0x7F
  237. #define DA9210_DVC_STEP_SIZE 0x80
  238. #define DA9210_DVC_STEP_SIZE_10MV 0x00
  239. #define DA9210_DVC_STEP_SIZE_20MV 0x80
  240. /* DA9210_REG_VBUCK_DVC (addr=0xD7) */
  241. #define DA9210_VBUCK_DVC_SHIFT 0
  242. #define DA9210_VBUCK_DVC_MASK 0x7F
  243. /* DA9210_REG_VBUCK_A/B (addr=0xD8/0xD9) */
  244. #define DA9210_VBUCK_SHIFT 0
  245. #define DA9210_VBUCK_MASK 0x7F
  246. #define DA9210_VBUCK_BIAS 0
  247. #define DA9210_BUCK_SL 0x80
  248. /* DA9210_REG_INTERFACE (addr=0x105) */
  249. #define DA9210_IF_BASE_ADDR_SHIFT 4
  250. #define DA9210_IF_BASE_ADDR_MASK 0xF0
  251. /* DA9210_REG_CONFIG_E (addr=0x147) */
  252. #define DA9210_STAND_ALONE 0x01
  253. #endif /* __DA9210_REGISTERS_H__ */