mc44s803_priv.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Driver for Freescale MC44S803 Low Power CMOS Broadband Tuner
  3. *
  4. * Copyright (c) 2009 Jochen Friedrich <jochen@scram.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. *
  15. * GNU General Public License for more details.
  16. */
  17. #ifndef MC44S803_PRIV_H
  18. #define MC44S803_PRIV_H
  19. /* This driver is based on the information available in the datasheet
  20. http://www.freescale.com/files/rf_if/doc/data_sheet/MC44S803.pdf
  21. SPI or I2C Address : 0xc0-0xc6
  22. Reg.No | Function
  23. -------------------------------------------
  24. 00 | Power Down
  25. 01 | Reference Oszillator
  26. 02 | Reference Dividers
  27. 03 | Mixer and Reference Buffer
  28. 04 | Reset/Serial Out
  29. 05 | LO 1
  30. 06 | LO 2
  31. 07 | Circuit Adjust
  32. 08 | Test
  33. 09 | Digital Tune
  34. 0A | LNA AGC
  35. 0B | Data Register Address
  36. 0C | Regulator Test
  37. 0D | VCO Test
  38. 0E | LNA Gain/Input Power
  39. 0F | ID Bits
  40. */
  41. #define MC44S803_OSC 26000000 /* 26 MHz */
  42. #define MC44S803_IF1 1086000000 /* 1086 MHz */
  43. #define MC44S803_IF2 36125000 /* 36.125 MHz */
  44. #define MC44S803_REG_POWER 0
  45. #define MC44S803_REG_REFOSC 1
  46. #define MC44S803_REG_REFDIV 2
  47. #define MC44S803_REG_MIXER 3
  48. #define MC44S803_REG_RESET 4
  49. #define MC44S803_REG_LO1 5
  50. #define MC44S803_REG_LO2 6
  51. #define MC44S803_REG_CIRCADJ 7
  52. #define MC44S803_REG_TEST 8
  53. #define MC44S803_REG_DIGTUNE 9
  54. #define MC44S803_REG_LNAAGC 0x0A
  55. #define MC44S803_REG_DATAREG 0x0B
  56. #define MC44S803_REG_REGTEST 0x0C
  57. #define MC44S803_REG_VCOTEST 0x0D
  58. #define MC44S803_REG_LNAGAIN 0x0E
  59. #define MC44S803_REG_ID 0x0F
  60. /* Register definitions */
  61. #define MC44S803_ADDR 0x0F
  62. #define MC44S803_ADDR_S 0
  63. /* REG_POWER */
  64. #define MC44S803_POWER 0xFFFFF0
  65. #define MC44S803_POWER_S 4
  66. /* REG_REFOSC */
  67. #define MC44S803_REFOSC 0x1FF0
  68. #define MC44S803_REFOSC_S 4
  69. #define MC44S803_OSCSEL 0x2000
  70. #define MC44S803_OSCSEL_S 13
  71. /* REG_REFDIV */
  72. #define MC44S803_R2 0x1FF0
  73. #define MC44S803_R2_S 4
  74. #define MC44S803_REFBUF_EN 0x2000
  75. #define MC44S803_REFBUF_EN_S 13
  76. #define MC44S803_R1 0x7C000
  77. #define MC44S803_R1_S 14
  78. /* REG_MIXER */
  79. #define MC44S803_R3 0x70
  80. #define MC44S803_R3_S 4
  81. #define MC44S803_MUX3 0x80
  82. #define MC44S803_MUX3_S 7
  83. #define MC44S803_MUX4 0x100
  84. #define MC44S803_MUX4_S 8
  85. #define MC44S803_OSC_SCR 0x200
  86. #define MC44S803_OSC_SCR_S 9
  87. #define MC44S803_TRI_STATE 0x400
  88. #define MC44S803_TRI_STATE_S 10
  89. #define MC44S803_BUF_GAIN 0x800
  90. #define MC44S803_BUF_GAIN_S 11
  91. #define MC44S803_BUF_IO 0x1000
  92. #define MC44S803_BUF_IO_S 12
  93. #define MC44S803_MIXER_RES 0xFE000
  94. #define MC44S803_MIXER_RES_S 13
  95. /* REG_RESET */
  96. #define MC44S803_RS 0x10
  97. #define MC44S803_RS_S 4
  98. #define MC44S803_SO 0x20
  99. #define MC44S803_SO_S 5
  100. /* REG_LO1 */
  101. #define MC44S803_LO1 0xFFF0
  102. #define MC44S803_LO1_S 4
  103. /* REG_LO2 */
  104. #define MC44S803_LO2 0x7FFF0
  105. #define MC44S803_LO2_S 4
  106. /* REG_CIRCADJ */
  107. #define MC44S803_G1 0x20
  108. #define MC44S803_G1_S 5
  109. #define MC44S803_G3 0x80
  110. #define MC44S803_G3_S 7
  111. #define MC44S803_CIRCADJ_RES 0x300
  112. #define MC44S803_CIRCADJ_RES_S 8
  113. #define MC44S803_G6 0x400
  114. #define MC44S803_G6_S 10
  115. #define MC44S803_G7 0x800
  116. #define MC44S803_G7_S 11
  117. #define MC44S803_S1 0x1000
  118. #define MC44S803_S1_S 12
  119. #define MC44S803_LP 0x7E000
  120. #define MC44S803_LP_S 13
  121. #define MC44S803_CLRF 0x80000
  122. #define MC44S803_CLRF_S 19
  123. #define MC44S803_CLIF 0x100000
  124. #define MC44S803_CLIF_S 20
  125. /* REG_TEST */
  126. /* REG_DIGTUNE */
  127. #define MC44S803_DA 0xF0
  128. #define MC44S803_DA_S 4
  129. #define MC44S803_XOD 0x300
  130. #define MC44S803_XOD_S 8
  131. #define MC44S803_RST 0x10000
  132. #define MC44S803_RST_S 16
  133. #define MC44S803_LO_REF 0x1FFF00
  134. #define MC44S803_LO_REF_S 8
  135. #define MC44S803_AT 0x200000
  136. #define MC44S803_AT_S 21
  137. #define MC44S803_MT 0x400000
  138. #define MC44S803_MT_S 22
  139. /* REG_LNAAGC */
  140. #define MC44S803_G 0x3F0
  141. #define MC44S803_G_S 4
  142. #define MC44S803_AT1 0x400
  143. #define MC44S803_AT1_S 10
  144. #define MC44S803_AT2 0x800
  145. #define MC44S803_AT2_S 11
  146. #define MC44S803_HL_GR_EN 0x8000
  147. #define MC44S803_HL_GR_EN_S 15
  148. #define MC44S803_AGC_AN_DIG 0x10000
  149. #define MC44S803_AGC_AN_DIG_S 16
  150. #define MC44S803_ATTEN_EN 0x20000
  151. #define MC44S803_ATTEN_EN_S 17
  152. #define MC44S803_AGC_READ_EN 0x40000
  153. #define MC44S803_AGC_READ_EN_S 18
  154. #define MC44S803_LNA0 0x80000
  155. #define MC44S803_LNA0_S 19
  156. #define MC44S803_AGC_SEL 0x100000
  157. #define MC44S803_AGC_SEL_S 20
  158. #define MC44S803_AT0 0x200000
  159. #define MC44S803_AT0_S 21
  160. #define MC44S803_B 0xC00000
  161. #define MC44S803_B_S 22
  162. /* REG_DATAREG */
  163. #define MC44S803_D 0xF0
  164. #define MC44S803_D_S 4
  165. /* REG_REGTEST */
  166. /* REG_VCOTEST */
  167. /* REG_LNAGAIN */
  168. #define MC44S803_IF_PWR 0x700
  169. #define MC44S803_IF_PWR_S 8
  170. #define MC44S803_RF_PWR 0x3800
  171. #define MC44S803_RF_PWR_S 11
  172. #define MC44S803_LNA_GAIN 0xFC000
  173. #define MC44S803_LNA_GAIN_S 14
  174. /* REG_ID */
  175. #define MC44S803_ID 0x3E00
  176. #define MC44S803_ID_S 9
  177. /* Some macros to read/write fields */
  178. /* First shift, then mask */
  179. #define MC44S803_REG_SM(_val, _reg) \
  180. (((_val) << _reg##_S) & (_reg))
  181. /* First mask, then shift */
  182. #define MC44S803_REG_MS(_val, _reg) \
  183. (((_val) & (_reg)) >> _reg##_S)
  184. struct mc44s803_priv {
  185. struct mc44s803_config *cfg;
  186. struct i2c_adapter *i2c;
  187. struct dvb_frontend *fe;
  188. u32 frequency;
  189. };
  190. #endif