Mailing List archive

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

[linux-dvb] Re: Erroneous unsupported PLL synthesizer: foundit!!



Hi Andrew,

Andrew de Quincey wrote:
Here you are.. this should also still report address errors correctly.
looks good, but I wonder if we shouldn't add a delay'n'retry on adress error for the current message only...
(imagine the stv0299 i2c gate case: 1st msg is opening the gate, then the second message has to wait a bit, but we don't want to resend the entire message...)

Anyway, I applied your patch to CVS, further optimisations can follow later.

Holger



------------------------------------------------------------------------

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.11
diff -u -r1.11 saa7146_i2c.c
--- linux/drivers/media/common/saa7146_i2c.c 13 Jan 2003 17:24:16 -0000 1.11
+++ linux/drivers/media/common/saa7146_i2c.c 18 Mar 2003 12:27:42 -0000
@@ -285,6 +285,7 @@
int i = 0, count = 0;
u32* buffer = dev->i2c_mem;
int err = 0;
+ int address_err = 0;

if (down_interruptible (&dev->i2c_lock))
return -ERESTARTSYS;
@@ -312,9 +313,8 @@
for(i = 0; i < count; i++) {
err = saa7146_i2c_writeout(dev, &buffer[i] );
if ( 0 != err) {
- /* if address-error occured, donīt retry */
if ( -EREMOTEIO == err ) {
- goto out;
+ address_err++;
}
DEB_I2C(("error while sending message(s). starting again.\n"));
break;
@@ -324,15 +324,11 @@
err = num;
break;
}
+ + /* delay a bit before retrying */
+ my_wait(dev, 10);

} while (err != num && retries--);
-
- /* if any things had to be read, get the results */
- if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) {
- DEB_I2C(("could not cleanup i2c-message.\n"));
- err = -1;
- goto out;
- }
/* another bug in revision 0: the i2c-registers get uploaded randomly by other
uploads, so we better clear them out before continueing */
@@ -341,6 +337,18 @@
if( 0 != saa7146_i2c_writeout(dev, &zero)) {
INFO(("revision 0 error. this should never happen.\n"));
}
+ }
+ + /* if every retry had an address error, exit right away */
+ if (address_err == retries) {
+ goto out;
+ }
+ + /* if any things had to be read, get the results */
+ if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) {
+ DEB_I2C(("could not cleanup i2c-message.\n"));
+ err = -1;
+ goto out;
}
/* return the number of delivered messages */


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



Home | Main Index | Thread Index