da9211-regulator.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * da9211-regulator.h - Regulator definitions for DA9211/DA9212
  4. * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
  5. * Copyright (C) 2015 Dialog Semiconductor Ltd.
  6. */
  7. #ifndef __DA9211_REGISTERS_H__
  8. #define __DA9211_REGISTERS_H__
  9. /* Page selection */
  10. #define DA9211_REG_PAGE_CON 0x00
  11. /* System Control and Event Registers */
  12. #define DA9211_REG_STATUS_A 0x50
  13. #define DA9211_REG_STATUS_B 0x51
  14. #define DA9211_REG_EVENT_A 0x52
  15. #define DA9211_REG_EVENT_B 0x53
  16. #define DA9211_REG_MASK_A 0x54
  17. #define DA9211_REG_MASK_B 0x55
  18. #define DA9211_REG_CONTROL_A 0x56
  19. /* GPIO Control Registers */
  20. #define DA9211_REG_GPIO_0_1 0x58
  21. #define DA9211_REG_GPIO_2_3 0x59
  22. #define DA9211_REG_GPIO_4 0x5A
  23. /* Regulator Registers */
  24. #define DA9211_REG_BUCKA_CONT 0x5D
  25. #define DA9211_REG_BUCKB_CONT 0x5E
  26. #define DA9211_REG_BUCK_ILIM 0xD0
  27. #define DA9211_REG_BUCKA_CONF 0xD1
  28. #define DA9211_REG_BUCKB_CONF 0xD2
  29. #define DA9211_REG_BUCK_CONF 0xD3
  30. #define DA9211_REG_VBACKA_MAX 0xD5
  31. #define DA9211_REG_VBACKB_MAX 0xD6
  32. #define DA9211_REG_VBUCKA_A 0xD7
  33. #define DA9211_REG_VBUCKA_B 0xD8
  34. #define DA9211_REG_VBUCKB_A 0xD9
  35. #define DA9211_REG_VBUCKB_B 0xDA
  36. /* I2C Interface Settings */
  37. #define DA9211_REG_INTERFACE 0x105
  38. /* BUCK Phase Selection*/
  39. #define DA9211_REG_CONFIG_E 0x147
  40. /* Device ID */
  41. #define DA9211_REG_DEVICE_ID 0x201
  42. /*
  43. * Registers bits
  44. */
  45. /* DA9211_REG_PAGE_CON (addr=0x00) */
  46. #define DA9211_REG_PAGE_SHIFT 1
  47. #define DA9211_REG_PAGE_MASK 0x06
  48. /* On I2C registers 0x00 - 0xFF */
  49. #define DA9211_REG_PAGE0 0
  50. /* On I2C registers 0x100 - 0x1FF */
  51. #define DA9211_REG_PAGE2 2
  52. #define DA9211_PAGE_WRITE_MODE 0x00
  53. #define DA9211_REPEAT_WRITE_MODE 0x40
  54. #define DA9211_PAGE_REVERT 0x80
  55. /* DA9211_REG_STATUS_A (addr=0x50) */
  56. #define DA9211_GPI0 0x01
  57. #define DA9211_GPI1 0x02
  58. #define DA9211_GPI2 0x04
  59. #define DA9211_GPI3 0x08
  60. #define DA9211_GPI4 0x10
  61. /* DA9211_REG_EVENT_A (addr=0x52) */
  62. #define DA9211_E_GPI0 0x01
  63. #define DA9211_E_GPI1 0x02
  64. #define DA9211_E_GPI2 0x04
  65. #define DA9211_E_GPI3 0x08
  66. #define DA9211_E_GPI4 0x10
  67. #define DA9211_E_UVLO_IO 0x40
  68. /* DA9211_REG_EVENT_B (addr=0x53) */
  69. #define DA9211_E_PWRGOOD_A 0x01
  70. #define DA9211_E_PWRGOOD_B 0x02
  71. #define DA9211_E_TEMP_WARN 0x04
  72. #define DA9211_E_TEMP_CRIT 0x08
  73. #define DA9211_E_OV_CURR_A 0x10
  74. #define DA9211_E_OV_CURR_B 0x20
  75. /* DA9211_REG_MASK_A (addr=0x54) */
  76. #define DA9211_M_GPI0 0x01
  77. #define DA9211_M_GPI1 0x02
  78. #define DA9211_M_GPI2 0x04
  79. #define DA9211_M_GPI3 0x08
  80. #define DA9211_M_GPI4 0x10
  81. #define DA9211_M_UVLO_IO 0x40
  82. /* DA9211_REG_MASK_B (addr=0x55) */
  83. #define DA9211_M_PWRGOOD_A 0x01
  84. #define DA9211_M_PWRGOOD_B 0x02
  85. #define DA9211_M_TEMP_WARN 0x04
  86. #define DA9211_M_TEMP_CRIT 0x08
  87. #define DA9211_M_OV_CURR_A 0x10
  88. #define DA9211_M_OV_CURR_B 0x20
  89. /* DA9211_REG_CONTROL_A (addr=0x56) */
  90. #define DA9211_DEBOUNCING_SHIFT 0
  91. #define DA9211_DEBOUNCING_MASK 0x07
  92. #define DA9211_SLEW_RATE_SHIFT 3
  93. #define DA9211_SLEW_RATE_A_MASK 0x18
  94. #define DA9211_SLEW_RATE_B_SHIFT 5
  95. #define DA9211_SLEW_RATE_B_MASK 0x60
  96. #define DA9211_V_LOCK 0x80
  97. /* DA9211_REG_GPIO_0_1 (addr=0x58) */
  98. #define DA9211_GPIO0_PIN_SHIFT 0
  99. #define DA9211_GPIO0_PIN_MASK 0x03
  100. #define DA9211_GPIO0_PIN_GPI 0x00
  101. #define DA9211_GPIO0_PIN_GPO_OD 0x02
  102. #define DA9211_GPIO0_PIN_GPO 0x03
  103. #define DA9211_GPIO0_TYPE 0x04
  104. #define DA9211_GPIO0_TYPE_GPI 0x00
  105. #define DA9211_GPIO0_TYPE_GPO 0x04
  106. #define DA9211_GPIO0_MODE 0x08
  107. #define DA9211_GPIO1_PIN_SHIFT 4
  108. #define DA9211_GPIO1_PIN_MASK 0x30
  109. #define DA9211_GPIO1_PIN_GPI 0x00
  110. #define DA9211_GPIO1_PIN_VERROR 0x10
  111. #define DA9211_GPIO1_PIN_GPO_OD 0x20
  112. #define DA9211_GPIO1_PIN_GPO 0x30
  113. #define DA9211_GPIO1_TYPE_SHIFT 0x40
  114. #define DA9211_GPIO1_TYPE_GPI 0x00
  115. #define DA9211_GPIO1_TYPE_GPO 0x40
  116. #define DA9211_GPIO1_MODE 0x80
  117. /* DA9211_REG_GPIO_2_3 (addr=0x59) */
  118. #define DA9211_GPIO2_PIN_SHIFT 0
  119. #define DA9211_GPIO2_PIN_MASK 0x03
  120. #define DA9211_GPIO2_PIN_GPI 0x00
  121. #define DA9211_GPIO5_PIN_BUCK_CLK 0x10
  122. #define DA9211_GPIO2_PIN_GPO_OD 0x02
  123. #define DA9211_GPIO2_PIN_GPO 0x03
  124. #define DA9211_GPIO2_TYPE 0x04
  125. #define DA9211_GPIO2_TYPE_GPI 0x00
  126. #define DA9211_GPIO2_TYPE_GPO 0x04
  127. #define DA9211_GPIO2_MODE 0x08
  128. #define DA9211_GPIO3_PIN_SHIFT 4
  129. #define DA9211_GPIO3_PIN_MASK 0x30
  130. #define DA9211_GPIO3_PIN_GPI 0x00
  131. #define DA9211_GPIO3_PIN_IERROR 0x10
  132. #define DA9211_GPIO3_PIN_GPO_OD 0x20
  133. #define DA9211_GPIO3_PIN_GPO 0x30
  134. #define DA9211_GPIO3_TYPE_SHIFT 0x40
  135. #define DA9211_GPIO3_TYPE_GPI 0x00
  136. #define DA9211_GPIO3_TYPE_GPO 0x40
  137. #define DA9211_GPIO3_MODE 0x80
  138. /* DA9211_REG_GPIO_4 (addr=0x5A) */
  139. #define DA9211_GPIO4_PIN_SHIFT 0
  140. #define DA9211_GPIO4_PIN_MASK 0x03
  141. #define DA9211_GPIO4_PIN_GPI 0x00
  142. #define DA9211_GPIO4_PIN_GPO_OD 0x02
  143. #define DA9211_GPIO4_PIN_GPO 0x03
  144. #define DA9211_GPIO4_TYPE 0x04
  145. #define DA9211_GPIO4_TYPE_GPI 0x00
  146. #define DA9211_GPIO4_TYPE_GPO 0x04
  147. #define DA9211_GPIO4_MODE 0x08
  148. /* DA9211_REG_BUCKA_CONT (addr=0x5D) */
  149. #define DA9211_BUCKA_EN 0x01
  150. #define DA9211_BUCKA_GPI_SHIFT 1
  151. #define DA9211_BUCKA_GPI_MASK 0x06
  152. #define DA9211_BUCKA_GPI_OFF 0x00
  153. #define DA9211_BUCKA_GPI_GPIO0 0x02
  154. #define DA9211_BUCKA_GPI_GPIO1 0x04
  155. #define DA9211_BUCKA_GPI_GPIO3 0x06
  156. #define DA9211_BUCKA_PD_DIS 0x08
  157. #define DA9211_VBUCKA_SEL 0x10
  158. #define DA9211_VBUCKA_SEL_A 0x00
  159. #define DA9211_VBUCKA_SEL_B 0x10
  160. #define DA9211_VBUCKA_GPI_SHIFT 5
  161. #define DA9211_VBUCKA_GPI_MASK 0x60
  162. #define DA9211_VBUCKA_GPI_OFF 0x00
  163. #define DA9211_VBUCKA_GPI_GPIO1 0x20
  164. #define DA9211_VBUCKA_GPI_GPIO2 0x40
  165. #define DA9211_VBUCKA_GPI_GPIO4 0x60
  166. /* DA9211_REG_BUCKB_CONT (addr=0x5E) */
  167. #define DA9211_BUCKB_EN 0x01
  168. #define DA9211_BUCKB_GPI_SHIFT 1
  169. #define DA9211_BUCKB_GPI_MASK 0x06
  170. #define DA9211_BUCKB_GPI_OFF 0x00
  171. #define DA9211_BUCKB_GPI_GPIO0 0x02
  172. #define DA9211_BUCKB_GPI_GPIO1 0x04
  173. #define DA9211_BUCKB_GPI_GPIO3 0x06
  174. #define DA9211_BUCKB_PD_DIS 0x08
  175. #define DA9211_VBUCKB_SEL 0x10
  176. #define DA9211_VBUCKB_SEL_A 0x00
  177. #define DA9211_VBUCKB_SEL_B 0x10
  178. #define DA9211_VBUCKB_GPI_SHIFT 5
  179. #define DA9211_VBUCKB_GPI_MASK 0x60
  180. #define DA9211_VBUCKB_GPI_OFF 0x00
  181. #define DA9211_VBUCKB_GPI_GPIO1 0x20
  182. #define DA9211_VBUCKB_GPI_GPIO2 0x40
  183. #define DA9211_VBUCKB_GPI_GPIO4 0x60
  184. /* DA9211_REG_BUCK_ILIM (addr=0xD0) */
  185. #define DA9211_BUCKA_ILIM_SHIFT 0
  186. #define DA9211_BUCKA_ILIM_MASK 0x0F
  187. #define DA9211_BUCKB_ILIM_SHIFT 4
  188. #define DA9211_BUCKB_ILIM_MASK 0xF0
  189. /* DA9211_REG_BUCKA_CONF (addr=0xD1) */
  190. #define DA9211_BUCKA_MODE_SHIFT 0
  191. #define DA9211_BUCKA_MODE_MASK 0x03
  192. #define DA9211_BUCKA_MODE_MANUAL 0x00
  193. #define DA9211_BUCKA_MODE_SLEEP 0x01
  194. #define DA9211_BUCKA_MODE_SYNC 0x02
  195. #define DA9211_BUCKA_MODE_AUTO 0x03
  196. #define DA9211_BUCKA_UP_CTRL_SHIFT 2
  197. #define DA9211_BUCKA_UP_CTRL_MASK 0x1C
  198. #define DA9211_BUCKA_DOWN_CTRL_SHIFT 5
  199. #define DA9211_BUCKA_DOWN_CTRL_MASK 0xE0
  200. /* DA9211_REG_BUCKB_CONF (addr=0xD2) */
  201. #define DA9211_BUCKB_MODE_SHIFT 0
  202. #define DA9211_BUCKB_MODE_MASK 0x03
  203. #define DA9211_BUCKB_MODE_MANUAL 0x00
  204. #define DA9211_BUCKB_MODE_SLEEP 0x01
  205. #define DA9211_BUCKB_MODE_SYNC 0x02
  206. #define DA9211_BUCKB_MODE_AUTO 0x03
  207. #define DA9211_BUCKB_UP_CTRL_SHIFT 2
  208. #define DA9211_BUCKB_UP_CTRL_MASK 0x1C
  209. #define DA9211_BUCKB_DOWN_CTRL_SHIFT 5
  210. #define DA9211_BUCKB_DOWN_CTRL_MASK 0xE0
  211. /* DA9211_REG_BUCK_CONF (addr=0xD3) */
  212. #define DA9211_PHASE_SEL_A_SHIFT 0
  213. #define DA9211_PHASE_SEL_A_MASK 0x03
  214. #define DA9211_PHASE_SEL_B_SHIFT 2
  215. #define DA9211_PHASE_SEL_B_MASK 0x04
  216. #define DA9211_PH_SH_EN_A_SHIFT 3
  217. #define DA9211_PH_SH_EN_A_MASK 0x08
  218. #define DA9211_PH_SH_EN_B_SHIFT 4
  219. #define DA9211_PH_SH_EN_B_MASK 0x10
  220. /* DA9211_REG_VBUCKA_MAX (addr=0xD5) */
  221. #define DA9211_VBUCKA_BASE_SHIFT 0
  222. #define DA9211_VBUCKA_BASE_MASK 0x7F
  223. /* DA9211_REG_VBUCKB_MAX (addr=0xD6) */
  224. #define DA9211_VBUCKB_BASE_SHIFT 0
  225. #define DA9211_VBUCKB_BASE_MASK 0x7F
  226. /* DA9211_REG_VBUCKA/B_A/B (addr=0xD7/0xD8/0xD9/0xDA) */
  227. #define DA9211_VBUCK_SHIFT 0
  228. #define DA9211_VBUCK_MASK 0x7F
  229. #define DA9211_VBUCK_BIAS 0
  230. #define DA9211_BUCK_SL 0x80
  231. /* DA9211_REG_INTERFACE (addr=0x105) */
  232. #define DA9211_IF_BASE_ADDR_SHIFT 4
  233. #define DA9211_IF_BASE_ADDR_MASK 0xF0
  234. /* DA9211_REG_CONFIG_E (addr=0x147) */
  235. #define DA9211_SLAVE_SEL 0x40
  236. #endif /* __DA9211_REGISTERS_H__ */