summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2003-06-16 22:02:46 +0000
committerHolger Waechtler <devnull@localhost>2003-06-16 22:02:46 +0000
commite9fa3995438bfb9e0383faa4b8e9a481863db3de (patch)
treee1b13824432ba129d8a64ea60ea7683eaa88112d /linux
parent977e89a6a4e6f7a2b9695d934c2acb8c6c21d205 (diff)
downloadmediapointer-dvb-s2-e9fa3995438bfb9e0383faa4b8e9a481863db3de.tar.gz
mediapointer-dvb-s2-e9fa3995438bfb9e0383faa4b8e9a481863db3de.tar.bz2
Fix to the jerking problem with tda10045h
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/common/saa7146_i2c.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/linux/drivers/media/common/saa7146_i2c.c b/linux/drivers/media/common/saa7146_i2c.c
index b5d2745a0..7b7d67ca9 100644
--- a/linux/drivers/media/common/saa7146_i2c.c
+++ b/linux/drivers/media/common/saa7146_i2c.c
@@ -187,7 +187,7 @@ int saa7146_i2c_reset(struct saa7146_dev *dev)
it returns 0 if ok, -1 if the transfer failed, -2 if the transfer
failed badly (e.g. address error) */
static
-int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword)
+int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_delay)
{
u32 status = 0, mc2 = 0;
int trial = 0;
@@ -245,7 +245,7 @@ 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;
}
- if (++trial < 10)
+ if ((++trial < 20) && short_delay)
udelay(10);
else
my_wait(dev,1);
@@ -290,6 +290,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
u32* buffer = dev->d_i2c.cpu_addr;
int err = 0;
int address_err = 0;
+ int short_delay = 0;
if (down_interruptible (&dev->i2c_lock))
return -ERESTARTSYS;
@@ -305,6 +306,8 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
goto out;
}
+ if (count > 3) short_delay = 1;
+
do {
/* reset the i2c-device if necessary */
err = saa7146_i2c_reset(dev);
@@ -315,7 +318,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
/* write out the u32s one after another */
for(i = 0; i < count; i++) {
- err = saa7146_i2c_writeout(dev, &buffer[i] );
+ err = saa7146_i2c_writeout(dev, &buffer[i], short_delay);
if ( 0 != err) {
/* this one is unsatisfying: some i2c slaves on some
dvb cards don't acknowledge correctly, so the saa7146
@@ -370,7 +373,7 @@ out:
if( 0 == dev->revision ) {
u32 zero = 0;
saa7146_i2c_reset(dev);
- if( 0 != saa7146_i2c_writeout(dev, &zero)) {
+ if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) {
INFO(("revision 0 error. this should never happen.\n"));
}
}