[linux-dvb] loop bandwidth

e9hack e9hack at googlemail.com
Sun Jan 21 10:40:38 CET 2007


Manu Abraham wrote:
> Hi all,
>
> would it make sense to initially lock with a larger loop bandwidth
> (for a faster lock) and once locked, switch to a smaller loop
> bandwidth (for lower phase noise) ?
>
If you mean the lock of the tuner-pll, I did it for the cinergy DVB-C card:

diff -r e625163eba29 linux/drivers/media/dvb/ttpci/budget-av.c
--- a/linux/drivers/media/dvb/ttpci/budget-av.c    Sat Jan 20 15:53:08
2007 -0200
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c    Sun Jan 21 09:54:15
2007 +0100
@@ -633,6 +633,7 @@ static int philips_cu1216_tuner_set_para
     struct budget *budget = (struct budget *) fe->dvb->priv;
     u8 buf[4];
     struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len =
sizeof(buf) };
+    int i;
 
 #define TUNER_MUL 62500
 
@@ -640,7 +641,7 @@ static int philips_cu1216_tuner_set_para
 
     buf[0] = (div >> 8) & 0x7f;
     buf[1] = div & 0xff;
-    buf[2] = 0x86;
+    buf[2] = 0xce;
     buf[3] = (params->frequency < 150000000 ? 0x01 :
           params->frequency < 445000000 ? 0x02 : 0x04);
 
@@ -648,6 +649,29 @@ static int philips_cu1216_tuner_set_para
         fe->ops.i2c_gate_ctrl(fe, 1);
     if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
         return -EIO;
+   
+    msg.flags = I2C_M_RD;
+    msg.len = 1;
+    for (i = 0; i < 20; i++) {
+        if (fe->ops.i2c_gate_ctrl)
+            fe->ops.i2c_gate_ctrl(fe, 1);
+        if (i2c_transfer(&budget->i2c_adap, &msg, 1) == 1 && (buf[0] &
0x40))
+            break;
+        msleep(10);
+    }
+   
+    msg.flags = 0;
+    msg.buf = &buf[2];
+    msg.len = 2;
+    buf[2] &= ~0x40;
+    if (fe->ops.i2c_gate_ctrl)
+        fe->ops.i2c_gate_ctrl(fe, 1);
+    if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
+        return -EIO;
+   
+    printk("(%s:%d)Loops %d, Status %02x, Frequency %d.%dMHz\n",
+           __FILE__, __LINE__, i, buf[0], params->frequency / 1000000,
(params->frequency / 100000) % 10);
+          
     return 0;
 }
 
Many pll chips have an auto-switch feature. It isn't necessary to switch
the charge pump current manually. It may be a problem, that many tune
functions do never wait for the lock. This is not a problem if the time
for the lock is lower than the time for initializing the demodulator.
For the patch above, I get one loop for switching some channels forward
or backward. I get 2..3 loops for switching from the highest channel on
VHFH to the lowest channel on UHF.

Another nice feature is the AGC time constant and the AGC take-over
point. The AGC values are never programed for the Cinergy card. The
reset values are used always. 

- Hartmut




More information about the linux-dvb mailing list