blob: aed539068d2df25ff040ed8712ab2eb296086a03 [file] [log] [blame]
Michael Krufky7b0ac9c2006-01-13 14:10:25 -02001/*
2 * descriptions for simple tuners.
3 */
4
5#ifndef __TUNER_TYPES_H__
6#define __TUNER_TYPES_H__
7
Mauro Carvalho Chehab5057f322015-10-05 11:37:15 -03008/**
9 * enum param_type - type of the tuner pameters
10 *
11 * @TUNER_PARAM_TYPE_RADIO: Tuner params are for FM and/or AM radio
12 * @TUNER_PARAM_TYPE_PAL: Tuner params are for PAL color TV standard
13 * @TUNER_PARAM_TYPE_SECAM: Tuner params are for SECAM color TV standard
14 * @TUNER_PARAM_TYPE_NTSC: Tuner params are for NTSC color TV standard
15 * @TUNER_PARAM_TYPE_DIGITAL: Tuner params are for digital TV
16 */
Michael Krufky7b0ac9c2006-01-13 14:10:25 -020017enum param_type {
Michael Krufky62325492008-04-22 14:45:52 -030018 TUNER_PARAM_TYPE_RADIO,
19 TUNER_PARAM_TYPE_PAL,
20 TUNER_PARAM_TYPE_SECAM,
21 TUNER_PARAM_TYPE_NTSC,
22 TUNER_PARAM_TYPE_DIGITAL,
Michael Krufky7b0ac9c2006-01-13 14:10:25 -020023};
24
Mauro Carvalho Chehab5057f322015-10-05 11:37:15 -030025/**
26 * struct tuner_range - define the frequencies supported by the tuner
27 *
28 * @limit: Max frequency supported by that range, in 62.5 kHz
29 * (TV) or 62.5 Hz (Radio), as defined by
30 * V4L2_TUNER_CAP_LOW.
31 * @config: Value of the band switch byte (BB) to setup this mode.
32 * @cb: Value of the CB byte to setup this mode.
33 *
34 * Please notice that digital tuners like xc3028/xc4000/xc5000 don't use
35 * those ranges, as they're defined inside the driver. This is used by
36 * analog tuners that are compatible with the "Philips way" to setup the
37 * tuners. On those devices, the tuner set is done via 4 bytes:
Mauro Carvalho Chehab89cb3dd2016-07-17 08:44:08 -030038 *
39 * #) divider byte1 (DB1)
40 * #) divider byte 2 (DB2)
41 * #) Control byte (CB)
42 * #) band switch byte (BB)
43 *
Mauro Carvalho Chehab5057f322015-10-05 11:37:15 -030044 * Some tuners also have an additional optional Auxiliary byte (AB).
45 */
Michael Krufky7b0ac9c2006-01-13 14:10:25 -020046struct tuner_range {
47 unsigned short limit;
Michael Krufky3fc46d32006-01-23 17:11:11 -020048 unsigned char config;
Michael Krufky7b0ac9c2006-01-13 14:10:25 -020049 unsigned char cb;
50};
51
Mauro Carvalho Chehab65fc6402015-10-05 10:24:59 -030052/**
53 * struct tuner_params - Parameters to be used to setup the tuner. Those
54 * are used by drivers/media/tuners/tuner-types.c in
55 * order to specify the tuner properties. Most of
56 * the parameters are for tuners based on tda9887 IF-PLL
57 * multi-standard analog TV/Radio demodulator, with is
58 * very common on legacy analog tuners.
59 *
60 * @type: Type of the tuner parameters, as defined at
61 * enum param_type. If the tuner supports multiple
62 * standards, an array should be used, with one
63 * row per different standard.
64 * @cb_first_if_lower_freq: Many Philips-based tuners have a comment in
65 * their datasheet like
66 * "For channel selection involving band
67 * switching, and to ensure smooth tuning to the
68 * desired channel without causing unnecessary
69 * charge pump action, it is recommended to
70 * consider the difference between wanted channel
71 * frequency and the current channel frequency.
72 * Unnecessary charge pump action will result
73 * in very low tuning voltage which may drive the
74 * oscillator to extreme conditions".
75 * Set cb_first_if_lower_freq to 1, if this check
76 * is required for this tuner. I tested this for
77 * PAL by first setting the TV frequency to
78 * 203 MHz and then switching to 96.6 MHz FM
79 * radio. The result was static unless the
80 * control byte was sent first.
81 * @has_tda9887: Set to 1 if this tuner uses a tda9887
82 * @port1_fm_high_sensitivity: Many Philips tuners use tda9887 PORT1 to select
83 * the FM radio sensitivity. If this setting is 1,
84 * then set PORT1 to 1 to get proper FM reception.
85 * @port2_fm_high_sensitivity: Some Philips tuners use tda9887 PORT2 to select
86 * the FM radio sensitivity. If this setting is 1,
87 * then set PORT2 to 1 to get proper FM reception.
88 * @fm_gain_normal: Some Philips tuners use tda9887 cGainNormal to
89 * select the FM radio sensitivity. If this
90 * setting is 1, e register will use cGainNormal
91 * instead of cGainLow.
92 * @intercarrier_mode: Most tuners with a tda9887 use QSS mode.
93 * Some (cheaper) tuners use Intercarrier mode.
94 * If this setting is 1, then the tuner needs to
95 * be set to intercarrier mode.
96 * @port1_active: This setting sets the default value for PORT1.
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 B6 bit.
100 * @port2_active: This setting sets the default value for PORT2.
101 * 0 means inactive, 1 means active. Note: the
102 * actual bit value written to the tda9887 is
103 * inverted. So a 0 here means a 1 in the B7 bit.
104 * @port1_invert_for_secam_lc: Sometimes PORT1 is inverted when the SECAM-L'
105 * standard is selected. Set this bit to 1 if this
106 * is needed.
107 * @port2_invert_for_secam_lc: Sometimes PORT2 is inverted when the SECAM-L'
108 * standard is selected. Set this bit to 1 if this
109 * is needed.
110 * @port1_set_for_fm_mono: Some cards require PORT1 to be 1 for mono Radio
111 * FM and 0 for stereo.
112 * @default_pll_gating_18: Select 18% (or according to datasheet 0%)
113 * L standard PLL gating, vs the driver default
114 * of 36%.
115 * @radio_if: IF to use in radio mode. Tuners with a
116 * separate radio IF filter seem to use 10.7,
117 * while those without use 33.3 for PAL/SECAM
118 * tuners and 41.3 for NTSC tuners.
119 * 0 = 10.7, 1 = 33.3, 2 = 41.3
120 * @default_top_low: Default tda9887 TOP value in dB for the low
121 * band. Default is 0. Range: -16:+15
122 * @default_top_mid: Default tda9887 TOP value in dB for the mid
123 * band. Default is 0. Range: -16:+15
124 * @default_top_high: Default tda9887 TOP value in dB for the high
125 * band. Default is 0. Range: -16:+15
126 * @default_top_secam_low: Default tda9887 TOP value in dB for SECAM-L/L'
127 * for the low 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_mid: Default tda9887 TOP value in dB for SECAM-L/L'
131 * for the mid band. Default is 0. Several tuners
132 * require a different TOP value for the
133 * SECAM-L/L' standards. Range: -16:+15
134 * @default_top_secam_high: Default tda9887 TOP value in dB for SECAM-L/L'
135 * for the high band. Default is 0. Several tuners
136 * require a different TOP value for the
137 * SECAM-L/L' standards. Range: -16:+15
138 * @iffreq: Intermediate frequency (IF) used by the tuner
139 * on digital mode.
140 * @count: Size of the ranges array.
141 * @ranges: Array with the frequency ranges supported by
142 * the tuner.
143 */
Michael Krufky7b0ac9c2006-01-13 14:10:25 -0200144struct tuner_params {
145 enum param_type type;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300146
Hans Verkuil27487d42006-01-15 15:04:52 -0200147 unsigned int cb_first_if_lower_freq:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300148 unsigned int has_tda9887:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300149 unsigned int port1_fm_high_sensitivity:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300150 unsigned int port2_fm_high_sensitivity:1;
Mauro Carvalho Chehab483deb02006-12-04 08:31:38 -0300151 unsigned int fm_gain_normal:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300152 unsigned int intercarrier_mode:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300153 unsigned int port1_active:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300154 unsigned int port2_active:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300155 unsigned int port1_invert_for_secam_lc:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300156 unsigned int port2_invert_for_secam_lc:1;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300157 unsigned int port1_set_for_fm_mono:1;
Trent Piephod7304de2006-08-24 22:43:45 -0300158 unsigned int default_pll_gating_18:1;
Trent Piepho5e082f12007-08-03 18:32:38 -0300159 unsigned int radio_if:2;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300160 signed int default_top_low:5;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300161 signed int default_top_mid:5;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300162 signed int default_top_high:5;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300163 signed int default_top_secam_low:5;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300164 signed int default_top_secam_mid:5;
Hans Verkuilba8fc392006-06-25 15:34:39 -0300165 signed int default_top_secam_high:5;
166
Michael Krufky62325492008-04-22 14:45:52 -0300167 u16 iffreq;
Michael Krufky7b0ac9c2006-01-13 14:10:25 -0200168
169 unsigned int count;
170 struct tuner_range *ranges;
171};
172
173struct tunertype {
174 char *name;
Michael Krufkybbab6fd2006-02-06 09:15:11 -0200175 unsigned int count;
Michael Krufky7b0ac9c2006-01-13 14:10:25 -0200176 struct tuner_params *params;
Michael Krufky62325492008-04-22 14:45:52 -0300177
178 u16 min;
179 u16 max;
Michael Krufky23a88102008-04-22 14:45:53 -0300180 u32 stepsize;
Michael Krufky6f4a5722008-04-22 14:45:53 -0300181
182 u8 *initdata;
183 u8 *sleepdata;
Michael Krufky7b0ac9c2006-01-13 14:10:25 -0200184};
185
186extern struct tunertype tuners[];
187extern unsigned const int tuner_count;
188
189#endif