aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2007-05-28 17:06:27 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-06-08 07:21:13 -0400
commitc6604150ab04aaaf98baf1ddca2e9e4f7d3da4d3 (patch)
tree61ff048d9c9b8b4f1c8d9a8b729ed847cc79f2ac /drivers/media/dvb
parentdc02d50a6d71cba2b2edb78377af5a5965879a49 (diff)
V4L/DVB (5716): Tda10086,tda826x: fix tuning, STR/SNR values
Several people reported unreliable reception with the current driver. Furthermore, STR and SNR values seem to be inverted. This fix is based on a patch posted by Hartmut Hackman. Thanks to Helmut Auer for testing and helping to optimize the patch. tda826x: - set baseband cut-off to 19 MHz tda10086: - change the parameters of the carrier recovery loop - toggle register 0x02 between 0x35 (tuning) and 0x00 (locked) - invert STR and SNR values Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/tda10086.c21
-rw-r--r--drivers/media/dvb/frontends/tda826x.c4
2 files changed, 18 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index ccc429cbbad0..0f2d4b415560 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -41,6 +41,7 @@ struct tda10086_state {
41 /* private demod data */ 41 /* private demod data */
42 u32 frequency; 42 u32 frequency;
43 u32 symbol_rate; 43 u32 symbol_rate;
44 bool has_lock;
44}; 45};
45 46
46static int debug = 0; 47static int debug = 0;
@@ -116,7 +117,7 @@ static int tda10086_init(struct dvb_frontend* fe)
116 // misc setup 117 // misc setup
117 tda10086_write_byte(state, 0x01, 0x94); 118 tda10086_write_byte(state, 0x01, 0x94);
118 tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP 119 tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP
119 tda10086_write_byte(state, 0x03, 0x64); 120 tda10086_write_byte(state, 0x03, 0xe4);
120 tda10086_write_byte(state, 0x04, 0x43); 121 tda10086_write_byte(state, 0x04, 0x43);
121 tda10086_write_byte(state, 0x0c, 0x0c); 122 tda10086_write_byte(state, 0x0c, 0x0c);
122 tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold 123 tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold
@@ -146,7 +147,7 @@ static int tda10086_init(struct dvb_frontend* fe)
146 // setup AGC 147 // setup AGC
147 tda10086_write_byte(state, 0x05, 0x0B); 148 tda10086_write_byte(state, 0x05, 0x0B);
148 tda10086_write_byte(state, 0x37, 0x63); 149 tda10086_write_byte(state, 0x37, 0x63);
149 tda10086_write_byte(state, 0x3f, 0x03); // NOTE: flydvb uses 0x0a and varies it 150 tda10086_write_byte(state, 0x3f, 0x0a); // NOTE: flydvb varies it
150 tda10086_write_byte(state, 0x40, 0x64); 151 tda10086_write_byte(state, 0x40, 0x64);
151 tda10086_write_byte(state, 0x41, 0x4f); 152 tda10086_write_byte(state, 0x41, 0x4f);
152 tda10086_write_byte(state, 0x42, 0x43); 153 tda10086_write_byte(state, 0x42, 0x43);
@@ -398,6 +399,10 @@ static int tda10086_set_frontend(struct dvb_frontend* fe,
398 399
399 dprintk ("%s\n", __FUNCTION__); 400 dprintk ("%s\n", __FUNCTION__);
400 401
402 // modify parameters for tuning
403 tda10086_write_byte(state, 0x02, 0x35);
404 state->has_lock = false;
405
401 // set params 406 // set params
402 if (fe->ops.tuner_ops.set_params) { 407 if (fe->ops.tuner_ops.set_params) {
403 fe->ops.tuner_ops.set_params(fe, fe_params); 408 fe->ops.tuner_ops.set_params(fe, fe_params);
@@ -542,8 +547,14 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status)
542 *fe_status |= FE_HAS_VITERBI; 547 *fe_status |= FE_HAS_VITERBI;
543 if (val & 0x08) 548 if (val & 0x08)
544 *fe_status |= FE_HAS_SYNC; 549 *fe_status |= FE_HAS_SYNC;
545 if (val & 0x10) 550 if (val & 0x10) {
546 *fe_status |= FE_HAS_LOCK; 551 *fe_status |= FE_HAS_LOCK;
552 if (!state->has_lock) {
553 state->has_lock = true;
554 // modify parameters for stable reception
555 tda10086_write_byte(state, 0x02, 0x00);
556 }
557 }
547 558
548 return 0; 559 return 0;
549} 560}
@@ -555,7 +566,7 @@ static int tda10086_read_signal_strength(struct dvb_frontend* fe, u16 * signal)
555 566
556 dprintk ("%s\n", __FUNCTION__); 567 dprintk ("%s\n", __FUNCTION__);
557 568
558 _str = tda10086_read_byte(state, 0x43); 569 _str = 0xff - tda10086_read_byte(state, 0x43);
559 *signal = (_str << 8) | _str; 570 *signal = (_str << 8) | _str;
560 571
561 return 0; 572 return 0;
@@ -568,7 +579,7 @@ static int tda10086_read_snr(struct dvb_frontend* fe, u16 * snr)
568 579
569 dprintk ("%s\n", __FUNCTION__); 580 dprintk ("%s\n", __FUNCTION__);
570 581
571 _snr = tda10086_read_byte(state, 0x1c); 582 _snr = 0xff - tda10086_read_byte(state, 0x1c);
572 *snr = (_snr << 8) | _snr; 583 *snr = (_snr << 8) | _snr;
573 584
574 return 0; 585 return 0;
diff --git a/drivers/media/dvb/frontends/tda826x.c b/drivers/media/dvb/frontends/tda826x.c
index 79f971dc52b6..bd3ebc284835 100644
--- a/drivers/media/dvb/frontends/tda826x.c
+++ b/drivers/media/dvb/frontends/tda826x.c
@@ -89,8 +89,8 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
89 buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO 89 buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO
90 buf[3] = div >> 7; 90 buf[3] = div >> 7;
91 buf[4] = div << 1; 91 buf[4] = div << 1;
92 buf[5] = 0xff; // basedband filter to max 92 buf[5] = 0x77; // baseband cut-off 19 MHz
93 buf[6] = 0xfe; // gains at max + no RF attenuation 93 buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation
94 buf[7] = 0x83; // charge pumps at high, tests off 94 buf[7] = 0x83; // charge pumps at high, tests off
95 buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. 95 buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports.
96 buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL 96 buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL