Proposal for a wrap-up tda10086/tda826x, and a couple of questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good day list. I am the happy owner of a Pinnacle 400e USB gizmo. It
indeed works with the default code that's include in the kernel. Lots
of thanks go to the people who did the large amount of work that made
this possible.

But I am using my dish for exploring frequencies and transponders. I
have found out that the attached changes are needed for my type of
use.

What is included is:

* Change in the value of a few register settings, according to past
messages found on this list. For me, it is just like blind walking,
since I cannot access the (expletive deleted) document where the use
of each register is described. I also obviously cannot say if these
values are appropriate for other boards that use these chips.

* Change of sign of signal and SNR reporting. A high value indeed
corresponds to a low signal (at least on the 400e).

* The largest part of the patch is a change in the tuning logic. The
existing module sets frequency and  symbol rate every time the tuning
function is called, even if the value has not changed. In my scanning
procedure I do a lot of small frequency or symbol rate changes, and
the result is really much smoother with my code. But I cannot swear on
it.  

It would be nice if some of the maintainers could check the code,
correct the indentation (I am too old to change my indentation
habits...) and massage the patch into the main repository, but it is
also OK for me that this patch is just available to readers of this
list who feel like experimenting.

My questions are: 

1) the tuner is doing its own happy zigzagging whenever not tuned (I
make sure linux-dvb zigzagging is turned off). Can the overgods who
have access to the programming details for these chips let it trickle
down which register has to be changed to stop the lovely behaviour? A
tuner that jumps up and down is quite unfriendly when you are
searching for signals.

2) signal strength and snr are 8-bit values obtained by reading,
respectively, registers 0x43 and 0x1c. I was used (with my old
Hauppauge board that died a horrible death) to receive 16-bit values
for both indicators. Do the same overgods maybe know if there is some
sort of 16-bit signal level indicator available? 

Ciao

Carlo

-- 
  *         Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@xxxxxxxxx             che bisogno ci sarebbe
  *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
