Mailing List archive

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

[linux-dvb] Re: mt352/bt878 cleanups, DVICO FusionHDTV DVB-T1/DVB-T Lite Patches



I made a mistake when resplitting the patches that were attached to my
previous mail.  Please find attached a replacement for the speedup patch
which ensures that the demodulator's initialisation routine has always
been called.

Oops,
Chris
diff -ru dvb-kernel-3/linux/drivers/media/dvb/frontends/mt352.c dvb-kernel-4a/linux/drivers/media/dvb/frontends/mt352.c
--- dvb-kernel-3/linux/drivers/media/dvb/frontends/mt352.c	2004-09-11 15:27:59.000000000 +1000
+++ dvb-kernel-4a/linux/drivers/media/dvb/frontends/mt352.c	2004-09-12 10:27:35.000000000 +1000
@@ -473,6 +473,7 @@
 	unsigned int tps = 0;
 	struct dvb_ofdm_parameters *op = &param->u.ofdm;
 	uint16_t tmp;
+	int i;
 
 	switch (op->code_rate_HP) {
 		case FEC_2_3:
@@ -622,7 +623,14 @@
 
 	buf[13] = 0x01; /* TUNER_GO!! */
 
-	mt352_write(buf, sizeof(buf));
+	/* Only send the tuning request if the tuner doesn't have the requested
+	 * parameters already set.  Enhances tuning time and prevents stream
+	 * breakup when retuning the same transponder. */
+	for (i = 1; i < 13; i++)
+		if (buf[i] != mt352_read_register(i2c, i + 0x50)) {
+			mt352_write(buf, sizeof(buf));
+			break;
+		}
 
 	return 0;
 }
@@ -842,7 +850,13 @@
 		return mt352_sleep(i2c);
 
 	case FE_INIT:
-		return mt352_init(i2c, card_type);
+		/* Only send the initialisation command if the demodulator
+		 * isn't already enabled.  Greatly enhances tuning time. */
+		if ((mt352_read_register(i2c, CLOCK_CTL) & 0x10) == 0 ||
+		    (mt352_read_register(i2c, CONFIG) & 0x20) == 0)
+			return mt352_init(i2c, card_type);
+		else
+			return 0;
 
 	default:
 		return -EOPNOTSUPP;
@@ -926,6 +940,12 @@
 	/* Do a "hard" reset */
 	mt352_write(mt352_reset_attach, sizeof(mt352_reset_attach));
 
+	/* Try to intiialise the device */
+	if (mt352_init(i2c, card_type) != 0) {
+		kfree(state);
+		return -ENODEV;
+	}
+
 	if ( !(client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)) ) {
 		kfree(state);
 		return -ENOMEM;
diff -ru dvb-kernel-3/linux/drivers/media/dvb/frontends/mt352.h dvb-kernel-4a/linux/drivers/media/dvb/frontends/mt352.h
--- dvb-kernel-3/linux/drivers/media/dvb/frontends/mt352.h	2004-09-11 15:48:40.000000000 +1000
+++ dvb-kernel-4a/linux/drivers/media/dvb/frontends/mt352.h	2004-09-12 07:15:59.000000000 +1000
@@ -169,5 +169,6 @@
 static unsigned char mt352_bs_TDTC9251DH01C(u32 freq);
 static unsigned char mt352_bs_DVICODVBT1(u32 freq);
 static unsigned char mt352_bs_DVICODVBTLITE(u32 freq);
+static u8 mt352_read_register(struct i2c_adapter *i2c, u8 reg);
 
 #endif                          /* _MT352_ */

Home | Main Index | Thread Index