Skip to contentSkip to conversation

XC5000 DVB-T/DMB-TH support

DISCUSSION David Wong 3 participants 12 messages Mar 31, 2009 – Apr 1, 2009 Media (V4L/DVB)

lore
Share & tools
lore

David Wong

author
#0 lore raw

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Regards,
David

#1 lore raw
Quoted 7 lines · David Wong

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Quoted 7 lines

Regards,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

All of my xc5000 work has been with ATSC/QAM, so I can't say authoritatively what is required to make it work.

Well, at a minimum you will have to modify xc5000_set_params to support setting priv->video_standard to DTV8. Beyond that, I don't think you need to do anything specific for DVB-T.

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
author
#2 lore raw
Quoted 23 lines · Devin Heitmueller
Quoted 7 lines · David Wong

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Quoted 7 lines

Regards,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

All of my xc5000 work has been with ATSC/QAM, so I can't say authoritatively what is required to make it work.

Well, at a minimum you will have to modify xc5000_set_params to support setting priv->video_standard to DTV8.  Beyond that, I don't think you need to do anything specific for DVB-T.

Quoted 7 lines

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

I have tried followings in xc5000_set_params()

if (fe->ops.info.type == FE_ATSC) {
...

} else if (fe->ops.info.type == FE_OFDM) {
		switch (params->u.ofdm.bandwidth) {
		case BANDWIDTH_6_MHZ:
			printk("xc5000 bandwidth 6MHz\n");
			priv->bandwidth = BANDWIDTH_6_MHZ;
			priv->video_standard = DTV6;
			break;
		case BANDWIDTH_7_MHZ:
			printk("xc5000 bandwidth 7MHz\n");
			priv->bandwidth = BANDWIDTH_7_MHZ;
			priv->video_standard = DTV7;
			break;
		case BANDWIDTH_8_MHZ:
			printk("xc5000 bandwidth 8MHz\n");
			priv->bandwidth = BANDWIDTH_8_MHZ;
			priv->video_standard = DTV8;
			break;
		default:
			printk("xc5000 bandwidth not set!\n");
			return -EINVAL;
		}
 		priv->rf_mode = XC_RF_MODE_AIR;
		priv->freq_hz = params->frequency - 1750000;
}

But no success yet.
I am wondering the -1750000 compensation for DTV8.

BTW, The xc_debug_dump() could get more information like firmware build number and tuner total gain

linux/drivers/media/common/tuners/xc5000.c +24 -4
diff -r 2276e777f950 linux/drivers/media/common/tuners/xc5000.c
@@ -84,6 +84,7 @@
 #define XREG_IF_OUT       0x05
 #define XREG_SEEK_MODE    0x07
 #define XREG_POWER_DOWN   0x0A
+#define XREG_OUTPUT_AMP   0x0B
 #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
 #define XREG_SMOOTHEDCVBS 0x0E
 #define XREG_XTALFREQ     0x0F
@@ -100,6 +101,8 @@
 #define XREG_VERSION      0x07
 #define XREG_PRODUCT_ID   0x08
 #define XREG_BUSY         0x09
