Mailing List archive

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

[linux-dvb] Re: Slow i2c problem -- temporary patch



> > 2) I've changed the wait-for-status-delay to use mdelay()... which is not
> > ideal as we are now effectively busy waiting, but the current 1 jiffy
> > delay is WAY too much at the new speed. At 275kHz, it doesn't  delay for
> > long enough for this to be significant though.
>
> I modified your patch so that we use busy waiting only the first 10
> trials, thenafter we call the scheduler so that the system won't lock up
> for some 1/10s seconds in the worst case.
>
> Please play a little with the actual number of trials we should to
> busy-waiting, I can't test this since I neither have a desktop PC with
> PCI slots nor a DVB card here.

Neat idea. I found for the tda10045h firmware upload I had to increase the 
number of trials to 20. Patch attached

> > 3) If you reduce the i2c bitrate again (say back to 10kHz), your machine
> > will appear to hang. This is because it is having to delay for much
> > longer for the transmission to complete, and therefore the busy wait
> > implied by mdelay() becomes significant
> >
> > Later, I'll submit a better patch with rate-adaptive delays, but for now,
> > I'd definitely recommend using this if you're testing the tda driver.
>
> Please create your patches in the future using 'cvs -q diff -pu',
> context patches are much easier to review.

Will do so. Might be an idea to put that command on your developer's 
webpage....

Index: linux/drivers/media/common/saa7146_i2c.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/common/saa7146_i2c.c,v
retrieving revision 1.19
diff -p -u -r1.19 saa7146_i2c.c
--- linux/drivers/media/common/saa7146_i2c.c	14 Jun 2003 20:06:03 -0000	1.19
+++ linux/drivers/media/common/saa7146_i2c.c	16 Jun 2003 09:26:07 -0000
@@ -245,7 +245,7 @@ int saa7146_i2c_writeout(struct saa7146_
 				DEB_I2C(("saa7146_i2c_writeout: timed out waiting for end of xfer\n"));
 				return -EIO;
 			}
-			if (++trial < 10)
+			if (++trial < 20)
 				udelay(10);
 			else
 				my_wait(dev,1);

Home | Main Index | Thread Index