smb5-reg.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __SMB5_CHARGER_REG_H
  7. #define __SMB5_CHARGER_REG_H
  8. #include <linux/bitops.h>
  9. #define CHGR_BASE 0x1000
  10. #define DCDC_BASE 0x1100
  11. #define BATIF_BASE 0x1200
  12. #define USBIN_BASE 0x1300
  13. #define DCIN_BASE 0x1400
  14. #define TYPEC_BASE 0X1500
  15. #define MISC_BASE 0x1600
  16. #define MISC_PBS_BASE 0x7500
  17. #define PERPH_TYPE_OFFSET 0x04
  18. #define TYPE_MASK GENMASK(7, 0)
  19. #define PERPH_SUBTYPE_OFFSET 0x05
  20. #define SUBTYPE_MASK GENMASK(7, 0)
  21. #define INT_RT_STS_OFFSET 0x10
  22. #define SDAM_TYPE 0x2E
  23. /********************************
  24. * CHGR Peripheral Registers *
  25. ********************************/
  26. #define BATTERY_CHARGER_STATUS_1_REG (CHGR_BASE + 0x06)
  27. #define BATTERY_CHARGER_STATUS_MASK GENMASK(2, 0)
  28. enum {
  29. INHIBIT_CHARGE = 0,
  30. TRICKLE_CHARGE,
  31. PRE_CHARGE,
  32. FULLON_CHARGE,
  33. TAPER_CHARGE,
  34. TERMINATE_CHARGE,
  35. PAUSE_CHARGE,
  36. DISABLE_CHARGE,
  37. };
  38. #define BATTERY_CHARGER_STATUS_2_REG (CHGR_BASE + 0x07)
  39. #define CHARGER_ERROR_STATUS_BAT_OV_BIT BIT(1)
  40. #define BATTERY_CHARGER_STATUS_5_REG (CHGR_BASE + 0x0B)
  41. #define ENABLE_TRICKLE_BIT BIT(2)
  42. #define ENABLE_PRE_CHARGING_BIT BIT(1)
  43. #define ENABLE_FULLON_MODE_BIT BIT(0)
  44. #define BATTERY_CHARGER_STATUS_7_REG (CHGR_BASE + 0x0D)
  45. #define BAT_TEMP_STATUS_SOFT_LIMIT_MASK GENMASK(5, 4)
  46. #define BAT_TEMP_STATUS_HOT_SOFT_BIT BIT(5)
  47. #define BAT_TEMP_STATUS_COLD_SOFT_BIT BIT(4)
  48. #define BAT_TEMP_STATUS_HARD_LIMIT_MASK GENMASK(3, 2)
  49. #define BAT_TEMP_STATUS_TOO_HOT_BIT BIT(3)
  50. #define BAT_TEMP_STATUS_TOO_COLD_BIT BIT(2)
  51. #define BAT_TEMP_STATUS_TOO_HOT_AFP_BIT BIT(1)
  52. #define BAT_TEMP_STATUS_TOO_COLD_AFP_BIT BIT(0)
  53. #define CHARGING_ENABLE_CMD_REG (CHGR_BASE + 0x42)
  54. #define CHARGING_ENABLE_CMD_BIT BIT(0)
  55. #define CHARGING_PAUSE_CMD_REG (CHGR_BASE + 0x43)
  56. #define CHARGING_PAUSE_CMD_BIT BIT(0)
  57. #define CHGR_CFG2_REG (CHGR_BASE + 0x51)
  58. #define RECHG_MASK GENMASK(2, 1)
  59. #define VBAT_BASED_RECHG_BIT BIT(2)
  60. #define SOC_BASED_RECHG_BIT GENMASK(2, 1)
  61. #define CHARGER_INHIBIT_BIT BIT(0)
  62. #define CHGR_FAST_CHARGE_CURRENT_CFG_REG (CHGR_BASE + 0x61)
  63. #define CHGR_ADC_ITERM_UP_THD_MSB_REG (CHGR_BASE + 0x67)
  64. #define CHGR_ADC_ITERM_UP_THD_LSB_REG (CHGR_BASE + 0x68)
  65. #define CHGR_ADC_ITERM_LO_THD_MSB_REG (CHGR_BASE + 0x69)
  66. #define CHGR_ADC_ITERM_LO_THD_LSB_REG (CHGR_BASE + 0x6A)
  67. #define CHGR_NO_SAMPLE_TERM_RCHG_CFG_REG (CHGR_BASE + 0x6B)
  68. #define NO_OF_SAMPLE_FOR_RCHG_SHIFT 2
  69. #define NO_OF_SAMPLE_FOR_RCHG GENMASK(3, 2)
  70. #define CHGR_ADC_TERM_CFG_REG (CHGR_BASE + 0x6C)
  71. #define TERM_BASED_ON_SYNC_CONV_OR_SAMPLE_CNT BIT(0)
  72. #define TERM_BASED_ON_SYNC_CONV 0
  73. #define TERM_BASED_ON_SAMPLE_CNT 1
  74. #define CHGR_FLOAT_VOLTAGE_CFG_REG (CHGR_BASE + 0x70)
  75. #define CHARGE_INHIBIT_THRESHOLD_CFG_REG (CHGR_BASE + 0x72)
  76. #define CHARGE_INHIBIT_THRESHOLD_MASK GENMASK(1, 0)
  77. #define INHIBIT_ANALOG_VFLT_MINUS_50MV 0
  78. #define INHIBIT_ANALOG_VFLT_MINUS_100MV 1
  79. #define INHIBIT_ANALOG_VFLT_MINUS_200MV 2
  80. #define INHIBIT_ANALOG_VFLT_MINUS_300MV 3
  81. #define CHARGE_RCHG_SOC_THRESHOLD_CFG_REG (CHGR_BASE + 0x7D)
  82. #define CHGR_ADC_RECHARGE_THRESHOLD_MSB_REG (CHGR_BASE + 0x7E)
  83. #define CHGR_ADC_RECHARGE_THRESHOLD_LSB_REG (CHGR_BASE + 0x7F)
  84. #define JEITA_EN_CFG_REG (CHGR_BASE + 0x90)
  85. #define JEITA_EN_HOT_SL_FCV_BIT BIT(3)
  86. #define JEITA_EN_COLD_SL_FCV_BIT BIT(2)
  87. #define JEITA_EN_HOT_SL_CCC_BIT BIT(1)
  88. #define JEITA_EN_COLD_SL_CCC_BIT BIT(0)
  89. #define JEITA_CCCOMP_CFG_HOT_REG (CHGR_BASE + 0x92)
  90. #define JEITA_CCCOMP_CFG_COLD_REG (CHGR_BASE + 0x93)
  91. #define CHGR_JEITA_THRESHOLD_BASE_REG(i) (CHGR_BASE + 0x94 + (i * 4))
  92. #define CHGR_JEITA_HOT_THRESHOLD_MSB_REG CHGR_JEITA_THRESHOLD_BASE_REG(0)
  93. #define CHGR_FAST_CHARGE_SAFETY_TIMER_CFG_REG (CHGR_BASE + 0xA2)
  94. #define FAST_CHARGE_SAFETY_TIMER_192_MIN 0x0
  95. #define FAST_CHARGE_SAFETY_TIMER_384_MIN 0x1
  96. #define FAST_CHARGE_SAFETY_TIMER_768_MIN 0x2
  97. #define FAST_CHARGE_SAFETY_TIMER_1536_MIN 0x3
  98. #define CHGR_ENG_CHARGING_CFG_REG (CHGR_BASE + 0xC0)
  99. #define CHGR_ITERM_USE_ANALOG_BIT BIT(3)
  100. /********************************
  101. * DCDC Peripheral Registers *
  102. ********************************/
  103. #define ICL_MAX_STATUS_REG (DCDC_BASE + 0x06)
  104. #define ICL_STATUS_REG (DCDC_BASE + 0x07)
  105. #define AICL_ICL_STATUS_REG (DCDC_BASE + 0x08)
  106. #define AICL_STATUS_REG (DCDC_BASE + 0x0A)
  107. #define SOFT_ILIMIT_BIT BIT(6)
  108. #define AICL_DONE_BIT BIT(0)
  109. #define POWER_PATH_STATUS_REG (DCDC_BASE + 0x0B)
  110. #define USBIN_SUSPEND_STS_BIT BIT(6)
  111. #define USE_USBIN_BIT BIT(4)
  112. #define USE_DCIN_BIT BIT(3)
  113. #define POWER_PATH_MASK GENMASK(2, 1)
  114. #define VALID_INPUT_POWER_SOURCE_STS_BIT BIT(0)
  115. #define DCDC_CMD_OTG_REG (DCDC_BASE + 0x40)
  116. #define OTG_EN_BIT BIT(0)
  117. #define DCDC_FSW_SEL_REG (DCDC_BASE + 0x50)
  118. #define DCDC_OTG_CURRENT_LIMIT_CFG_REG (DCDC_BASE + 0x52)
  119. #define DCDC_OTG_CFG_REG (DCDC_BASE + 0x53)
  120. #define OTG_EN_SRC_CFG_BIT BIT(1)
  121. #define OTG_FAULT_CONDITION_CFG_REG (DCDC_BASE + 0x56)
  122. #define USBIN_MID_COMP_FAULT_EN_BIT BIT(5)
  123. #define USBIN_COLLAPSE_FAULT_EN_BIT BIT(4)
  124. #define DCDC_CFG_REF_MAX_PSNS_REG (DCDC_BASE + 0x8C)
  125. #define DCDC_ENG_SDCDC_CFG5_REG (DCDC_BASE + 0xC4)
  126. #define ENG_SDCDC_BAT_HPWR_MASK GENMASK(7, 6)
  127. enum {
  128. BOOST_MODE_THRESH_3P3_V,
  129. BOOST_MODE_THRESH_3P4_V = 0x40,
  130. BOOST_MODE_THRESH_3P5_V = 0x80,
  131. BOOST_MODE_THRESH_3P6_V = 0xC0
  132. };
  133. /********************************
  134. * BATIF Peripheral Registers *
  135. ********************************/
  136. /* BATIF Interrupt Bits */
  137. #define VPH_OV_RT_STS_BIT BIT(7)
  138. #define BUCK_OC_RT_STS_BIT BIT(6)
  139. #define BAT_TERMINAL_MISSING_RT_STS_BIT BIT(5)
  140. #define BAT_THERM_OR_ID_MISSING_RT_STS_BIT BIT(4)
  141. #define BAT_LOW_RT_STS_BIT BIT(3)
  142. #define BAT_OV_RT_STS_BIT BIT(2)
  143. #define ALL_CHNL_CONV_DONE_RT_STS BIT(1)
  144. #define BAT_TEMP_RT_STS_BIT BIT(0)
  145. #define SHIP_MODE_REG (BATIF_BASE + 0x40)
  146. #define SHIP_MODE_EN_BIT BIT(0)
  147. #define BATIF_ADC_CHANNEL_EN_REG (BATIF_BASE + 0x82)
  148. #define IBATT_CHANNEL_EN_BIT BIT(6)
  149. #define CONN_THM_CHANNEL_EN_BIT BIT(4)
  150. #define DIE_TEMP_CHANNEL_EN_BIT BIT(2)
  151. #define MISC_THM_CHANNEL_EN_BIT BIT(1)
  152. #define BATIF_ADC_INTERNAL_PULL_UP_REG (BATIF_BASE + 0x86)
  153. #define INTERNAL_PULL_UP_CONN_THM_MASK GENMASK(5, 4)
  154. #define CONN_THM_SHIFT 4
  155. #define INTERNAL_PULL_NO_PULL 0x00
  156. #define INTERNAL_PULL_30K_PULL 0x01
  157. #define INTERNAL_PULL_100K_PULL 0x02
  158. #define INTERNAL_PULL_400K_PULL 0x03
  159. /********************************
  160. * USBIN Peripheral Registers *
  161. ********************************/
  162. #define APSD_STATUS_REG (USBIN_BASE + 0x07)
  163. #define APSD_STATUS_7_BIT BIT(7)
  164. #define HVDCP_CHECK_TIMEOUT_BIT BIT(6)
  165. #define SLOW_PLUGIN_TIMEOUT_BIT BIT(5)
  166. #define ENUMERATION_DONE_BIT BIT(4)
  167. #define VADP_CHANGE_DONE_AFTER_AUTH_BIT BIT(3)
  168. #define QC_AUTH_DONE_STATUS_BIT BIT(2)
  169. #define QC_CHARGER_BIT BIT(1)
  170. #define APSD_DTC_STATUS_DONE_BIT BIT(0)
  171. #define APSD_RESULT_STATUS_REG (USBIN_BASE + 0x08)
  172. #define APSD_RESULT_STATUS_7_BIT BIT(7)
  173. #define APSD_RESULT_STATUS_MASK GENMASK(6, 0)
  174. #define QC_3P0_BIT BIT(6)
  175. #define QC_2P0_BIT BIT(5)
  176. #define FLOAT_CHARGER_BIT BIT(4)
  177. #define DCP_CHARGER_BIT BIT(3)
  178. #define CDP_CHARGER_BIT BIT(2)
  179. #define OCP_CHARGER_BIT BIT(1)
  180. #define SDP_CHARGER_BIT BIT(0)
  181. #define QC_CHANGE_STATUS_REG (USBIN_BASE + 0x09)
  182. #define QC_12V_BIT BIT(2)
  183. #define QC_9V_BIT BIT(1)
  184. #define QC_5V_BIT BIT(0)
  185. #define QC_2P0_STATUS_MASK GENMASK(2, 0)
  186. /* USBIN Interrupt Bits */
  187. #define USBIN_ICL_CHANGE_RT_STS_BIT BIT(7)
  188. #define USBIN_SOURCE_CHANGE_RT_STS_BIT BIT(6)
  189. #define USBIN_REVI_RT_STS_BIT BIT(5)
  190. #define USBIN_PLUGIN_RT_STS_BIT BIT(4)
  191. #define USBIN_OV_RT_STS_BIT BIT(3)
  192. #define USBIN_UV_RT_STS_BIT BIT(2)
  193. #define USBIN_VASHDN_RT_STS_BIT BIT(1)
  194. #define USBIN_COLLAPSE_RT_STS_BIT BIT(0)
  195. #define USBIN_CMD_IL_REG (USBIN_BASE + 0x40)
  196. #define USBIN_SUSPEND_BIT BIT(0)
  197. #define CMD_APSD_REG (USBIN_BASE + 0x41)
  198. #define APSD_RERUN_BIT BIT(0)
  199. #define CMD_ICL_OVERRIDE_REG (USBIN_BASE + 0x42)
  200. #define ICL_OVERRIDE_BIT BIT(0)
  201. #define CMD_HVDCP_2_REG (USBIN_BASE + 0x43)
  202. #define FORCE_12V_BIT BIT(5)
  203. #define FORCE_9V_BIT BIT(4)
  204. #define FORCE_5V_BIT BIT(3)
  205. #define IDLE_BIT BIT(2)
  206. #define SINGLE_DECREMENT_BIT BIT(1)
  207. #define SINGLE_INCREMENT_BIT BIT(0)
  208. #define USBIN_ADAPTER_ALLOW_OVERRIDE_REG (USBIN_BASE + 0x44)
  209. #define CONTINUOUS BIT(3)
  210. #define FORCE_12V BIT(2)
  211. #define FORCE_9V BIT(1)
  212. #define FORCE_5V BIT(0)
  213. #define FORCE_NULL 0
  214. #define USB_CMD_PULLDOWN_REG (USBIN_BASE + 0x45)
  215. #define EN_PULLDOWN_USB_IN_BIT BIT(0)
  216. #define TYPE_C_CFG_REG (USBIN_BASE + 0x58)
  217. #define BC1P2_START_ON_CC_BIT BIT(7)
  218. #define HVDCP_PULSE_COUNT_MAX_REG (USBIN_BASE + 0x5B)
  219. #define HVDCP_PULSE_COUNT_MAX_QC2_MASK GENMASK(7, 6)
  220. enum {
  221. HVDCP_PULSE_COUNT_MAX_QC2_5V = 0,
  222. HVDCP_PULSE_COUNT_MAX_QC2_9V = 0x40,
  223. HVDCP_PULSE_COUNT_MAX_QC2_12V = 0x80,
  224. HVDCP_PULSE_COUNT_MAX_QC2_INVALID = 0xC0
  225. };
  226. #define USBIN_OPTIONS_1_CFG_REG (USBIN_BASE + 0x62)
  227. #define HVDCP_AUTH_ALG_EN_CFG_BIT BIT(6)
  228. #define HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT BIT(5)
  229. #define BC1P2_SRC_DETECT_BIT BIT(3)
  230. #define HVDCP_EN_BIT BIT(2)
  231. #define USBIN_OPTIONS_2_CFG_REG (USBIN_BASE + 0x63)
  232. #define DCD_TIMEOUT_SEL_BIT BIT(5)
  233. #define FLOAT_OPTIONS_MASK GENMASK(2, 0)
  234. #define FLOAT_DIS_CHGING_CFG_BIT BIT(2)
  235. #define SUSPEND_FLOAT_CFG_BIT BIT(1)
  236. #define FORCE_FLOAT_SDP_CFG_BIT BIT(0)
  237. #define USBIN_LOAD_CFG_REG (USBIN_BASE + 0x65)
  238. #define ICL_OVERRIDE_AFTER_APSD_BIT BIT(4)
  239. #define USBIN_AICL_STEP_TIMING_SEL_MASK GENMASK(3, 2)
  240. #define USBIN_IN_COLLAPSE_GF_SEL_MASK GENMASK(1, 0)
  241. #define USBIN_ICL_OPTIONS_REG (USBIN_BASE + 0x66)
  242. #define CFG_USB3P0_SEL_BIT BIT(2)
  243. #define USB51_MODE_BIT BIT(1)
  244. #define USBIN_MODE_CHG_BIT BIT(0)
  245. #define USBIN_CURRENT_LIMIT_CFG_REG (USBIN_BASE + 0x70)
  246. #define USBIN_AICL_OPTIONS_CFG_REG (USBIN_BASE + 0x80)
  247. #define SUSPEND_ON_COLLAPSE_USBIN_BIT BIT(7)
  248. #define USBIN_AICL_PERIODIC_RERUN_EN_BIT BIT(4)
  249. #define USBIN_AICL_ADC_EN_BIT BIT(3)
  250. #define USBIN_AICL_EN_BIT BIT(2)
  251. #define USB_ENG_SSUPPLY_USB2_REG (USBIN_BASE + 0xC0)
  252. #define ENG_SSUPPLY_12V_OV_OPT_BIT BIT(1)
  253. #define USBIN_5V_AICL_THRESHOLD_REG (USBIN_BASE + 0x81)
  254. #define USBIN_CONT_AICL_THRESHOLD_REG (USBIN_BASE + 0x84)
  255. /********************************
  256. * DCIN Peripheral Registers *
  257. ********************************/
  258. /* DCIN Interrupt Bits */
  259. #define DCIN_PLUGIN_RT_STS_BIT BIT(4)
  260. #define DCIN_CMD_IL_REG (DCIN_BASE + 0x40)
  261. #define DCIN_SUSPEND_BIT BIT(0)
  262. #define DCIN_EN_OVERRIDE_BIT BIT(1)
  263. #define DCIN_EN_MASK GENMASK(2, 1)
  264. #define DCIN_CMD_PON_REG (DCIN_BASE + 0x45)
  265. #define DCIN_PON_BIT BIT(0)
  266. #define MID_CHG_BIT BIT(1)
  267. #define DCIN_LOAD_CFG_REG (DCIN_BASE + 0x65)
  268. #define INPUT_MISS_POLL_EN_BIT BIT(5)
  269. /********************************
  270. * TYPEC Peripheral Registers *
  271. ********************************/
  272. #define TYPE_C_SNK_STATUS_REG (TYPEC_BASE + 0x06)
  273. #define DETECTED_SRC_TYPE_MASK GENMASK(6, 0)
  274. #define SNK_DAM_MASK GENMASK(6, 4)
  275. #define SNK_DAM_500MA_BIT BIT(6)
  276. #define SNK_DAM_1500MA_BIT BIT(5)
  277. #define SNK_DAM_3000MA_BIT BIT(4)
  278. #define SNK_RP_STD_BIT BIT(3)
  279. #define SNK_RP_1P5_BIT BIT(2)
  280. #define SNK_RP_3P0_BIT BIT(1)
  281. #define SNK_RP_SHORT_BIT BIT(0)
  282. #define TYPE_C_SRC_STATUS_REG (TYPEC_BASE + 0x08)
  283. #define DETECTED_SNK_TYPE_MASK GENMASK(4, 0)
  284. #define SRC_HIGH_BATT_BIT BIT(5)
  285. #define SRC_DEBUG_ACCESS_BIT BIT(4)
  286. #define SRC_RD_OPEN_BIT BIT(3)
  287. #define SRC_RD_RA_VCONN_BIT BIT(2)
  288. #define SRC_RA_OPEN_BIT BIT(1)
  289. #define AUDIO_ACCESS_RA_RA_BIT BIT(0)
  290. #define TYPE_C_STATE_MACHINE_STATUS_REG (TYPEC_BASE + 0x09)
  291. #define TYPEC_ATTACH_DETACH_STATE_BIT BIT(5)
  292. #define TYPE_C_MISC_STATUS_REG (TYPEC_BASE + 0x0B)
  293. #define TYPEC_WATER_DETECTION_STATUS_BIT BIT(7)
  294. #define SNK_SRC_MODE_BIT BIT(6)
  295. #define TYPEC_VBUS_ERROR_STATUS_BIT BIT(4)
  296. #define TYPEC_TCCDEBOUNCE_DONE_STATUS_BIT BIT(3)
  297. #define CC_ORIENTATION_BIT BIT(1)
  298. #define CC_ATTACHED_BIT BIT(0)
  299. #define LEGACY_CABLE_STATUS_REG (TYPEC_BASE + 0x0D)
  300. #define TYPEC_LEGACY_CABLE_STATUS_BIT BIT(1)
  301. #define TYPEC_NONCOMP_LEGACY_CABLE_STATUS_BIT BIT(0)
  302. #define TYPEC_U_USB_STATUS_REG (TYPEC_BASE + 0x0F)
  303. #define U_USB_GROUND_NOVBUS_BIT BIT(6)
  304. #define U_USB_GROUND_BIT BIT(4)
  305. #define U_USB_FMB1_BIT BIT(3)
  306. #define U_USB_FLOAT1_BIT BIT(2)
  307. #define U_USB_FMB2_BIT BIT(1)
  308. #define U_USB_FLOAT2_BIT BIT(0)
  309. #define TYPE_C_MODE_CFG_REG (TYPEC_BASE + 0x44)
  310. #define TYPEC_TRY_MODE_MASK GENMASK(4, 3)
  311. #define EN_TRY_SNK_BIT BIT(4)
  312. #define EN_TRY_SRC_BIT BIT(3)
  313. #define TYPEC_POWER_ROLE_CMD_MASK GENMASK(2, 0)
  314. #define EN_SRC_ONLY_BIT BIT(2)
  315. #define EN_SNK_ONLY_BIT BIT(1)
  316. #define TYPEC_DISABLE_CMD_BIT BIT(0)
  317. #define TYPE_C_VCONN_CONTROL_REG (TYPEC_BASE + 0x46)
  318. #define VCONN_EN_ORIENTATION_BIT BIT(2)
  319. #define VCONN_EN_VALUE_BIT BIT(1)
  320. #define VCONN_EN_SRC_BIT BIT(0)
  321. #define TYPE_C_CCOUT_CONTROL_REG (TYPEC_BASE + 0x48)
  322. #define TYPEC_CCOUT_BUFFER_EN_BIT BIT(2)
  323. #define TYPEC_CCOUT_VALUE_BIT BIT(1)
  324. #define TYPEC_CCOUT_SRC_BIT BIT(0)
  325. #define DEBUG_ACCESS_SRC_CFG_REG (TYPEC_BASE + 0x4C)
  326. #define EN_UNORIENTED_DEBUG_ACCESS_SRC_BIT BIT(0)
  327. #define TYPE_C_CRUDE_SENSOR_CFG_REG (TYPEC_BASE + 0x4e)
  328. #define EN_SRC_CRUDE_SENSOR_BIT BIT(1)
  329. #define EN_SNK_CRUDE_SENSOR_BIT BIT(0)
  330. #define TYPE_C_EXIT_STATE_CFG_REG (TYPEC_BASE + 0x50)
  331. #define BYPASS_VSAFE0V_DURING_ROLE_SWAP_BIT BIT(3)
  332. #define SEL_SRC_UPPER_REF_BIT BIT(2)
  333. #define EXIT_SNK_BASED_ON_CC_BIT BIT(0)
  334. #define TYPE_C_CURRSRC_CFG_REG (TYPEC_BASE + 0x52)
  335. #define TYPEC_SRC_RP_SEL_MASK GENMASK(1, 0)
  336. enum {
  337. TYPEC_SRC_RP_STD,
  338. TYPEC_SRC_RP_1P5A,
  339. TYPEC_SRC_RP_3A,
  340. TYPEC_SRC_RP_3A_DUPLICATE,
  341. TYPEC_SRC_RP_MAX_ELEMENTS
  342. };
  343. #define TYPE_C_INTERRUPT_EN_CFG_1_REG (TYPEC_BASE + 0x5E)
  344. #define TYPEC_LEGACY_CABLE_INT_EN_BIT BIT(7)
  345. #define TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN_BIT BIT(6)
  346. #define TYPEC_TRYSOURCE_DETECT_INT_EN_BIT BIT(5)
  347. #define TYPEC_TRYSINK_DETECT_INT_EN_BIT BIT(4)
  348. #define TYPEC_CCOUT_DETACH_INT_EN_BIT BIT(3)
  349. #define TYPEC_CCOUT_ATTACH_INT_EN_BIT BIT(2)
  350. #define TYPEC_VBUS_DEASSERT_INT_EN_BIT BIT(1)
  351. #define TYPEC_VBUS_ASSERT_INT_EN_BIT BIT(0)
  352. #define TYPE_C_INTERRUPT_EN_CFG_2_REG (TYPEC_BASE + 0x60)
  353. #define TYPEC_SRC_BATT_HPWR_INT_EN_BIT BIT(6)
  354. #define MICRO_USB_STATE_CHANGE_INT_EN_BIT BIT(5)
  355. #define TYPEC_STATE_MACHINE_CHANGE_INT_EN_BIT BIT(4)
  356. #define TYPEC_DEBUG_ACCESS_DETECT_INT_EN_BIT BIT(3)
  357. #define TYPEC_WATER_DETECTION_INT_EN_BIT BIT(2)
  358. #define TYPEC_VBUS_ERROR_INT_EN_BIT BIT(1)
  359. #define TYPEC_DEBOUNCE_DONE_INT_EN_BIT BIT(0)
  360. #define TYPE_C_DEBOUNCE_OPTION_REG (TYPEC_BASE + 0x62)
  361. #define REDUCE_TCCDEBOUNCE_TO_2MS_BIT BIT(2)
  362. #define TYPE_C_SBU_CFG_REG (TYPEC_BASE + 0x6A)
  363. #define SEL_SBU1_ISRC_VAL 0x04
  364. #define SEL_SBU2_ISRC_VAL 0x01
  365. #define TYPEC_U_USB_CFG_REG (TYPEC_BASE + 0x70)
  366. #define EN_MICRO_USB_FACTORY_MODE_BIT BIT(1)
  367. #define EN_MICRO_USB_MODE_BIT BIT(0)
  368. #define PMI632_TYPEC_U_USB_WATER_PROTECTION_CFG_REG (TYPEC_BASE + 0x72)
  369. #define TYPEC_U_USB_WATER_PROTECTION_CFG_REG (TYPEC_BASE + 0x73)
  370. #define EN_MICRO_USB_WATER_PROTECTION_BIT BIT(4)
  371. #define MICRO_USB_DETECTION_ON_TIME_CFG_MASK GENMASK(3, 2)
  372. #define MICRO_USB_DETECTION_PERIOD_CFG_MASK GENMASK(1, 0)
  373. #define PMI632_TYPEC_MICRO_USB_MODE_REG (TYPEC_BASE + 0x73)
  374. #define MICRO_USB_MODE_ONLY_BIT BIT(0)
  375. /********************************
  376. * MISC Peripheral Registers *
  377. ********************************/
  378. #define TEMP_RANGE_STATUS_REG (MISC_BASE + 0x06)
  379. #define THERM_REG_ACTIVE_BIT BIT(6)
  380. #define TLIM_BIT BIT(5)
  381. #define TEMP_RANGE_MASK GENMASK(4, 1)
  382. #define ALERT_LEVEL_BIT BIT(4)
  383. #define TEMP_ABOVE_RANGE_BIT BIT(3)
  384. #define TEMP_WITHIN_RANGE_BIT BIT(2)
  385. #define TEMP_BELOW_RANGE_BIT BIT(1)
  386. #define THERMREG_DISABLED_BIT BIT(0)
  387. #define DIE_TEMP_STATUS_REG (MISC_BASE + 0x07)
  388. #define DIE_TEMP_SHDN_BIT BIT(3)
  389. #define DIE_TEMP_RST_BIT BIT(2)
  390. #define DIE_TEMP_UB_BIT BIT(1)
  391. #define DIE_TEMP_LB_BIT BIT(0)
  392. #define SKIN_TEMP_STATUS_REG (MISC_BASE + 0x08)
  393. #define SKIN_TEMP_SHDN_BIT BIT(3)
  394. #define SKIN_TEMP_RST_BIT BIT(2)
  395. #define SKIN_TEMP_UB_BIT BIT(1)
  396. #define SKIN_TEMP_LB_BIT BIT(0)
  397. #define CONNECTOR_TEMP_STATUS_REG (MISC_BASE + 0x09)
  398. #define CONNECTOR_TEMP_SHDN_BIT BIT(3)
  399. #define CONNECTOR_TEMP_RST_BIT BIT(2)
  400. #define CONNECTOR_TEMP_UB_BIT BIT(1)
  401. #define CONNECTOR_TEMP_LB_BIT BIT(0)
  402. #define SMB_TEMP_STATUS_REG (MISC_BASE + 0x0A)
  403. #define SMB_TEMP_SHDN_BIT BIT(3)
  404. #define SMB_TEMP_RST_BIT BIT(2)
  405. #define SMB_TEMP_UB_BIT BIT(1)
  406. #define SMB_TEMP_LB_BIT BIT(0)
  407. #define BARK_BITE_WDOG_PET_REG (MISC_BASE + 0x43)
  408. #define BARK_BITE_WDOG_PET_BIT BIT(0)
  409. #define AICL_CMD_REG (MISC_BASE + 0x44)
  410. #define RESTART_AICL_BIT BIT(1)
  411. #define RERUN_AICL_BIT BIT(0)
  412. #define MISC_SMB_EN_CMD_REG (MISC_BASE + 0x48)
  413. #define SMB_EN_OVERRIDE_VALUE_BIT BIT(4)
  414. #define SMB_EN_OVERRIDE_BIT BIT(3)
  415. #define EN_STAT_CMD_BIT BIT(2)
  416. #define EN_CP_FPF_CMD_BIT BIT(1)
  417. #define EN_CP_CMD_BIT BIT(0)
  418. #define WD_CFG_REG (MISC_BASE + 0x51)
  419. #define WATCHDOG_TRIGGER_AFP_EN_BIT BIT(7)
  420. #define BARK_WDOG_INT_EN_BIT BIT(6)
  421. #define WDOG_TIMER_EN_ON_PLUGIN_BIT BIT(1)
  422. #define SNARL_BARK_BITE_WD_CFG_REG (MISC_BASE + 0x53)
  423. #define BITE_WDOG_DISABLE_CHARGING_CFG_BIT BIT(7)
  424. #define SNARL_WDOG_TIMEOUT_MASK GENMASK(6, 4)
  425. #define SNARL_WDOG_TIMEOUT_SHIFT 4
  426. #define SNARL_WDOG_TMOUT_62P5MS 0x00
  427. #define SNARL_WDOG_TMOUT_1S 0x40
  428. #define SNARL_WDOG_TMOUT_8S 0x70
  429. #define BARK_WDOG_TIMEOUT_MASK GENMASK(3, 2)
  430. #define BARK_WDOG_TIMEOUT_SHIFT 2
  431. #define BITE_WDOG_TIMEOUT_MASK GENMASK(1, 0)
  432. #define BITE_WDOG_TIMEOUT_8S 0x3
  433. #define MIN_WD_BARK_TIME 16
  434. #define AICL_RERUN_TIME_CFG_REG (MISC_BASE + 0x61)
  435. #define AICL_RERUN_TIME_12S_VAL 0x01
  436. #define MISC_THERMREG_SRC_CFG_REG (MISC_BASE + 0x70)
  437. #define THERMREG_SW_ICL_ADJUST_BIT BIT(7)
  438. #define DIE_ADC_SEL_BIT BIT(6)
  439. #define THERMREG_SMB_ADC_SRC_EN_BIT BIT(5)
  440. #define THERMREG_CONNECTOR_ADC_SRC_EN_BIT BIT(4)
  441. #define SKIN_ADC_CFG_BIT BIT(3)
  442. #define THERMREG_SKIN_ADC_SRC_EN_BIT BIT(2)
  443. #define THERMREG_DIE_ADC_SRC_EN_BIT BIT(1)
  444. #define THERMREG_DIE_CMP_SRC_EN_BIT BIT(0)
  445. #define MISC_SMB_CFG_REG (MISC_BASE + 0x90)
  446. #define SMB_EN_SEL_BIT BIT(4)
  447. #define CP_EN_POLARITY_CFG_BIT BIT(3)
  448. #define STAT_POLARITY_CFG_BIT BIT(2)
  449. #define STAT_FUNCTION_CFG_BIT BIT(1)
  450. #define STAT_IRQ_PULSING_EN_BIT BIT(0)
  451. #define DIE_REG_H_THRESHOLD_MSB_REG (MISC_BASE + 0xA0)
  452. #define SMB_REG_H_THRESHOLD_MSB_REG (MISC_BASE + 0XBC)
  453. /* SDAM regs */
  454. #define MISC_PBS_RT_STS_REG (MISC_PBS_BASE + 0x10)
  455. #define PULSE_SKIP_IRQ_BIT BIT(4)
  456. #define SDAM_QC_DET_STATUS_REG 0x58
  457. #define SDAM_QC_ADC_LSB_REG 0x54
  458. #endif /* __SMB5_CHARGER_REG_H */