Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Re: Slow i2c problem
Hello Robert,
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:
Yes, yes, bash me already... 8-)
/* 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.
The "old" av7110 driver (in DVB) was forked from an early version of my
saa7146. From a time, where I did not fully understand the hardware and
had quite poor kernel programming knowledge.
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:
It fully admit that this stuff is utterly crap. It was improved during
my work on the video4linux-2 saa7146 driver and is now in dvb-kernel.
It's still far from being optimal, but it works.
For the analog video cards, i2c is only used for non-critical stuff, so
even the old code was good-enough most of the time.
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.
Please have a look at dvb-kernel, too. If anyone fixes up the i2c
routines, I'll apply the patches.
The only problem is, that the code must work with all old analog tv
cards I have, too, which use various i2c helper chipsets. (The
Multimedia eXtension Board, the dpc7146 Demonstration board, the Hexium
Orion and Gemini frame grabbers, ...)
I once added irq based i2c transmission, but this only works for non-DVB
cards. If you do have TS grabbing and use irq based i2c for reading the
frontend status for example, the additionaly irqs screw up the TS
capture irqs, resulting in debi oops messages and TS lockup.
CU
Michael.
--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index