+#define XREG_BUILD_NUM    0x0D
+#define XREG_TOTAL_GAIN   0x0F
 
 /*
    Basic firmware description. This will remain with
@@ -468,7 +485,8 @@
 
 static int xc_get_version(struct xc5000_priv *priv,
 	u8 *hw_majorversion, u8 *hw_minorversion,
-	u8 *fw_majorversion, u8 *fw_minorversion)
+	u8 *fw_majorversion, u8 *fw_minorversion,
+	u16 *fw_buildnum)
 {
 	u16 data;
 	int result;
@@ -481,6 +499,11 @@
 	(*hw_minorversion) = (data >>  8) & 0x0F;
 	(*fw_majorversion) = (data >>  4) & 0x0F;
 	(*fw_minorversion) = data & 0x0F;
+
+	result = xc_read_reg(priv, XREG_BUILD_NUM, &data);
+	if (result)
+		return result;
+	*fw_buildnum = data;
 
 	return 0;
 }
@@ -506,6 +529,11 @@
 static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
 {
 	return xc_read_reg(priv, XREG_QUALITY, quality);
+}
+
+static int xc_get_total_gain(struct xc5000_priv *priv, u16 *gain)
+{
+	return xc_read_reg(priv, XREG_TOTAL_GAIN, gain);
 }
 
 static u16 WaitForLock(struct xc5000_priv *priv)
@@ -626,8 +654,10 @@
 	u32 hsync_freq_hz = 0;
 	u16 frame_lines;
 	u16 quality;
+	u16 gain;
 	u8 hw_majorversion = 0, hw_minorversion = 0;
 	u8 fw_majorversion = 0, fw_minorversion = 0;
+	u16 fw_buildnum = 0;
 
 	/* Wait for stats to stabilize.
 	 * Frame Lines needs two frame times after initial lock
@@ -646,10 +676,11 @@
 		lock_status);
 
 	xc_get_version(priv,  &hw_majorversion, &hw_minorversion,
-		&fw_majorversion, &fw_minorversion);
-	dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
+		&fw_majorversion, &fw_minorversion, &fw_buildnum);
+	dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x build %d\n",
 		hw_majorversion, hw_minorversion,
-		fw_majorversion, fw_minorversion);
+		fw_majorversion, fw_minorversion,
+		fw_buildnum);
 
 	xc_get_hsync_freq(priv,  &hsync_freq_hz);
 	dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);
@@ -659,6 +690,9 @@
 
 	xc_get_quality(priv,  &quality);
 	dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
+
+	xc_get_total_gain(priv,  &gain);
+	dprintk(1, "*** Total Gain = %d mdB\n", gain * 1000 / 256);
 }
#3 lore raw
Quoted 150 lines · David Wong
Quoted 23 lines · Devin Heitmueller
Quoted 7 lines · David Wong

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Quoted 7 lines

Regards,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

All of my xc5000 work has been with ATSC/QAM, so I can't say authoritatively what is required to make it work.

Well, at a minimum you will have to modify xc5000_set_params to support setting priv->video_standard to DTV8.  Beyond that, I don't think you need to do anything specific for DVB-T.

Quoted 7 lines

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

I have tried followings in xc5000_set_params()

if (fe->ops.info.type == FE_ATSC) {
 ...
} else if (fe->ops.info.type == FE_OFDM) {
               switch (params->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ:
                       printk("xc5000 bandwidth 6MHz\n"); priv->bandwidth = BANDWIDTH_6_MHZ; priv->video_standard = DTV6; break;
               case BANDWIDTH_7_MHZ:
                       printk("xc5000 bandwidth 7MHz\n"); priv->bandwidth = BANDWIDTH_7_MHZ; priv->video_standard = DTV7; break;
               case BANDWIDTH_8_MHZ:
                       printk("xc5000 bandwidth 8MHz\n"); priv->bandwidth = BANDWIDTH_8_MHZ; priv->video_standard = DTV8; break;
               default:
                       printk("xc5000 bandwidth not set!\n"); return -EINVAL;
               }
               priv->rf_mode = XC_RF_MODE_AIR; priv->freq_hz = params->frequency - 1750000; }

But no success yet.
I am wondering the -1750000 compensation for DTV8.

BTW, The xc_debug_dump() could get more information like firmware build number and tuner total gain

diff -r 2276e777f950 linux/drivers/media/common/tuners/xc5000.c

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
@@ -84,6 +84,7 @@
  #define XREG_IF_OUT       0x05
  #define XREG_SEEK_MODE    0x07
  #define XREG_POWER_DOWN   0x0A
+#define XREG_OUTPUT_AMP   0x0B
  #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
  #define XREG_SMOOTHEDCVBS 0x0E
  #define XREG_XTALFREQ     0x0F
@@ -100,6 +101,8 @@
  #define XREG_VERSION      0x07
  #define XREG_PRODUCT_ID   0x08
  #define XREG_BUSY         0x09
+#define XREG_BUILD_NUM    0x0D
+#define XREG_TOTAL_GAIN   0x0F
 
  /*

   Basic firmware description. This will remain with

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +18 -4
@@ -468,7 +485,8 @@
 
  static int xc_get_version(struct xc5000_priv *priv,
        u8 *hw_majorversion, u8 *hw_minorversion,
-       u8 *fw_majorversion, u8 *fw_minorversion)
+       u8 *fw_majorversion, u8 *fw_minorversion,
+       u16 *fw_buildnum)
  {
        u16 data;
        int result;
@@ -481,6 +499,11 @@
        (*hw_minorversion) = (data >>  8) & 0x0F;
        (*fw_majorversion) = (data >>  4) & 0x0F;
        (*fw_minorversion) = data & 0x0F;
+
+       result = xc_read_reg(priv, XREG_BUILD_NUM, &data);
+       if (result)
+               return result;
+       *fw_buildnum = data;
 
        return 0;
  }
@@ -506,6 +529,11 @@
  static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
  {
        return xc_read_reg(priv, XREG_QUALITY, quality);
+}
+
+static int xc_get_total_gain(struct xc5000_priv *priv, u16 *gain)
+{
+       return xc_read_reg(priv, XREG_TOTAL_GAIN, gain);
  }
 
  static u16 WaitForLock(struct xc5000_priv *priv)
@@ -626,8 +654,10 @@
        u32 hsync_freq_hz = 0;
        u16 frame_lines;
        u16 quality;
+       u16 gain;
        u8 hw_majorversion = 0, hw_minorversion = 0;
        u8 fw_majorversion = 0, fw_minorversion = 0;
+       u16 fw_buildnum = 0;
 
        /* Wait for stats to stabilize.
         * Frame Lines needs two frame times after initial lock
@@ -646,10 +676,11 @@
                lock_status);
 
        xc_get_version(priv,  &hw_majorversion, &hw_minorversion,
-               &fw_majorversion, &fw_minorversion);
-       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
+               &fw_majorversion, &fw_minorversion, &fw_buildnum);
+       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x build %d\n",
                hw_majorversion, hw_minorversion,
-               fw_majorversion, fw_minorversion);
+               fw_majorversion, fw_minorversion,
+               fw_buildnum);
 
        xc_get_hsync_freq(priv,  &hsync_freq_hz);
        dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 line 697

Quoted 8 lines
linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
@@ -659,6 +690,9 @@
 
        xc_get_quality(priv,  &quality);
        dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
+
+       xc_get_total_gain(priv,  &gain);
+       dprintk(1, "*** Total Gain = %d mdB\n", gain * 1000 / 256);
  }
 

That compensation offset should be correct for all of the digital standards.

Yeah, without having one to try out, I am not sure.

I already have a patch for the build number and total gain in my queue (along with a bunch of other bugfixes and performance improvements). I'm just waiting on Xceive to resolve the firmware licensing issue (I spoke to them last week about it).

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
author
#4 lore raw
Quoted 152 lines · Devin Heitmueller
Quoted 151 lines · David Wong
Quoted 23 lines · Devin Heitmueller
Quoted 7 lines · David Wong

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Quoted 7 lines

Regards,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

All of my xc5000 work has been with ATSC/QAM, so I can't say authoritatively what is required to make it work.

Well, at a minimum you will have to modify xc5000_set_params to support setting priv->video_standard to DTV8.  Beyond that, I don't think you need to do anything specific for DVB-T.

Quoted 7 lines

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

I have tried followings in xc5000_set_params()

if (fe->ops.info.type == FE_ATSC) {
 ...
} else if (fe->ops.info.type == FE_OFDM) {
               switch (params->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ:
                       printk("xc5000 bandwidth 6MHz\n"); priv->bandwidth = BANDWIDTH_6_MHZ; priv->video_standard = DTV6; break;
               case BANDWIDTH_7_MHZ:
                       printk("xc5000 bandwidth 7MHz\n"); priv->bandwidth = BANDWIDTH_7_MHZ; priv->video_standard = DTV7; break;
               case BANDWIDTH_8_MHZ:
                       printk("xc5000 bandwidth 8MHz\n"); priv->bandwidth = BANDWIDTH_8_MHZ; priv->video_standard = DTV8; break;
               default:
                       printk("xc5000 bandwidth not set!\n"); return -EINVAL;
               }
               priv->rf_mode = XC_RF_MODE_AIR; priv->freq_hz = params->frequency - 1750000; }

But no success yet.
I am wondering the -1750000 compensation for DTV8.

BTW, The xc_debug_dump() could get more information like firmware build number and tuner total gain

diff -r 2276e777f950 linux/drivers/media/common/tuners/xc5000.c

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
@@ -84,6 +84,7 @@
  #define XREG_IF_OUT       0x05
  #define XREG_SEEK_MODE    0x07
  #define XREG_POWER_DOWN   0x0A
+#define XREG_OUTPUT_AMP   0x0B
  #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
  #define XREG_SMOOTHEDCVBS 0x0E
  #define XREG_XTALFREQ     0x0F
@@ -100,6 +101,8 @@
  #define XREG_VERSION      0x07
  #define XREG_PRODUCT_ID   0x08
  #define XREG_BUSY         0x09
+#define XREG_BUILD_NUM    0x0D
+#define XREG_TOTAL_GAIN   0x0F
 
  /*

   Basic firmware description. This will remain with

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +18 -4
@@ -468,7 +485,8 @@
 
  static int xc_get_version(struct xc5000_priv *priv,
        u8 *hw_majorversion, u8 *hw_minorversion,
-       u8 *fw_majorversion, u8 *fw_minorversion)
+       u8 *fw_majorversion, u8 *fw_minorversion,
+       u16 *fw_buildnum)
  {
        u16 data;
        int result;
@@ -481,6 +499,11 @@
        (*hw_minorversion) = (data >>  8) & 0x0F;
        (*fw_majorversion) = (data >>  4) & 0x0F;
        (*fw_minorversion) = data & 0x0F;
+
+       result = xc_read_reg(priv, XREG_BUILD_NUM, &data);
+       if (result)
+               return result;
+       *fw_buildnum = data;
 
        return 0;
  }
@@ -506,6 +529,11 @@
  static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
  {
        return xc_read_reg(priv, XREG_QUALITY, quality);
+}
+
+static int xc_get_total_gain(struct xc5000_priv *priv, u16 *gain)
+{
+       return xc_read_reg(priv, XREG_TOTAL_GAIN, gain);
  }
 
  static u16 WaitForLock(struct xc5000_priv *priv)
@@ -626,8 +654,10 @@
        u32 hsync_freq_hz = 0;
        u16 frame_lines;
        u16 quality;
+       u16 gain;
        u8 hw_majorversion = 0, hw_minorversion = 0;
        u8 fw_majorversion = 0, fw_minorversion = 0;
+       u16 fw_buildnum = 0;
 
        /* Wait for stats to stabilize.
         * Frame Lines needs two frame times after initial lock
@@ -646,10 +676,11 @@
                lock_status);
 
        xc_get_version(priv,  &hw_majorversion, &hw_minorversion,
-               &fw_majorversion, &fw_minorversion);
-       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
+               &fw_majorversion, &fw_minorversion, &fw_buildnum);
+       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x build %d\n",
                hw_majorversion, hw_minorversion,
-               fw_majorversion, fw_minorversion);
+               fw_majorversion, fw_minorversion,
+               fw_buildnum);
 
        xc_get_hsync_freq(priv,  &hsync_freq_hz);
        dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);
@@ -659,6 +690,9 @@
 
Quoted 10 lines

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 line 697

Quoted 7 lines
linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
        xc_get_quality(priv,  &quality);
        dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
+
+       xc_get_total_gain(priv,  &gain);
+       dprintk(1, "*** Total Gain = %d mdB\n", gain * 1000 / 256);
  }
 

That compensation offset should be correct for all of the digital standards.

Thanks Devin, perhaps there is something that I don't know between the tuner and the demod (lgs8gl5) on my card, so it doesn't work. Honestly I have never seen such digital output from a tuner (DDI interface). I don't know if my card use that, and I have never seen lgs8xxx with
serial digital input from tuner.
What is the "protocol" of DDI of XC5000? UART-like or I2C-like? it has only two wires, p and n. I am wonder how it defines clock and data.

David

#5 lore raw
Quoted 174 lines · David Wong
Quoted 152 lines · Devin Heitmueller
Quoted 151 lines · David Wong
Quoted 23 lines · Devin Heitmueller
Quoted 7 lines · David Wong

Does anyone know how to get XC5000 working for DVB-T, especially 8MHz bandwidth? Current driver only supports ATSC with 6MHz bandwidth only.
It seems there is a trick at setting compensated RF frequency.

DVB-T 8MHz support would probably works for DMB-TH, but DMB-TH settings is very welcome.

Quoted 7 lines

Regards,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

All of my xc5000 work has been with ATSC/QAM, so I can't say authoritatively what is required to make it work.

Well, at a minimum you will have to modify xc5000_set_params to support setting priv->video_standard to DTV8.  Beyond that, I don't think you need to do anything specific for DVB-T.

Quoted 7 lines

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

I have tried followings in xc5000_set_params()

if (fe->ops.info.type == FE_ATSC) {
 ...
} else if (fe->ops.info.type == FE_OFDM) {
               switch (params->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ:
                       printk("xc5000 bandwidth 6MHz\n"); priv->bandwidth = BANDWIDTH_6_MHZ; priv->video_standard = DTV6; break;
               case BANDWIDTH_7_MHZ:
                       printk("xc5000 bandwidth 7MHz\n"); priv->bandwidth = BANDWIDTH_7_MHZ; priv->video_standard = DTV7; break;
               case BANDWIDTH_8_MHZ:
                       printk("xc5000 bandwidth 8MHz\n"); priv->bandwidth = BANDWIDTH_8_MHZ; priv->video_standard = DTV8; break;
               default:
                       printk("xc5000 bandwidth not set!\n"); return -EINVAL;
               }
               priv->rf_mode = XC_RF_MODE_AIR; priv->freq_hz = params->frequency - 1750000; }

But no success yet.
I am wondering the -1750000 compensation for DTV8.

BTW, The xc_debug_dump() could get more information like firmware build number and tuner total gain

diff -r 2276e777f950 linux/drivers/media/common/tuners/xc5000.c

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
@@ -84,6 +84,7 @@
  #define XREG_IF_OUT       0x05
  #define XREG_SEEK_MODE    0x07
  #define XREG_POWER_DOWN   0x0A
+#define XREG_OUTPUT_AMP   0x0B
  #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
  #define XREG_SMOOTHEDCVBS 0x0E
  #define XREG_XTALFREQ     0x0F
@@ -100,6 +101,8 @@
  #define XREG_VERSION      0x07
  #define XREG_PRODUCT_ID   0x08
  #define XREG_BUSY         0x09
+#define XREG_BUILD_NUM    0x0D
+#define XREG_TOTAL_GAIN   0x0F
 
  /*

   Basic firmware description. This will remain with

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +18 -4
@@ -468,7 +485,8 @@
 
  static int xc_get_version(struct xc5000_priv *priv,
        u8 *hw_majorversion, u8 *hw_minorversion,
-       u8 *fw_majorversion, u8 *fw_minorversion)
+       u8 *fw_majorversion, u8 *fw_minorversion,
+       u16 *fw_buildnum)
  {
        u16 data;
        int result;
@@ -481,6 +499,11 @@
        (*hw_minorversion) = (data >>  8) & 0x0F;
        (*fw_majorversion) = (data >>  4) & 0x0F;
        (*fw_minorversion) = data & 0x0F;
+
+       result = xc_read_reg(priv, XREG_BUILD_NUM, &data);
+       if (result)
+               return result;
+       *fw_buildnum = data;
 
        return 0;
  }
@@ -506,6 +529,11 @@
  static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
  {
        return xc_read_reg(priv, XREG_QUALITY, quality);
+}
+
+static int xc_get_total_gain(struct xc5000_priv *priv, u16 *gain)
+{
+       return xc_read_reg(priv, XREG_TOTAL_GAIN, gain);
  }
 
  static u16 WaitForLock(struct xc5000_priv *priv)
@@ -626,8 +654,10 @@
        u32 hsync_freq_hz = 0;
        u16 frame_lines;
        u16 quality;
+       u16 gain;
        u8 hw_majorversion = 0, hw_minorversion = 0;
        u8 fw_majorversion = 0, fw_minorversion = 0;
+       u16 fw_buildnum = 0;
 
        /* Wait for stats to stabilize.
         * Frame Lines needs two frame times after initial lock
@@ -646,10 +676,11 @@
                lock_status);
 
        xc_get_version(priv,  &hw_majorversion, &hw_minorversion,
-               &fw_majorversion, &fw_minorversion);
-       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
+               &fw_majorversion, &fw_minorversion, &fw_buildnum);
+       dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x build %d\n",
                hw_majorversion, hw_minorversion,
-               fw_majorversion, fw_minorversion);
+               fw_majorversion, fw_minorversion,
+               fw_buildnum);
 
        xc_get_hsync_freq(priv,  &hsync_freq_hz);
        dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);
@@ -659,6 +690,9 @@
 
Quoted 10 lines

linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 line 697

Quoted 7 lines
linux/drivers/media/common/tuners/xc5000.c        Mon Mar 30 16:23:11 2009 +0800 renamed from linux/drivers/media/common/tuners/xc5000.c        Thu Mar 26 22:17:48 2009 -0300 +3 -0
        xc_get_quality(priv,  &quality);
        dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
+
+       xc_get_total_gain(priv,  &gain);
+       dprintk(1, "*** Total Gain = %d mdB\n", gain * 1000 / 256);
  }
 

That compensation offset should be correct for all of the digital standards.

Thanks Devin, perhaps there is something that I don't know between the tuner and the demod (lgs8gl5) on my card, so it doesn't work. Honestly I have never seen such digital output from a tuner (DDI interface). I don't know if my card use that, and I have never seen lgs8xxx with
serial digital input from tuner.
What is the "protocol" of DDI of XC5000? UART-like or I2C-like? it has only two wires, p and n. I am wonder how it defines clock and data.

Quoted 2 lines

David

Did you make sure the IF was configured properly in your demod to match the IF of the xc5000? If it does not match, then you will not get lock. That is the very first thing I would check since at least for me that is usually the problem when making a new device work.

I am assuming that you concluded it isn't working based on the fact that you didn't get a lock. Is that correct?

Regarding the protocol, the xc5000 is programmed via i2c.

I'm actually slightly surprised/confused. How did you know about the missing AGC and build registers if you are unfamiliar with the xc5000 programming interface?

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
#6 lore raw
In reply to David Wong

Hmm.

Quoted 1 line
		priv->freq_hz = params->frequency - 1750000;

Prior to reading this I would of sworn blind that we'd witnessed the XC5000 working on DVB-T devices, it's been a while and now I'm doubting that belief.

- Steve

#7 lore raw
Quoted 7 lines · Steven Toth

Hmm.

Quoted 1 line

               priv->freq_hz = params->frequency - 1750000;

Prior to reading this I would of sworn blind that we'd witnessed the XC5000 working on DVB-T devices, it's been a while and now I'm doubting that belief.

Yeah, the code doesn't currently have DVB-T support. If you specify any modulation other than the VSB or QAM modulations, it returns -EINVAL..

If I had a board and a generator, I could probably bring it up pretty quick.

Also, as I later told David in an off-list email, I believe I was mistaken about the offset needing to be 1750000. I think it should actually be 2570000 for DVB-T.

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
author
#8 lore raw
Quoted 19 lines · Devin Heitmueller
Quoted 7 lines · Steven Toth

Hmm.

Quoted 1 line

               priv->freq_hz = params->frequency - 1750000;

Prior to reading this I would of sworn blind that we'd witnessed the XC5000 working on DVB-T devices, it's been a while and now I'm doubting that belief.

Yeah, the code doesn't currently have DVB-T support.  If you specify any modulation other than the VSB or QAM modulations, it returns -EINVAL..

If I had a board and a generator, I could probably bring it up pretty quick.

Also, as I later told David in an off-list email, I believe I was mistaken about the offset needing to be 1750000.  I think it should actually be 2570000 for DVB-T.

Quoted 7 lines

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

Thanks Devin. The demod locks after using -2750000.

David.

#9 lore raw
Quoted 3 lines · David Wong

Thanks Devin. The demod locks after using -2750000.

David.

That's great news. If you send me a patch (including your SOB), I will put it into the xc5000 patch series I am putting together this week.

Regards,

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller
author
#10 lore raw
Quoted 9 lines · Devin Heitmueller
Quoted 3 lines · David Wong

Thanks Devin. The demod locks after using -2750000.

David.

That's great news.  If you send me a patch (including your SOB), I will put it into the xc5000 patch series I am putting together this week.

Quoted 9 lines

Regards,

Devin

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

No problem. But how about frequency compensation value for DTV7? We know DTV6 and DTV8 settings now, just DTV7 is missing for FE_OFDM.

David

#11 lore raw
Quoted 15 lines · David Wong
Quoted 13 lines · Devin Heitmueller
Quoted 3 lines · David Wong

Thanks Devin. The demod locks after using -2750000.

David.

That's great news.  If you send me a patch (including your SOB), I will put it into the xc5000 patch series I am putting together this week.

Regards,

Devin

Quoted 8 lines
Quoted 5 lines

--
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller

No problem. But how about frequency compensation value for DTV7? We know DTV6 and DTV8 settings now, just DTV7 is missing for FE_OFDM.

DTV7 is probably also 2750000. Also, looking at the tuner-xc2028.c suggests there are some edge cases where it might need to be 2250000.

However, if you are unable to test it, do not include it in the patch.
I would rather have it not supported explicitly in the driver than
include untested code.

Devin

Signature · 3 lines
Devin J. Heitmueller
http://www.devinheitmueller.com
AIM: devinheitmueller