wsa884x-reg-masks.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef WSA884X_REG_MASKS_H
  6. #define WSA884X_REG_MASKS_H
  7. #include <linux/regmap.h>
  8. #include <linux/device.h>
  9. #include "wsa884x-registers.h"
  10. /*
  11. * Use in conjunction with wsa884x-reg-shifts.c for field values.
  12. * field_value = (register_value & field_mask) >> field_shift
  13. */
  14. #define FIELD_MASK(register_name, field_name) \
  15. WSA884X_##register_name##_##field_name##_MASK
  16. /* WSA884X_VSENSE1 Fields: */
  17. #define WSA884X_VSENSE1_GAIN_VSENSE_FE_MASK 0xe0
  18. #define WSA884X_VSENSE1_VSENSE_AMP_IQ_CTL_1_MASK 0x10
  19. #define WSA884X_VSENSE1_IDLE_MODE_CTL_MASK 0x0c
  20. #define WSA884X_VSENSE1_VOCM_AMP_CTL_MASK 0x03
  21. /* WSA884X_ISENSE2 Fields: */
  22. #define WSA884X_ISENSE2_ISENSE_GAIN_CTL_MASK 0xe0
  23. #define WSA884X_ISENSE2_SUMAMP_IQ_CTL_MASK 0x10
  24. #define WSA884X_ISENSE2_SPARE_BITS_3_0_MASK 0x0f
  25. /* WSA884X_ADC_2 Fields: */
  26. #define WSA884X_ADC_2_ATEST_SEL_CAL_REF_MASK 0x80
  27. #define WSA884X_ADC_2_ISNS_LOAD_STORED_MASK 0x40
  28. #define WSA884X_ADC_2_EN_DET_MASK 0x20
  29. #define WSA884X_ADC_2_EN_ATEST_REF_MASK 0x10
  30. #define WSA884X_ADC_2_EN_ATEST_INT_MASK 0x0e
  31. #define WSA884X_ADC_2_D_ADC_REG_EN_MASK 0x01
  32. /* WSA884X_ADC_7 Fields: */
  33. #define WSA884X_ADC_7_CLAMPON_MASK 0x80
  34. #define WSA884X_ADC_7_CAL_LOOP_TRIM_MASK 0x70
  35. #define WSA884X_ADC_7_REG_TRIM_EN_MASK 0x08
  36. #define WSA884X_ADC_7_EN_AZ_REG_MASK 0x04
  37. #define WSA884X_ADC_7_EN_SAR_REG_MASK 0x02
  38. #define WSA884X_ADC_7_EN_SW_CURRENT_REG_MASK 0x01
  39. /* WSA884X_BOP_DEGLITCH_CTL Fields: */
  40. #define WSA884X_BOP_DEGLITCH_CTL_BOP_DEGLITCH_SETTING_MASK 0x1e
  41. #define WSA884X_BOP_DEGLITCH_CTL_BOP_DEGLITCH_EN_MASK 0x01
  42. /* WSA884X_CDC_SPK_DSM_A2_0 Fields: */
  43. #define WSA884X_CDC_SPK_DSM_A2_0_COEF_A2_MASK 0xff
  44. /* WSA884X_CDC_SPK_DSM_A2_1 Fields: */
  45. #define WSA884X_CDC_SPK_DSM_A2_1_COEF_A2_MASK 0x0f
  46. /* WSA884X_CDC_SPK_DSM_A3_0 Fields: */
  47. #define WSA884X_CDC_SPK_DSM_A3_0_COEF_A3_MASK 0xff
  48. /* WSA884X_CDC_SPK_DSM_A3_1 Fields: */
  49. #define WSA884X_CDC_SPK_DSM_A3_1_COEF_A3_MASK 0x07
  50. /* WSA884X_CDC_SPK_DSM_A4_0 Fields: */
  51. #define WSA884X_CDC_SPK_DSM_A4_0_COEF_A4_MASK 0xff
  52. /* WSA884X_CDC_SPK_DSM_A5_0 Fields: */
  53. #define WSA884X_CDC_SPK_DSM_A5_0_COEF_A5_MASK 0xff
  54. /* WSA884X_CDC_SPK_DSM_A6_0 Fields: */
  55. #define WSA884X_CDC_SPK_DSM_A6_0_COEF_A6_MASK 0xff
  56. /* WSA884X_CDC_SPK_DSM_A7_0 Fields: */
  57. #define WSA884X_CDC_SPK_DSM_A7_0_COEF_A7_MASK 0xff
  58. /* WSA884X_CDC_SPK_DSM_C_0 Fields: */
  59. #define WSA884X_CDC_SPK_DSM_C_0_COEF_C3_MASK 0xf0
  60. #define WSA884X_CDC_SPK_DSM_C_0_COEF_C2_MASK 0x0f
  61. /* WSA884X_CDC_SPK_DSM_C_2 Fields: */
  62. #define WSA884X_CDC_SPK_DSM_C_2_COEF_C7_MASK 0xf0
  63. #define WSA884X_CDC_SPK_DSM_C_2_COEF_C6_MASK 0x0f
  64. /* WSA884X_CDC_SPK_DSM_C_3 Fields: */
  65. #define WSA884X_CDC_SPK_DSM_C_3_COEF_C7_MASK 0x3f
  66. /* WSA884X_CDC_SPK_DSM_R1 Fields: */
  67. #define WSA884X_CDC_SPK_DSM_R1_SAT_LIMIT_R1_MASK 0xff
  68. /* WSA884X_CDC_SPK_DSM_R2 Fields: */
  69. #define WSA884X_CDC_SPK_DSM_R2_SAT_LIMIT_R2_MASK 0xff
  70. /* WSA884X_CDC_SPK_DSM_R3 Fields: */
  71. #define WSA884X_CDC_SPK_DSM_R3_SAT_LIMIT_R3_MASK 0xff
  72. /* WSA884X_CDC_SPK_DSM_R4 Fields: */
  73. #define WSA884X_CDC_SPK_DSM_R4_SAT_LIMIT_R4_MASK 0xff
  74. /* WSA884X_CDC_SPK_DSM_R5 Fields: */
  75. #define WSA884X_CDC_SPK_DSM_R5_SAT_LIMIT_R5_MASK 0xff
  76. /* WSA884X_CDC_SPK_DSM_R6 Fields: */
  77. #define WSA884X_CDC_SPK_DSM_R6_SAT_LIMIT_R6_MASK 0xff
  78. /* WSA884X_CDC_SPK_DSM_R7 Fields: */
  79. #define WSA884X_CDC_SPK_DSM_R7_SAT_LIMIT_R7_MASK 0xff
  80. /* WSA884X_DRE_CTL_0 Fields: */
  81. #define WSA884X_DRE_CTL_0_PROG_DELAY_MASK 0xf0
  82. #define WSA884X_DRE_CTL_0_OFFSET_MASK 0x07
  83. /* WSA884X_GAIN_RAMPING_MIN Fields: */
  84. #define WSA884X_GAIN_RAMPING_MIN_MIN_GAIN_MASK 0x1f
  85. /* WSA884X_CLSH_SOFT_MAX Fields: */
  86. #define WSA884X_CLSH_SOFT_MAX_SOFT_MAX_MASK 0xff
  87. /* WSA884X_CLSH_VTH1 Fields: */
  88. #define WSA884X_CLSH_VTH1_CLSH_VTH1_MASK 0xff
  89. /* WSA884X_CLSH_VTH10 Fields: */
  90. #define WSA884X_CLSH_VTH10_CLSH_VTH10_MASK 0xff
  91. /* WSA884X_CLSH_VTH11 Fields: */
  92. #define WSA884X_CLSH_VTH11_CLSH_VTH11_MASK 0xff
  93. /* WSA884X_CLSH_VTH12 Fields: */
  94. #define WSA884X_CLSH_VTH12_CLSH_VTH12_MASK 0xff
  95. /* WSA884X_CLSH_VTH13 Fields: */
  96. #define WSA884X_CLSH_VTH13_CLSH_VTH13_MASK 0xff
  97. /* WSA884X_CLSH_VTH14 Fields: */
  98. #define WSA884X_CLSH_VTH14_CLSH_VTH14_MASK 0xff
  99. /* WSA884X_CLSH_VTH15 Fields: */
  100. #define WSA884X_CLSH_VTH15_CLSH_VTH15_MASK 0xff
  101. /* WSA884X_ANA_WO_CTL_0 Fields: */
  102. #define WSA884X_ANA_WO_CTL_0_VPHX_SYS_EN_MASK 0xc0
  103. #define WSA884X_ANA_WO_CTL_0_PA_AUX_GAIN_MASK 0x3c
  104. #define WSA884X_ANA_WO_CTL_0_PA_MIN_GAIN_BYP_MASK 0x02
  105. #define WSA884X_ANA_WO_CTL_0_DAC_CM_CLAMP_EN_MASK 0x01
  106. /* WSA884X_ANA_WO_CTL_1 Fields: */
  107. #define WSA884X_ANA_WO_CTL_1_BOOST_SHARE_EN_MASK 0x08
  108. #define WSA884X_ANA_WO_CTL_1_EXT_VDDSPK_EN_MASK 0x07
  109. /* WSA884X_DRE_CTL_1 Fields: */
  110. #define WSA884X_DRE_CTL_1_CSR_GAIN_MASK 0x3e
  111. #define WSA884X_DRE_CTL_1_CSR_GAIN_EN_MASK 0x01
  112. /* WSA884X_VBAT_THRM_FLT_CTL Fields: */
  113. #define WSA884X_VBAT_THRM_FLT_CTL_THRM_COEF_SEL_MASK 0xe0
  114. #define WSA884X_VBAT_THRM_FLT_CTL_THRM_FLT_EN_MASK 0x10
  115. #define WSA884X_VBAT_THRM_FLT_CTL_VBAT_COEF_SEL_MASK 0x0e
  116. #define WSA884X_VBAT_THRM_FLT_CTL_VBAT_FLT_EN_MASK 0x01
  117. /* WSA884X_PDM_WD_CTL Fields: */
  118. #define WSA884X_PDM_WD_CTL_HOLD_OFF_MASK 0x04
  119. #define WSA884X_PDM_WD_CTL_TIME_OUT_SEL_MASK 0x02
  120. #define WSA884X_PDM_WD_CTL_PDM_WD_EN_MASK 0x01
  121. /* WSA884X_PA_FSM_BYP_CTL Fields: */
  122. #define WSA884X_PA_FSM_BYP_CTL_PA_FSM_BYP_MASK 0x01
  123. /* WSA884X_TADC_VALUE_CTL Fields: */
  124. #define WSA884X_TADC_VALUE_CTL_VBAT_VALUE_RD_EN_MASK 0x02
  125. #define WSA884X_TADC_VALUE_CTL_TEMP_VALUE_RD_EN_MASK 0x01
  126. /* WSA884X_CDC_PATH_MODE Fields: */
  127. #define WSA884X_CDC_PATH_MODE_RXD_MODE_MASK 0x02
  128. #define WSA884X_CDC_PATH_MODE_TXD_MODE_MASK 0x01
  129. /* WSA884X_PA_FSM_BYP0 Fields: */
  130. #define WSA884X_PA_FSM_BYP0_TSADC_EN_MASK 0x80
  131. #define WSA884X_PA_FSM_BYP0_SPKR_PROT_EN_MASK 0x40
  132. #define WSA884X_PA_FSM_BYP0_D_UNMUTE_MASK 0x20
  133. #define WSA884X_PA_FSM_BYP0_PA_EN_MASK 0x10
  134. #define WSA884X_PA_FSM_BYP0_BOOST_EN_MASK 0x08
  135. #define WSA884X_PA_FSM_BYP0_BG_EN_MASK 0x04
  136. #define WSA884X_PA_FSM_BYP0_CLK_WD_EN_MASK 0x02
  137. #define WSA884X_PA_FSM_BYP0_DC_CAL_EN_MASK 0x01
  138. /* WSA884X_PA_FSM_BYP1 Fields: */
  139. #define WSA884X_PA_FSM_BYP1_NG_MODE_MASK 0xc0
  140. #define WSA884X_PA_FSM_BYP1_PWRSAV_CTL_MASK 0x20
  141. #define WSA884X_PA_FSM_BYP1_RAMP_DOWN_MASK 0x10
  142. #define WSA884X_PA_FSM_BYP1_RAMP_UP_MASK 0x08
  143. #define WSA884X_PA_FSM_BYP1_BLEEDER_EN_MASK 0x04
  144. #define WSA884X_PA_FSM_BYP1_PA_MAIN_EN_MASK 0x02
  145. #define WSA884X_PA_FSM_BYP1_PA_AUX_EN_MASK 0x01
  146. /* WSA884X_PA_FSM_EN Fields: */
  147. #define WSA884X_PA_FSM_EN_GLOBAL_PA_EN_MASK 0x01
  148. /* WSA884X_OTP_REG_0 Fields: */
  149. #define WSA884X_OTP_REG_0_WSA884X_ID_MASK 0x0f
  150. /* WSA884X_CHIP_ID0 Fields: */
  151. #define WSA884X_CHIP_ID0_BYTE_0_MASK 0xff
  152. /* WSA884X_CHIP_ID1 Fields: */
  153. #define WSA884X_CHIP_ID1_BYTE_1_MASK 0xff
  154. /* WSA884X_CHIP_ID2 Fields: */
  155. #define WSA884X_CHIP_ID2_BYTE_2_MASK 0xff
  156. /* WSA884X_CHIP_ID3 Fields: */
  157. #define WSA884X_CHIP_ID3_BYTE_3_MASK 0xff
  158. /* WSA884X_OCP_CTL Fields: */
  159. #define WSA884X_OCP_CTL_OCP_EN_MASK 0x80
  160. #define WSA884X_OCP_CTL_OCP_CURR_LIMIT_MASK 0x70
  161. #define WSA884X_OCP_CTL_GLITCH_FILTER_MASK 0x0c
  162. #define WSA884X_OCP_CTL_OCP_P_HS_DLY_CTL_MASK 0x03
  163. /* WSA884X_ILIM_CTRL1 Fields: */
  164. #define WSA884X_ILIM_CTRL1_EN_AUTO_MAXD_SEL_MASK 0x80
  165. #define WSA884X_ILIM_CTRL1_EN_ILIM_SW_CLH_MASK 0x40
  166. #define WSA884X_ILIM_CTRL1_ILIM_OFFSET_CLH_MASK 0x38
  167. #define WSA884X_ILIM_CTRL1_ILIM_OFFSET_PB_MASK 0x07
  168. /* WSA884X_CLSH_CTL_0 Fields: */
  169. #define WSA884X_CLSH_CTL_0_CSR_GAIN_EN_MASK 0x80
  170. #define WSA884X_CLSH_CTL_0_DLY_CODE_MASK 0x70
  171. #define WSA884X_CLSH_CTL_0_DLY_RST_MASK 0x08
  172. #define WSA884X_CLSH_CTL_0_DLY_EN_MASK 0x04
  173. #define WSA884X_CLSH_CTL_0_INPUT_EN_MASK 0x02
  174. #define WSA884X_CLSH_CTL_0_CLSH_EN_MASK 0x01
  175. /* WSA884X_STB_CTRL1 Fields: */
  176. #define WSA884X_STB_CTRL1_SLOPE_COMP_CURRENT_MASK 0xf8
  177. #define WSA884X_STB_CTRL1_VOUT_FS_MASK 0x07
  178. /* WSA884X_OTP_REG_38 Fields: */
  179. #define WSA884X_OTP_REG_38_RESERVER_MASK 0xf0
  180. #define WSA884X_OTP_REG_38_BST_CFG_SEL_MASK 0x08
  181. #define WSA884X_OTP_REG_38_BOOST_ILIM_TUNE_MASK 0x07
  182. /* WSA884X_OTP_REG_40 Fields: */
  183. #define WSA884X_OTP_REG_40_SPARE_TYPE2_MASK 0xc0
  184. #define WSA884X_OTP_REG_40_ISENSE_RESCAL_MASK 0x3c
  185. #define WSA884X_OTP_REG_40_ATE_BOOST_RDSON_TEST_MASK 0x02
  186. #define WSA884X_OTP_REG_40_ATE_CLASSD_RDSON_TEST_MASK 0x01
  187. /* WSA884X_CURRENT_LIMIT Fields: */
  188. #define WSA884X_CURRENT_LIMIT_CURRENT_LIMIT_OVRD_EN_MASK 0x80
  189. #define WSA884X_CURRENT_LIMIT_CURRENT_LIMIT_MASK 0x7c
  190. #define WSA884X_CURRENT_LIMIT_CLK_PHASE_MASK 0x03
  191. /* WSA884X_PWM_CLK_CTL Fields: */
  192. #define WSA884X_PWM_CLK_CTL_VCMO_INT1_IDLE_MODE_OVRT_MASK 0x80
  193. #define WSA884X_PWM_CLK_CTL_REG_MCLK_DIV_RATIO_MASK 0x40
  194. #define WSA884X_PWM_CLK_CTL_PWM_DEGLITCH_CLK_DELAY_CTRL_MASK 0x30
  195. #define WSA884X_PWM_CLK_CTL_PWM_CLK_FREQ_SEL_MASK 0x08
  196. #define WSA884X_PWM_CLK_CTL_PWM_CLK_DIV_RATIO_MASK 0x06
  197. #define WSA884X_PWM_CLK_CTL_PWM_CLK_DIV_BYPASS_MASK 0x01
  198. /* WSA884X_CKWD_CTL_1 Fields: */
  199. #define WSA884X_CKWD_CTL_1_SPARE_BITS_7_6_MASK 0xc0
  200. #define WSA884X_CKWD_CTL_1_VPP_SW_CTL_MASK 0x20
  201. #define WSA884X_CKWD_CTL_1_CKWD_VCOMP_VREF_SEL_MASK 0x1f
  202. #endif /* WSA884X_REG_MASKS_H */