tuner-types.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * descriptions for simple tuners.
  3. */
  4. #ifndef __TUNER_TYPES_H__
  5. #define __TUNER_TYPES_H__
  6. /**
  7. * enum param_type - type of the tuner pameters
  8. *
  9. * @TUNER_PARAM_TYPE_RADIO: Tuner params are for FM and/or AM radio
  10. * @TUNER_PARAM_TYPE_PAL: Tuner params are for PAL color TV standard
  11. * @TUNER_PARAM_TYPE_SECAM: Tuner params are for SECAM color TV standard
  12. * @TUNER_PARAM_TYPE_NTSC: Tuner params are for NTSC color TV standard
  13. * @TUNER_PARAM_TYPE_DIGITAL: Tuner params are for digital TV
  14. */
  15. enum param_type {
  16. TUNER_PARAM_TYPE_RADIO,
  17. TUNER_PARAM_TYPE_PAL,
  18. TUNER_PARAM_TYPE_SECAM,
  19. TUNER_PARAM_TYPE_NTSC,
  20. TUNER_PARAM_TYPE_DIGITAL,
  21. };
  22. /**
  23. * struct tuner_range - define the frequencies supported by the tuner
  24. *
  25. * @limit: Max frequency supported by that range, in 62.5 kHz
  26. * (TV) or 62.5 Hz (Radio), as defined by
  27. * V4L2_TUNER_CAP_LOW.
  28. * @config: Value of the band switch byte (BB) to setup this mode.
  29. * @cb: Value of the CB byte to setup this mode.
  30. *
  31. * Please notice that digital tuners like xc3028/xc4000/xc5000 don't use
  32. * those ranges, as they're defined inside the driver. This is used by
  33. * analog tuners that are compatible with the "Philips way" to setup the
  34. * tuners. On those devices, the tuner set is done via 4 bytes:
  35. *
  36. * #) divider byte1 (DB1)
  37. * #) divider byte 2 (DB2)
  38. * #) Control byte (CB)
  39. * #) band switch byte (BB)
  40. *
  41. * Some tuners also have an additional optional Auxiliary byte (AB).
  42. */
  43. struct tuner_range {
  44. unsigned short limit;
  45. unsigned char config;
  46. unsigned char cb;
  47. };
  48. /**
  49. * struct tuner_params - Parameters to be used to setup the tuner. Those
  50. * are used by drivers/media/tuners/tuner-types.c in
  51. * order to specify the tuner properties. Most of
  52. * the parameters are for tuners based on tda9887 IF-PLL
  53. * multi-standard analog TV/Radio demodulator, with is
  54. * very common on legacy analog tuners.
  55. *
  56. * @type: Type of the tuner parameters, as defined at
  57. * enum param_type. If the tuner supports multiple
  58. * standards, an array should be used, with one
  59. * row per different standard.
  60. * @cb_first_if_lower_freq: Many Philips-based tuners have a comment in
  61. * their datasheet like
  62. * "For channel selection involving band
  63. * switching, and to ensure smooth tuning to the
  64. * desired channel without causing unnecessary
  65. * charge pump action, it is recommended to
  66. * consider the difference between wanted channel
  67. * frequency and the current channel frequency.
  68. * Unnecessary charge pump action will result
  69. * in very low tuning voltage which may drive the
  70. * oscillator to extreme conditions".
  71. * Set cb_first_if_lower_freq to 1, if this check
  72. * is required for this tuner. I tested this for
  73. * PAL by first setting the TV frequency to
  74. * 203 MHz and then switching to 96.6 MHz FM
  75. * radio. The result was static unless the
  76. * control byte was sent first.
  77. * @has_tda9887: Set to 1 if this tuner uses a tda9887
  78. * @port1_fm_high_sensitivity: Many Philips tuners use tda9887 PORT1 to select
  79. * the FM radio sensitivity. If this setting is 1,
  80. * then set PORT1 to 1 to get proper FM reception.
  81. * @port2_fm_high_sensitivity: Some Philips tuners use tda9887 PORT2 to select
  82. * the FM radio sensitivity. If this setting is 1,
  83. * then set PORT2 to 1 to get proper FM reception.
  84. * @fm_gain_normal: Some Philips tuners use tda9887 cGainNormal to
  85. * select the FM radio sensitivity. If this
  86. * setting is 1, e register will use cGainNormal
  87. * instead of cGainLow.
  88. * @intercarrier_mode: Most tuners with a tda9887 use QSS mode.
  89. * Some (cheaper) tuners use Intercarrier mode.
  90. * If this setting is 1, then the tuner needs to
  91. * be set to intercarrier mode.
  92. * @port1_active: This setting sets the default value for PORT1.
  93. * 0 means inactive, 1 means active. Note: the
  94. * actual bit value written to the tda9887 is
  95. * inverted. So a 0 here means a 1 in the B6 bit.
  96. * @port2_active: This setting sets the default value for PORT2.
  97. * 0 means inactive, 1 means active. Note: the
  98. * actual bit value written to the tda9887 is
  99. * inverted. So a 0 here means a 1 in the B7 bit.
  100. * @port1_invert_for_secam_lc: Sometimes PORT1 is inverted when the SECAM-L'
  101. * standard is selected. Set this bit to 1 if this
  102. * is needed.
  103. * @port2_invert_for_secam_lc: Sometimes PORT2 is inverted when the SECAM-L'
  104. * standard is selected. Set this bit to 1 if this
  105. * is needed.
  106. * @port1_set_for_fm_mono: Some cards require PORT1 to be 1 for mono Radio
  107. * FM and 0 for stereo.
  108. * @default_pll_gating_18: Select 18% (or according to datasheet 0%)
  109. * L standard PLL gating, vs the driver default
  110. * of 36%.
  111. * @radio_if: IF to use in radio mode. Tuners with a
  112. * separate radio IF filter seem to use 10.7,
  113. * while those without use 33.3 for PAL/SECAM
  114. * tuners and 41.3 for NTSC tuners.
  115. * 0 = 10.7, 1 = 33.3, 2 = 41.3
  116. * @default_top_low: Default tda9887 TOP value in dB for the low
  117. * band. Default is 0. Range: -16:+15
  118. * @default_top_mid: Default tda9887 TOP value in dB for the mid
  119. * band. Default is 0. Range: -16:+15
  120. * @default_top_high: Default tda9887 TOP value in dB for the high
  121. * band. Default is 0. Range: -16:+15
  122. * @default_top_secam_low: Default tda9887 TOP value in dB for SECAM-L/L'
  123. * for the low band. Default is 0. Several tuners
  124. * require a different TOP value for the
  125. * SECAM-L/L' standards. Range: -16:+15
  126. * @default_top_secam_mid: Default tda9887 TOP value in dB for SECAM-L/L'
  127. * for the mid band. Default is 0. Several tuners
  128. * require a different TOP value for the
  129. * SECAM-L/L' standards. Range: -16:+15
  130. * @default_top_secam_high: Default tda9887 TOP value in dB for SECAM-L/L'
  131. * for the high band. Default is 0. Several tuners
  132. * require a different TOP value for the
  133. * SECAM-L/L' standards. Range: -16:+15
  134. * @iffreq: Intermediate frequency (IF) used by the tuner
  135. * on digital mode.
  136. * @count: Size of the ranges array.
  137. * @ranges: Array with the frequency ranges supported by
  138. * the tuner.
  139. */
  140. struct tuner_params {
  141. enum param_type type;
  142. unsigned int cb_first_if_lower_freq:1;
  143. unsigned int has_tda9887:1;
  144. unsigned int port1_fm_high_sensitivity:1;
  145. unsigned int port2_fm_high_sensitivity:1;
  146. unsigned int fm_gain_normal:1;
  147. unsigned int intercarrier_mode:1;
  148. unsigned int port1_active:1;
  149. unsigned int port2_active:1;
  150. unsigned int port1_invert_for_secam_lc:1;
  151. unsigned int port2_invert_for_secam_lc:1;
  152. unsigned int port1_set_for_fm_mono:1;
  153. unsigned int default_pll_gating_18:1;
  154. unsigned int radio_if:2;
  155. signed int default_top_low:5;
  156. signed int default_top_mid:5;
  157. signed int default_top_high:5;
  158. signed int default_top_secam_low:5;
  159. signed int default_top_secam_mid:5;
  160. signed int default_top_secam_high:5;
  161. u16 iffreq;
  162. unsigned int count;
  163. struct tuner_range *ranges;
  164. };
  165. struct tunertype {
  166. char *name;
  167. unsigned int count;
  168. struct tuner_params *params;
  169. u16 min;
  170. u16 max;
  171. u32 stepsize;
  172. u8 *initdata;
  173. u8 *sleepdata;
  174. };
  175. extern struct tunertype tuners[];
  176. extern unsigned const int tuner_count;
  177. #endif