tuner-types.h 6.9 KB

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