aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/dvb-pll.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/dvb-pll.c')
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c117
1 files changed, 74 insertions, 43 deletions
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 5c26fa112983..01a11262c8db 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -24,6 +24,23 @@
24 24
25#include "dvb-pll.h" 25#include "dvb-pll.h"
26 26
27struct dvb_pll_desc {
28 char *name;
29 u32 min;
30 u32 max;
31 u32 iffreq;
32 void (*set)(u8 *buf, const struct dvb_frontend_parameters *params);
33 u8 *initdata;
34 u8 *sleepdata;
35 int count;
36 struct {
37 u32 limit;
38 u32 stepsize;
39 u8 config;
40 u8 cb;
41 } entries[12];
42};
43
27/* ----------------------------------------------------------- */ 44/* ----------------------------------------------------------- */
28/* descriptions */ 45/* descriptions */
29 46
@@ -44,7 +61,7 @@ static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };
44 0x20 = AGC Take over point = 112 dBuV */ 61 0x20 = AGC Take over point = 112 dBuV */
45static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 }; 62static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };
46 63
47struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { 64static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
48 .name = "Thomson dtt7579", 65 .name = "Thomson dtt7579",
49 .min = 177000000, 66 .min = 177000000,
50 .max = 858000000, 67 .max = 858000000,
@@ -58,9 +75,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
58 { 999999999, 166667, 0xf4, 0x08 }, 75 { 999999999, 166667, 0xf4, 0x08 },
59 }, 76 },
60}; 77};
61EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
62 78
63struct dvb_pll_desc dvb_pll_thomson_dtt7610 = { 79static struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
64 .name = "Thomson dtt7610", 80 .name = "Thomson dtt7610",
65 .min = 44000000, 81 .min = 44000000,
66 .max = 958000000, 82 .max = 958000000,
@@ -72,7 +88,6 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
72 { 999999999, 62500, 0x8e, 0x3c }, 88 { 999999999, 62500, 0x8e, 0x3c },
73 }, 89 },
74}; 90};
75EXPORT_SYMBOL(dvb_pll_thomson_dtt7610);
76 91
77static void thomson_dtt759x_bw(u8 *buf, 92static void thomson_dtt759x_bw(u8 *buf,
78 const struct dvb_frontend_parameters *params) 93 const struct dvb_frontend_parameters *params)
@@ -81,7 +96,7 @@ static void thomson_dtt759x_bw(u8 *buf,
81 buf[3] |= 0x10; 96 buf[3] |= 0x10;
82} 97}
83 98
84struct dvb_pll_desc dvb_pll_thomson_dtt759x = { 99static struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
85 .name = "Thomson dtt759x", 100 .name = "Thomson dtt759x",
86 .min = 177000000, 101 .min = 177000000,
87 .max = 896000000, 102 .max = 896000000,
@@ -97,9 +112,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
97 { 999999999, 166667, 0xfc, 0x08 }, 112 { 999999999, 166667, 0xfc, 0x08 },
98 }, 113 },
99}; 114};
100EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
101 115
102struct dvb_pll_desc dvb_pll_lg_z201 = { 116static struct dvb_pll_desc dvb_pll_lg_z201 = {
103 .name = "LG z201", 117 .name = "LG z201",
104 .min = 174000000, 118 .min = 174000000,
105 .max = 862000000, 119 .max = 862000000,
@@ -114,9 +128,8 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
114 { 999999999, 166667, 0xfc, 0x04 }, 128 { 999999999, 166667, 0xfc, 0x04 },
115 }, 129 },
116}; 130};
117EXPORT_SYMBOL(dvb_pll_lg_z201);
118 131
119struct dvb_pll_desc dvb_pll_microtune_4042 = { 132static struct dvb_pll_desc dvb_pll_microtune_4042 = {
120 .name = "Microtune 4042 FI5", 133 .name = "Microtune 4042 FI5",
121 .min = 57000000, 134 .min = 57000000,
122 .max = 858000000, 135 .max = 858000000,
@@ -128,9 +141,8 @@ struct dvb_pll_desc dvb_pll_microtune_4042 = {
128 { 999999999, 62500, 0x8e, 0x31 }, 141 { 999999999, 62500, 0x8e, 0x31 },
129 }, 142 },
130}; 143};
131EXPORT_SYMBOL(dvb_pll_microtune_4042);
132 144
133struct dvb_pll_desc dvb_pll_thomson_dtt761x = { 145static struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
134 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ 146 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
135 .name = "Thomson dtt761x", 147 .name = "Thomson dtt761x",
136 .min = 57000000, 148 .min = 57000000,
@@ -144,9 +156,8 @@ struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
144 { 999999999, 62500, 0x8e, 0x3c }, 156 { 999999999, 62500, 0x8e, 0x3c },
145 }, 157 },
146}; 158};
147EXPORT_SYMBOL(dvb_pll_thomson_dtt761x);
148 159
149struct dvb_pll_desc dvb_pll_unknown_1 = { 160static struct dvb_pll_desc dvb_pll_unknown_1 = {
150 .name = "unknown 1", /* used by dntv live dvb-t */ 161 .name = "unknown 1", /* used by dntv live dvb-t */
151 .min = 174000000, 162 .min = 174000000,
152 .max = 862000000, 163 .max = 862000000,
@@ -164,12 +175,11 @@ struct dvb_pll_desc dvb_pll_unknown_1 = {
164 { 999999999, 166667, 0xfc, 0x08 }, 175 { 999999999, 166667, 0xfc, 0x08 },
165 }, 176 },
166}; 177};
167EXPORT_SYMBOL(dvb_pll_unknown_1);
168 178
169/* Infineon TUA6010XS 179/* Infineon TUA6010XS
170 * used in Thomson Cable Tuner 180 * used in Thomson Cable Tuner
171 */ 181 */
172struct dvb_pll_desc dvb_pll_tua6010xs = { 182static struct dvb_pll_desc dvb_pll_tua6010xs = {
173 .name = "Infineon TUA6010XS", 183 .name = "Infineon TUA6010XS",
174 .min = 44250000, 184 .min = 44250000,
175 .max = 858000000, 185 .max = 858000000,
@@ -181,10 +191,9 @@ struct dvb_pll_desc dvb_pll_tua6010xs = {
181 { 999999999, 62500, 0x8e, 0x85 }, 191 { 999999999, 62500, 0x8e, 0x85 },
182 }, 192 },
183}; 193};
184EXPORT_SYMBOL(dvb_pll_tua6010xs);
185 194
186/* Panasonic env57h1xd5 (some Philips PLL ?) */ 195/* Panasonic env57h1xd5 (some Philips PLL ?) */
187struct dvb_pll_desc dvb_pll_env57h1xd5 = { 196static struct dvb_pll_desc dvb_pll_env57h1xd5 = {
188 .name = "Panasonic ENV57H1XD5", 197 .name = "Panasonic ENV57H1XD5",
189 .min = 44250000, 198 .min = 44250000,
190 .max = 858000000, 199 .max = 858000000,
@@ -197,7 +206,6 @@ struct dvb_pll_desc dvb_pll_env57h1xd5 = {
197 { 999999999, 166667, 0xc2, 0xa4 }, 206 { 999999999, 166667, 0xc2, 0xa4 },
198 }, 207 },
199}; 208};
200EXPORT_SYMBOL(dvb_pll_env57h1xd5);
201 209
202/* Philips TDA6650/TDA6651 210/* Philips TDA6650/TDA6651
203 * used in Panasonic ENV77H11D5 211 * used in Panasonic ENV77H11D5
@@ -208,7 +216,7 @@ static void tda665x_bw(u8 *buf, const struct dvb_frontend_parameters *params)
208 buf[3] |= 0x08; 216 buf[3] |= 0x08;
209} 217}
210 218
211struct dvb_pll_desc dvb_pll_tda665x = { 219static struct dvb_pll_desc dvb_pll_tda665x = {
212 .name = "Philips TDA6650/TDA6651", 220 .name = "Philips TDA6650/TDA6651",
213 .min = 44250000, 221 .min = 44250000,
214 .max = 858000000, 222 .max = 858000000,
@@ -231,7 +239,6 @@ struct dvb_pll_desc dvb_pll_tda665x = {
231 { 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ }, 239 { 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ },
232 } 240 }
233}; 241};
234EXPORT_SYMBOL(dvb_pll_tda665x);
235 242
236/* Infineon TUA6034 243/* Infineon TUA6034
237 * used in LG TDTP E102P 244 * used in LG TDTP E102P
@@ -242,7 +249,7 @@ static void tua6034_bw(u8 *buf, const struct dvb_frontend_parameters *params)
242 buf[3] |= 0x08; 249 buf[3] |= 0x08;
243} 250}
244 251
245struct dvb_pll_desc dvb_pll_tua6034 = { 252static struct dvb_pll_desc dvb_pll_tua6034 = {
246 .name = "Infineon TUA6034", 253 .name = "Infineon TUA6034",
247 .min = 44250000, 254 .min = 44250000,
248 .max = 858000000, 255 .max = 858000000,
@@ -255,12 +262,11 @@ struct dvb_pll_desc dvb_pll_tua6034 = {
255 { 999999999, 62500, 0xce, 0x04 }, 262 { 999999999, 62500, 0xce, 0x04 },
256 }, 263 },
257}; 264};
258EXPORT_SYMBOL(dvb_pll_tua6034);
259 265
260/* Infineon TUA6034 266/* Infineon TUA6034
261 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F 267 * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F
262 */ 268 */
263struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = { 269static struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {
264 .name = "LG TDVS-H06xF", 270 .name = "LG TDVS-H06xF",
265 .min = 54000000, 271 .min = 54000000,
266 .max = 863000000, 272 .max = 863000000,
@@ -273,7 +279,6 @@ struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {
273 { 999999999, 62500, 0xce, 0x04 }, 279 { 999999999, 62500, 0xce, 0x04 },
274 }, 280 },
275}; 281};
276EXPORT_SYMBOL(dvb_pll_lg_tdvs_h06xf);
277 282
278/* Philips FMD1216ME 283/* Philips FMD1216ME
279 * used in Medion Hybrid PCMCIA card and USB Box 284 * used in Medion Hybrid PCMCIA card and USB Box
@@ -285,7 +290,7 @@ static void fmd1216me_bw(u8 *buf, const struct dvb_frontend_parameters *params)
285 buf[3] |= 0x08; 290 buf[3] |= 0x08;
286} 291}
287 292
288struct dvb_pll_desc dvb_pll_fmd1216me = { 293static struct dvb_pll_desc dvb_pll_fmd1216me = {
289 .name = "Philips FMD1216ME", 294 .name = "Philips FMD1216ME",
290 .min = 50870000, 295 .min = 50870000,
291 .max = 858000000, 296 .max = 858000000,
@@ -304,7 +309,6 @@ struct dvb_pll_desc dvb_pll_fmd1216me = {
304 { 999999999, 166667, 0xfc, 0x44 }, 309 { 999999999, 166667, 0xfc, 0x44 },
305 } 310 }
306}; 311};
307EXPORT_SYMBOL(dvb_pll_fmd1216me);
308 312
309/* ALPS TDED4 313/* ALPS TDED4
310 * used in Nebula-Cards and USB boxes 314 * used in Nebula-Cards and USB boxes
@@ -315,7 +319,7 @@ static void tded4_bw(u8 *buf, const struct dvb_frontend_parameters *params)
315 buf[3] |= 0x04; 319 buf[3] |= 0x04;
316} 320}
317 321
318struct dvb_pll_desc dvb_pll_tded4 = { 322static struct dvb_pll_desc dvb_pll_tded4 = {
319 .name = "ALPS TDED4", 323 .name = "ALPS TDED4",
320 .min = 47000000, 324 .min = 47000000,
321 .max = 863000000, 325 .max = 863000000,
@@ -329,12 +333,11 @@ struct dvb_pll_desc dvb_pll_tded4 = {
329 { 999999999, 166667, 0x85, 0x88 }, 333 { 999999999, 166667, 0x85, 0x88 },
330 } 334 }
331}; 335};
332EXPORT_SYMBOL(dvb_pll_tded4);
333 336
334/* ALPS TDHU2 337/* ALPS TDHU2
335 * used in AverTVHD MCE A180 338 * used in AverTVHD MCE A180
336 */ 339 */
337struct dvb_pll_desc dvb_pll_tdhu2 = { 340static struct dvb_pll_desc dvb_pll_tdhu2 = {
338 .name = "ALPS TDHU2", 341 .name = "ALPS TDHU2",
339 .min = 54000000, 342 .min = 54000000,
340 .max = 864000000, 343 .max = 864000000,
@@ -347,7 +350,6 @@ struct dvb_pll_desc dvb_pll_tdhu2 = {
347 { 999999999, 62500, 0x85, 0x88 }, 350 { 999999999, 62500, 0x85, 0x88 },
348 } 351 }
349}; 352};
350EXPORT_SYMBOL(dvb_pll_tdhu2);
351 353
352/* Philips TUV1236D 354/* Philips TUV1236D
353 * used in ATI HDTV Wonder 355 * used in ATI HDTV Wonder
@@ -365,7 +367,7 @@ static void tuv1236d_rf(u8 *buf, const struct dvb_frontend_parameters *params)
365 } 367 }
366} 368}
367 369
368struct dvb_pll_desc dvb_pll_tuv1236d = { 370static struct dvb_pll_desc dvb_pll_tuv1236d = {
369 .name = "Philips TUV1236D", 371 .name = "Philips TUV1236D",
370 .min = 54000000, 372 .min = 54000000,
371 .max = 864000000, 373 .max = 864000000,
@@ -378,12 +380,11 @@ struct dvb_pll_desc dvb_pll_tuv1236d = {
378 { 999999999, 62500, 0xc6, 0x44 }, 380 { 999999999, 62500, 0xc6, 0x44 },
379 }, 381 },
380}; 382};
381EXPORT_SYMBOL(dvb_pll_tuv1236d);
382 383
383/* Samsung TBMV30111IN / TBMV30712IN1 384/* Samsung TBMV30111IN / TBMV30712IN1
384 * used in Air2PC ATSC - 2nd generation (nxt2002) 385 * used in Air2PC ATSC - 2nd generation (nxt2002)
385 */ 386 */
386struct dvb_pll_desc dvb_pll_samsung_tbmv = { 387static struct dvb_pll_desc dvb_pll_samsung_tbmv = {
387 .name = "Samsung TBMV30111IN / TBMV30712IN1", 388 .name = "Samsung TBMV30111IN / TBMV30712IN1",
388 .min = 54000000, 389 .min = 54000000,
389 .max = 860000000, 390 .max = 860000000,
@@ -398,12 +399,11 @@ struct dvb_pll_desc dvb_pll_samsung_tbmv = {
398 { 999999999, 166667, 0xfc, 0x02 }, 399 { 999999999, 166667, 0xfc, 0x02 },
399 } 400 }
400}; 401};
401EXPORT_SYMBOL(dvb_pll_samsung_tbmv);
402 402
403/* 403/*
404 * Philips SD1878 Tuner. 404 * Philips SD1878 Tuner.
405 */ 405 */
406struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = { 406static struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
407 .name = "Philips SD1878", 407 .name = "Philips SD1878",
408 .min = 950000, 408 .min = 950000,
409 .max = 2150000, 409 .max = 2150000,
@@ -416,7 +416,6 @@ struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
416 { 2150000, 500, 0xc4, 0xc0}, 416 { 2150000, 500, 0xc4, 0xc0},
417 }, 417 },
418}; 418};
419EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
420 419
421/* 420/*
422 * Philips TD1316 Tuner. 421 * Philips TD1316 Tuner.
@@ -440,7 +439,7 @@ static void td1316_bw(u8 *buf, const struct dvb_frontend_parameters *params)
440 buf[3] |= 1 << 3; 439 buf[3] |= 1 << 3;
441} 440}
442 441
443struct dvb_pll_desc dvb_pll_philips_td1316 = { 442static struct dvb_pll_desc dvb_pll_philips_td1316 = {
444 .name = "Philips TD1316", 443 .name = "Philips TD1316",
445 .min = 87000000, 444 .min = 87000000,
446 .max = 895000000, 445 .max = 895000000,
@@ -459,10 +458,9 @@ struct dvb_pll_desc dvb_pll_philips_td1316 = {
459 { 858834000, 166667, 0xca, 0xe0}, 458 { 858834000, 166667, 0xca, 0xe0},
460 }, 459 },
461}; 460};
462EXPORT_SYMBOL(dvb_pll_philips_td1316);
463 461
464/* FE6600 used on DViCO Hybrid */ 462/* FE6600 used on DViCO Hybrid */
465struct dvb_pll_desc dvb_pll_thomson_fe6600 = { 463static struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
466 .name = "Thomson FE6600", 464 .name = "Thomson FE6600",
467 .min = 44250000, 465 .min = 44250000,
468 .max = 858000000, 466 .max = 858000000,
@@ -475,14 +473,14 @@ struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
475 { 999999999, 166667, 0xf4, 0x18 }, 473 { 999999999, 166667, 0xf4, 0x18 },
476 } 474 }
477}; 475};
478EXPORT_SYMBOL(dvb_pll_thomson_fe6600); 476
479static void opera1_bw(u8 *buf, const struct dvb_frontend_parameters *params) 477static void opera1_bw(u8 *buf, const struct dvb_frontend_parameters *params)
480{ 478{
481 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) 479 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
482 buf[2] |= 0x08; 480 buf[2] |= 0x08;
483} 481}
484 482
485struct dvb_pll_desc dvb_pll_opera1 = { 483static struct dvb_pll_desc dvb_pll_opera1 = {
486 .name = "Opera Tuner", 484 .name = "Opera Tuner",
487 .min = 900000, 485 .min = 900000,
488 .max = 2250000, 486 .max = 2250000,
@@ -500,7 +498,35 @@ struct dvb_pll_desc dvb_pll_opera1 = {
500 { 2250000, 500, 0xe5, 0xc4 }, 498 { 2250000, 500, 0xe5, 0xc4 },
501 } 499 }
502}; 500};
503EXPORT_SYMBOL(dvb_pll_opera1); 501
502/* ----------------------------------------------------------- */
503
504static struct dvb_pll_desc *pll_list[] = {
505 [DVB_PLL_UNDEFINED] = NULL,
506 [DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579,
507 [DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x,
508 [DVB_PLL_THOMSON_DTT7610] = &dvb_pll_thomson_dtt7610,
509 [DVB_PLL_LG_Z201] = &dvb_pll_lg_z201,
510 [DVB_PLL_MICROTUNE_4042] = &dvb_pll_microtune_4042,
511 [DVB_PLL_THOMSON_DTT761X] = &dvb_pll_thomson_dtt761x,
512 [DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1,
513 [DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs,
514 [DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5,
515 [DVB_PLL_TUA6034] = &dvb_pll_tua6034,
516 [DVB_PLL_LG_TDVS_H06XF] = &dvb_pll_lg_tdvs_h06xf,
517 [DVB_PLL_TDA665X] = &dvb_pll_tda665x,
518 [DVB_PLL_FMD1216ME] = &dvb_pll_fmd1216me,
519 [DVB_PLL_TDED4] = &dvb_pll_tded4,
520 [DVB_PLL_TUV1236D] = &dvb_pll_tuv1236d,
521 [DVB_PLL_TDHU2] = &dvb_pll_tdhu2,
522 [DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv,
523 [DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261,
524 [DVB_PLL_PHILIPS_TD1316] = &dvb_pll_philips_td1316,
525 [DVB_PLL_THOMSON_FE6600] = &dvb_pll_thomson_fe6600,
526 [DVB_PLL_OPERA1] = &dvb_pll_opera1,
527};
528
529/* ----------------------------------------------------------- */
504 530
505struct dvb_pll_priv { 531struct dvb_pll_priv {
506 /* i2c details */ 532 /* i2c details */
@@ -702,13 +728,18 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = {
702 728
703struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, 729struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
704 struct i2c_adapter *i2c, 730 struct i2c_adapter *i2c,
705 struct dvb_pll_desc *desc) 731 unsigned int pll_desc_id)
706{ 732{
707 u8 b1 [] = { 0 }; 733 u8 b1 [] = { 0 };
708 struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, 734 struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD,
709 .buf = b1, .len = 1 }; 735 .buf = b1, .len = 1 };
710 struct dvb_pll_priv *priv = NULL; 736 struct dvb_pll_priv *priv = NULL;
711 int ret; 737 int ret;
738 struct dvb_pll_desc *desc;
739
740 BUG_ON(pll_desc_id < 1 || pll_desc_id >= ARRAY_SIZE(pll_list));
741
742 desc = pll_list[pll_desc_id];
712 743
713 if (i2c != NULL) { 744 if (i2c != NULL) {
714 if (fe->ops.i2c_gate_ctrl) 745 if (fe->ops.i2c_gate_ctrl)