Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Slow i2c problem -- temporary patch



Here's a temporary patch (for dvb-kernel CVS head) for those trying out the 
tda10045h driver. As per Robert's suggestion, I have upped the i2c bitrate to 
275kHz, and I've reduced the delay while waiting for the i2c status.

Issues:
1) Is there a reason for the i2c bitrate to be set to 10kHz right now? Perhaps 
some cards have very slow i2c components? It is fine on the tda10045h-based 
cards

2) I've changed the wait-for-status-delay to use mdelay()... which is not 
ideal as we are now effectively busy waiting, but the current 1 jiffy delay 
is WAY too much at the new speed. At 275kHz, it doesn't  delay for long 
enough for this to be significant though.

3) If you reduce the i2c bitrate again (say back to 10kHz), your machine will 
appear to hang. This is because it is having to delay for much longer for the 
transmission to complete, and therefore the busy wait implied by mdelay() 
becomes significant.

Later, I'll submit a better patch with rate-adaptive delays, but for now, I'd 
definitely recommend using this if you're testing the tda driver.
Index: linux/drivers/media/common/saa7146_i2c.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/common/saa7146_i2c.c,v
retrieving revision 1.18
diff -r1.18 saa7146_i2c.c
220c220
< 		while(1) {
---
> 	        while(1) {
229a230
>
231a233
> 	        saa7146_i2c_status(dev);
234c236
< 			if( (0x3 == (status & 0x3)) || (0 == (status & 0x1)) ) {
---
> 		        if ((status & 0x3) != 1) {
244c246
< 			my_wait(dev,1);
---
> 		        udelay(10);
Index: linux/drivers/media/dvb/ttpci/budget-core.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/budget-core.c,v
retrieving revision 1.4
diff -r1.4 budget-core.c
233c233
< 	saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_3200);
---
>   	saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_120);


Home | Main Index | Thread Index