Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bb6e259 authored by Oliver Endriss's avatar Oliver Endriss Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (4784): [saa7146_i2c] short_delay mode fixed for fast machines



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: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 588f9831
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -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 */
		/* wait until we get a transfer done or error */
		timeout = jiffies + HZ/100 + 1; /* 10ms */
		timeout = jiffies + HZ/100 + 1; /* 10ms */
		while(1) {
		/* first read usually delivers bogus results... */
			/**
			 *  first read usually delivers bogus results...
			 */
		saa7146_i2c_status(dev);
		saa7146_i2c_status(dev);
		while(1) {
			status = saa7146_i2c_status(dev);
			status = saa7146_i2c_status(dev);
			if ((status & 0x3) != 1)
			if ((status & 0x3) != 1)
				break;
				break;
@@ -232,7 +230,7 @@ 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"));
				DEB_I2C(("saa7146_i2c_writeout: timed out waiting for end of xfer\n"));
				return -EIO;
				return -EIO;
			}
			}
			if ((++trial < 20) && short_delay)
			if (++trial < 50 && short_delay)
				udelay(10);
				udelay(10);
			else
			else
				msleep(1);
				msleep(1);