aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/stv0297.c
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2005-09-09 16:03:07 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:45 -0400
commitdc27a1696089a9a9d317fc815915e6761e22eeb5 (patch)
treece797c46a6c8ef98d7c7bcc5da90e210967799d3 /drivers/media/dvb/frontends/stv0297.c
parentf63f5346c943008fe8f6ac66a9026f6c35e24947 (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/frontends/stv0297.c')
-rw-r--r--drivers/media/dvb/frontends/stv0297.c121
1 files changed, 3 insertions, 118 deletions
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
49static 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
138static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) 49static 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)
738static struct dvb_frontend_ops stv0297_ops; 624static struct dvb_frontend_ops stv0297_ops;
739 625
740struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, 626struct 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)