On Mon, Jul 25, 2005 Adam Szalkowski wrote: > > 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. Cool. Can you give me your Signed-off-by: for this patch (see linux/Documentaion/SubmittingPatches), please? Additionally, the patch is word-wrapped, which is no problem in this case because it is small enough so I can repair it by hand, but you better send it as an attachment if you cannot get your mailer to stop work-wrapping it. Thanks, Johannes > --- 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 >