[linux-dvb] [Patch] Added Nova-S-Plus and Nova-SE2 DVB-S support

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

 



Johannes Stezenbach wrote:
> On Thu, Dec 01, 2005, Steve Toth wrote:
>   
>>> How long does the private 3 wire write usually take? Doesn't
>>> the initial check in your code fail everytime because it is
>>> done too soon, and then your code waits needlessly for 500msecs
>>> before checking again?
>>>       
Fair comment. 500ms was probably way too high.

It doesn't say in the public datasheet how long it can take, but I've 
reduced the values to very reasonable limits.

I don't have the ability to test the patch (for a couple of days) but it 
should be fine. Anyone else want to try it prior to sign-off?

Thanks,

Steve

-------------- next part --------------
Index: linux/drivers/media/dvb/frontends/cx24123.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/frontends/cx24123.c,v
retrieving revision 1.4
diff -u -p -r1.4 cx24123.c
--- linux/drivers/media/dvb/frontends/cx24123.c	26 Nov 2005 23:46:56 -0000	1.4
+++ linux/drivers/media/dvb/frontends/cx24123.c	1 Dec 2005 20:55:49 -0000
@@ -483,6 +483,8 @@ static int cx24123_pll_calculate(struct 
 /*
  * Tuner data is 21 bits long, must be left-aligned in data.
  * Tuner cx24109 is written through a dedicated 3wire interface on the demod chip.
+ * If the tuner hangs during byte xmit the timeout code will avoid a
+ * driver hang and fail after a reasonable timeout.
  */
 static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_parameters *p, u32 data)
 {
@@ -501,12 +503,11 @@ static int cx24123_pll_writereg(struct d
 	cx24123_writereg(state, 0x22, (data >> 16) & 0xff);
 	while ( ( cx24123_readreg(state, 0x20) & 0x40 ) == 0 )
 	{
-		/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
 		if (timeout++ >= 4) {
-			printk("%s:  demodulator is no longer responding, aborting.\n",__FUNCTION__);
+			printk("%s:  demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
 			return -EREMOTEIO;
 		}
-		msleep(500);
+		msleep(10);
 	}
 
 	timeout = 0;
@@ -514,12 +515,11 @@ static int cx24123_pll_writereg(struct d
 	cx24123_writereg(state, 0x22, (data>>8) & 0xff );
 	while ( (cx24123_readreg(state, 0x20) & 0x40 ) == 0 )
 	{
-		/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
 		if (timeout++ >= 4) {
-			printk("%s:  demodulator is not responding, possibly hung, aborting.\n",__FUNCTION__);
+			printk("%s:  demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
 			return -EREMOTEIO;
 		}
-		msleep(500);
+		msleep(10);
 	}
 
 	timeout = 0;
@@ -527,12 +527,11 @@ static int cx24123_pll_writereg(struct d
 	cx24123_writereg(state, 0x22, (data) & 0xff );
 	while ((cx24123_readreg(state, 0x20) & 0x80))
 	{
-		/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
 		if (timeout++ >= 4) {
-			printk("%s:  demodulator is not responding, possibly hung, aborting.\n",__FUNCTION__);
+			printk("%s:  demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
 			return -EREMOTEIO;
 		}
-		msleep(500);
+		msleep(10);
 	}
 
 	/* Trigger the demod to configure the tuner */

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux