[linux-dvb] xc3028 config issue. Re: Why I need to choose better Subject: headers [was: Re: Why (etc.)]

Mauro Carvalho Chehab mchehab at infradead.org
Mon Sep 15 16:30:54 CEST 2008


On Mon, 15 Sep 2008, Paul Chubb wrote:

> Hi,
>     the mcentral.de tree loads DTV7_2633.
> whereas the v4l-dvb code loads F8MHZ D2620 DTV7

> How does it figure out which firmware to load since I assume for Australia it 
> should be F7MHZ (D2633 DTV7)
>
> Would this be the problem?

Yes. Firmware selection is something really trick on xc3028. I'm enclosing 
a patch that will hopefully fix it for you, if you have a Zarlink 
firmware. If this doesn't solve the firmware detection part, you'll need 
to add something like this, before sending the control struct to xc3028:

 	ctrl.type    = XC2028_D2633;

This will override type autodetection.

You should also notice that, on Australia, you'll need an extra offset of 
500 KHz for the frequency. There's a trick on tuner-xc2028 for doing 
this, at generic_set_freq():

                 if (((priv->cur_fw.type & DTV7) &&
                      (priv->cur_fw.scode_table & (ZARLINK456 | DIBCOM52))) ||
                     ((priv->cur_fw.type & DTV78) && freq < 470000000))
                         offset -= 500000;

So, if you don't successfully tune your board at the right frequencies, 
you may need to fix the above code.

Steven,

Please review the code also. I suspect that you can get hid of the cx25885 
hack after this patch.

Cheers,
Mauro

---

tuner-xc2028: Do a better job selecting firmware type

Firmware selection is very tricky on this device. This patch do a better
selection of the proper firmware type, by using a code to hint if the
firmware to be loaded should be D2620 or D2633.

It also allows overriding the hint at the control structure.

Signed-off-by: Mauro Carvalho Chehab <mchehab at infradead.org>

diff -r e5ca4534b543 linux/drivers/media/common/tuners/tuner-xc2028.c
--- a/linux/drivers/media/common/tuners/tuner-xc2028.c	Tue Sep 09 08:29:56 2008 -0700
+++ b/linux/drivers/media/common/tuners/tuner-xc2028.c	Mon Sep 15 11:07:03 2008 -0300
@@ -1006,11 +1006,6 @@

  	tuner_dbg("%s called\n", __func__);

-	if (priv->ctrl.d2633)
-		type |= D2633;
-	else
-		type |= D2620;
-
  	switch(fe->ops.info.type) {
  	case FE_OFDM:
  		bw = p->u.ofdm.bandwidth;
@@ -1025,10 +1020,8 @@
  		break;
  	case FE_ATSC:
  		bw = BANDWIDTH_6_MHZ;
-		/* The only ATSC firmware (at least on v2.7) is D2633,
-		   so overrides ctrl->d2633 */
-		type |= ATSC| D2633;
-		type &= ~D2620;
+		/* The only ATSC firmware (at least on v2.7) is D2633 */
+		type |= ATSC | D2633;
  		break;
  	/* DVB-S is not supported */
  	default:
@@ -1060,6 +1053,28 @@
  	default:
  		tuner_err("error: bandwidth not supported.\n");
  	};
+
+	/*
+	  Selects between D2633 or D2620 firmware.
+	  It doesn't make sense for ATSC, since it should be D2633 on all cases
+	 */
+	if (fe->ops.info.type != FE_ATSC) {
+		switch (priv->ctrl.type) {
+		case XC2028_D2633:
+			type |= D2633;
+			break;
+		case XC2028_D2620:
+			type |= D2620;
+			break;
+		case XC2028_AUTO:
+		default:
+			/* Zarlink seems to need D2633 */
+			if (priv->ctrl.demod == XC3028_FE_ZARLINK456)
+				type |= D2633;
+			else
+				type |= D2620;
+		}
+	}

  	/* All S-code tables need a 200kHz shift */
  	if (priv->ctrl.demod)
diff -r e5ca4534b543 linux/drivers/media/common/tuners/tuner-xc2028.h
--- a/linux/drivers/media/common/tuners/tuner-xc2028.h	Tue Sep 09 08:29:56 2008 -0700
+++ b/linux/drivers/media/common/tuners/tuner-xc2028.h	Mon Sep 15 11:07:03 2008 -0300
@@ -23,15 +23,21 @@
  #define	XC3028_FE_ZARLINK456	4560
  #define	XC3028_FE_CHINA		5200

+enum firmware_type {
+	XC2028_AUTO = 0,	/* By default, auto-detects */
+	XC2028_D2633,
+	XC2028_D2620,
+};
+
  struct xc2028_ctrl {
  	char			*fname;
  	int			max_len;
  	unsigned int		scode_table;
  	unsigned int		mts   :1;
-	unsigned int		d2633 :1;
  	unsigned int		input1:1;
  	unsigned int		vhfbw7:1;
  	unsigned int		uhfbw8:1;
+	enum firmware_type	type:2;
  	unsigned int		demod;
  };

diff -r e5ca4534b543 linux/drivers/media/video/cx23885/cx23885-dvb.c
--- a/linux/drivers/media/video/cx23885/cx23885-dvb.c	Tue Sep 09 08:29:56 2008 -0700
+++ b/linux/drivers/media/video/cx23885/cx23885-dvb.c	Mon Sep 15 11:07:03 2008 -0300
@@ -451,7 +451,8 @@
  				.fname   = "xc3028L-v36.fw",
  				.max_len = 64,
  				.demod   = 5000,
-				.d2633   = 1
+				/* This is true for all demods with v36 firmware? */
+				.type    = XC2028_D2633,
  			};

  			fe = dvb_attach(xc2028_attach,



More information about the linux-dvb mailing list