Mailing List archive

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

[linux-dvb] Re: Full featured DVB-T card update



On Thursday 14 August 2003 03:19, Nils Ohlmeier wrote:
> On Wednesday 13 August 2003 11:49, Juri Haberland wrote:
> > Nils Ohlmeier wrote:
> > > I'll try now with Juegens and my patch applied to the latest code from
> > > CVS for some time, to say something about firmware lockups.
> >
> > Great.
>
> Ok, with Juergens and my own patch (my card does not work without it)
> applied i had no lockup for one day now.
> Rarely i get no output after switching to a new frequency for a very long
> time, i guess more then 20 or 30 seconds. In this case i have only the
> normal "Delay (xx)" message in the logs, but until now i always got an
> output after waiting for a long time.

Do you use the latest dvb-cvs driver? I mean from this week?
If not please update!

> I get the "firmware lockup!" messages some times, but still no "firmware
> recovered" message until now.

Can you please test with the following patch against clean dvb-cvs. It has the 
same functionality as the previous one but gives more debug information.

Juergen


Patch:

------------------------------------------------------------------------------------------------------------------------------

--- DVB/driver/frontends/alps_tdlb7.c	2003-08-12 17:15:28.000000000 +0200
+++ DVB_PATCH2/driver/frontends/alps_tdlb7.c	2003-08-14 11:57:22.000000000 
+0200
@@ -50,6 +50,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/unistd.h>
+#include <linux/delay.h>

 #include "compat.h"
 #include "dvb_frontend.h"
@@ -286,6 +287,105 @@ int sp8870_init (struct dvb_i2c_bus *i2c
 	return 0;
 }

+static
+void sp8870_set_frontend_parameters (struct dvb_i2c_bus *i2c,
+				      struct dvb_frontend_parameters *p)
+{
+	// system controller stop
+	sp8870_writereg(i2c,0x0F00,0x0000);
+
+	sp5659_set_tv_freq (i2c, p->frequency);
+
+	// sample rate correction bit [23..17]
+	sp8870_writereg(i2c,0x0319,0x000A);
+
+	// sample rate correction bit [16..0]
+	sp8870_writereg(i2c,0x031A,0x0AAB);
+
+	// integer carrier offset 
+	sp8870_writereg(i2c,0x0309,0x0400);
+
+	// fractional carrier offset
+	sp8870_writereg(i2c,0x030A,0x0000);
+
+	// filter for 6/7/8 Mhz channel
+	if (p->u.ofdm.bandwidth == BANDWIDTH_6_MHZ)
+		sp8870_writereg(i2c,0x0311,0x0002);
+	else if (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ)
+		sp8870_writereg(i2c,0x0311,0x0001);
+	else
+		sp8870_writereg(i2c,0x0311,0x0000);
+
+	// scan order: 2k first = 0x0000, 8k first = 0x0001 
+	if (p->u.ofdm.transmission_mode == TRANSMISSION_MODE_2K)
+		sp8870_writereg(i2c,0x0338,0x0000);
+	else
+		sp8870_writereg(i2c,0x0338,0x0001);
+
+	// read status reg in order to clear pending irqs
+	sp8870_readreg(i2c, 0x200);
+
+	// instruction RAM register loword
+	sp8870_writereg(i2c,0x0F09,0x0000);
+
+	// instruction RAM register hiword
+	sp8870_writereg(i2c,0x0F08,0x0000);
+
+	// system controller start
+	sp8870_writereg(i2c,0x0F00,0x0001);
+}
+
+
+#define MAXTRIALS 5
+#define MAXCHECKS 100
+
+static int lockups = 0;
+static int switches = 0;
+
+static void sp8870_set_frontend (struct dvb_i2c_bus *i2c,
+					struct dvb_frontend_parameters *p)
+{
+	int lock = 0;
+	int trials = 1;
+	int check_count = 0;
+
+	dprintk("%s: frequency = %i\n", __FUNCTION__, p->frequency);
+
+	for (trials = 1; trials <= MAXTRIALS; trials++) {
+
+		sp8870_set_frontend_parameters(i2c, p);
+
+		for (check_count = 0; check_count < MAXCHECKS; check_count++) {
+			lock = (sp8870_readreg(i2c, 0x0200) & 4);
+			if (!lock) {
+				dprintk("%s: delay = %i usec\n",__FUNCTION__, check_count * 10);
+				break;
+			}
+			udelay(10);
+		}
+
+		if (!lock)
+			break;
+	}
+
+	if (lock)
+		printk("%s: firmware crash!!!!!!\n", __FUNCTION__);
+
+	if (debug) {
+		if ( !lock ) {
+			if (trials > 1) {
+				printk("%s: firmware lockup!!!\n", __FUNCTION__);
+				printk("%s: recovered after %i trial(s))\n", __FUNCTION__, trials - 1);
+				lockups++;
+			}
+		}
+		switches++;
+		printk("%s: switches = %i lockups = %i\n", __FUNCTION__, switches, 
lockups);
+	}
+
+	return;
+}
+
 
 static
 int tdlb7_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