diff -r 520f7d68c8b4 linux/drivers/media/dvb/frontends/tda10086.c
--- a/linux/drivers/media/dvb/frontends/tda10086.c	Wed Apr 25 00:38:22 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/tda10086.c	Wed Apr 25 18:03:04 2007 +0200
@@ -115,8 +115,8 @@ static int tda10086_init(struct dvb_fron
 
 	// misc setup
 	tda10086_write_byte(state, 0x01, 0x94);
-	tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP
-	tda10086_write_byte(state, 0x03, 0x64);
+	tda10086_write_byte(state, 0x02, 0 /*0x35*/); // NOTE: TT drivers appear to disable CSWP
+	tda10086_write_byte(state, 0x03, 0xe4 /*0x64*/);
 	tda10086_write_byte(state, 0x04, 0x43);
 	tda10086_write_byte(state, 0x0c, 0x0c);
 	tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold
@@ -146,7 +146,7 @@ static int tda10086_init(struct dvb_fron
 	// setup AGC
 	tda10086_write_byte(state, 0x05, 0x0B);
 	tda10086_write_byte(state, 0x37, 0x63);
-	tda10086_write_byte(state, 0x3f, 0x03); // NOTE: flydvb uses 0x0a and varies it
+	tda10086_write_byte(state, 0x3f, 0x0a /* 0x03*/); // NOTE: flydvb uses 0x0a and varies it
 	tda10086_write_byte(state, 0x40, 0x64);
 	tda10086_write_byte(state, 0x41, 0x4f);
 	tda10086_write_byte(state, 0x42, 0x43);
@@ -398,28 +398,38 @@ static int tda10086_set_frontend(struct 
 
 	dprintk ("%s\n", __FUNCTION__);
 
-	// set params
-	if (fe->ops.tuner_ops.set_params) {
-		fe->ops.tuner_ops.set_params(fe, fe_params);
-		if (fe->ops.i2c_gate_ctrl)
-			fe->ops.i2c_gate_ctrl(fe, 0);
-
-		if (fe->ops.tuner_ops.get_frequency)
-			fe->ops.tuner_ops.get_frequency(fe, &freq);
-		if (fe->ops.i2c_gate_ctrl)
-			fe->ops.i2c_gate_ctrl(fe, 0);
-	}
-
-	// calcluate the frequency offset (in *Hz* not kHz)
-	freqoff = fe_params->frequency - freq;
-	freqoff = ((1<<16) * freqoff) / (SACLK/1000);
-	tda10086_write_byte(state, 0x3d, 0x80 | ((freqoff >> 8) & 0x7f));
-	tda10086_write_byte(state, 0x3e, freqoff);
+	if(state->frequency!=fe_params->frequency)
+	{
+// set params
+	  if (fe->ops.tuner_ops.set_params) {
+	    fe->ops.tuner_ops.set_params(fe, fe_params);
+	    if (fe->ops.i2c_gate_ctrl)
+	      fe->ops.i2c_gate_ctrl(fe, 0);
+	    
+	    if (fe->ops.tuner_ops.get_frequency)
+	      fe->ops.tuner_ops.get_frequency(fe, &freq);
+	    if (fe->ops.i2c_gate_ctrl)
+	      fe->ops.i2c_gate_ctrl(fe, 0);
+	  }
+	  
+// calcluate the frequency offset (in *Hz* not kHz)
+	  freqoff = fe_params->frequency - freq;
+	  
+	  freqoff = ((1<<16) * freqoff) / (SACLK/1000);
+	  tda10086_write_byte(state, 0x3d, 0x80 | ((freqoff >> 8) & 0x7f));
+	  tda10086_write_byte(state, 0x3e, freqoff);
+	  state->frequency = fe_params->frequency;
+	}
 
 	if ((ret = tda10086_set_inversion(state, fe_params)) < 0)
 		return ret;
-	if ((ret = tda10086_set_symbol_rate(state, fe_params)) < 0)
-		return ret;
+	if(state->symbol_rate != fe_params->u.qpsk.symbol_rate)
+	{
+	  if ((ret = tda10086_set_symbol_rate(state, fe_params)) < 0)
+	    return ret;
+	  state->symbol_rate = fe_params->u.qpsk.symbol_rate;
+	}
+	  
 	if ((ret = tda10086_set_fec(state, fe_params)) < 0)
 		return ret;
 
@@ -427,8 +437,6 @@ static int tda10086_set_frontend(struct 
 	tda10086_write_mask(state, 0x10, 0x40, 0x40);
 	tda10086_write_mask(state, 0x00, 0x01, 0x00);
 
-	state->symbol_rate = fe_params->u.qpsk.symbol_rate;
-	state->frequency = fe_params->frequency;
 	return 0;
 }
 
@@ -555,7 +563,7 @@ static int tda10086_read_signal_strength
 
 	dprintk ("%s\n", __FUNCTION__);
 
-	_str = tda10086_read_byte(state, 0x43);
+	_str = 255-tda10086_read_byte(state, 0x43);
 	*signal = (_str << 8) | _str;
 
 	return 0;
@@ -568,7 +576,7 @@ static int tda10086_read_snr(struct dvb_
 
 	dprintk ("%s\n", __FUNCTION__);
 
-	_snr = tda10086_read_byte(state, 0x1c);
+	_snr = 255-tda10086_read_byte(state, 0x1c);
 	*snr = (_snr << 8) | _snr;
 
 	return 0;
diff -r 520f7d68c8b4 linux/drivers/media/dvb/frontends/tda826x.c
--- a/linux/drivers/media/dvb/frontends/tda826x.c	Wed Apr 25 00:38:22 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/tda826x.c	Wed Apr 25 17:09:18 2007 +0200
@@ -89,8 +89,8 @@ static int tda826x_set_params(struct dvb
 	buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO
 	buf[3] = div >> 7;
 	buf[4] = div << 1;
-	buf[5] = 0xff; // basedband filter to max
-	buf[6] = 0xfe; // gains at max + no RF attenuation
+	buf[5] = 0x77 /*0xff*/; // basedband filter to max
+	buf[6] = 0x0e /*0xfe*/; // gains at max + no RF attenuation
 	buf[7] = 0x83; // charge pumps at high, tests off
 	buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports.
 	buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux