[linux-dvb] [PATCH 1/3] Fix a problem during the access to the IER and ISR registers of the SA7146

e9hack e9hack at googlemail.com
Sun Dec 17 20:06:13 CET 2006


Dominik Strasser wrote:
> Hartmut,
> here is the output + maybe some interesting info.
> I haven't connected the antenna connector to the FF card.
> The card has the analogue module mounted but it is unused. It also has
> a CI interface, but no CAM is inserted.
>
> Regards
>
> Dominik
>
> Here is the debug output (some lines, I can give you more if you want
> :-) )
>
> Dec 17 17:09:43 VDR kernel: saa7146_i2c_writeout(13c2,0000): timed out
> waiting for end of xfer
It comes from your FuSi FF card.

> Dec 17 17:09:43 VDR kernel: EIO after saa7146_i2c_writeout:
> count=1(2), data=0x86000040, addr=0x09, R/W=W, buf[0]=0x00
I think that this comes from ves1820_readreg(). The failing transfer is
always the second message. I would like to see the affected register,
but for the ves1820 the first value is the sub-address. I've modified
the patch a little bit. Now it prints also the register.

If your kernel is configured with a timer frequency of 100Hz or if your
pc runs with a high load, the timeout value of 10ms may be to small. The
second patch increases the timeout value to 50ms.

- Hartmut

 
-------------- next part --------------
diff -r 557f307c31de linux/drivers/media/common/saa7146_i2c.c
--- a/linux/drivers/media/common/saa7146_i2c.c	Sat Dec 16 18:38:44 2006 -0200
+++ b/linux/drivers/media/common/saa7146_i2c.c	Sun Dec 17 19:45:37 2006 +0100
@@ -203,7 +203,8 @@ static int saa7146_i2c_writeout(struct s
 				/* a signal arrived */
 				return -ERESTARTSYS;
 
-			printk(KERN_WARNING "saa7146_i2c_writeout: timed out waiting for end of xfer\n");
+			printk(KERN_WARNING "saa7146_i2c_writeout(%04x,%04x): timed out waiting for end of xfer\n", 
+				dev->pci->subsystem_vendor, dev->pci->subsystem_device);
 			return -EIO;
 		}
 		status = saa7146_read(dev, I2C_STATUS);
@@ -314,6 +315,10 @@ int saa7146_i2c_transfer(struct saa7146_
 		/* write out the u32s one after another */
 		for(i = 0; i < count; i++) {
 			err = saa7146_i2c_writeout(dev, &buffer[i], short_delay);
+			if (err == -EIO) {
+				printk("EIO after saa7146_i2c_writeout: count=%d(%d), data=0x%08x, addr=0x%02x, R/W=%c, len=%d, buf[0]=0x%02x, buf[1]=0x%02x\n", 
+					i, count, buffer[i], msgs[0].addr , msgs[0].flags & I2C_M_RD ? 'R' : 'W', msgs[0].len, msgs[0].buf[0], msgs[0].len > 1 ? msgs[0].buf[1] : 0);
+			}
 			if ( 0 != err) {
 				/* this one is unsatisfying: some i2c slaves on some
 				   dvb cards don't acknowledge correctly, so the saa7146
-------------- next part --------------
diff -r 557f307c31de linux/drivers/media/common/saa7146_i2c.c
--- a/linux/drivers/media/common/saa7146_i2c.c	Sat Dec 16 18:38:44 2006 -0200
+++ b/linux/drivers/media/common/saa7146_i2c.c	Sun Dec 17 19:48:28 2006 +0100
@@ -194,7 +194,7 @@ static int saa7146_i2c_writeout(struct s
 		SAA7146_IER_ENABLE(dev, MASK_16|MASK_17);
 		saa7146_write(dev, MC2, (MASK_00 | MASK_16));
 
-		timeout = HZ/100 + 1; /* 10ms */
+		timeout = 5*HZ/100 + 1; /* 50ms */
 		timeout = wait_event_interruptible_timeout(dev->i2c_wq, dev->i2c_op == 0, timeout);
 		if (timeout == -ERESTARTSYS || dev->i2c_op) {
 			SAA7146_IER_DISABLE(dev, MASK_16|MASK_17);


More information about the linux-dvb mailing list