diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2005-09-09 16:03:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:45 -0400 |
commit | dc27a1696089a9a9d317fc815915e6761e22eeb5 (patch) | |
tree | ce797c46a6c8ef98d7c7bcc5da90e210967799d3 /drivers/media/dvb | |
parent | f63f5346c943008fe8f6ac66a9026f6c35e24947 (diff) |
[PATCH] dvb: budget-ci: add support for TT DVB-C CI card
Add support for TT DVB-C CI card.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 97 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0297.c | 121 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0297.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 95 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 188 |
5 files changed, 387 insertions, 122 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index a36bec3a2bea..47e28b0ee951 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -334,8 +334,103 @@ static struct mt312_config skystar23_samsung_tbdu18132_config = { | |||
334 | .pll_set = skystar23_samsung_tbdu18132_pll_set, | 334 | .pll_set = skystar23_samsung_tbdu18132_pll_set, |
335 | }; | 335 | }; |
336 | 336 | ||
337 | |||
338 | static u8 alps_tdee4_stv0297_inittab[] = { | ||
339 | 0x80, 0x01, | ||
340 | 0x80, 0x00, | ||
341 | 0x81, 0x01, | ||
342 | 0x81, 0x00, | ||
343 | 0x00, 0x09, | ||
344 | 0x01, 0x69, | ||
345 | 0x03, 0x00, | ||
346 | 0x04, 0x00, | ||
347 | 0x07, 0x00, | ||
348 | 0x08, 0x00, | ||
349 | 0x20, 0x00, | ||
350 | 0x21, 0x40, | ||
351 | 0x22, 0x00, | ||
352 | 0x23, 0x00, | ||
353 | 0x24, 0x40, | ||
354 | 0x25, 0x88, | ||
355 | 0x30, 0xff, | ||
356 | 0x31, 0x00, | ||
357 | 0x32, 0xff, | ||
358 | 0x33, 0x00, | ||
359 | 0x34, 0x50, | ||
360 | 0x35, 0x7f, | ||
361 | 0x36, 0x00, | ||
362 | 0x37, 0x20, | ||
363 | 0x38, 0x00, | ||
364 | 0x40, 0x1c, | ||
365 | 0x41, 0xff, | ||
366 | 0x42, 0x29, | ||
367 | 0x43, 0x00, | ||
368 | 0x44, 0xff, | ||
369 | 0x45, 0x00, | ||
370 | 0x46, 0x00, | ||
371 | 0x49, 0x04, | ||
372 | 0x4a, 0x00, | ||
373 | 0x4b, 0xf8, | ||
374 | 0x52, 0x30, | ||
375 | 0x55, 0xae, | ||
376 | 0x56, 0x47, | ||
377 | 0x57, 0xe1, | ||
378 | 0x58, 0x3a, | ||
379 | 0x5a, 0x1e, | ||
380 | 0x5b, 0x34, | ||
381 | 0x60, 0x00, | ||
382 | 0x63, 0x00, | ||
383 | 0x64, 0x00, | ||
384 | 0x65, 0x00, | ||
385 | 0x66, 0x00, | ||
386 | 0x67, 0x00, | ||
387 | 0x68, 0x00, | ||
388 | 0x69, 0x00, | ||
389 | 0x6a, 0x02, | ||
390 | 0x6b, 0x00, | ||
391 | 0x70, 0xff, | ||
392 | 0x71, 0x00, | ||
393 | 0x72, 0x00, | ||
394 | 0x73, 0x00, | ||
395 | 0x74, 0x0c, | ||
396 | 0x80, 0x00, | ||
397 | 0x81, 0x00, | ||
398 | 0x82, 0x00, | ||
399 | 0x83, 0x00, | ||
400 | 0x84, 0x04, | ||
401 | 0x85, 0x80, | ||
402 | 0x86, 0x24, | ||
403 | 0x87, 0x78, | ||
404 | 0x88, 0x10, | ||
405 | 0x89, 0x00, | ||
406 | 0x90, 0x01, | ||
407 | 0x91, 0x01, | ||
408 | 0xa0, 0x04, | ||
409 | 0xa1, 0x00, | ||
410 | 0xa2, 0x00, | ||
411 | 0xb0, 0x91, | ||
412 | 0xb1, 0x0b, | ||
413 | 0xc0, 0x53, | ||
414 | 0xc1, 0x70, | ||
415 | 0xc2, 0x12, | ||
416 | 0xd0, 0x00, | ||
417 | 0xd1, 0x00, | ||
418 | 0xd2, 0x00, | ||
419 | 0xd3, 0x00, | ||
420 | 0xd4, 0x00, | ||
421 | 0xd5, 0x00, | ||
422 | 0xde, 0x00, | ||
423 | 0xdf, 0x00, | ||
424 | 0x61, 0x49, | ||
425 | 0x62, 0x0b, | ||
426 | 0x53, 0x08, | ||
427 | 0x59, 0x08, | ||
428 | 0xff, 0xff, | ||
429 | }; | ||
430 | |||
337 | static struct stv0297_config alps_tdee4_stv0297_config = { | 431 | static struct stv0297_config alps_tdee4_stv0297_config = { |
338 | .demod_address = 0x1c, | 432 | .demod_address = 0x1c, |
433 | .inittab = alps_tdee4_stv0297_inittab, | ||
339 | // .invert = 1, | 434 | // .invert = 1, |
340 | // .pll_set = alps_tdee4_stv0297_pll_set, | 435 | // .pll_set = alps_tdee4_stv0297_pll_set, |
341 | }; | 436 | }; |
@@ -369,7 +464,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
369 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); | 464 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); |
370 | } else | 465 | } else |
371 | /* try the cable dvb (stv0297) */ | 466 | /* try the cable dvb (stv0297) */ |
372 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { | 467 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) { |
373 | fc->dev_type = FC_CABLE; | 468 | fc->dev_type = FC_CABLE; |
374 | info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); | 469 | info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); |
375 | } else | 470 | } else |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 01eb41990e8a..8d09afd7545d 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -35,7 +35,6 @@ struct stv0297_state { | |||
35 | struct dvb_frontend frontend; | 35 | struct dvb_frontend frontend; |
36 | 36 | ||
37 | unsigned long base_freq; | 37 | unsigned long base_freq; |
38 | u8 pwm; | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | #if 1 | 40 | #if 1 |
@@ -46,94 +45,6 @@ struct stv0297_state { | |||
46 | 45 | ||
47 | #define STV0297_CLOCK_KHZ 28900 | 46 | #define STV0297_CLOCK_KHZ 28900 |
48 | 47 | ||
49 | static u8 init_tab[] = { | ||
50 | 0x00, 0x09, | ||
51 | 0x01, 0x69, | ||
52 | 0x03, 0x00, | ||
53 | 0x04, 0x00, | ||
54 | 0x07, 0x00, | ||
55 | 0x08, 0x00, | ||
56 | 0x20, 0x00, | ||
57 | 0x21, 0x40, | ||
58 | 0x22, 0x00, | ||
59 | 0x23, 0x00, | ||
60 | 0x24, 0x40, | ||
61 | 0x25, 0x88, | ||
62 | 0x30, 0xff, | ||
63 | 0x31, 0x00, | ||
64 | 0x32, 0xff, | ||
65 | 0x33, 0x00, | ||
66 | 0x34, 0x50, | ||
67 | 0x35, 0x7f, | ||
68 | 0x36, 0x00, | ||
69 | 0x37, 0x20, | ||
70 | 0x38, 0x00, | ||
71 | 0x40, 0x1c, | ||
72 | 0x41, 0xff, | ||
73 | 0x42, 0x29, | ||
74 | 0x43, 0x00, | ||
75 | 0x44, 0xff, | ||
76 | 0x45, 0x00, | ||
77 | 0x46, 0x00, | ||
78 | 0x49, 0x04, | ||
79 | 0x4a, 0xff, | ||
80 | 0x4b, 0x7f, | ||
81 | 0x52, 0x30, | ||
82 | 0x55, 0xae, | ||
83 | 0x56, 0x47, | ||
84 | 0x57, 0xe1, | ||
85 | 0x58, 0x3a, | ||
86 | 0x5a, 0x1e, | ||
87 | 0x5b, 0x34, | ||
88 | 0x60, 0x00, | ||
89 | 0x63, 0x00, | ||
90 | 0x64, 0x00, | ||
91 | 0x65, 0x00, | ||
92 | 0x66, 0x00, | ||
93 | 0x67, 0x00, | ||
94 | 0x68, 0x00, | ||
95 | 0x69, 0x00, | ||
96 | 0x6a, 0x02, | ||
97 | 0x6b, 0x00, | ||
98 | 0x70, 0xff, | ||
99 | 0x71, 0x00, | ||
100 | 0x72, 0x00, | ||
101 | 0x73, 0x00, | ||
102 | 0x74, 0x0c, | ||
103 | 0x80, 0x00, | ||
104 | 0x81, 0x00, | ||
105 | 0x82, 0x00, | ||
106 | 0x83, 0x00, | ||
107 | 0x84, 0x04, | ||
108 | 0x85, 0x80, | ||
109 | 0x86, 0x24, | ||
110 | 0x87, 0x78, | ||
111 | 0x88, 0x00, | ||
112 | 0x89, 0x00, | ||
113 | 0x90, 0x01, | ||
114 | 0x91, 0x01, | ||
115 | 0xa0, 0x00, | ||
116 | 0xa1, 0x00, | ||
117 | 0xa2, 0x00, | ||
118 | 0xb0, 0x91, | ||
119 | 0xb1, 0x0b, | ||
120 | 0xc0, 0x53, | ||
121 | 0xc1, 0x70, | ||
122 | 0xc2, 0x12, | ||
123 | 0xd0, 0x00, | ||
124 | 0xd1, 0x00, | ||
125 | 0xd2, 0x00, | ||
126 | 0xd3, 0x00, | ||
127 | 0xd4, 0x00, | ||
128 | 0xd5, 0x00, | ||
129 | 0xde, 0x00, | ||
130 | 0xdf, 0x00, | ||
131 | 0x61, 0x49, | ||
132 | 0x62, 0x0b, | ||
133 | 0x53, 0x08, | ||
134 | 0x59, 0x08, | ||
135 | }; | ||
136 | |||
137 | 48 | ||
138 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) | 49 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) |
139 | { | 50 | { |
@@ -378,34 +289,9 @@ static int stv0297_init(struct dvb_frontend *fe) | |||
378 | struct stv0297_state *state = fe->demodulator_priv; | 289 | struct stv0297_state *state = fe->demodulator_priv; |
379 | int i; | 290 | int i; |
380 | 291 | ||
381 | /* soft reset */ | ||
382 | stv0297_writereg_mask(state, 0x80, 1, 1); | ||
383 | stv0297_writereg_mask(state, 0x80, 1, 0); | ||
384 | |||
385 | /* reset deinterleaver */ | ||
386 | stv0297_writereg_mask(state, 0x81, 1, 1); | ||
387 | stv0297_writereg_mask(state, 0x81, 1, 0); | ||
388 | |||
389 | /* load init table */ | 292 | /* load init table */ |
390 | for (i = 0; i < sizeof(init_tab); i += 2) { | 293 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) |
391 | stv0297_writereg(state, init_tab[i], init_tab[i + 1]); | 294 | stv0297_writereg(state, state->config->inittab[i], state->config->inittab[i+1]); |
392 | } | ||
393 | |||
394 | /* set a dummy symbol rate */ | ||
395 | stv0297_set_symbolrate(state, 6900); | ||
396 | |||
397 | /* invert AGC1 polarity */ | ||
398 | stv0297_writereg_mask(state, 0x88, 0x10, 0x10); | ||
399 | |||
400 | /* setup bit error counting */ | ||
401 | stv0297_writereg_mask(state, 0xA0, 0x80, 0x00); | ||
402 | stv0297_writereg_mask(state, 0xA0, 0x10, 0x00); | ||
403 | stv0297_writereg_mask(state, 0xA0, 0x08, 0x00); | ||
404 | stv0297_writereg_mask(state, 0xA0, 0x07, 0x04); | ||
405 | |||
406 | /* min + max PWM */ | ||
407 | stv0297_writereg(state, 0x4a, 0x00); | ||
408 | stv0297_writereg(state, 0x4b, state->pwm); | ||
409 | msleep(200); | 295 | msleep(200); |
410 | 296 | ||
411 | if (state->config->pll_init) | 297 | if (state->config->pll_init) |
@@ -738,7 +624,7 @@ static void stv0297_release(struct dvb_frontend *fe) | |||
738 | static struct dvb_frontend_ops stv0297_ops; | 624 | static struct dvb_frontend_ops stv0297_ops; |
739 | 625 | ||
740 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | 626 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, |
741 | struct i2c_adapter *i2c, int pwm) | 627 | struct i2c_adapter *i2c) |
742 | { | 628 | { |
743 | struct stv0297_state *state = NULL; | 629 | struct stv0297_state *state = NULL; |
744 | 630 | ||
@@ -752,7 +638,6 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
752 | state->i2c = i2c; | 638 | state->i2c = i2c; |
753 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); | 639 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); |
754 | state->base_freq = 0; | 640 | state->base_freq = 0; |
755 | state->pwm = pwm; | ||
756 | 641 | ||
757 | /* check if the demod is there */ | 642 | /* check if the demod is there */ |
758 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) | 643 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) |
diff --git a/drivers/media/dvb/frontends/stv0297.h b/drivers/media/dvb/frontends/stv0297.h index 3be535989302..9e53f019db71 100644 --- a/drivers/media/dvb/frontends/stv0297.h +++ b/drivers/media/dvb/frontends/stv0297.h | |||
@@ -29,6 +29,12 @@ struct stv0297_config | |||
29 | /* the demodulator's i2c address */ | 29 | /* the demodulator's i2c address */ |
30 | u8 demod_address; | 30 | u8 demod_address; |
31 | 31 | ||
32 | /* inittab - array of pairs of values. | ||
33 | * First of each pair is the register, second is the value. | ||
34 | * List should be terminated with an 0xff, 0xff pair. | ||
35 | */ | ||
36 | u8* inittab; | ||
37 | |||
32 | /* does the "inversion" need inverted? */ | 38 | /* does the "inversion" need inverted? */ |
33 | u8 invert:1; | 39 | u8 invert:1; |
34 | 40 | ||
@@ -38,7 +44,7 @@ struct stv0297_config | |||
38 | }; | 44 | }; |
39 | 45 | ||
40 | extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, | 46 | extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, |
41 | struct i2c_adapter* i2c, int pwm); | 47 | struct i2c_adapter* i2c); |
42 | extern int stv0297_enable_plli2c(struct dvb_frontend* fe); | 48 | extern int stv0297_enable_plli2c(struct dvb_frontend* fe); |
43 | 49 | ||
44 | #endif // STV0297_H | 50 | #endif // STV0297_H |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index c91cf8958b38..48e8097d8430 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -1934,6 +1934,98 @@ static struct sp8870_config alps_tdlb7_config = { | |||
1934 | }; | 1934 | }; |
1935 | 1935 | ||
1936 | 1936 | ||
1937 | static u8 nexusca_stv0297_inittab[] = { | ||
1938 | 0x80, 0x01, | ||
1939 | 0x80, 0x00, | ||
1940 | 0x81, 0x01, | ||
1941 | 0x81, 0x00, | ||
1942 | 0x00, 0x09, | ||
1943 | 0x01, 0x69, | ||
1944 | 0x03, 0x00, | ||
1945 | 0x04, 0x00, | ||
1946 | 0x07, 0x00, | ||
1947 | 0x08, 0x00, | ||
1948 | 0x20, 0x00, | ||
1949 | 0x21, 0x40, | ||
1950 | 0x22, 0x00, | ||
1951 | 0x23, 0x00, | ||
1952 | 0x24, 0x40, | ||
1953 | 0x25, 0x88, | ||
1954 | 0x30, 0xff, | ||
1955 | 0x31, 0x00, | ||
1956 | 0x32, 0xff, | ||
1957 | 0x33, 0x00, | ||
1958 | 0x34, 0x50, | ||
1959 | 0x35, 0x7f, | ||
1960 | 0x36, 0x00, | ||
1961 | 0x37, 0x20, | ||
1962 | 0x38, 0x00, | ||
1963 | 0x40, 0x1c, | ||
1964 | 0x41, 0xff, | ||
1965 | 0x42, 0x29, | ||
1966 | 0x43, 0x00, | ||
1967 | 0x44, 0xff, | ||
1968 | 0x45, 0x00, | ||
1969 | 0x46, 0x00, | ||
1970 | 0x49, 0x04, | ||
1971 | 0x4a, 0x00, | ||
1972 | 0x4b, 0x7b, | ||
1973 | 0x52, 0x30, | ||
1974 | 0x55, 0xae, | ||
1975 | 0x56, 0x47, | ||
1976 | 0x57, 0xe1, | ||
1977 | 0x58, 0x3a, | ||
1978 | 0x5a, 0x1e, | ||
1979 | 0x5b, 0x34, | ||
1980 | 0x60, 0x00, | ||
1981 | 0x63, 0x00, | ||
1982 | 0x64, 0x00, | ||
1983 | 0x65, 0x00, | ||
1984 | 0x66, 0x00, | ||
1985 | 0x67, 0x00, | ||
1986 | 0x68, 0x00, | ||
1987 | 0x69, 0x00, | ||
1988 | 0x6a, 0x02, | ||
1989 | 0x6b, 0x00, | ||
1990 | 0x70, 0xff, | ||
1991 | 0x71, 0x00, | ||
1992 | 0x72, 0x00, | ||
1993 | 0x73, 0x00, | ||
1994 | 0x74, 0x0c, | ||
1995 | 0x80, 0x00, | ||
1996 | 0x81, 0x00, | ||
1997 | 0x82, 0x00, | ||
1998 | 0x83, 0x00, | ||
1999 | 0x84, 0x04, | ||
2000 | 0x85, 0x80, | ||
2001 | 0x86, 0x24, | ||
2002 | 0x87, 0x78, | ||
2003 | 0x88, 0x10, | ||
2004 | 0x89, 0x00, | ||
2005 | 0x90, 0x01, | ||
2006 | 0x91, 0x01, | ||
2007 | 0xa0, 0x04, | ||
2008 | 0xa1, 0x00, | ||
2009 | 0xa2, 0x00, | ||
2010 | 0xb0, 0x91, | ||
2011 | 0xb1, 0x0b, | ||
2012 | 0xc0, 0x53, | ||
2013 | 0xc1, 0x70, | ||
2014 | 0xc2, 0x12, | ||
2015 | 0xd0, 0x00, | ||
2016 | 0xd1, 0x00, | ||
2017 | 0xd2, 0x00, | ||
2018 | 0xd3, 0x00, | ||
2019 | 0xd4, 0x00, | ||
2020 | 0xd5, 0x00, | ||
2021 | 0xde, 0x00, | ||
2022 | 0xdf, 0x00, | ||
2023 | 0x61, 0x49, | ||
2024 | 0x62, 0x0b, | ||
2025 | 0x53, 0x08, | ||
2026 | 0x59, 0x08, | ||
2027 | 0xff, 0xff, | ||
2028 | }; | ||
1937 | 2029 | ||
1938 | static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 2030 | static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1939 | { | 2031 | { |
@@ -1982,6 +2074,7 @@ static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ | |||
1982 | static struct stv0297_config nexusca_stv0297_config = { | 2074 | static struct stv0297_config nexusca_stv0297_config = { |
1983 | 2075 | ||
1984 | .demod_address = 0x1C, | 2076 | .demod_address = 0x1C, |
2077 | .inittab = nexusca_stv0297_inittab, | ||
1985 | .invert = 1, | 2078 | .invert = 1, |
1986 | .pll_set = nexusca_stv0297_pll_set, | 2079 | .pll_set = nexusca_stv0297_pll_set, |
1987 | }; | 2080 | }; |
@@ -2259,7 +2352,7 @@ static int frontend_init(struct av7110 *av7110) | |||
2259 | 2352 | ||
2260 | case 0x000A: // Hauppauge/TT Nexus-CA rev1.X | 2353 | case 0x000A: // Hauppauge/TT Nexus-CA rev1.X |
2261 | 2354 | ||
2262 | av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap, 0x7b); | 2355 | av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap); |
2263 | if (av7110->fe) { | 2356 | if (av7110->fe) { |
2264 | /* set TDA9819 into DVB mode */ | 2357 | /* set TDA9819 into DVB mode */ |
2265 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) | 2358 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 88f27a532163..2980db3ef22f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
42 | #include "stv0299.h" | 42 | #include "stv0299.h" |
43 | #include "stv0297.h" | ||
43 | #include "tda1004x.h" | 44 | #include "tda1004x.h" |
44 | 45 | ||
45 | #define DEBIADDR_IR 0x1234 | 46 | #define DEBIADDR_IR 0x1234 |
@@ -847,6 +848,180 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
847 | .request_firmware = philips_tdm1316l_request_firmware, | 848 | .request_firmware = philips_tdm1316l_request_firmware, |
848 | }; | 849 | }; |
849 | 850 | ||
851 | static int dvbc_philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
852 | { | ||
853 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
854 | u8 tuner_buf[5]; | ||
855 | struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, | ||
856 | .flags = 0, | ||
857 | .buf = tuner_buf, | ||
858 | .len = sizeof(tuner_buf) }; | ||
859 | int tuner_frequency = 0; | ||
860 | u8 band, cp, filter; | ||
861 | |||
862 | // determine charge pump | ||
863 | tuner_frequency = params->frequency + 36125000; | ||
864 | if (tuner_frequency < 87000000) | ||
865 | return -EINVAL; | ||
866 | else if (tuner_frequency < 130000000) { | ||
867 | cp = 3; | ||
868 | band = 1; | ||
869 | } else if (tuner_frequency < 160000000) { | ||
870 | cp = 5; | ||
871 | band = 1; | ||
872 | } else if (tuner_frequency < 200000000) { | ||
873 | cp = 6; | ||
874 | band = 1; | ||
875 | } else if (tuner_frequency < 290000000) { | ||
876 | cp = 3; | ||
877 | band = 2; | ||
878 | } else if (tuner_frequency < 420000000) { | ||
879 | cp = 5; | ||
880 | band = 2; | ||
881 | } else if (tuner_frequency < 480000000) { | ||
882 | cp = 6; | ||
883 | band = 2; | ||
884 | } else if (tuner_frequency < 620000000) { | ||
885 | cp = 3; | ||
886 | band = 4; | ||
887 | } else if (tuner_frequency < 830000000) { | ||
888 | cp = 5; | ||
889 | band = 4; | ||
890 | } else if (tuner_frequency < 895000000) { | ||
891 | cp = 7; | ||
892 | band = 4; | ||
893 | } else | ||
894 | return -EINVAL; | ||
895 | |||
896 | // assume PLL filter should always be 8MHz for the moment. | ||
897 | filter = 1; | ||
898 | |||
899 | // calculate divisor | ||
900 | tuner_frequency = (params->frequency + 36125000 + (62500/2)) / 62500; | ||
901 | |||
902 | // setup tuner buffer | ||
903 | tuner_buf[0] = tuner_frequency >> 8; | ||
904 | tuner_buf[1] = tuner_frequency & 0xff; | ||
905 | tuner_buf[2] = 0xc8; | ||
906 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
907 | tuner_buf[4] = 0x80; | ||
908 | |||
909 | stv0297_enable_plli2c(fe); | ||
910 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
911 | return -EIO; | ||
912 | |||
913 | msleep(50); | ||
914 | |||
915 | stv0297_enable_plli2c(fe); | ||
916 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
917 | return -EIO; | ||
918 | |||
919 | msleep(1); | ||
920 | |||
921 | return 0; | ||
922 | } | ||
923 | |||
924 | static u8 dvbc_philips_tdm1316l_inittab[] = { | ||
925 | 0x80, 0x01, | ||
926 | 0x80, 0x00, | ||
927 | 0x81, 0x01, | ||
928 | 0x81, 0x00, | ||
929 | 0x00, 0x09, | ||
930 | 0x01, 0x69, | ||
931 | 0x03, 0x00, | ||
932 | 0x04, 0x00, | ||
933 | 0x07, 0x00, | ||
934 | 0x08, 0x00, | ||
935 | 0x20, 0x00, | ||
936 | 0x21, 0x40, | ||
937 | 0x22, 0x00, | ||
938 | 0x23, 0x00, | ||
939 | 0x24, 0x40, | ||
940 | 0x25, 0x88, | ||
941 | 0x30, 0xff, | ||
942 | 0x31, 0x00, | ||
943 | 0x32, 0xff, | ||
944 | 0x33, 0x00, | ||
945 | 0x34, 0x50, | ||
946 | 0x35, 0x7f, | ||
947 | 0x36, 0x00, | ||
948 | 0x37, 0x20, | ||
949 | 0x38, 0x00, | ||
950 | 0x40, 0x1c, | ||
951 | 0x41, 0xff, | ||
952 | 0x42, 0x29, | ||
953 | 0x43, 0x20, | ||
954 | 0x44, 0xff, | ||
955 | 0x45, 0x00, | ||
956 | 0x46, 0x00, | ||
957 | 0x49, 0x04, | ||
958 | 0x4a, 0x00, | ||
959 | 0x4b, 0x7b, | ||
960 | 0x52, 0x30, | ||
961 | 0x55, 0xae, | ||
962 | 0x56, 0x47, | ||
963 | 0x57, 0xe1, | ||
964 | 0x58, 0x3a, | ||
965 | 0x5a, 0x1e, | ||
966 | 0x5b, 0x34, | ||
967 | 0x60, 0x00, | ||
968 | 0x63, 0x00, | ||
969 | 0x64, 0x00, | ||
970 | 0x65, 0x00, | ||
971 | 0x66, 0x00, | ||
972 | 0x67, 0x00, | ||
973 | 0x68, 0x00, | ||
974 | 0x69, 0x00, | ||
975 | 0x6a, 0x02, | ||
976 | 0x6b, 0x00, | ||
977 | 0x70, 0xff, | ||
978 | 0x71, 0x00, | ||
979 | 0x72, 0x00, | ||
980 | 0x73, 0x00, | ||
981 | 0x74, 0x0c, | ||
982 | 0x80, 0x00, | ||
983 | 0x81, 0x00, | ||
984 | 0x82, 0x00, | ||
985 | 0x83, 0x00, | ||
986 | 0x84, 0x04, | ||
987 | 0x85, 0x80, | ||
988 | 0x86, 0x24, | ||
989 | 0x87, 0x78, | ||
990 | 0x88, 0x10, | ||
991 | 0x89, 0x00, | ||
992 | 0x90, 0x01, | ||
993 | 0x91, 0x01, | ||
994 | 0xa0, 0x04, | ||
995 | 0xa1, 0x00, | ||
996 | 0xa2, 0x00, | ||
997 | 0xb0, 0x91, | ||
998 | 0xb1, 0x0b, | ||
999 | 0xc0, 0x53, | ||
1000 | 0xc1, 0x70, | ||
1001 | 0xc2, 0x12, | ||
1002 | 0xd0, 0x00, | ||
1003 | 0xd1, 0x00, | ||
1004 | 0xd2, 0x00, | ||
1005 | 0xd3, 0x00, | ||
1006 | 0xd4, 0x00, | ||
1007 | 0xd5, 0x00, | ||
1008 | 0xde, 0x00, | ||
1009 | 0xdf, 0x00, | ||
1010 | 0x61, 0x38, | ||
1011 | 0x62, 0x0a, | ||
1012 | 0x53, 0x13, | ||
1013 | 0x59, 0x08, | ||
1014 | 0xff, 0xff, | ||
1015 | }; | ||
1016 | |||
1017 | static struct stv0297_config dvbc_philips_tdm1316l_config = { | ||
1018 | .demod_address = 0x1c, | ||
1019 | .inittab = dvbc_philips_tdm1316l_inittab, | ||
1020 | .invert = 0, | ||
1021 | .pll_set = dvbc_philips_tdm1316l_pll_set, | ||
1022 | }; | ||
1023 | |||
1024 | |||
850 | 1025 | ||
851 | 1026 | ||
852 | static void frontend_init(struct budget_ci *budget_ci) | 1027 | static void frontend_init(struct budget_ci *budget_ci) |
@@ -868,6 +1043,15 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
868 | } | 1043 | } |
869 | break; | 1044 | break; |
870 | 1045 | ||
1046 | case 0x1010: // TT DVB-C CI budget (stv0297/Philips tdm1316l(tda6651tt)) | ||
1047 | budget_ci->tuner_pll_address = 0x61; | ||
1048 | budget_ci->budget.dvb_frontend = | ||
1049 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | ||
1050 | if (budget_ci->budget.dvb_frontend) { | ||
1051 | break; | ||
1052 | } | ||
1053 | break; | ||
1054 | |||
871 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1055 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) |
872 | budget_ci->tuner_pll_address = 0x63; | 1056 | budget_ci->tuner_pll_address = 0x63; |
873 | budget_ci->budget.dvb_frontend = | 1057 | budget_ci->budget.dvb_frontend = |
@@ -877,7 +1061,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
877 | } | 1061 | } |
878 | break; | 1062 | break; |
879 | 1063 | ||
880 | case 0x1012: // Hauppauge/TT Nova-T CI budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1064 | case 0x1012: // TT DVB-T CI budget (tda10046/Philips tdm1316l(tda6651tt)) |
881 | budget_ci->tuner_pll_address = 0x60; | 1065 | budget_ci->tuner_pll_address = 0x60; |
882 | budget_ci->budget.dvb_frontend = | 1066 | budget_ci->budget.dvb_frontend = |
883 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1067 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
@@ -965,10 +1149,12 @@ static struct saa7146_extension budget_extension; | |||
965 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); | 1149 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); |
966 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 1150 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
967 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); | 1151 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); |
1152 | MAKE_BUDGET_INFO(ttbcci, "TT-Budget-C-CI PCI", BUDGET_TT); | ||
968 | 1153 | ||
969 | static struct pci_device_id pci_tbl[] = { | 1154 | static struct pci_device_id pci_tbl[] = { |
970 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), | 1155 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), |
971 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), | 1156 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), |
1157 | MAKE_EXTENSION_PCI(ttbcci, 0x13c2, 0x1010), | ||
972 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), | 1158 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), |
973 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), | 1159 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), |
974 | { | 1160 | { |