Mailing List archive

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

[linux-dvb] Re: Slow i2c problem



From: "Andrew de Quincey" <adq_dvb@lidskialf.net>
> I'm transmitting the data in 64 byte chunks to the chip. Problem is
> the data rate turns out to be roughly 320 bytes/sec! So a full upload
> takes 95 SECONDS to complete.

I'd say the i2c routines are just poorly written, or rather, the hardware
was not fully understood. Look at this comment in the source:

/* reason: while fiddling around with the i2c-routines, I noticed
   that after writing out an i2c-command, one may not read out the
   status immediately after that. you *must* wait some time, before
   even the busy-flag gets set */

I, too, noticed that the PSR does not immediately reflect the I2C busy
status, but the fix is *FAR* simpler than that: Simply read the PSR *once*
and *junk* the result. Reading it a *second* time always resulted in the
proper I2C busy status for me.

But take a look what the i2c_busy_rise_and_fall() function does instead: It
reads the PSR *once* and if the "I2C busy" bit is not set (which it never
is upon the first read!) it does:

  /* see if anything can be done while we're waiting */
  SAA7146_RESCHED;
  mdelay(1);

Not surprising that the performance is poor...

> Does anyone have any suggestions?

Yes, rewrite the SAA7146A I2C functions from scratch :) Alternatively, try
putting just an extra read of the PSR into the i2c_busy_rise_and_fall()
function before the loops, that might work wonders already.

Regards,
--
Robert Schlabbach
e-mail: robert_s@gmx.net
Berlin, Germany



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index