Yes, this works fine for me. Can somebody competent check it and then apply attached patches?

Robert Schlabbach wrote:
From: "michal" <[EMAIL PROTECTED]>

Revision 1.9:


There appear to be several typos in this code:


        cpump = div < 175000000 ? 2 : div < 390000000 ? 1 :
                div < 470000000 ? 2 : div < 750000000 ? 1 : 3;

        band_select = div < 175000000 ? 0x0e : div < 470000000 ? 0x05 :
0x03;


These comparions should apparently be against the *frequency*, not the
divider. Thus, replace all "div" with "freq" in above lines.


buf [3] = cpump | band_select;


Another bug. The charge pump bits are 7 and 6, not 1 and 0. Try

buf [3] = (cpump << 6) | band-select;

instead.

Hope this helps,
--
Robert Schlabbach
e-mail: [EMAIL PROTECTED]
Berlin, Germany




--- DVB/driver/frontends/grundig_29504-401.c.old        2003-04-09 13:24:35.000000000 
+0200
+++ DVB/driver/frontends/grundig_29504-401.c    2003-06-04 14:37:34.000000000 +0200
@@ -110,15 +110,15 @@
        div = (36125000 + freq) / 166666;
        cfg = 0x88;
 
-       cpump = div < 175000000 ? 2 : div < 390000000 ? 1 :
-               div < 470000000 ? 2 : div < 750000000 ? 1 : 3;
+       cpump = freq < 175000000 ? 2 : freq < 390000000 ? 1 :
+               freq < 470000000 ? 2 : freq < 750000000 ? 1 : 3;
 
-       band_select = div < 175000000 ? 0x0e : div < 470000000 ? 0x05 : 0x03;
+       band_select = freq < 175000000 ? 0x0e : freq < 470000000 ? 0x05 : 0x03;
 
        buf [0] = (div >> 8) & 0x7f;
        buf [1] = div & 0xff;
        buf [2] = ((div >> 10) & 0x60) | cfg;
-       buf [3] = cpump | band_select;
+       buf [3] = (cpump<<6) | band_select;
 
        return tsa5060_write(i2c, buf);
 }
--- dvb-kernel/linux/drivers/media/dvb/frontends/grundig_29504-401.c.old        
2003-05-27 13:06:47.000000000 +0200
+++ dvb-kernel/linux/drivers/media/dvb/frontends/grundig_29504-401.c    2003-06-04 
14:30:43.000000000 +0200
@@ -113,15 +113,15 @@
        div = (36125000 + freq) / 166666;
        cfg = 0x88;
 
-       cpump = div < 175000000 ? 2 : div < 390000000 ? 1 :
-               div < 470000000 ? 2 : div < 750000000 ? 1 : 3;
+       cpump = freq < 175000000 ? 2 : freq < 390000000 ? 1 :
+               freq < 470000000 ? 2 : freq < 750000000 ? 1 : 3;
 
-       band_select = div < 175000000 ? 0x0e : div < 470000000 ? 0x05 : 0x03;
+       band_select = freq < 175000000 ? 0x0e : freq < 470000000 ? 0x05 : 0x03;
 
        buf [0] = (div >> 8) & 0x7f;
        buf [1] = div & 0xff;
        buf [2] = ((div >> 10) & 0x60) | cfg;
-       buf [3] = cpump | band_select;
+       buf [3] = (cpump << 6) | band_select;
 
        return tsa5060_write(i2c, buf);
 }

Reply via email to