aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r--drivers/media/video/tuner-simple.c794
1 files changed, 47 insertions, 747 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index e5fb74365836..37977ff49780 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -79,722 +79,16 @@ MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner");
79#define TUNER_PLL_LOCKED 0x40 79#define TUNER_PLL_LOCKED 0x40
80#define TUNER_STEREO_MK3 0x04 80#define TUNER_STEREO_MK3 0x04
81 81
82#define TUNER_MAX_RANGES 3 82#define TUNER_PARAM_ANALOG 0 /* to be removed */
83 83/* FIXME:
84/* ---------------------------------------------------------------------- */ 84 * Right now, all tuners are using the first tuner_params[] array element
85 85 * for analog mode. In the future, we will be merging similar tuner
86struct tunertype 86 * definitions together, such that each tuner definition will have a
87{ 87 * tuner_params struct for each available video standard. At that point,
88 char *name; 88 * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array
89 89 * element will be chosen based on the video standard in use.
90 int count; 90 *
91 struct {
92 unsigned short thresh;
93 unsigned char cb;
94 } ranges[TUNER_MAX_RANGES];
95 unsigned char config;
96};
97
98/*
99 * The floats in the tuner struct are computed at compile time
100 * by gcc and cast back to integers. Thus we don't violate the
101 * "no float in kernel" rule.
102 */ 91 */
103static struct tunertype tuners[] = {
104 /* 0-9 */
105 [TUNER_TEMIC_PAL] = { /* TEMIC PAL */
106 .name = "Temic PAL (4002 FH5)",
107 .count = 3,
108 .ranges = {
109 { 16 * 140.25 /*MHz*/, 0x02, },
110 { 16 * 463.25 /*MHz*/, 0x04, },
111 { 16 * 999.99 , 0x01, },
112 },
113 .config = 0x8e,
114 },
115 [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
116 .name = "Philips PAL_I (FI1246 and compatibles)",
117 .count = 3,
118 .ranges = {
119 { 16 * 140.25 /*MHz*/, 0xa0, },
120 { 16 * 463.25 /*MHz*/, 0x90, },
121 { 16 * 999.99 , 0x30, },
122 },
123 .config = 0x8e,
124 },
125 [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
126 .name = "Philips NTSC (FI1236,FM1236 and compatibles)",
127 .count = 3,
128 .ranges = {
129 { 16 * 157.25 /*MHz*/, 0xa0, },
130 { 16 * 451.25 /*MHz*/, 0x90, },
131 { 16 * 999.99 , 0x30, },
132 },
133 .config = 0x8e,
134 },
135 [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
136 .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
137 .count = 3,
138 .ranges = {
139 { 16 * 168.25 /*MHz*/, 0xa7, },
140 { 16 * 447.25 /*MHz*/, 0x97, },
141 { 16 * 999.99 , 0x37, },
142 },
143 .config = 0x8e,
144 },
145 [TUNER_ABSENT] = { /* Tuner Absent */
146 .name = "NoTuner",
147 .count = 1,
148 .ranges = {
149 { 0, 0x00, },
150 },
151 .config = 0x00,
152 },
153 [TUNER_PHILIPS_PAL] = { /* Philips PAL */
154 .name = "Philips PAL_BG (FI1216 and compatibles)",
155 .count = 3,
156 .ranges = {
157 { 16 * 168.25 /*MHz*/, 0xa0, },
158 { 16 * 447.25 /*MHz*/, 0x90, },
159 { 16 * 999.99 , 0x30, },
160 },
161 .config = 0x8e,
162 },
163 [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
164 .name = "Temic NTSC (4032 FY5)",
165 .count = 3,
166 .ranges = {
167 { 16 * 157.25 /*MHz*/, 0x02, },
168 { 16 * 463.25 /*MHz*/, 0x04, },
169 { 16 * 999.99 , 0x01, },
170 },
171 .config = 0x8e,
172 },
173 [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
174 .name = "Temic PAL_I (4062 FY5)",
175 .count = 3,
176 .ranges = {
177 { 16 * 170.00 /*MHz*/, 0x02, },
178 { 16 * 450.00 /*MHz*/, 0x04, },
179 { 16 * 999.99 , 0x01, },
180 },
181 .config = 0x8e,
182 },
183 [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
184 .name = "Temic NTSC (4036 FY5)",
185 .count = 3,
186 .ranges = {
187 { 16 * 157.25 /*MHz*/, 0xa0, },
188 { 16 * 463.25 /*MHz*/, 0x90, },
189 { 16 * 999.99 , 0x30, },
190 },
191 .config = 0x8e,
192 },
193 [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
194 .name = "Alps HSBH1",
195 .count = 3,
196 .ranges = {
197 { 16 * 137.25 /*MHz*/, 0x01, },
198 { 16 * 385.25 /*MHz*/, 0x02, },
199 { 16 * 999.99 , 0x08, },
200 },
201 .config = 0x8e,
202 },
203
204 /* 10-19 */
205 [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
206 .name = "Alps TSBE1",
207 .count = 3,
208 .ranges = {
209 { 16 * 137.25 /*MHz*/, 0x01, },
210 { 16 * 385.25 /*MHz*/, 0x02, },
211 { 16 * 999.99 , 0x08, },
212 },
213 .config = 0x8e,
214 },
215 [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
216 .name = "Alps TSBB5",
217 .count = 3,
218 .ranges = {
219 { 16 * 133.25 /*MHz*/, 0x01, },
220 { 16 * 351.25 /*MHz*/, 0x02, },
221 { 16 * 999.99 , 0x08, },
222 },
223 .config = 0x8e,
224 },
225 [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
226 .name = "Alps TSBE5",
227 .count = 3,
228 .ranges = {
229 { 16 * 133.25 /*MHz*/, 0x01, },
230 { 16 * 351.25 /*MHz*/, 0x02, },
231 { 16 * 999.99 , 0x08, },
232 },
233 .config = 0x8e,
234 },
235 [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
236 .name = "Alps TSBC5",
237 .count = 3,
238 .ranges = {
239 { 16 * 133.25 /*MHz*/, 0x01, },
240 { 16 * 351.25 /*MHz*/, 0x02, },
241 { 16 * 999.99 , 0x08, },
242 },
243 .config = 0x8e,
244 },
245 [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
246 .name = "Temic PAL_BG (4006FH5)",
247 .count = 3,
248 .ranges = {
249 { 16 * 170.00 /*MHz*/, 0xa0, },
250 { 16 * 450.00 /*MHz*/, 0x90, },
251 { 16 * 999.99 , 0x30, },
252 },
253 .config = 0x8e,
254 },
255 [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
256 .name = "Alps TSCH6",
257 .count = 3,
258 .ranges = {
259 { 16 * 137.25 /*MHz*/, 0x14, },
260 { 16 * 385.25 /*MHz*/, 0x12, },
261 { 16 * 999.99 , 0x11, },
262 },
263 .config = 0x8e,
264 },
265 [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
266 .name = "Temic PAL_DK (4016 FY5)",
267 .count = 3,
268 .ranges = {
269 { 16 * 168.25 /*MHz*/, 0xa0, },
270 { 16 * 456.25 /*MHz*/, 0x90, },
271 { 16 * 999.99 , 0x30, },
272 },
273 .config = 0x8e,
274 },
275 [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
276 .name = "Philips NTSC_M (MK2)",
277 .count = 3,
278 .ranges = {
279 { 16 * 160.00 /*MHz*/, 0xa0, },
280 { 16 * 454.00 /*MHz*/, 0x90, },
281 { 16 * 999.99 , 0x30, },
282 },
283 .config = 0x8e,
284 },
285 [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
286 .name = "Temic PAL_I (4066 FY5)",
287 .count = 3,
288 .ranges = {
289 { 16 * 169.00 /*MHz*/, 0xa0, },
290 { 16 * 454.00 /*MHz*/, 0x90, },
291 { 16 * 999.99 , 0x30, },
292 },
293 .config = 0x8e,
294 },
295 [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
296 .name = "Temic PAL* auto (4006 FN5)",
297 .count = 3,
298 .ranges = {
299 { 16 * 169.00 /*MHz*/, 0xa0, },
300 { 16 * 454.00 /*MHz*/, 0x90, },
301 { 16 * 999.99 , 0x30, },
302 },
303 .config = 0x8e,
304 },
305
306 /* 20-29 */
307 [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
308 .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
309 .count = 3,
310 .ranges = {
311 { 16 * 141.00 /*MHz*/, 0xa0, },
312 { 16 * 464.00 /*MHz*/, 0x90, },
313 { 16 * 999.99 , 0x30, },
314 },
315 .config = 0x8e,
316 },
317 [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
318 .name = "Temic NTSC (4039 FR5)",
319 .count = 3,
320 .ranges = {
321 { 16 * 158.00 /*MHz*/, 0xa0, },
322 { 16 * 453.00 /*MHz*/, 0x90, },
323 { 16 * 999.99 , 0x30, },
324 },
325 .config = 0x8e,
326 },
327 [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
328 .name = "Temic PAL/SECAM multi (4046 FM5)",
329 .count = 3,
330 .ranges = {
331 { 16 * 169.00 /*MHz*/, 0xa0, },
332 { 16 * 454.00 /*MHz*/, 0x90, },
333 { 16 * 999.99 , 0x30, },
334 },
335 .config = 0x8e,
336 },
337 [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
338 .name = "Philips PAL_DK (FI1256 and compatibles)",
339 .count = 3,
340 .ranges = {
341 { 16 * 170.00 /*MHz*/, 0xa0, },
342 { 16 * 450.00 /*MHz*/, 0x90, },
343 { 16 * 999.99 , 0x30, },
344 },
345 .config = 0x8e,
346 },
347 [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
348 .name = "Philips PAL/SECAM multi (FQ1216ME)",
349 .count = 3,
350 .ranges = {
351 { 16 * 170.00 /*MHz*/, 0xa0, },
352 { 16 * 450.00 /*MHz*/, 0x90, },
353 { 16 * 999.99 , 0x30, },
354 },
355 .config = 0x8e,
356 },
357 [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
358 .name = "LG PAL_I+FM (TAPC-I001D)",
359 .count = 3,
360 .ranges = {
361 { 16 * 170.00 /*MHz*/, 0xa0, },
362 { 16 * 450.00 /*MHz*/, 0x90, },
363 { 16 * 999.99 , 0x30, },
364 },
365 .config = 0x8e,
366 },
367 [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
368 .name = "LG PAL_I (TAPC-I701D)",
369 .count = 3,
370 .ranges = {
371 { 16 * 170.00 /*MHz*/, 0xa0, },
372 { 16 * 450.00 /*MHz*/, 0x90, },
373 { 16 * 999.99 , 0x30, },
374 },
375 .config = 0x8e,
376 },
377 [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
378 .name = "LG NTSC+FM (TPI8NSR01F)",
379 .count = 3,
380 .ranges = {
381 { 16 * 210.00 /*MHz*/, 0xa0, },
382 { 16 * 497.00 /*MHz*/, 0x90, },
383 { 16 * 999.99 , 0x30, },
384 },
385 .config = 0x8e,
386 },
387 [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
388 .name = "LG PAL_BG+FM (TPI8PSB01D)",
389 .count = 3,
390 .ranges = {
391 { 16 * 170.00 /*MHz*/, 0xa0, },
392 { 16 * 450.00 /*MHz*/, 0x90, },
393 { 16 * 999.99 , 0x30, },
394 },
395 .config = 0x8e,
396 },
397 [TUNER_LG_PAL] = { /* LGINNOTEK PAL */
398 .name = "LG PAL_BG (TPI8PSB11D)",
399 .count = 3,
400 .ranges = {
401 { 16 * 170.00 /*MHz*/, 0xa0, },
402 { 16 * 450.00 /*MHz*/, 0x90, },
403 { 16 * 999.99 , 0x30, },
404 },
405 .config = 0x8e,
406 },
407
408 /* 30-39 */
409 [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
410 .name = "Temic PAL* auto + FM (4009 FN5)",
411 .count = 3,
412 .ranges = {
413 { 16 * 141.00 /*MHz*/, 0xa0, },
414 { 16 * 464.00 /*MHz*/, 0x90, },
415 { 16 * 999.99 , 0x30, },
416 },
417 .config = 0x8e,
418 },
419 [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
420 .name = "SHARP NTSC_JP (2U5JF5540)",
421 .count = 3,
422 .ranges = {
423 { 16 * 137.25 /*MHz*/, 0x01, },
424 { 16 * 317.25 /*MHz*/, 0x02, },
425 { 16 * 999.99 , 0x08, },
426 },
427 .config = 0x8e,
428 },
429 [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
430 .name = "Samsung PAL TCPM9091PD27",
431 .count = 3,
432 .ranges = {
433 { 16 * 169 /*MHz*/, 0xa0, },
434 { 16 * 464 /*MHz*/, 0x90, },
435 { 16 * 999.99 , 0x30, },
436 },
437 .config = 0x8e,
438 },
439 [TUNER_MT2032] = { /* Microtune PAL|NTSC */
440 .name = "MT20xx universal",
441 /* see mt20xx.c for details */ },
442 [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
443 .name = "Temic PAL_BG (4106 FH5)",
444 .count = 3,
445 .ranges = {
446 { 16 * 141.00 /*MHz*/, 0xa0, },
447 { 16 * 464.00 /*MHz*/, 0x90, },
448 { 16 * 999.99 , 0x30, },
449 },
450 .config = 0x8e,
451 },
452 [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
453 .name = "Temic PAL_DK/SECAM_L (4012 FY5)",
454 .count = 3,
455 .ranges = {
456 { 16 * 140.25 /*MHz*/, 0x02, },
457 { 16 * 463.25 /*MHz*/, 0x04, },
458 { 16 * 999.99 , 0x01, },
459 },
460 .config = 0x8e,
461 },
462 [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
463 .name = "Temic NTSC (4136 FY5)",
464 .count = 3,
465 .ranges = {
466 { 16 * 158.00 /*MHz*/, 0xa0, },
467 { 16 * 453.00 /*MHz*/, 0x90, },
468 { 16 * 999.99 , 0x30, },
469 },
470 .config = 0x8e,
471 },
472 [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
473 .name = "LG PAL (newer TAPC series)",
474 .count = 3,
475 .ranges = {
476 { 16 * 170.00 /*MHz*/, 0x01, },
477 { 16 * 450.00 /*MHz*/, 0x02, },
478 { 16 * 999.99 , 0x08, },
479 },
480 .config = 0x8e,
481 },
482 [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
483 .name = "Philips PAL/SECAM multi (FM1216ME MK3)",
484 .count = 3,
485 .ranges = {
486 { 16 * 158.00 /*MHz*/, 0x01, },
487 { 16 * 442.00 /*MHz*/, 0x02, },
488 { 16 * 999.99 , 0x04, },
489 },
490 .config = 0x8e,
491 },
492 [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
493 .name = "LG NTSC (newer TAPC series)",
494 .count = 3,
495 .ranges = {
496 { 16 * 170.00 /*MHz*/, 0x01, },
497 { 16 * 450.00 /*MHz*/, 0x02, },
498 { 16 * 999.99 , 0x08, },
499 },
500 .config = 0x8e,
501 },
502
503 /* 40-49 */
504 [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
505 .name = "HITACHI V7-J180AT",
506 .count = 3,
507 .ranges = {
508 { 16 * 170.00 /*MHz*/, 0x01, },
509 { 16 * 450.00 /*MHz*/, 0x02, },
510 { 16 * 999.99 , 0x08, },
511 },
512 .config = 0x8e,
513 },
514 [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
515 .name = "Philips PAL_MK (FI1216 MK)",
516 .count = 3,
517 .ranges = {
518 { 16 * 140.25 /*MHz*/, 0x01, },
519 { 16 * 463.25 /*MHz*/, 0xc2, },
520 { 16 * 999.99 , 0xcf, },
521 },
522 .config = 0x8e,
523 },
524 [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
525 .name = "Philips 1236D ATSC/NTSC dual in",
526 .count = 3,
527 .ranges = {
528 { 16 * 157.25 /*MHz*/, 0xa0, },
529 { 16 * 454.00 /*MHz*/, 0x90, },
530 { 16 * 999.99 , 0x30, },
531 },
532 .config = 0x8e,
533 },
534 [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
535 .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
536 .count = 3,
537 .ranges = {
538 { 16 * 160.00 /*MHz*/, 0x01, },
539 { 16 * 442.00 /*MHz*/, 0x02, },
540 { 16 * 999.99 , 0x04, },
541 },
542 .config = 0x8e,
543 },
544 [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
545 .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
546 .count = 3,
547 .ranges = {
548 { 16 * 160.00 /*MHz*/, 0x01, },
549 { 16 * 442.00 /*MHz*/, 0x02, },
550 { 16 * 999.99 , 0x04, },
551 },
552 .config = 0x8e,
553 },
554 [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
555 .name = "Microtune 4049 FM5",
556 .count = 3,
557 .ranges = {
558 { 16 * 141.00 /*MHz*/, 0xa0, },
559 { 16 * 464.00 /*MHz*/, 0x90, },
560 { 16 * 999.99 , 0x30, },
561 },
562 .config = 0x8e,
563 },
564 [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
565 .name = "Panasonic VP27s/ENGE4324D",
566 .count = 3,
567 .ranges = {
568 { 16 * 160.00 /*MHz*/, 0x01, },
569 { 16 * 454.00 /*MHz*/, 0x02, },
570 { 16 * 999.99 , 0x08, },
571 },
572 .config = 0xce,
573 },
574 [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
575 .name = "LG NTSC (TAPE series)",
576 .count = 3,
577 .ranges = {
578 { 16 * 160.00 /*MHz*/, 0x01, },
579 { 16 * 442.00 /*MHz*/, 0x02, },
580 { 16 * 999.99 , 0x04, },
581 },
582 .config = 0x8e,
583 },
584 [TUNER_TNF_8831BGFF] = { /* Philips PAL */
585 .name = "Tenna TNF 8831 BGFF)",
586 .count = 3,
587 .ranges = {
588 { 16 * 161.25 /*MHz*/, 0xa0, },
589 { 16 * 463.25 /*MHz*/, 0x90, },
590 { 16 * 999.99 , 0x30, },
591 },
592 .config = 0x8e,
593 },
594 [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
595 .name = "Microtune 4042 FI5 ATSC/NTSC dual in",
596 .count = 3,
597 .ranges = {
598 { 16 * 162.00 /*MHz*/, 0xa2, },
599 { 16 * 457.00 /*MHz*/, 0x94, },
600 { 16 * 999.99 , 0x31, },
601 },
602 .config = 0x8e,
603 },
604
605 /* 50-59 */
606 [TUNER_TCL_2002N] = { /* TCL NTSC */
607 .name = "TCL 2002N",
608 .count = 3,
609 .ranges = {
610 { 16 * 172.00 /*MHz*/, 0x01, },
611 { 16 * 448.00 /*MHz*/, 0x02, },
612 { 16 * 999.99 , 0x08, },
613 },
614 .config = 0x8e,
615 },
616 [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
617 .name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
618 .count = 3,
619 .ranges = {
620 { 16 * 160.00 /*MHz*/, 0x01, },
621 { 16 * 442.00 /*MHz*/, 0x02, },
622 { 16 * 999.99 , 0x04, },
623 },
624 .config = 0x8e,
625 },
626 [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
627 .name = "Thomson DTT 7610 (ATSC/NTSC)",
628 .count = 3,
629 .ranges = {
630 { 16 * 157.25 /*MHz*/, 0x39, },
631 { 16 * 454.00 /*MHz*/, 0x3a, },
632 { 16 * 999.99 , 0x3c, },
633 },
634 .config = 0x8e,
635 },
636 [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
637 .name = "Philips FQ1286",
638 .count = 3,
639 .ranges = {
640 { 16 * 160.00 /*MHz*/, 0x41, },
641 { 16 * 454.00 /*MHz*/, 0x42, },
642 { 16 * 999.99 , 0x04, },
643 },
644 .config = 0x8e,
645 },
646 [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
647 .name = "tda8290+75",
648 /* see tda8290.c for details */ },
649 [TUNER_TCL_2002MB] = { /* TCL PAL */
650 .name = "TCL 2002MB",
651 .count = 3,
652 .ranges = {
653 { 16 * 170.00 /*MHz*/, 0x01, },
654 { 16 * 450.00 /*MHz*/, 0x02, },
655 { 16 * 999.99 , 0x08, },
656 },
657 .config = 0xce,
658 },
659 [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
660 .name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
661 .count = 3,
662 .ranges = {
663 { 16 * 160.00 /*MHz*/, 0x01, },
664 { 16 * 442.00 /*MHz*/, 0x02, },
665 { 16 * 999.99 , 0x04, },
666 },
667 .config = 0xce,
668 },
669 [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
670 .name = "Philips FQ1236A MK4",
671 .count = 3,
672 .ranges = {
673 { 16 * 160.00 /*MHz*/, 0x01, },
674 { 16 * 442.00 /*MHz*/, 0x02, },
675 { 16 * 999.99 , 0x04, },
676 },
677 .config = 0x8e,
678 },
679 [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
680 .name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
681 .count = 3,
682 .ranges = {
683 { 16 * 160.00 /*MHz*/, 0xa0, },
684 { 16 * 454.00 /*MHz*/, 0x90, },
685 { 16 * 999.99 , 0x30, },
686 },
687 .config = 0x8e,
688 },
689 [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
690 .name = "Ymec TVision TVF-5533MF",
691 .count = 3,
692 .ranges = {
693 { 16 * 160.00 /*MHz*/, 0x01, },
694 { 16 * 454.00 /*MHz*/, 0x02, },
695 { 16 * 999.99 , 0x04, },
696 },
697 .config = 0x8e,
698 },
699
700 /* 60-69 */
701 [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */
702 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
703 .name = "Thomson DTT 761X (ATSC/NTSC)",
704 .count = 3,
705 .ranges = {
706 { 16 * 145.25 /*MHz*/, 0x39, },
707 { 16 * 415.25 /*MHz*/, 0x3a, },
708 { 16 * 999.99 , 0x3c, },
709 },
710 .config = 0x8e,
711 },
712 [TUNER_TENA_9533_DI] = { /* Philips PAL */
713 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
714 .count = 3,
715 .ranges = {
716 { 16 * 160.25 /*MHz*/, 0x01, },
717 { 16 * 464.25 /*MHz*/, 0x02, },
718 { 16 * 999.99 , 0x04, },
719 },
720 .config = 0x8e,
721 },
722 [TUNER_TEA5767] = { /* Philips RADIO */
723 .name = "Philips TEA5767HN FM Radio",
724 /* see tea5767.c for details */},
725 [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
726 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
727 .count = 3,
728 .ranges = {
729 { 16 * 160.00 /*MHz*/, 0x51, },
730 { 16 * 442.00 /*MHz*/, 0x52, },
731 { 16 * 999.99 , 0x54, },
732 },
733 .config = 0x86,
734 },
735 [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
736 .name = "LG TDVS-H062F/TUA6034",
737 .count = 3,
738 .ranges = {
739 { 16 * 160.00 /*MHz*/, 0x01 },
740 { 16 * 455.00 /*MHz*/, 0x02 },
741 { 16 * 999.99 , 0x04 },
742 },
743 .config = 0x8e,
744 },
745 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
746 .name = "Ymec TVF66T5-B/DFF",
747 .count = 3,
748 .ranges = {
749 { 16 * 160.25 /*MHz*/, 0x01, },
750 { 16 * 464.25 /*MHz*/, 0x02, },
751 { 16 * 999.99 , 0x08, },
752 },
753 .config = 0x8e,
754 },
755 [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
756 .name = "LG NTSC (TALN mini series)",
757 .count = 3,
758 .ranges = {
759 { 16 * 137.25 /*MHz*/, 0x01, },
760 { 16 * 373.25 /*MHz*/, 0x02, },
761 { 16 * 999.99 , 0x08, },
762 },
763 .config = 0x8e,
764 },
765 [TUNER_PHILIPS_TD1316] = { /* Philips PAL */
766 .name = "Philips TD1316 Hybrid Tuner",
767 .count = 3,
768 .ranges = {
769 { 16 * 160.00 /*MHz*/, 0xa1, },
770 { 16 * 442.00 /*MHz*/, 0xa2, },
771 { 16 * 999.99 , 0xa4, },
772 },
773 .config = 0xc8,
774 },
775 [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
776 .name = "Philips TUV1236D ATSC/NTSC dual in",
777 .count = 3,
778 .ranges = {
779 { 16 * 157.25 /*MHz*/, 0x01, },
780 { 16 * 454.00 /*MHz*/, 0x02, },
781 { 16 * 999.99 , 0x04, },
782 },
783 .config = 0xce,
784 },
785 [TUNER_TNF_5335MF] = { /* Philips NTSC */
786 .name = "Tena TNF 5335 MF",
787 .count = 3,
788 .ranges = {
789 { 16 * 157.25 /*MHz*/, 0x01, },
790 { 16 * 454.00 /*MHz*/, 0x02, },
791 { 16 * 999.99 , 0x04, },
792 },
793 .config = 0x8e,
794 },
795};
796
797unsigned const int tuner_count = ARRAY_SIZE(tuners);
798 92
799/* ---------------------------------------------------------------------- */ 93/* ---------------------------------------------------------------------- */
800 94
@@ -842,16 +136,23 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
842 u8 config, tuneraddr; 136 u8 config, tuneraddr;
843 u16 div; 137 u16 div;
844 struct tunertype *tun; 138 struct tunertype *tun;
845 unsigned char buffer[4]; 139 u8 buffer[4];
846 int rc, IFPCoff, i; 140 int rc, IFPCoff, i, j;
847 141
848 tun = &tuners[t->type]; 142 tun = &tuners[t->type];
849 for (i = 0; i < tun->count; i++) { 143 j = TUNER_PARAM_ANALOG;
850 if (freq > tun->ranges[i].thresh) 144
145 for (i = 0; i < tun->params[j].count; i++) {
146 if (freq > tun->params[j].ranges[i].limit)
851 continue; 147 continue;
852 break; 148 break;
853 } 149 }
854 config = tun->ranges[i].cb; 150 if (i == tun->params[j].count) {
151 tuner_dbg("TV frequency out of range (%d > %d)",
152 freq, tun->params[j].ranges[i - 1].limit);
153 freq = tun->params[j].ranges[--i].limit;
154 }
155 config = tun->params[j].ranges[i].cb;
855 /* i == 0 -> VHF_LO */ 156 /* i == 0 -> VHF_LO */
856 /* i == 1 -> VHF_HI */ 157 /* i == 1 -> VHF_HI */
857 /* i == 2 -> UHF */ 158 /* i == 2 -> UHF */
@@ -914,7 +215,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
914 215
915 case TUNER_MICROTUNE_4042FI5: 216 case TUNER_MICROTUNE_4042FI5:
916 /* Set the charge pump for fast tuning */ 217 /* Set the charge pump for fast tuning */
917 tun->config |= TUNER_CHARGE_PUMP; 218 tun->params[j].config |= TUNER_CHARGE_PUMP;
918 break; 219 break;
919 220
920 case TUNER_PHILIPS_TUV1236D: 221 case TUNER_PHILIPS_TUV1236D:
@@ -943,20 +244,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
943 break; 244 break;
944 } 245 }
945 246
946 /*
947 * Philips FI1216MK2 remark from specification :
948 * for channel selection involving band switching, and to ensure
949 * smooth tuning to the desired channel without causing
950 * unnecessary charge pump action, it is recommended to consider
951 * the difference between wanted channel frequency and the
952 * current channel frequency. Unnecessary charge pump action
953 * will result in very low tuning voltage which may drive the
954 * oscillator to extreme conditions.
955 *
956 * Progfou: specification says to send config data before
957 * frequency in case (wanted frequency < current frequency).
958 */
959
960 /* IFPCoff = Video Intermediate Frequency - Vif: 247 /* IFPCoff = Video Intermediate Frequency - Vif:
961 940 =16*58.75 NTSC/J (Japan) 248 940 =16*58.75 NTSC/J (Japan)
962 732 =16*45.75 M/N STD 249 732 =16*45.75 M/N STD
@@ -988,17 +275,18 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
988 offset / 16, offset % 16 * 100 / 16, 275 offset / 16, offset % 16 * 100 / 16,
989 div); 276 div);
990 277
991 if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { 278 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
992 buffer[0] = tun->config; 279 buffer[0] = tun->params[j].config;
993 buffer[1] = config; 280 buffer[1] = config;
994 buffer[2] = (div>>8) & 0x7f; 281 buffer[2] = (div>>8) & 0x7f;
995 buffer[3] = div & 0xff; 282 buffer[3] = div & 0xff;
996 } else { 283 } else {
997 buffer[0] = (div>>8) & 0x7f; 284 buffer[0] = (div>>8) & 0x7f;
998 buffer[1] = div & 0xff; 285 buffer[1] = div & 0xff;
999 buffer[2] = tun->config; 286 buffer[2] = tun->params[j].config;
1000 buffer[3] = config; 287 buffer[3] = config;
1001 } 288 }
289 t->last_div = div;
1002 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 290 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1003 buffer[0],buffer[1],buffer[2],buffer[3]); 291 buffer[0],buffer[1],buffer[2],buffer[3]);
1004 292
@@ -1024,10 +312,10 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
1024 } 312 }
1025 313
1026 /* Set the charge pump for optimized phase noise figure */ 314 /* Set the charge pump for optimized phase noise figure */
1027 tun->config &= ~TUNER_CHARGE_PUMP; 315 tun->params[j].config &= ~TUNER_CHARGE_PUMP;
1028 buffer[0] = (div>>8) & 0x7f; 316 buffer[0] = (div>>8) & 0x7f;
1029 buffer[1] = div & 0xff; 317 buffer[1] = div & 0xff;
1030 buffer[2] = tun->config; 318 buffer[2] = tun->params[j].config;
1031 buffer[3] = config; 319 buffer[3] = config;
1032 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 320 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1033 buffer[0],buffer[1],buffer[2],buffer[3]); 321 buffer[0],buffer[1],buffer[2],buffer[3]);
@@ -1041,13 +329,15 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
1041{ 329{
1042 struct tunertype *tun; 330 struct tunertype *tun;
1043 struct tuner *t = i2c_get_clientdata(c); 331 struct tuner *t = i2c_get_clientdata(c);
1044 unsigned char buffer[4]; 332 u8 buffer[4];
1045 unsigned div; 333 u16 div;
1046 int rc; 334 int rc, j;
1047 335
1048 tun = &tuners[t->type]; 336 tun = &tuners[t->type];
337 j = TUNER_PARAM_ANALOG;
338
1049 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ 339 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
1050 buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ 340 buffer[2] = (tun->params[j].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
1051 341
1052 switch (t->type) { 342 switch (t->type) {
1053 case TUNER_TENA_9533_DI: 343 case TUNER_TENA_9533_DI:
@@ -1076,9 +366,19 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
1076 } 366 }
1077 buffer[0] = (div>>8) & 0x7f; 367 buffer[0] = (div>>8) & 0x7f;
1078 buffer[1] = div & 0xff; 368 buffer[1] = div & 0xff;
369 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
370 buffer[0] = buffer[2];
371 buffer[1] = buffer[3];
372 buffer[2] = (div>>8) & 0x7f;
373 buffer[3] = div & 0xff;
374 } else {
375 buffer[0] = (div>>8) & 0x7f;
376 buffer[1] = div & 0xff;
377 }
1079 378
1080 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", 379 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n",
1081 buffer[0],buffer[1],buffer[2],buffer[3]); 380 buffer[0],buffer[1],buffer[2],buffer[3]);
381 t->last_div = div;
1082 382
1083 if (4 != (rc = i2c_master_send(c,buffer,4))) 383 if (4 != (rc = i2c_master_send(c,buffer,4)))
1084 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 384 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
@@ -1092,10 +392,10 @@ int default_tuner_init(struct i2c_client *c)
1092 t->type, tuners[t->type].name); 392 t->type, tuners[t->type].name);
1093 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 393 strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
1094 394
1095 t->tv_freq = default_set_tv_freq; 395 t->set_tv_freq = default_set_tv_freq;
1096 t->radio_freq = default_set_radio_freq; 396 t->set_radio_freq = default_set_radio_freq;
1097 t->has_signal = tuner_signal; 397 t->has_signal = tuner_signal;
1098 t->is_stereo = tuner_stereo; 398 t->is_stereo = tuner_stereo;
1099 t->standby = NULL; 399 t->standby = NULL;
1100 400
1101 return 0; 401 return 0;