wsa884x-reg-shifts.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef WSA884X_REG_SHIFTS_H
  6. #define WSA884X_REG_SHIFTS_H
  7. #include <linux/regmap.h>
  8. #include <linux/device.h>
  9. #include "wsa884x-registers.h"
  10. /*
  11. * Use in conjunction with wsa884x-reg-masks.c for field values.
  12. * field_value = (register_value & field_mask) >> field_shift
  13. */
  14. #define FIELD_SHIFT(register_name, field_name) \
  15. WSA884X_##register_name##_##field_name##_SHIFT
  16. /* WSA884X_VSENSE1 Fields: */
  17. #define WSA884X_VSENSE1_GAIN_VSENSE_FE_SHIFT 0x05
  18. #define WSA884X_VSENSE1_VSENSE_AMP_IQ_CTL_1_SHIFT 0x04
  19. #define WSA884X_VSENSE1_IDLE_MODE_CTL_SHIFT 0x02
  20. #define WSA884X_VSENSE1_VOCM_AMP_CTL_SHIFT 0x00
  21. /* WSA884X_ISENSE2 Fields: */
  22. #define WSA884X_ISENSE2_ISENSE_GAIN_CTL_SHIFT 0x05
  23. #define WSA884X_ISENSE2_SUMAMP_IQ_CTL_SHIFT 0x04
  24. #define WSA884X_ISENSE2_SPARE_BITS_3_0_SHIFT 0x00
  25. /* WSA884X_ADC_2 Fields: */
  26. #define WSA884X_ADC_2_ATEST_SEL_CAL_REF_SHIFT 0x07
  27. #define WSA884X_ADC_2_ISNS_LOAD_STORED_SHIFT 0x06
  28. #define WSA884X_ADC_2_EN_DET_SHIFT 0x05
  29. #define WSA884X_ADC_2_EN_ATEST_REF_SHIFT 0x04
  30. #define WSA884X_ADC_2_EN_ATEST_INT_SHIFT 0x01
  31. #define WSA884X_ADC_2_D_ADC_REG_EN_SHIFT 0x00
  32. /* WSA884X_ADC_7 Fields: */
  33. #define WSA884X_ADC_7_CLAMPON_SHIFT 0x07
  34. #define WSA884X_ADC_7_CAL_LOOP_TRIM_SHIFT 0x04
  35. #define WSA884X_ADC_7_REG_TRIM_EN_SHIFT 0x03
  36. #define WSA884X_ADC_7_EN_AZ_REG_SHIFT 0x02
  37. #define WSA884X_ADC_7_EN_SAR_REG_SHIFT 0x01
  38. #define WSA884X_ADC_7_EN_SW_CURRENT_REG_SHIFT 0x00
  39. /* WSA884X_BOP_DEGLITCH_CTL Fields: */
  40. #define WSA884X_BOP_DEGLITCH_CTL_BOP_DEGLITCH_SETTING_SHIFT 0x01
  41. #define WSA884X_BOP_DEGLITCH_CTL_BOP_DEGLITCH_EN_SHIFT 0x00
  42. /* WSA884X_CDC_SPK_DSM_A2_0 Fields: */
  43. #define WSA884X_CDC_SPK_DSM_A2_0_COEF_A2_SHIFT 0x00
  44. /* WSA884X_CDC_SPK_DSM_A2_1 Fields: */
  45. #define WSA884X_CDC_SPK_DSM_A2_1_COEF_A2_SHIFT 0x00
  46. /* WSA884X_CDC_SPK_DSM_A3_0 Fields: */
  47. #define WSA884X_CDC_SPK_DSM_A3_0_COEF_A3_SHIFT 0x00
  48. /* WSA884X_CDC_SPK_DSM_A3_1 Fields: */
  49. #define WSA884X_CDC_SPK_DSM_A3_1_COEF_A3_SHIFT 0x00
  50. /* WSA884X_CDC_SPK_DSM_A4_0 Fields: */
  51. #define WSA884X_CDC_SPK_DSM_A4_0_COEF_A4_SHIFT 0x00
  52. /* WSA884X_CDC_SPK_DSM_A5_0 Fields: */
  53. #define WSA884X_CDC_SPK_DSM_A5_0_COEF_A5_SHIFT 0x00
  54. /* WSA884X_CDC_SPK_DSM_A6_0 Fields: */
  55. #define WSA884X_CDC_SPK_DSM_A6_0_COEF_A6_SHIFT 0x00
  56. /* WSA884X_CDC_SPK_DSM_A7_0 Fields: */
  57. #define WSA884X_CDC_SPK_DSM_A7_0_COEF_A7_SHIFT 0x00
  58. /* WSA884X_CDC_SPK_DSM_C_0 Fields: */
  59. #define WSA884X_CDC_SPK_DSM_C_0_COEF_C3_SHIFT 0x04
  60. #define WSA884X_CDC_SPK_DSM_C_0_COEF_C2_SHIFT 0x00
  61. /* WSA884X_CDC_SPK_DSM_C_2 Fields: */
  62. #define WSA884X_CDC_SPK_DSM_C_2_COEF_C7_SHIFT 0x04
  63. #define WSA884X_CDC_SPK_DSM_C_2_COEF_C6_SHIFT 0x00
  64. /* WSA884X_CDC_SPK_DSM_C_3 Fields: */
  65. #define WSA884X_CDC_SPK_DSM_C_3_COEF_C7_SHIFT 0x00
  66. /* WSA884X_CDC_SPK_DSM_R1 Fields: */
  67. #define WSA884X_CDC_SPK_DSM_R1_SAT_LIMIT_R1_SHIFT 0x00
  68. /* WSA884X_CDC_SPK_DSM_R2 Fields: */
  69. #define WSA884X_CDC_SPK_DSM_R2_SAT_LIMIT_R2_SHIFT 0x00
  70. /* WSA884X_CDC_SPK_DSM_R3 Fields: */
  71. #define WSA884X_CDC_SPK_DSM_R3_SAT_LIMIT_R3_SHIFT 0x00
  72. /* WSA884X_CDC_SPK_DSM_R4 Fields: */
  73. #define WSA884X_CDC_SPK_DSM_R4_SAT_LIMIT_R4_SHIFT 0x00
  74. /* WSA884X_CDC_SPK_DSM_R5 Fields: */
  75. #define WSA884X_CDC_SPK_DSM_R5_SAT_LIMIT_R5_SHIFT 0x00
  76. /* WSA884X_CDC_SPK_DSM_R6 Fields: */
  77. #define WSA884X_CDC_SPK_DSM_R6_SAT_LIMIT_R6_SHIFT 0x00
  78. /* WSA884X_CDC_SPK_DSM_R7 Fields: */
  79. #define WSA884X_CDC_SPK_DSM_R7_SAT_LIMIT_R7_SHIFT 0x00
  80. /* WSA884X_DRE_CTL_0 Fields: */
  81. #define WSA884X_DRE_CTL_0_PROG_DELAY_SHIFT 0x04
  82. #define WSA884X_DRE_CTL_0_OFFSET_SHIFT 0x00
  83. /* WSA884X_GAIN_RAMPING_MIN Fields: */
  84. #define WSA884X_GAIN_RAMPING_MIN_MIN_GAIN_SHIFT 0x00
  85. /* WSA884X_CLSH_SOFT_MAX Fields: */
  86. #define WSA884X_CLSH_SOFT_MAX_SOFT_MAX_SHIFT 0x00
  87. /* WSA884X_CLSH_VTH1 Fields: */
  88. #define WSA884X_CLSH_VTH1_CLSH_VTH1_SHIFT 0x00
  89. /* WSA884X_CLSH_VTH10 Fields: */
  90. #define WSA884X_CLSH_VTH10_CLSH_VTH10_SHIFT 0x00
  91. /* WSA884X_CLSH_VTH11 Fields: */
  92. #define WSA884X_CLSH_VTH11_CLSH_VTH11_SHIFT 0x00
  93. /* WSA884X_CLSH_VTH12 Fields: */
  94. #define WSA884X_CLSH_VTH12_CLSH_VTH12_SHIFT 0x00
  95. /* WSA884X_CLSH_VTH13 Fields: */
  96. #define WSA884X_CLSH_VTH13_CLSH_VTH13_SHIFT 0x00
  97. /* WSA884X_CLSH_VTH14 Fields: */
  98. #define WSA884X_CLSH_VTH14_CLSH_VTH14_SHIFT 0x00
  99. /* WSA884X_CLSH_VTH15 Fields: */
  100. #define WSA884X_CLSH_VTH15_CLSH_VTH15_SHIFT 0x00
  101. /* WSA884X_ANA_WO_CTL_0 Fields: */
  102. #define WSA884X_ANA_WO_CTL_0_VPHX_SYS_EN_SHIFT 0x06
  103. #define WSA884X_ANA_WO_CTL_0_PA_AUX_GAIN_SHIFT 0x02
  104. #define WSA884X_ANA_WO_CTL_0_PA_MIN_GAIN_BYP_SHIFT 0x01
  105. #define WSA884X_ANA_WO_CTL_0_DAC_CM_CLAMP_EN_SHIFT 0x00
  106. /* WSA884X_ANA_WO_CTL_1 Fields: */
  107. #define WSA884X_ANA_WO_CTL_1_BOOST_SHARE_EN_SHIFT 0x03
  108. #define WSA884X_ANA_WO_CTL_1_EXT_VDDSPK_EN_SHIFT 0x00
  109. /* WSA884X_DRE_CTL_1 Fields: */
  110. #define WSA884X_DRE_CTL_1_CSR_GAIN_SHIFT 0x01
  111. #define WSA884X_DRE_CTL_1_CSR_GAIN_EN_SHIFT 0x00
  112. /* WSA884X_VBAT_THRM_FLT_CTL Fields: */
  113. #define WSA884X_VBAT_THRM_FLT_CTL_THRM_COEF_SEL_SHIFT 0x05
  114. #define WSA884X_VBAT_THRM_FLT_CTL_THRM_FLT_EN_SHIFT 0x04
  115. #define WSA884X_VBAT_THRM_FLT_CTL_VBAT_COEF_SEL_SHIFT 0x01
  116. #define WSA884X_VBAT_THRM_FLT_CTL_VBAT_FLT_EN_SHIFT 0x00
  117. /* WSA884X_PDM_WD_CTL Fields: */
  118. #define WSA884X_PDM_WD_CTL_HOLD_OFF_SHIFT 0x02
  119. #define WSA884X_PDM_WD_CTL_TIME_OUT_SEL_SHIFT 0x01
  120. #define WSA884X_PDM_WD_CTL_PDM_WD_EN_SHIFT 0x00
  121. /* WSA884X_PA_FSM_BYP_CTL Fields: */
  122. #define WSA884X_PA_FSM_BYP_CTL_PA_FSM_BYP_SHIFT 0x00
  123. /* WSA884X_TADC_VALUE_CTL Fields: */
  124. #define WSA884X_TADC_VALUE_CTL_VBAT_VALUE_RD_EN_SHIFT 0x01
  125. #define WSA884X_TADC_VALUE_CTL_TEMP_VALUE_RD_EN_SHIFT 0x00
  126. /* WSA884X_CDC_PATH_MODE Fields: */
  127. #define WSA884X_CDC_PATH_MODE_RXD_MODE_SHIFT 0x01
  128. #define WSA884X_CDC_PATH_MODE_TXD_MODE_SHIFT 0x00
  129. /* WSA884X_PA_FSM_BYP0 Fields: */
  130. #define WSA884X_PA_FSM_BYP0_TSADC_EN_SHIFT 0x07
  131. #define WSA884X_PA_FSM_BYP0_SPKR_PROT_EN_SHIFT 0x06
  132. #define WSA884X_PA_FSM_BYP0_D_UNMUTE_SHIFT 0x05
  133. #define WSA884X_PA_FSM_BYP0_PA_EN_SHIFT 0x04
  134. #define WSA884X_PA_FSM_BYP0_BOOST_EN_SHIFT 0x03
  135. #define WSA884X_PA_FSM_BYP0_BG_EN_SHIFT 0x02
  136. #define WSA884X_PA_FSM_BYP0_CLK_WD_EN_SHIFT 0x01
  137. #define WSA884X_PA_FSM_BYP0_DC_CAL_EN_SHIFT 0x00
  138. /* WSA884X_PA_FSM_BYP1 Fields: */
  139. #define WSA884X_PA_FSM_BYP1_NG_MODE_SHIFT 0x06
  140. #define WSA884X_PA_FSM_BYP1_PWRSAV_CTL_SHIFT 0x05
  141. #define WSA884X_PA_FSM_BYP1_RAMP_DOWN_SHIFT 0x04
  142. #define WSA884X_PA_FSM_BYP1_RAMP_UP_SHIFT 0x03
  143. #define WSA884X_PA_FSM_BYP1_BLEEDER_EN_SHIFT 0x02
  144. #define WSA884X_PA_FSM_BYP1_PA_MAIN_EN_SHIFT 0x01
  145. #define WSA884X_PA_FSM_BYP1_PA_AUX_EN_SHIFT 0x00
  146. /* WSA884X_PA_FSM_EN Fields: */
  147. #define WSA884X_PA_FSM_EN_GLOBAL_PA_EN_SHIFT 0x00
  148. /* WSA884X_OCP_CTL Fields: */
  149. #define WSA884X_OCP_CTL_OCP_EN_SHIFT 0x07
  150. #define WSA884X_OCP_CTL_OCP_CURR_LIMIT_SHIFT 0x04
  151. #define WSA884X_OCP_CTL_GLITCH_FILTER_SHIFT 0x02
  152. #define WSA884X_OCP_CTL_OCP_P_HS_DLY_CTL_SHIFT 0x00
  153. /* WSA884X_ILIM_CTRL1 Fields: */
  154. #define WSA884X_ILIM_CTRL1_EN_AUTO_MAXD_SEL_SHIFT 0x07
  155. #define WSA884X_ILIM_CTRL1_EN_ILIM_SW_CLH_SHIFT 0x06
  156. #define WSA884X_ILIM_CTRL1_ILIM_OFFSET_CLH_SHIFT 0x03
  157. #define WSA884X_ILIM_CTRL1_ILIM_OFFSET_PB_SHIFT 0x00
  158. /* WSA884X_CLSH_CTL_0 Fields: */
  159. #define WSA884X_CLSH_CTL_0_CSR_GAIN_EN_SHIFT 0x07
  160. #define WSA884X_CLSH_CTL_0_DLY_CODE_SHIFT 0x04
  161. #define WSA884X_CLSH_CTL_0_DLY_RST_SHIFT 0x03
  162. #define WSA884X_CLSH_CTL_0_DLY_EN_SHIFT 0x02
  163. #define WSA884X_CLSH_CTL_0_INPUT_EN_SHIFT 0x01
  164. #define WSA884X_CLSH_CTL_0_CLSH_EN_SHIFT 0x00
  165. /* WSA884X_STB_CTRL1 Fields: */
  166. #define WSA884X_STB_CTRL1_SLOPE_COMP_CURRENT_SHIFT 0x03
  167. #define WSA884X_STB_CTRL1_VOUT_FS_SHIFT 0x00
  168. /* WSA884X_OTP_REG_38 Fields: */
  169. #define WSA884X_OTP_REG_38_RESERVER_SHIFT 0x04
  170. #define WSA884X_OTP_REG_38_BST_CFG_SEL_SHIFT 0x03
  171. #define WSA884X_OTP_REG_38_BOOST_ILIM_TUNE_SHIFT 0x00
  172. /* WSA884X_OTP_REG_40 Fields: */
  173. #define WSA884X_OTP_REG_40_SPARE_TYPE2_SHIFT 0x06
  174. #define WSA884X_OTP_REG_40_ISENSE_RESCAL_SHIFT 0x02
  175. #define WSA884X_OTP_REG_40_ATE_BOOST_RDSON_TEST_SHIFT 0x01
  176. #define WSA884X_OTP_REG_40_ATE_CLASSD_RDSON_TEST_SHIFT 0x00
  177. /* WSA884X_CURRENT_LIMIT Fields: */
  178. #define WSA884X_CURRENT_LIMIT_CURRENT_LIMIT_OVRD_EN_SHIFT 0x07
  179. #define WSA884X_CURRENT_LIMIT_CURRENT_LIMIT_SHIFT 0x02
  180. #define WSA884X_CURRENT_LIMIT_CLK_PHASE_SHIFT 0x00
  181. /* WSA884X_PWM_CLK_CTL Fields: */
  182. #define WSA884X_PWM_CLK_CTL_VCMO_INT1_IDLE_MODE_OVRT_SHIFT 0x07
  183. #define WSA884X_PWM_CLK_CTL_REG_MCLK_DIV_RATIO_SHIFT 0x06
  184. #define WSA884X_PWM_CLK_CTL_PWM_DEGLITCH_CLK_DELAY_CTRL_SHIFT 0x04
  185. #define WSA884X_PWM_CLK_CTL_PWM_CLK_FREQ_SEL_SHIFT 0x03
  186. #define WSA884X_PWM_CLK_CTL_PWM_CLK_DIV_RATIO_SHIFT 0x01
  187. #define WSA884X_PWM_CLK_CTL_PWM_CLK_DIV_BYPASS_SHIFT 0x00
  188. /* WSA884X_CKWD_CTL_1 Fields: */
  189. #define WSA884X_CKWD_CTL_1_SPARE_BITS_7_6_SHIFT 0x06
  190. #define WSA884X_CKWD_CTL_1_VPP_SW_CTL_SHIFT 0x05
  191. #define WSA884X_CKWD_CTL_1_CKWD_VCOMP_VREF_SEL_SHIFT 0x00
  192. #endif /* WSA884X_REG_SHIFTS_H */