[linux-dvb] cx24110 driver question/problem

Adam Szalkowski adamsz at gmx.net
Mon Jul 25 08:40:46 CEST 2005


> BTW, the loop:
> 	for (i = 500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40) ; )
> 		; /* wait for LNB ready */
>
> hammers mercilessly on the i2c bus, it might be worth to
> add an msleep(1) and descrease i to 13 resp. 100 (burst
> lenght is 12.5ms, DiSEqC msg is 54ms typically but depends on the
> message), or not?

Hi,
I've included this improvement in the patch and it is working for me.
Additionally I've made the register writes conditional, this could save a few 
cycles.

--- drivers/media/dvb/frontends/cx24110.c.orig  2005-07-11 22:26:25.000000000 
+0200
+++ drivers/media/dvb/frontends/cx24110.c       2005-07-25 08:26:52.000000000 
+0200
@@ -398,7 +398,8 @@
                return -EINVAL;

        rv = cx24110_readreg(state, 0x77);
-       cx24110_writereg(state, 0x77, rv|0x04);
+       if (!(rv & 0x04))
+               cx24110_writereg(state, 0x77, rv | 0x04);

        rv = cx24110_readreg(state, 0x76);
        cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit));
@@ -418,13 +419,16 @@
                cx24110_writereg(state, 0x79 + i, cmd->msg[i]);

        rv = cx24110_readreg(state, 0x77);
-       cx24110_writereg(state, 0x77, rv|0x04);
+       if (rv & 0x04) {
+               cx24110_writereg(state, 0x77, rv & ~0x04);
+               msleep(30);
+       }

        rv = cx24110_readreg(state, 0x76);

        cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) 
& 3));
-       for (i=500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40);)
-               ; /* wait for LNB ready */
+       for (i=100; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40);)
+               msleep(1); /* wait for LNB ready */

        return 0;
 }



Adam




More information about the linux-dvb mailing list