@@ -324,9 +424,12 @@ int tdlb7_ioctl (struct dvb_frontend *fe
 
         case FE_READ_BER:
 	{
-		u32 *ber=(u32 *) arg;
 		// bit error rate before Viterbi
-		*ber=sp8870_readreg(i2c,0x0C07);
+		u32 *ber=(u32 *) arg;
+		*ber = (sp8870_readreg(i2c, 0xC08) & 0x3F) |
+					(sp8870_readreg(i2c, 0xC07) << 6);
+		if (*ber >= 0x3FFF0)
+			*ber = ~0;
 		break;
 
 	}
@@ -347,69 +450,19 @@ int tdlb7_ioctl (struct dvb_frontend *fe
 	case FE_READ_UNCORRECTED_BLOCKS: 	// not supported by hardware?
 	{
 		u32 *ublocks=(u32 *) arg;
-		*ublocks=0;  
-		return -EOPNOTSUPP;
+		*ublocks = sp8870_readreg(i2c, 0xC0C);
+		if (*ublocks == 0xFFFF)
+			*ublocks = ~0;
+		break;
 	}
 
         case FE_SET_FRONTEND:
         {
 		struct dvb_frontend_parameters *p = arg;
-
-		// system controller stop 
-		sp8870_writereg(i2c,0x0F00,0x0000);
-
-		sp5659_set_tv_freq (i2c, p->frequency);
-
-		// read status reg in order to clear pending irqs
-		sp8870_readreg(i2c, 0x200);
-
-		// sample rate correction bit [23..17]
-		sp8870_writereg(i2c,0x0319,0x000A);
-
-		// sample rate correction bit [16..0]
-		sp8870_writereg(i2c,0x031A,0x0AAB);
-
-		// integer carrier offset 
-		sp8870_writereg(i2c,0x0309,0x0400);
-
-		// fractional carrier offset
-		sp8870_writereg(i2c,0x030A,0x0000);
-
-		// filter for 6/7/8 Mhz channel
-		if (p->u.ofdm.bandwidth == BANDWIDTH_6_MHZ)
-			sp8870_writereg(i2c,0x0311,0x0002);
-		else if (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ)
-			sp8870_writereg(i2c,0x0311,0x0001);
-		else
-			sp8870_writereg(i2c,0x0311,0x0000);
-
-		// scan order: 2k first = 0x0000, 8k first = 0x0001 
-		if (p->u.ofdm.transmission_mode == TRANSMISSION_MODE_2K)
-			sp8870_writereg(i2c,0x0338,0x0000);
-		else
-			sp8870_writereg(i2c,0x0338,0x0001);
-
-		// instruction RAM register loword
-		sp8870_writereg(i2c,0x0F09,0x0000);
-
-		// instruction RAM register hiword
-		sp8870_writereg(i2c,0x0F08,0x0000);
-
-		// system controller start
-		sp8870_writereg(i2c,0x0F00,0x0001);
-
+		sp8870_set_frontend(i2c, p);
 		break;
         }
 
-	case FE_RESET:
-		// system controller stop
-		sp8870_writereg(i2c,0x0F00,0x0000);
-		// read status reg in order to clear pending irqs
-		sp8870_readreg(i2c, 0x200);
-		// system controller start
-		sp8870_writereg(i2c,0x0F00,0x0001);
-		break;
-
 	case FE_GET_FRONTEND:  // FIXME: read known values back from Hardware...
 	{
 		break;



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index