sta350.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. * Codec driver for ST STA350 2.1-channel high-efficiency digital audio system
  3. *
  4. * Copyright: 2011 Raumfeld GmbH
  5. * Author: Sven Brandau <info@brandau.biz>
  6. *
  7. * based on code from:
  8. * Raumfeld GmbH
  9. * Johannes Stezenbach <js@sig21.net>
  10. * Wolfson Microelectronics PLC.
  11. * Mark Brown <broonie@opensource.wolfsonmicro.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. */
  18. #ifndef _ASOC_STA_350_H
  19. #define _ASOC_STA_350_H
  20. /* STA50 register addresses */
  21. #define STA350_REGISTER_COUNT 0x4D
  22. #define STA350_COEF_COUNT 62
  23. #define STA350_CONFA 0x00
  24. #define STA350_CONFB 0x01
  25. #define STA350_CONFC 0x02
  26. #define STA350_CONFD 0x03
  27. #define STA350_CONFE 0x04
  28. #define STA350_CONFF 0x05
  29. #define STA350_MMUTE 0x06
  30. #define STA350_MVOL 0x07
  31. #define STA350_C1VOL 0x08
  32. #define STA350_C2VOL 0x09
  33. #define STA350_C3VOL 0x0a
  34. #define STA350_AUTO1 0x0b
  35. #define STA350_AUTO2 0x0c
  36. #define STA350_AUTO3 0x0d
  37. #define STA350_C1CFG 0x0e
  38. #define STA350_C2CFG 0x0f
  39. #define STA350_C3CFG 0x10
  40. #define STA350_TONE 0x11
  41. #define STA350_L1AR 0x12
  42. #define STA350_L1ATRT 0x13
  43. #define STA350_L2AR 0x14
  44. #define STA350_L2ATRT 0x15
  45. #define STA350_CFADDR2 0x16
  46. #define STA350_B1CF1 0x17
  47. #define STA350_B1CF2 0x18
  48. #define STA350_B1CF3 0x19
  49. #define STA350_B2CF1 0x1a
  50. #define STA350_B2CF2 0x1b
  51. #define STA350_B2CF3 0x1c
  52. #define STA350_A1CF1 0x1d
  53. #define STA350_A1CF2 0x1e
  54. #define STA350_A1CF3 0x1f
  55. #define STA350_A2CF1 0x20
  56. #define STA350_A2CF2 0x21
  57. #define STA350_A2CF3 0x22
  58. #define STA350_B0CF1 0x23
  59. #define STA350_B0CF2 0x24
  60. #define STA350_B0CF3 0x25
  61. #define STA350_CFUD 0x26
  62. #define STA350_MPCC1 0x27
  63. #define STA350_MPCC2 0x28
  64. #define STA350_DCC1 0x29
  65. #define STA350_DCC2 0x2a
  66. #define STA350_FDRC1 0x2b
  67. #define STA350_FDRC2 0x2c
  68. #define STA350_STATUS 0x2d
  69. /* reserved: 0x2d - 0x30 */
  70. #define STA350_EQCFG 0x31
  71. #define STA350_EATH1 0x32
  72. #define STA350_ERTH1 0x33
  73. #define STA350_EATH2 0x34
  74. #define STA350_ERTH2 0x35
  75. #define STA350_CONFX 0x36
  76. #define STA350_SVCA 0x37
  77. #define STA350_SVCB 0x38
  78. #define STA350_RMS0A 0x39
  79. #define STA350_RMS0B 0x3a
  80. #define STA350_RMS0C 0x3b
  81. #define STA350_RMS1A 0x3c
  82. #define STA350_RMS1B 0x3d
  83. #define STA350_RMS1C 0x3e
  84. #define STA350_EVOLRES 0x3f
  85. /* reserved: 0x40 - 0x47 */
  86. #define STA350_NSHAPE 0x48
  87. #define STA350_CTXB4B1 0x49
  88. #define STA350_CTXB7B5 0x4a
  89. #define STA350_MISC1 0x4b
  90. #define STA350_MISC2 0x4c
  91. /* 0x00 CONFA */
  92. #define STA350_CONFA_MCS_MASK 0x03
  93. #define STA350_CONFA_MCS_SHIFT 0
  94. #define STA350_CONFA_IR_MASK 0x18
  95. #define STA350_CONFA_IR_SHIFT 3
  96. #define STA350_CONFA_TWRB BIT(5)
  97. #define STA350_CONFA_TWAB BIT(6)
  98. #define STA350_CONFA_FDRB BIT(7)
  99. /* 0x01 CONFB */
  100. #define STA350_CONFB_SAI_MASK 0x0f
  101. #define STA350_CONFB_SAI_SHIFT 0
  102. #define STA350_CONFB_SAIFB BIT(4)
  103. #define STA350_CONFB_DSCKE BIT(5)
  104. #define STA350_CONFB_C1IM BIT(6)
  105. #define STA350_CONFB_C2IM BIT(7)
  106. /* 0x02 CONFC */
  107. #define STA350_CONFC_OM_MASK 0x03
  108. #define STA350_CONFC_OM_SHIFT 0
  109. #define STA350_CONFC_CSZ_MASK 0x3c
  110. #define STA350_CONFC_CSZ_SHIFT 2
  111. #define STA350_CONFC_OCRB BIT(7)
  112. /* 0x03 CONFD */
  113. #define STA350_CONFD_HPB_SHIFT 0
  114. #define STA350_CONFD_DEMP_SHIFT 1
  115. #define STA350_CONFD_DSPB_SHIFT 2
  116. #define STA350_CONFD_PSL_SHIFT 3
  117. #define STA350_CONFD_BQL_SHIFT 4
  118. #define STA350_CONFD_DRC_SHIFT 5
  119. #define STA350_CONFD_ZDE_SHIFT 6
  120. #define STA350_CONFD_SME_SHIFT 7
  121. /* 0x04 CONFE */
  122. #define STA350_CONFE_MPCV BIT(0)
  123. #define STA350_CONFE_MPCV_SHIFT 0
  124. #define STA350_CONFE_MPC BIT(1)
  125. #define STA350_CONFE_MPC_SHIFT 1
  126. #define STA350_CONFE_NSBW BIT(2)
  127. #define STA350_CONFE_NSBW_SHIFT 2
  128. #define STA350_CONFE_AME BIT(3)
  129. #define STA350_CONFE_AME_SHIFT 3
  130. #define STA350_CONFE_PWMS BIT(4)
  131. #define STA350_CONFE_PWMS_SHIFT 4
  132. #define STA350_CONFE_DCCV BIT(5)
  133. #define STA350_CONFE_DCCV_SHIFT 5
  134. #define STA350_CONFE_ZCE BIT(6)
  135. #define STA350_CONFE_ZCE_SHIFT 6
  136. #define STA350_CONFE_SVE BIT(7)
  137. #define STA350_CONFE_SVE_SHIFT 7
  138. /* 0x05 CONFF */
  139. #define STA350_CONFF_OCFG_MASK 0x03
  140. #define STA350_CONFF_OCFG_SHIFT 0
  141. #define STA350_CONFF_IDE BIT(2)
  142. #define STA350_CONFF_BCLE BIT(3)
  143. #define STA350_CONFF_LDTE BIT(4)
  144. #define STA350_CONFF_ECLE BIT(5)
  145. #define STA350_CONFF_PWDN BIT(6)
  146. #define STA350_CONFF_EAPD BIT(7)
  147. /* 0x06 MMUTE */
  148. #define STA350_MMUTE_MMUTE 0x01
  149. #define STA350_MMUTE_MMUTE_SHIFT 0
  150. #define STA350_MMUTE_C1M 0x02
  151. #define STA350_MMUTE_C1M_SHIFT 1
  152. #define STA350_MMUTE_C2M 0x04
  153. #define STA350_MMUTE_C2M_SHIFT 2
  154. #define STA350_MMUTE_C3M 0x08
  155. #define STA350_MMUTE_C3M_SHIFT 3
  156. #define STA350_MMUTE_LOC_MASK 0xC0
  157. #define STA350_MMUTE_LOC_SHIFT 6
  158. /* 0x0b AUTO1 */
  159. #define STA350_AUTO1_AMGC_MASK 0x30
  160. #define STA350_AUTO1_AMGC_SHIFT 4
  161. /* 0x0c AUTO2 */
  162. #define STA350_AUTO2_AMAME 0x01
  163. #define STA350_AUTO2_AMAM_MASK 0x0e
  164. #define STA350_AUTO2_AMAM_SHIFT 1
  165. #define STA350_AUTO2_XO_MASK 0xf0
  166. #define STA350_AUTO2_XO_SHIFT 4
  167. /* 0x0d AUTO3 */
  168. #define STA350_AUTO3_PEQ_MASK 0x1f
  169. #define STA350_AUTO3_PEQ_SHIFT 0
  170. /* 0x0e 0x0f 0x10 CxCFG */
  171. #define STA350_CxCFG_TCB_SHIFT 0
  172. #define STA350_CxCFG_EQBP_SHIFT 1
  173. #define STA350_CxCFG_VBP_SHIFT 2
  174. #define STA350_CxCFG_BO_SHIFT 3
  175. #define STA350_CxCFG_LS_SHIFT 4
  176. #define STA350_CxCFG_OM_MASK 0xc0
  177. #define STA350_CxCFG_OM_SHIFT 6
  178. /* 0x11 TONE */
  179. #define STA350_TONE_BTC_SHIFT 0
  180. #define STA350_TONE_TTC_SHIFT 4
  181. /* 0x12 0x13 0x14 0x15 limiter attack/release */
  182. #define STA350_LxA_SHIFT 0
  183. #define STA350_LxR_SHIFT 4
  184. /* 0x26 CFUD */
  185. #define STA350_CFUD_W1 0x01
  186. #define STA350_CFUD_WA 0x02
  187. #define STA350_CFUD_R1 0x04
  188. #define STA350_CFUD_RA 0x08
  189. /* biquad filter coefficient table offsets */
  190. #define STA350_C1_BQ_BASE 0
  191. #define STA350_C2_BQ_BASE 20
  192. #define STA350_CH_BQ_NUM 4
  193. #define STA350_BQ_NUM_COEF 5
  194. #define STA350_XO_HP_BQ_BASE 40
  195. #define STA350_XO_LP_BQ_BASE 45
  196. #define STA350_C1_PRESCALE 50
  197. #define STA350_C2_PRESCALE 51
  198. #define STA350_C1_POSTSCALE 52
  199. #define STA350_C2_POSTSCALE 53
  200. #define STA350_C3_POSTSCALE 54
  201. #define STA350_TW_POSTSCALE 55
  202. #define STA350_C1_MIX1 56
  203. #define STA350_C1_MIX2 57
  204. #define STA350_C2_MIX1 58
  205. #define STA350_C2_MIX2 59
  206. #define STA350_C3_MIX1 60
  207. #define STA350_C3_MIX2 61
  208. /* miscellaneous register 1 */
  209. #define STA350_MISC1_CPWMEN BIT(2)
  210. #define STA350_MISC1_BRIDGOFF BIT(5)
  211. #define STA350_MISC1_NSHHPEN BIT(6)
  212. #define STA350_MISC1_RPDNEN BIT(7)
  213. /* miscellaneous register 2 */
  214. #define STA350_MISC2_PNDLSL_MASK 0x1c
  215. #define STA350_MISC2_PNDLSL_SHIFT 2
  216. #endif /* _ASOC_STA_350_H */