diff options
author | Holger Waechtler <devnull@localhost> | 2003-06-14 20:06:03 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-06-14 20:06:03 +0000 |
commit | 6ab1b6d82dd4695f9640f7a34085057c7ab043c2 (patch) | |
tree | 3e984096b5f8c24cf180f1ba3580bcc2d0f3c73a /linux/drivers/media/common/saa7146_i2c.c | |
parent | 07e4c27ee61a298e28ad61b55df67ba81b6a07e2 (diff) | |
download | mediapointer-dvb-s2-6ab1b6d82dd4695f9640f7a34085057c7ab043c2.tar.gz mediapointer-dvb-s2-6ab1b6d82dd4695f9640f7a34085057c7ab043c2.tar.bz2 |
i2c fixes and build fixes. Must have been brain-amputated yesterday...
Diffstat (limited to 'linux/drivers/media/common/saa7146_i2c.c')
-rw-r--r-- | linux/drivers/media/common/saa7146_i2c.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/linux/drivers/media/common/saa7146_i2c.c b/linux/drivers/media/common/saa7146_i2c.c index 535cd55ba..b5d2745a0 100644 --- a/linux/drivers/media/common/saa7146_i2c.c +++ b/linux/drivers/media/common/saa7146_i2c.c @@ -190,6 +190,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword) { u32 status = 0, mc2 = 0; + int trial = 0; int timeout; /* write out i2c-command */ @@ -230,10 +231,13 @@ int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword) /* wait until we get a transfer done or error */ timeout = jiffies + HZ/100 + 1; /* 10ms */ while(1) { + /** + * first read usually delivers bogus results... + */ + saa7146_i2c_status(dev); status = saa7146_i2c_status(dev); - if( (0x3 == (status & 0x3)) || (0 == (status & 0x1)) ) { + if ((status & 0x3) != 1) break; - } if (jiffies > timeout) { /* this is normal when probing the bus * (no answer from nonexisistant device...) @@ -241,7 +245,10 @@ int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword) DEB_I2C(("saa7146_i2c_writeout: timed out waiting for end of xfer\n")); return -EIO; } - my_wait(dev,1); + if (++trial < 10) + udelay(10); + else + my_wait(dev,1); } } |