msp3400.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. msp3400.h - definition for msp3400 inputs and outputs
  3. Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef _MSP3400_H_
  17. #define _MSP3400_H_
  18. /* msp3400 routing
  19. ===============
  20. The msp3400 has a complicated routing scheme with many possible
  21. combinations. The details are all in the datasheets but I will try
  22. to give a short description here.
  23. Inputs
  24. ======
  25. There are 1) tuner inputs, 2) I2S inputs, 3) SCART inputs. You will have
  26. to select which tuner input to use and which SCART input to use. The
  27. selected tuner input, the selected SCART input and all I2S inputs go to
  28. the DSP (the tuner input first goes through the demodulator).
  29. The DSP handles things like volume, bass/treble, balance, and some chips
  30. have support for surround sound. It has several outputs: MAIN, AUX, I2S
  31. and SCART1/2. Each output can select which DSP input to use. So the MAIN
  32. output can select the tuner input while at the same time the SCART1 output
  33. uses the I2S input.
  34. Outputs
  35. =======
  36. Most DSP outputs are also the outputs of the msp3400. However, the SCART
  37. outputs of the msp3400 can select which input to use: either the SCART1 or
  38. SCART2 output from the DSP, or the msp3400 SCART inputs, thus completely
  39. bypassing the DSP.
  40. Summary
  41. =======
  42. So to specify a complete routing scheme for the msp3400 you will have to
  43. specify in the 'input' arg of the s_routing function:
  44. 1) which tuner input to use
  45. 2) which SCART input to use
  46. 3) which DSP input to use for each DSP output
  47. And in the 'output' arg of the s_routing function you specify:
  48. 1) which SCART input to use for each SCART output
  49. Depending on how the msp is wired to the other components you can
  50. ignore or mute certain inputs or outputs.
  51. Also, depending on the msp version only a subset of the inputs or
  52. outputs may be present. At the end of this header some tables are
  53. added containing a list of what is available for each msp version.
  54. */
  55. /* Inputs to the DSP unit: two independent selections have to be made:
  56. 1) the tuner (SIF) input
  57. 2) the SCART input
  58. Bits 0-2 are used for the SCART input select, bit 3 is used for the tuner
  59. input, bits 4-7 are reserved.
  60. */
  61. /* SCART input to DSP selection */
  62. #define MSP_IN_SCART1 0 /* Pin SC1_IN */
  63. #define MSP_IN_SCART2 1 /* Pin SC2_IN */
  64. #define MSP_IN_SCART3 2 /* Pin SC3_IN */
  65. #define MSP_IN_SCART4 3 /* Pin SC4_IN */
  66. #define MSP_IN_MONO 6 /* Pin MONO_IN */
  67. #define MSP_IN_MUTE 7 /* Mute DSP input */
  68. #define MSP_SCART_TO_DSP(in) (in)
  69. /* Tuner input to demodulator and DSP selection */
  70. #define MSP_IN_TUNER1 0 /* Analog Sound IF input pin ANA_IN1 */
  71. #define MSP_IN_TUNER2 1 /* Analog Sound IF input pin ANA_IN2 */
  72. #define MSP_TUNER_TO_DSP(in) ((in) << 3)
  73. /* The msp has up to 5 DSP outputs, each output can independently select
  74. a DSP input.
  75. The DSP outputs are: loudspeaker output (aka MAIN), headphones output
  76. (aka AUX), SCART1 DA output, SCART2 DA output and an I2S output.
  77. There also is a quasi-peak detector output, but that is not used by
  78. this driver and is set to the same input as the loudspeaker output.
  79. Not all outputs are supported by all msp models. Setting the input
  80. of an unsupported output will be ignored by the driver.
  81. There are up to 16 DSP inputs to choose from, so each output is
  82. assigned 4 bits.
  83. Note: the 44x8G can mix two inputs and feed the result back to the
  84. DSP. This is currently not implemented. Also not implemented is the
  85. multi-channel capable I2S3 input of the 44x0G. If someone can demonstrate
  86. a need for one of those features then additional support can be added. */
  87. #define MSP_DSP_IN_TUNER 0 /* Tuner DSP input */
  88. #define MSP_DSP_IN_SCART 2 /* SCART DSP input */
  89. #define MSP_DSP_IN_I2S1 5 /* I2S1 DSP input */
  90. #define MSP_DSP_IN_I2S2 6 /* I2S2 DSP input */
  91. #define MSP_DSP_IN_I2S3 7 /* I2S3 DSP input */
  92. #define MSP_DSP_IN_MAIN_AVC 11 /* MAIN AVC processed DSP input */
  93. #define MSP_DSP_IN_MAIN 12 /* MAIN DSP input */
  94. #define MSP_DSP_IN_AUX 13 /* AUX DSP input */
  95. #define MSP_DSP_TO_MAIN(in) ((in) << 4)
  96. #define MSP_DSP_TO_AUX(in) ((in) << 8)
  97. #define MSP_DSP_TO_SCART1(in) ((in) << 12)
  98. #define MSP_DSP_TO_SCART2(in) ((in) << 16)
  99. #define MSP_DSP_TO_I2S(in) ((in) << 20)
  100. /* Output SCART select: the SCART outputs can select which input
  101. to use. */
  102. #define MSP_SC_IN_SCART1 0 /* SCART1 input, bypassing the DSP */
  103. #define MSP_SC_IN_SCART2 1 /* SCART2 input, bypassing the DSP */
  104. #define MSP_SC_IN_SCART3 2 /* SCART3 input, bypassing the DSP */
  105. #define MSP_SC_IN_SCART4 3 /* SCART4 input, bypassing the DSP */
  106. #define MSP_SC_IN_DSP_SCART1 4 /* DSP SCART1 input */
  107. #define MSP_SC_IN_DSP_SCART2 5 /* DSP SCART2 input */
  108. #define MSP_SC_IN_MONO 6 /* MONO input, bypassing the DSP */
  109. #define MSP_SC_IN_MUTE 7 /* MUTE output */
  110. #define MSP_SC_TO_SCART1(in) (in)
  111. #define MSP_SC_TO_SCART2(in) ((in) << 4)
  112. /* Shortcut macros */
  113. #define MSP_INPUT(sc, t, main_aux_src, sc_i2s_src) \
  114. (MSP_SCART_TO_DSP(sc) | \
  115. MSP_TUNER_TO_DSP(t) | \
  116. MSP_DSP_TO_MAIN(main_aux_src) | \
  117. MSP_DSP_TO_AUX(main_aux_src) | \
  118. MSP_DSP_TO_SCART1(sc_i2s_src) | \
  119. MSP_DSP_TO_SCART2(sc_i2s_src) | \
  120. MSP_DSP_TO_I2S(sc_i2s_src))
  121. #define MSP_INPUT_DEFAULT MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1, \
  122. MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER)
  123. #define MSP_OUTPUT(sc) \
  124. (MSP_SC_TO_SCART1(sc) | \
  125. MSP_SC_TO_SCART2(sc))
  126. /* This equals the RESET position of the msp3400 ACB register */
  127. #define MSP_OUTPUT_DEFAULT (MSP_SC_TO_SCART1(MSP_SC_IN_SCART3) | \
  128. MSP_SC_TO_SCART2(MSP_SC_IN_DSP_SCART1))
  129. /* Tuner inputs vs. msp version */
  130. /* Chip TUNER_1 TUNER_2
  131. -------------------------
  132. msp34x0b y y
  133. msp34x0c y y
  134. msp34x0d y y
  135. msp34x5d y n
  136. msp34x7d y n
  137. msp34x0g y y
  138. msp34x1g y y
  139. msp34x2g y y
  140. msp34x5g y n
  141. msp34x7g y n
  142. msp44x0g y y
  143. msp44x8g y y
  144. */
  145. /* SCART inputs vs. msp version */
  146. /* Chip SC1 SC2 SC3 SC4
  147. -------------------------
  148. msp34x0b y y y n
  149. msp34x0c y y y n
  150. msp34x0d y y y y
  151. msp34x5d y y n n
  152. msp34x7d y n n n
  153. msp34x0g y y y y
  154. msp34x1g y y y y
  155. msp34x2g y y y y
  156. msp34x5g y y n n
  157. msp34x7g y n n n
  158. msp44x0g y y y y
  159. msp44x8g y y y y
  160. */
  161. /* DSP inputs vs. msp version (tuner and SCART inputs are always available) */
  162. /* Chip I2S1 I2S2 I2S3 MAIN_AVC MAIN AUX
  163. ------------------------------------------
  164. msp34x0b y n n n n n
  165. msp34x0c y y n n n n
  166. msp34x0d y y n n n n
  167. msp34x5d y y n n n n
  168. msp34x7d n n n n n n
  169. msp34x0g y y n n n n
  170. msp34x1g y y n n n n
  171. msp34x2g y y n y y y
  172. msp34x5g y y n n n n
  173. msp34x7g n n n n n n
  174. msp44x0g y y y y y y
  175. msp44x8g y y y n n n
  176. */
  177. /* DSP outputs vs. msp version */
  178. /* Chip MAIN AUX SCART1 SCART2 I2S
  179. ------------------------------------
  180. msp34x0b y y y n y
  181. msp34x0c y y y n y
  182. msp34x0d y y y y y
  183. msp34x5d y n y n y
  184. msp34x7d y n y n n
  185. msp34x0g y y y y y
  186. msp34x1g y y y y y
  187. msp34x2g y y y y y
  188. msp34x5g y n y n y
  189. msp34x7g y n y n n
  190. msp44x0g y y y y y
  191. msp44x8g y y y y y
  192. */
  193. #endif /* MSP3400_H */