]> err.no Git - linux-2.6/commitdiff
V4L/DVB (4784): [saa7146_i2c] short_delay mode fixed for fast machines
authorOliver Endriss <o.endriss@gmx.de>
Fri, 27 Oct 2006 21:02:01 +0000 (18:02 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 3 Nov 2006 02:58:11 +0000 (23:58 -0300)
TT DVB-C 2300 runs at 137 kHz I2C speed. short_delay mode did not work
reliably on fast machines with that speed. Increased max loop count from
20 to 50. Moved dummy access out of the loop.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/common/saa7146_i2c.c

index d9953f7a8b6b924eb13964624021593252a850cb..5297a365c928e2b8c8928c8f3edafc7324db1915 100644 (file)
@@ -217,11 +217,9 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
                }
                /* wait until we get a transfer done or error */
                timeout = jiffies + HZ/100 + 1; /* 10ms */
+               /* first read usually delivers bogus results... */
+               saa7146_i2c_status(dev);
                while(1) {
-                       /**
-                        *  first read usually delivers bogus results...
-                        */
-                       saa7146_i2c_status(dev);
                        status = saa7146_i2c_status(dev);
                        if ((status & 0x3) != 1)
                                break;
@@ -232,10 +230,10 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
                                DEB_I2C(("saa7146_i2c_writeout: timed out waiting for end of xfer\n"));
                                return -EIO;
                        }
-                       if ((++trial < 20) && short_delay)
+                       if (++trial < 50 && short_delay)
                                udelay(10);
                        else
-                       msleep(1);
+                               msleep(1);
                }
        }