]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/media/tuner-types.h
UBUNTU: Start new release
[mirror_ubuntu-zesty-kernel.git] / include / media / tuner-types.h
CommitLineData
7b0ac9cd
MK
1/*
2 * descriptions for simple tuners.
3 */
4
5#ifndef __TUNER_TYPES_H__
6#define __TUNER_TYPES_H__
7
5057f326
MCC
8/**
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 */
7b0ac9cd 17enum param_type {
62325497
MK
18 TUNER_PARAM_TYPE_RADIO,
19 TUNER_PARAM_TYPE_PAL,
20 TUNER_PARAM_TYPE_SECAM,
21 TUNER_PARAM_TYPE_NTSC,
22 TUNER_PARAM_TYPE_DIGITAL,
7b0ac9cd
MK
23};
24
5057f326
MCC
25/**
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:
89cb3ddb
MCC
38 *
39 * #) divider byte1 (DB1)
40 * #) divider byte 2 (DB2)
41 * #) Control byte (CB)
42 * #) band switch byte (BB)
43 *
5057f326
MCC
44 * Some tuners also have an additional optional Auxiliary byte (AB).
45 */
7b0ac9cd
MK
46struct tuner_range {
47 unsigned short limit;
3fc46d35 48 unsigned char config;
7b0ac9cd
MK
49 unsigned char cb;
50};
51
65fc6409
MCC
52/**
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 */
7b0ac9cd
MK
144struct tuner_params {
145 enum param_type type;
ba8fc399 146
27487d44 147 unsigned int cb_first_if_lower_freq:1;
ba8fc399 148 unsigned int has_tda9887:1;
ba8fc399 149 unsigned int port1_fm_high_sensitivity:1;
ba8fc399 150 unsigned int port2_fm_high_sensitivity:1;
483deb0f 151 unsigned int fm_gain_normal:1;
ba8fc399 152 unsigned int intercarrier_mode:1;
ba8fc399 153 unsigned int port1_active:1;
ba8fc399 154 unsigned int port2_active:1;
ba8fc399 155 unsigned int port1_invert_for_secam_lc:1;
ba8fc399 156 unsigned int port2_invert_for_secam_lc:1;
ba8fc399 157 unsigned int port1_set_for_fm_mono:1;
d7304dee 158 unsigned int default_pll_gating_18:1;
5e082f15 159 unsigned int radio_if:2;
ba8fc399 160 signed int default_top_low:5;
ba8fc399 161 signed int default_top_mid:5;
ba8fc399 162 signed int default_top_high:5;
ba8fc399 163 signed int default_top_secam_low:5;
ba8fc399 164 signed int default_top_secam_mid:5;
ba8fc399
HV
165 signed int default_top_secam_high:5;
166
62325497 167 u16 iffreq;
7b0ac9cd
MK
168
169 unsigned int count;
170 struct tuner_range *ranges;
171};
172
173struct tunertype {
174 char *name;
bbab6fd8 175 unsigned int count;
7b0ac9cd 176 struct tuner_params *params;
62325497
MK
177
178 u16 min;
179 u16 max;
23a88108 180 u32 stepsize;
6f4a5729
MK
181
182 u8 *initdata;
183 u8 *sleepdata;
7b0ac9cd
MK
184};
185
186extern struct tunertype tuners[];
187extern unsigned const int tuner_count;
188
189#endif