tfa9879.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * tfa9879.h -- driver for NXP Semiconductors TFA9879
  4. *
  5. * Copyright (C) 2014 Axentia Technologies AB
  6. * Author: Peter Rosin <[email protected]>
  7. */
  8. #ifndef _TFA9879_H
  9. #define _TFA9879_H
  10. #define TFA9879_DEVICE_CONTROL 0x00
  11. #define TFA9879_SERIAL_INTERFACE_1 0x01
  12. #define TFA9879_PCM_IOM2_FORMAT_1 0x02
  13. #define TFA9879_SERIAL_INTERFACE_2 0x03
  14. #define TFA9879_PCM_IOM2_FORMAT_2 0x04
  15. #define TFA9879_EQUALIZER_A1 0x05
  16. #define TFA9879_EQUALIZER_A2 0x06
  17. #define TFA9879_EQUALIZER_B1 0x07
  18. #define TFA9879_EQUALIZER_B2 0x08
  19. #define TFA9879_EQUALIZER_C1 0x09
  20. #define TFA9879_EQUALIZER_C2 0x0a
  21. #define TFA9879_EQUALIZER_D1 0x0b
  22. #define TFA9879_EQUALIZER_D2 0x0c
  23. #define TFA9879_EQUALIZER_E1 0x0d
  24. #define TFA9879_EQUALIZER_E2 0x0e
  25. #define TFA9879_BYPASS_CONTROL 0x0f
  26. #define TFA9879_DYNAMIC_RANGE_COMPR 0x10
  27. #define TFA9879_BASS_TREBLE 0x11
  28. #define TFA9879_HIGH_PASS_FILTER 0x12
  29. #define TFA9879_VOLUME_CONTROL 0x13
  30. #define TFA9879_MISC_CONTROL 0x14
  31. #define TFA9879_MISC_STATUS 0x15
  32. /* TFA9879_DEVICE_CONTROL */
  33. #define TFA9879_INPUT_SEL_MASK 0x0010
  34. #define TFA9879_INPUT_SEL_SHIFT 4
  35. #define TFA9879_OPMODE_MASK 0x0008
  36. #define TFA9879_OPMODE_SHIFT 3
  37. #define TFA9879_RESET_MASK 0x0002
  38. #define TFA9879_RESET_SHIFT 1
  39. #define TFA9879_POWERUP_MASK 0x0001
  40. #define TFA9879_POWERUP_SHIFT 0
  41. /* TFA9879_SERIAL_INTERFACE */
  42. #define TFA9879_MONO_SEL_MASK 0x0c00
  43. #define TFA9879_MONO_SEL_SHIFT 10
  44. #define TFA9879_MONO_SEL_LEFT 0
  45. #define TFA9879_MONO_SEL_RIGHT 1
  46. #define TFA9879_MONO_SEL_BOTH 2
  47. #define TFA9879_I2S_FS_MASK 0x03c0
  48. #define TFA9879_I2S_FS_SHIFT 6
  49. #define TFA9879_I2S_FS_8000 0
  50. #define TFA9879_I2S_FS_11025 1
  51. #define TFA9879_I2S_FS_12000 2
  52. #define TFA9879_I2S_FS_16000 3
  53. #define TFA9879_I2S_FS_22050 4
  54. #define TFA9879_I2S_FS_24000 5
  55. #define TFA9879_I2S_FS_32000 6
  56. #define TFA9879_I2S_FS_44100 7
  57. #define TFA9879_I2S_FS_48000 8
  58. #define TFA9879_I2S_FS_64000 9
  59. #define TFA9879_I2S_FS_88200 10
  60. #define TFA9879_I2S_FS_96000 11
  61. #define TFA9879_I2S_SET_MASK 0x0038
  62. #define TFA9879_I2S_SET_SHIFT 3
  63. #define TFA9879_I2S_SET_MSB_J_24 2
  64. #define TFA9879_I2S_SET_I2S_24 3
  65. #define TFA9879_I2S_SET_LSB_J_16 4
  66. #define TFA9879_I2S_SET_LSB_J_18 5
  67. #define TFA9879_I2S_SET_LSB_J_20 6
  68. #define TFA9879_I2S_SET_LSB_J_24 7
  69. #define TFA9879_SCK_POL_MASK 0x0004
  70. #define TFA9879_SCK_POL_SHIFT 2
  71. #define TFA9879_SCK_POL_NORMAL 0
  72. #define TFA9879_SCK_POL_INVERSE 1
  73. #define TFA9879_I_MODE_MASK 0x0003
  74. #define TFA9879_I_MODE_SHIFT 0
  75. #define TFA9879_I_MODE_I2S 0
  76. #define TFA9879_I_MODE_PCM_IOM2_SHORT 1
  77. #define TFA9879_I_MODE_PCM_IOM2_LONG 2
  78. /* TFA9879_PCM_IOM2_FORMAT */
  79. #define TFA9879_PCM_FS_MASK 0x0800
  80. #define TFA9879_PCM_FS_SHIFT 11
  81. #define TFA9879_A_LAW_MASK 0x0400
  82. #define TFA9879_A_LAW_SHIFT 10
  83. #define TFA9879_PCM_COMP_MASK 0x0200
  84. #define TFA9879_PCM_COMP_SHIFT 9
  85. #define TFA9879_PCM_DL_MASK 0x0100
  86. #define TFA9879_PCM_DL_SHIFT 8
  87. #define TFA9879_D1_SLOT_MASK 0x00f0
  88. #define TFA9879_D1_SLOT_SHIFT 4
  89. #define TFA9879_D2_SLOT_MASK 0x000f
  90. #define TFA9879_D2_SLOT_SHIFT 0
  91. /* TFA9879_EQUALIZER_X1 */
  92. #define TFA9879_T1_MASK 0x8000
  93. #define TFA9879_T1_SHIFT 15
  94. #define TFA9879_K1M_MASK 0x7ff0
  95. #define TFA9879_K1M_SHIFT 4
  96. #define TFA9879_K1E_MASK 0x000f
  97. #define TFA9879_K1E_SHIFT 0
  98. /* TFA9879_EQUALIZER_X2 */
  99. #define TFA9879_T2_MASK 0x8000
  100. #define TFA9879_T2_SHIFT 15
  101. #define TFA9879_K2M_MASK 0x7800
  102. #define TFA9879_K2M_SHIFT 11
  103. #define TFA9879_K2E_MASK 0x0700
  104. #define TFA9879_K2E_SHIFT 8
  105. #define TFA9879_K0_MASK 0x00fe
  106. #define TFA9879_K0_SHIFT 1
  107. #define TFA9879_S_MASK 0x0001
  108. #define TFA9879_S_SHIFT 0
  109. /* TFA9879_BYPASS_CONTROL */
  110. #define TFA9879_L_OCP_MASK 0x00c0
  111. #define TFA9879_L_OCP_SHIFT 6
  112. #define TFA9879_L_OTP_MASK 0x0030
  113. #define TFA9879_L_OTP_SHIFT 4
  114. #define TFA9879_CLIPCTRL_MASK 0x0008
  115. #define TFA9879_CLIPCTRL_SHIFT 3
  116. #define TFA9879_HPF_BP_MASK 0x0004
  117. #define TFA9879_HPF_BP_SHIFT 2
  118. #define TFA9879_DRC_BP_MASK 0x0002
  119. #define TFA9879_DRC_BP_SHIFT 1
  120. #define TFA9879_EQ_BP_MASK 0x0001
  121. #define TFA9879_EQ_BP_SHIFT 0
  122. /* TFA9879_DYNAMIC_RANGE_COMPR */
  123. #define TFA9879_AT_LVL_MASK 0xf000
  124. #define TFA9879_AT_LVL_SHIFT 12
  125. #define TFA9879_AT_RATE_MASK 0x0f00
  126. #define TFA9879_AT_RATE_SHIFT 8
  127. #define TFA9879_RL_LVL_MASK 0x00f0
  128. #define TFA9879_RL_LVL_SHIFT 4
  129. #define TFA9879_RL_RATE_MASK 0x000f
  130. #define TFA9879_RL_RATE_SHIFT 0
  131. /* TFA9879_BASS_TREBLE */
  132. #define TFA9879_G_TRBLE_MASK 0x3e00
  133. #define TFA9879_G_TRBLE_SHIFT 9
  134. #define TFA9879_F_TRBLE_MASK 0x0180
  135. #define TFA9879_F_TRBLE_SHIFT 7
  136. #define TFA9879_G_BASS_MASK 0x007c
  137. #define TFA9879_G_BASS_SHIFT 2
  138. #define TFA9879_F_BASS_MASK 0x0003
  139. #define TFA9879_F_BASS_SHIFT 0
  140. /* TFA9879_HIGH_PASS_FILTER */
  141. #define TFA9879_HP_CTRL_MASK 0x00ff
  142. #define TFA9879_HP_CTRL_SHIFT 0
  143. /* TFA9879_VOLUME_CONTROL */
  144. #define TFA9879_ZR_CRSS_MASK 0x1000
  145. #define TFA9879_ZR_CRSS_SHIFT 12
  146. #define TFA9879_VOL_MASK 0x00ff
  147. #define TFA9879_VOL_SHIFT 0
  148. /* TFA9879_MISC_CONTROL */
  149. #define TFA9879_DE_PHAS_MASK 0x0c00
  150. #define TFA9879_DE_PHAS_SHIFT 10
  151. #define TFA9879_H_MUTE_MASK 0x0200
  152. #define TFA9879_H_MUTE_SHIFT 9
  153. #define TFA9879_S_MUTE_MASK 0x0100
  154. #define TFA9879_S_MUTE_SHIFT 8
  155. #define TFA9879_P_LIM_MASK 0x00ff
  156. #define TFA9879_P_LIM_SHIFT 0
  157. /* TFA9879_MISC_STATUS */
  158. #define TFA9879_PS_MASK 0x4000
  159. #define TFA9879_PS_SHIFT 14
  160. #define TFA9879_PORA_MASK 0x2000
  161. #define TFA9879_PORA_SHIFT 13
  162. #define TFA9879_AMP_MASK 0x0600
  163. #define TFA9879_AMP_SHIFT 9
  164. #define TFA9879_IBP_2_MASK 0x0100
  165. #define TFA9879_IBP_2_SHIFT 8
  166. #define TFA9879_OFP_2_MASK 0x0080
  167. #define TFA9879_OFP_2_SHIFT 7
  168. #define TFA9879_UFP_2_MASK 0x0040
  169. #define TFA9879_UFP_2_SHIFT 6
  170. #define TFA9879_IBP_1_MASK 0x0020
  171. #define TFA9879_IBP_1_SHIFT 5
  172. #define TFA9879_OFP_1_MASK 0x0010
  173. #define TFA9879_OFP_1_SHIFT 4
  174. #define TFA9879_UFP_1_MASK 0x0008
  175. #define TFA9879_UFP_1_SHIFT 3
  176. #define TFA9879_OCPOKA_MASK 0x0004
  177. #define TFA9879_OCPOKA_SHIFT 2
  178. #define TFA9879_OCPOKB_MASK 0x0002
  179. #define TFA9879_OCPOKB_SHIFT 1
  180. #define TFA9879_OTPOK_MASK 0x0001
  181. #define TFA9879_OTPOK_SHIFT 0
  182. #endif