sta32x.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * Codec driver for ST STA32x 2.1-channel high-efficiency digital audio system
  3. *
  4. * Copyright: 2011 Raumfeld GmbH
  5. * Author: Johannes Stezenbach <js@sig21.net>
  6. *
  7. * based on code from:
  8. * Wolfson Microelectronics PLC.
  9. * Mark Brown <broonie@opensource.wolfsonmicro.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #ifndef _ASOC_STA_32X_H
  17. #define _ASOC_STA_32X_H
  18. /* STA326 register addresses */
  19. #define STA32X_REGISTER_COUNT 0x2d
  20. #define STA32X_COEF_COUNT 62
  21. #define STA32X_CONFA 0x00
  22. #define STA32X_CONFB 0x01
  23. #define STA32X_CONFC 0x02
  24. #define STA32X_CONFD 0x03
  25. #define STA32X_CONFE 0x04
  26. #define STA32X_CONFF 0x05
  27. #define STA32X_MMUTE 0x06
  28. #define STA32X_MVOL 0x07
  29. #define STA32X_C1VOL 0x08
  30. #define STA32X_C2VOL 0x09
  31. #define STA32X_C3VOL 0x0a
  32. #define STA32X_AUTO1 0x0b
  33. #define STA32X_AUTO2 0x0c
  34. #define STA32X_AUTO3 0x0d
  35. #define STA32X_C1CFG 0x0e
  36. #define STA32X_C2CFG 0x0f
  37. #define STA32X_C3CFG 0x10
  38. #define STA32X_TONE 0x11
  39. #define STA32X_L1AR 0x12
  40. #define STA32X_L1ATRT 0x13
  41. #define STA32X_L2AR 0x14
  42. #define STA32X_L2ATRT 0x15
  43. #define STA32X_CFADDR2 0x16
  44. #define STA32X_B1CF1 0x17
  45. #define STA32X_B1CF2 0x18
  46. #define STA32X_B1CF3 0x19
  47. #define STA32X_B2CF1 0x1a
  48. #define STA32X_B2CF2 0x1b
  49. #define STA32X_B2CF3 0x1c
  50. #define STA32X_A1CF1 0x1d
  51. #define STA32X_A1CF2 0x1e
  52. #define STA32X_A1CF3 0x1f
  53. #define STA32X_A2CF1 0x20
  54. #define STA32X_A2CF2 0x21
  55. #define STA32X_A2CF3 0x22
  56. #define STA32X_B0CF1 0x23
  57. #define STA32X_B0CF2 0x24
  58. #define STA32X_B0CF3 0x25
  59. #define STA32X_CFUD 0x26
  60. #define STA32X_MPCC1 0x27
  61. #define STA32X_MPCC2 0x28
  62. /* Reserved 0x29 */
  63. /* Reserved 0x2a */
  64. #define STA32X_Reserved 0x2a
  65. #define STA32X_FDRC1 0x2b
  66. #define STA32X_FDRC2 0x2c
  67. /* Reserved 0x2d */
  68. /* STA326 register field definitions */
  69. /* 0x00 CONFA */
  70. #define STA32X_CONFA_MCS_MASK 0x03
  71. #define STA32X_CONFA_MCS_SHIFT 0
  72. #define STA32X_CONFA_IR_MASK 0x18
  73. #define STA32X_CONFA_IR_SHIFT 3
  74. #define STA32X_CONFA_TWRB 0x20
  75. #define STA32X_CONFA_TWAB 0x40
  76. #define STA32X_CONFA_FDRB 0x80
  77. /* 0x01 CONFB */
  78. #define STA32X_CONFB_SAI_MASK 0x0f
  79. #define STA32X_CONFB_SAI_SHIFT 0
  80. #define STA32X_CONFB_SAIFB 0x10
  81. #define STA32X_CONFB_DSCKE 0x20
  82. #define STA32X_CONFB_C1IM 0x40
  83. #define STA32X_CONFB_C2IM 0x80
  84. /* 0x02 CONFC */
  85. #define STA32X_CONFC_OM_MASK 0x03
  86. #define STA32X_CONFC_OM_SHIFT 0
  87. #define STA32X_CONFC_CSZ_MASK 0x7c
  88. #define STA32X_CONFC_CSZ_SHIFT 2
  89. /* 0x03 CONFD */
  90. #define STA32X_CONFD_HPB 0x01
  91. #define STA32X_CONFD_HPB_SHIFT 0
  92. #define STA32X_CONFD_DEMP 0x02
  93. #define STA32X_CONFD_DEMP_SHIFT 1
  94. #define STA32X_CONFD_DSPB 0x04
  95. #define STA32X_CONFD_DSPB_SHIFT 2
  96. #define STA32X_CONFD_PSL 0x08
  97. #define STA32X_CONFD_PSL_SHIFT 3
  98. #define STA32X_CONFD_BQL 0x10
  99. #define STA32X_CONFD_BQL_SHIFT 4
  100. #define STA32X_CONFD_DRC 0x20
  101. #define STA32X_CONFD_DRC_SHIFT 5
  102. #define STA32X_CONFD_ZDE 0x40
  103. #define STA32X_CONFD_ZDE_SHIFT 6
  104. #define STA32X_CONFD_MME 0x80
  105. #define STA32X_CONFD_MME_SHIFT 7
  106. /* 0x04 CONFE */
  107. #define STA32X_CONFE_MPCV 0x01
  108. #define STA32X_CONFE_MPCV_SHIFT 0
  109. #define STA32X_CONFE_MPC 0x02
  110. #define STA32X_CONFE_MPC_SHIFT 1
  111. #define STA32X_CONFE_AME 0x08
  112. #define STA32X_CONFE_AME_SHIFT 3
  113. #define STA32X_CONFE_PWMS 0x10
  114. #define STA32X_CONFE_PWMS_SHIFT 4
  115. #define STA32X_CONFE_ZCE 0x40
  116. #define STA32X_CONFE_ZCE_SHIFT 6
  117. #define STA32X_CONFE_SVE 0x80
  118. #define STA32X_CONFE_SVE_SHIFT 7
  119. /* 0x05 CONFF */
  120. #define STA32X_CONFF_OCFG_MASK 0x03
  121. #define STA32X_CONFF_OCFG_SHIFT 0
  122. #define STA32X_CONFF_IDE 0x04
  123. #define STA32X_CONFF_IDE_SHIFT 2
  124. #define STA32X_CONFF_BCLE 0x08
  125. #define STA32X_CONFF_ECLE 0x20
  126. #define STA32X_CONFF_PWDN 0x40
  127. #define STA32X_CONFF_EAPD 0x80
  128. /* 0x06 MMUTE */
  129. #define STA32X_MMUTE_MMUTE 0x01
  130. /* 0x0b AUTO1 */
  131. #define STA32X_AUTO1_AMEQ_MASK 0x03
  132. #define STA32X_AUTO1_AMEQ_SHIFT 0
  133. #define STA32X_AUTO1_AMV_MASK 0xc0
  134. #define STA32X_AUTO1_AMV_SHIFT 2
  135. #define STA32X_AUTO1_AMGC_MASK 0x30
  136. #define STA32X_AUTO1_AMGC_SHIFT 4
  137. #define STA32X_AUTO1_AMPS 0x80
  138. /* 0x0c AUTO2 */
  139. #define STA32X_AUTO2_AMAME 0x01
  140. #define STA32X_AUTO2_AMAM_MASK 0x0e
  141. #define STA32X_AUTO2_AMAM_SHIFT 1
  142. #define STA32X_AUTO2_XO_MASK 0xf0
  143. #define STA32X_AUTO2_XO_SHIFT 4
  144. /* 0x0d AUTO3 */
  145. #define STA32X_AUTO3_PEQ_MASK 0x1f
  146. #define STA32X_AUTO3_PEQ_SHIFT 0
  147. /* 0x0e 0x0f 0x10 CxCFG */
  148. #define STA32X_CxCFG_TCB 0x01 /* only C1 and C2 */
  149. #define STA32X_CxCFG_TCB_SHIFT 0
  150. #define STA32X_CxCFG_EQBP 0x02 /* only C1 and C2 */
  151. #define STA32X_CxCFG_EQBP_SHIFT 1
  152. #define STA32X_CxCFG_VBP 0x03
  153. #define STA32X_CxCFG_VBP_SHIFT 2
  154. #define STA32X_CxCFG_BO 0x04
  155. #define STA32X_CxCFG_LS_MASK 0x30
  156. #define STA32X_CxCFG_LS_SHIFT 4
  157. #define STA32X_CxCFG_OM_MASK 0xc0
  158. #define STA32X_CxCFG_OM_SHIFT 6
  159. /* 0x11 TONE */
  160. #define STA32X_TONE_BTC_SHIFT 0
  161. #define STA32X_TONE_TTC_SHIFT 4
  162. /* 0x12 0x13 0x14 0x15 limiter attack/release */
  163. #define STA32X_LxA_SHIFT 0
  164. #define STA32X_LxR_SHIFT 4
  165. /* 0x26 CFUD */
  166. #define STA32X_CFUD_W1 0x01
  167. #define STA32X_CFUD_WA 0x02
  168. #define STA32X_CFUD_R1 0x04
  169. #define STA32X_CFUD_RA 0x08
  170. /* biquad filter coefficient table offsets */
  171. #define STA32X_C1_BQ_BASE 0
  172. #define STA32X_C2_BQ_BASE 20
  173. #define STA32X_CH_BQ_NUM 4
  174. #define STA32X_BQ_NUM_COEF 5
  175. #define STA32X_XO_HP_BQ_BASE 40
  176. #define STA32X_XO_LP_BQ_BASE 45
  177. #define STA32X_C1_PRESCALE 50
  178. #define STA32X_C2_PRESCALE 51
  179. #define STA32X_C1_POSTSCALE 52
  180. #define STA32X_C2_POSTSCALE 53
  181. #define STA32X_C3_POSTSCALE 54
  182. #define STA32X_TW_POSTSCALE 55
  183. #define STA32X_C1_MIX1 56
  184. #define STA32X_C1_MIX2 57
  185. #define STA32X_C2_MIX1 58
  186. #define STA32X_C2_MIX2 59
  187. #define STA32X_C3_MIX1 60
  188. #define STA32X_C3_MIX2 61
  189. #endif /* _ASOC_STA_32X_H */