[linux-dvb] Mantis 2033 dvb-tuning problems

Niklas Edmundsson nikke at acc.umu.se
Sun Oct 19 11:19:40 CEST 2008


On Wed, 15 Oct 2008, Hans Bergersen wrote:

> Hi,
>

> I have got a Twinhan vp-2033 based card. I run Ubuntu 8.04. I have 
> downloaded the driver from http://jusst.de/hg/mantis and it compiled 
> just fine. But when i try to tune a channel the tuning fails. It is 
> a newer card with the tda10023 tuner but when the driver loads it 
> uses the tda10021. What do I have to do to make it use the right 
> tuner? Can i give some options when compiling or when loading the 
> module?
<snip>
> Any ideas?

Try the attached patch which fixes this for my Azurewave AD-CP300 (at 
least last time I compiled it).

I've sent it to Manu and he was going to apply it, but it hasn't shown 
up on http://jusst.de/hg/mantis/ yet...


/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke at acc.umu.se
---------------------------------------------------------------------------
  "I don't believe it. There are no respected plastic surgeons." - Logan
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-------------- next part --------------

Fix tda10021 to not claim tda10023.

Previously mantis_frontend_init() relied on the PCI ID alone, this
causes trouble when a card has a different chip depending on
the manufacturing date. This match makes it work with newer
Azurewave AD-CP300 cards while (hopefully) maintaining compatibility
with older cards.

Signed-off-by: Niklas Edmundsson <nikke at acc.umu.se>


diff -r 303b1d29d735 linux/drivers/media/dvb/frontends/tda10021.c
--- a/linux/drivers/media/dvb/frontends/tda10021.c	Sun Sep 21 19:41:00 2008 +0400
+++ b/linux/drivers/media/dvb/frontends/tda10021.c	Sun Sep 14 21:43:24 2008 +0200
@@ -425,6 +425,11 @@ struct dvb_frontend* tda10021_attach(str
 	/* check if the demod is there */
 	id = tda10021_readreg(state, 0x1a);
 	if ((id & 0xf0) != 0x70) goto error;
+
+	/* Don't claim TDA10023 */
+	if(id == 0x7d) {
+		goto error;
+	}
 
 	printk("TDA10021: i2c-addr = 0x%02x, id = 0x%02x\n",
 	       state->config->demod_address, id);
diff -r 303b1d29d735 linux/drivers/media/dvb/frontends/tda10023.c
--- a/linux/drivers/media/dvb/frontends/tda10023.c	Sun Sep 21 19:41:00 2008 +0400
+++ b/linux/drivers/media/dvb/frontends/tda10023.c	Sun Sep 14 21:54:53 2008 +0200
@@ -487,6 +487,7 @@ struct dvb_frontend *tda10023_attach(con
 				     u8 pwm)
 {
 	struct tda10023_state* state = NULL;
+	u8 id;
 
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct tda10023_state), GFP_KERNEL);
@@ -498,8 +499,13 @@ struct dvb_frontend *tda10023_attach(con
 
 	/* wakeup if in standby */
 	tda10023_writereg (state, 0x00, 0x33);
+
 	/* check if the demod is there */
-	if ((tda10023_readreg(state, 0x1a) & 0xf0) != 0x70) goto error;
+	id = tda10023_readreg(state, 0x1a);
+	if ((id & 0xf0) != 0x70) goto error;
+
+	printk("TDA10023: i2c-addr = 0x%02x, id = 0x%02x\n",
+		state->config->demod_address, id);
 
 	/* create dvb_frontend */
 	memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
diff -r 303b1d29d735 linux/drivers/media/dvb/mantis/mantis_dvb.c
--- a/linux/drivers/media/dvb/mantis/mantis_dvb.c	Sun Sep 21 19:41:00 2008 +0400
+++ b/linux/drivers/media/dvb/mantis/mantis_dvb.c	Sun Sep 14 21:54:55 2008 +0200
@@ -263,29 +263,26 @@ int __devinit mantis_frontend_init(struc
 		}
 		break;
 	case MANTIS_VP_2033_DVB_C:	// VP-2033
-		dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
-		mantis->fe = tda10021_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
-		if (mantis->fe) {
-			mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
-			dprintk(verbose, MANTIS_ERROR, 1,
-				"found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
-				philips_cu1216_config.demod_address);
-
-			dprintk(verbose, MANTIS_ERROR, 1,
-				"Mantis DVB-C Philips CU1216 frontend attach success");
-
-		}
-		break;
 	case MANTIS_VP_2040_DVB_C:	// VP-2040
 	case TERRATEC_CINERGY_C_PCI:
 	case TECHNISAT_CABLESTAR_HD2:
 		dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
-		mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
+		mantis->fe = tda10021_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
+		if(mantis->fe) {
+			dprintk(verbose, MANTIS_ERROR, 1,
+				"found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
+				philips_cu1216_config.demod_address);
+		}
+		else {
+			mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
+			if(mantis->fe) {
+				dprintk(verbose, MANTIS_ERROR, 1,
+					"found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+					philips_cu1216_config.demod_address);
+			}
+		}
 		if (mantis->fe) {
 			mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
-			dprintk(verbose, MANTIS_ERROR, 1,
-				"found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
-				philips_cu1216_config.demod_address);
 
 			dprintk(verbose, MANTIS_ERROR, 1,
 				"Mantis DVB-C Philips CU1216 frontend attach success");


More information about the linux-dvb mailing list