aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2006-02-07 03:25:33 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 03:25:33 -0500
commit5f5941872c0035cb4624efe8c5a1dfbb89d199e7 (patch)
tree0283d55a9bf202bead411201e3563df54ff54638 /drivers/media
parenta78d0bfabda67dd40a5a97ba4c24265e1820e7ea (diff)
V4L/DVB (3268): Move video std detection to top of set_tv_freq function
- move video std detection to top of set_tv_freq function - we must detect video std first, so that we can choose the correct tuner_params Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tuner-simple.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 6f0d376f0d18..907ea8c5d9b3 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -142,6 +142,29 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
142 tun = &tuners[t->type]; 142 tun = &tuners[t->type];
143 j = TUNER_PARAM_ANALOG; 143 j = TUNER_PARAM_ANALOG;
144 144
145 /* IFPCoff = Video Intermediate Frequency - Vif:
146 940 =16*58.75 NTSC/J (Japan)
147 732 =16*45.75 M/N STD
148 704 =16*44 ATSC (at DVB code)
149 632 =16*39.50 I U.K.
150 622.4=16*38.90 B/G D/K I, L STD
151 592 =16*37.00 D China
152 590 =16.36.875 B Australia
153 543.2=16*33.95 L' STD
154 171.2=16*10.70 FM Radio (at set_radio_freq)
155 */
156
157 if (t->std == V4L2_STD_NTSC_M_JP) {
158 IFPCoff = 940;
159 } else if ((t->std & V4L2_STD_MN) &&
160 !(t->std & ~V4L2_STD_MN)) {
161 IFPCoff = 732;
162 } else if (t->std == V4L2_STD_SECAM_LC) {
163 IFPCoff = 543;
164 } else {
165 IFPCoff = 623;
166 }
167
145 for (i = 0; i < tun->params[j].count; i++) { 168 for (i = 0; i < tun->params[j].count; i++) {
146 if (freq > tun->params[j].ranges[i].limit) 169 if (freq > tun->params[j].ranges[i].limit)
147 continue; 170 continue;
@@ -154,11 +177,19 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
154 } 177 }
155 config = tun->params[j].ranges[i].config; 178 config = tun->params[j].ranges[i].config;
156 cb = tun->params[j].ranges[i].cb; 179 cb = tun->params[j].ranges[i].cb;
157 /* i == 0 -> VHF_LO */ 180 /* i == 0 -> VHF_LO
158 /* i == 1 -> VHF_HI */ 181 * i == 1 -> VHF_HI
159 /* i == 2 -> UHF */ 182 * i == 2 -> UHF */
160 tuner_dbg("tv: range %d\n",i); 183 tuner_dbg("tv: range %d\n",i);
161 184
185 div=freq + IFPCoff + offset;
186
187 tuner_dbg("Freq= %d.%02d MHz, V_IF=%d.%02d MHz, Offset=%d.%02d MHz, div=%0d\n",
188 freq / 16, freq % 16 * 100 / 16,
189 IFPCoff / 16, IFPCoff % 16 * 100 / 16,
190 offset / 16, offset % 16 * 100 / 16,
191 div);
192
162 /* tv norm specific stuff for multi-norm tuners */ 193 /* tv norm specific stuff for multi-norm tuners */
163 switch (t->type) { 194 switch (t->type) {
164 case TUNER_PHILIPS_SECAM: // FI1216MF 195 case TUNER_PHILIPS_SECAM: // FI1216MF
@@ -245,37 +276,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
245 break; 276 break;
246 } 277 }
247 278
248 /* IFPCoff = Video Intermediate Frequency - Vif:
249 940 =16*58.75 NTSC/J (Japan)
250 732 =16*45.75 M/N STD
251 704 =16*44 ATSC (at DVB code)
252 632 =16*39.50 I U.K.
253 622.4=16*38.90 B/G D/K I, L STD
254 592 =16*37.00 D China
255 590 =16.36.875 B Australia
256 543.2=16*33.95 L' STD
257 171.2=16*10.70 FM Radio (at set_radio_freq)
258 */
259
260 if (t->std == V4L2_STD_NTSC_M_JP) {
261 IFPCoff = 940;
262 } else if ((t->std & V4L2_STD_MN) &&
263 !(t->std & ~V4L2_STD_MN)) {
264 IFPCoff = 732;
265 } else if (t->std == V4L2_STD_SECAM_LC) {
266 IFPCoff = 543;
267 } else {
268 IFPCoff = 623;
269 }
270
271 div=freq + IFPCoff + offset;
272
273 tuner_dbg("Freq= %d.%02d MHz, V_IF=%d.%02d MHz, Offset=%d.%02d MHz, div=%0d\n",
274 freq / 16, freq % 16 * 100 / 16,
275 IFPCoff / 16, IFPCoff % 16 * 100 / 16,
276 offset / 16, offset % 16 * 100 / 16,
277 div);
278
279 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { 279 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
280 buffer[0] = config; 280 buffer[0] = config;
281 buffer[1] = cb; 281 buffer[1] = cb;