msp3400.h 7.6 KB

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