[linux-dvb] [Patch] Adding support for the Hauppage HVR1100

Steve Toth stoth at hauppauge.com
Tue Nov 29 00:20:14 CET 2005


[Patch] Adding support for the Hauppage HVR1100

Signed-off-by: Steven Toth <stoth at hauppauge.com>


As the patch says, it adds support for the HVR1100. I noticed some odd 
module load / ordering issues with this. On my system I have to load 
tuner and tda9887 before any of the cx88 modules else the i2c_attach 
from cx88-i2c did not work correctly, and the tuner (via tuner-simple.c) 
was never set to the FMD correctly (it was unset).... tuning 
subsequently failed. This feels like a common cx88 problem ... Has 
anyone seen this before?

The HVR1100 product has a single Hybrid tuner supporting both analog and 
DVB-T. No locking or resource management takes place, so he who tunes 
last - wins.

I did discover an issue with the I2C gate on the cx22702. I raised this 
last week. Basically, the cx22702 module expects the gate to be closed 
(blocking access to the pll from other modules). Now, by default, I 
start the part in 'open' mode then the board specific configs (during 
_init)  determine whether the gate is acting in open or closed mode.

The default behavior for existing drivers has not changed... The gate 
will be closed at all times.

For the HVR1100, we leave the gate OPEN at all times... This approach 
felt like a good compromise.

As always, comments/feedback welcome.

Steve




-------------- next part --------------
Index: linux/Documentation/video4linux/CARDLIST.cx88
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/Documentation/video4linux/CARDLIST.cx88,v
retrieving revision 1.16
diff -u -p -r1.16 CARDLIST.cx88
--- linux/Documentation/video4linux/CARDLIST.cx88	22 Nov 2005 19:32:26 -0000	1.16
+++ linux/Documentation/video4linux/CARDLIST.cx88	28 Nov 2005 23:00:18 -0000
@@ -38,3 +38,4 @@
  37 -> Hauppauge Nova-S-Plus DVB-S                         [0070:9201,0070:9202]
  38 -> Hauppauge Nova-SE2 DVB-S                            [0070:9200]
  39 -> KWorld DVB-S 100                                    [17de:08b2]
+ 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid                [0070:9400,0070:9402]
Index: linux/drivers/media/dvb/frontends/cx22702.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/frontends/cx22702.c,v
retrieving revision 1.14
diff -u -p -r1.14 cx22702.c
--- linux/drivers/media/dvb/frontends/cx22702.c	26 Nov 2005 23:46:56 -0000	1.14
+++ linux/drivers/media/dvb/frontends/cx22702.c	28 Nov 2005 23:00:19 -0000
@@ -59,7 +59,7 @@ static u8 init_tab [] = {
 	0x00, 0x00, /* Stop aquisition */
 	0x0B, 0x06,
 	0x09, 0x01,
-	0x0D, 0x41,
+	0x0D, 0x40, /* Open the I2C gate by default */
 	0x16, 0x32,
 	0x20, 0x0A,
 	0x21, 0x17,
@@ -202,7 +202,8 @@ static int cx22702_set_tps (struct dvb_f
 	struct cx22702_state* state = fe->demodulator_priv;
 
 	/* set PLL */
-	cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe);
+	if(state->config->i2cgate_mode == CX22702_I2CGATE_CLOSED)
+		cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe);
 	if (state->config->pll_set) {
 		state->config->pll_set(fe, p);
 	} else if (state->config->pll_desc) {
@@ -216,7 +217,8 @@ static int cx22702_set_tps (struct dvb_f
 	} else {
 		BUG();
 	}
-	cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
+	if(state->config->i2cgate_mode == CX22702_I2CGATE_CLOSED)
+		cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
 
 	/* set inversion */
 	cx22702_set_inversion (state, p->inversion);
@@ -349,11 +351,12 @@ static int cx22702_init (struct dvb_fron
 	cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02);
 
 	/* init PLL */
-	if (state->config->pll_init) {
-		cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) & 0xfe);
+	if (state->config->pll_init)
 		state->config->pll_init(fe);
+
+	if(state->config->i2cgate_mode == CX22702_I2CGATE_CLOSED)
 		cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
-	}
+
 
 	return 0;
 }
Index: linux/drivers/media/dvb/frontends/cx22702.h
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/frontends/cx22702.h,v
retrieving revision 1.6
diff -u -p -r1.6 cx22702.h
--- linux/drivers/media/dvb/frontends/cx22702.h	26 Nov 2005 23:46:56 -0000	1.6
+++ linux/drivers/media/dvb/frontends/cx22702.h	28 Nov 2005 23:00:19 -0000
@@ -40,6 +40,11 @@ struct cx22702_config
 #define CX22702_SERIAL_OUTPUT   1
 	u8 output_mode;
 
+	/* Allow the I2C gate to be closed or open */
+#define CX22702_I2CGATE_CLOSED 0
+#define CX22702_I2CGATE_OPEN   1
+	u8 i2cgate_mode;
+
 	/* PLL maintenance */
 	u8 pll_address;
 	struct dvb_pll_desc *pll_desc;
Index: linux/drivers/media/video/cx88/cx88-cards.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-cards.c,v
retrieving revision 1.108
diff -u -p -r1.108 cx88-cards.c
--- linux/drivers/media/video/cx88/cx88-cards.c	25 Nov 2005 10:24:13 -0000	1.108
+++ linux/drivers/media/video/cx88/cx88-cards.c	28 Nov 2005 23:00:20 -0000
@@ -903,7 +903,6 @@ struct cx88_board cx88_boards[] = {
 		.radio_type	= UNSET,
 		.tuner_addr	= ADDR_UNSET,
 		.radio_addr	= ADDR_UNSET,
-		/* fixme: add the analog gpio stuff here */
 		.input		= {{
 			.type	= CX88_VMUX_DVB,
 			.vmux	= 0,
@@ -946,6 +945,26 @@ struct cx88_board cx88_boards[] = {
 		}},
 		.dvb		= 1,
 	},
+	[CX88_BOARD_HAUPPAUGE_HVR1100] = {
+		.name		= "Hauppauge WinTV-HVR1100 DVB-T/Hybrid",
+		.tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
+		.radio_type	= UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT
+		.input		= {{
+			.type   = CX88_VMUX_TELEVISION,
+			.vmux   = 0,
+		},{
+			.type	= CX88_VMUX_COMPOSITE1,
+			.vmux	= 1,
+		},{
+			.type	= CX88_VMUX_SVIDEO,
+			.vmux	= 2,
+		}},
+		/* fixme: Add radio support */
+		.dvb		= 1,
+	},
 };
 const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
 
@@ -1109,6 +1128,14 @@ struct cx88_subid cx88_subids[] = {
 		.subvendor = 0x17de,
 		.subdevice = 0x08b2,
 		.card      = CX88_BOARD_KWORLD_DVBS_100,
+	},{
+		.subvendor = 0x0070,
+		.subdevice = 0x9400,
+		.card      = CX88_BOARD_HAUPPAUGE_HVR1100,
+	},{
+		.subvendor = 0x0070,
+		.subdevice = 0x9402,
+		.card      = CX88_BOARD_HAUPPAUGE_HVR1100,
 	},
 };
 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
@@ -1140,9 +1167,6 @@ static void __devinit leadtek_eeprom(str
 	       core->name, core->tuner_type, eeprom_data[0]);
 }
 
-
-/* ----------------------------------------------------------------------- */
-
 static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
 {
 	struct tveeprom tv;
@@ -1161,7 +1185,8 @@ static void hauppauge_eeprom(struct cx88
 	case 90500: /* Nova-T-PCI (oem) */
 	case 90501: /* Nova-T-PCI (oem/IR) */
 	case 92000: /* Nova-SE2 (OEM, No Video or IR) */
-
+	case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
+	case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
 		/* known */
 		break;
 	default:
@@ -1279,6 +1304,7 @@ void cx88_card_setup(struct cx88_core *c
 	case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
 	case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
+	case CX88_BOARD_HAUPPAUGE_HVR1100:
 		if (0 == core->i2c_rc)
 			hauppauge_eeprom(core,eeprom);
 		break;
Index: linux/drivers/media/video/cx88/cx88-dvb.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c,v
retrieving revision 1.74
diff -u -p -r1.74 cx88-dvb.c
--- linux/drivers/media/video/cx88/cx88-dvb.c	22 Nov 2005 19:32:26 -0000	1.74
+++ linux/drivers/media/video/cx88/cx88-dvb.c	28 Nov 2005 23:00:20 -0000
@@ -187,6 +187,7 @@ static struct cx22702_config connexant_r
 #endif
 	.pll_address   = 0x60,
 	.pll_desc      = &dvb_pll_thomson_dtt7579,
+	.i2cgate_mode  = CX22702_I2CGATE_CLOSED,
 };
 
 static struct cx22702_config hauppauge_novat_config = {
@@ -196,6 +197,16 @@ static struct cx22702_config hauppauge_n
 #endif
 	.pll_address   = 0x61,
 	.pll_desc      = &dvb_pll_thomson_dtt759x,
+	.i2cgate_mode  = CX22702_I2CGATE_CLOSED,
+};
+static struct cx22702_config hauppauge_hvr1100_config = {
+	.demod_address = 0x63,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+	.output_mode   = CX22702_SERIAL_OUTPUT,
+#endif
+	.pll_address   = 0x61,
+	.pll_desc      = &dvb_pll_fmd1216me,
+	.i2cgate_mode  = CX22702_I2CGATE_OPEN,
 };
 #endif
 
@@ -376,6 +387,10 @@ static int dvb_register(struct cx8802_de
 		dev->dvb.frontend = cx22702_attach(&connexant_refboard_config,
 						   &dev->core->i2c_adap);
 		break;
+	case CX88_BOARD_HAUPPAUGE_HVR1100:
+		dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config,
+						   &dev->core->i2c_adap);
+		break;
 #endif
 #ifdef HAVE_MT352
 	case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
Index: linux/drivers/media/video/cx88/cx88-input.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-input.c,v
retrieving revision 1.23
diff -u -p -r1.23 cx88-input.c
--- linux/drivers/media/video/cx88/cx88-input.c	18 Nov 2005 01:02:18 -0000	1.23
+++ linux/drivers/media/video/cx88/cx88-input.c	28 Nov 2005 23:00:21 -0000
@@ -385,6 +385,7 @@ int cx88_ir_init(struct cx88_core *core,
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
 	case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
 	case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
+	case CX88_BOARD_HAUPPAUGE_HVR1100:
 		ir_codes = ir_codes_hauppauge_new;
 		ir_type = IR_TYPE_RC5;
 		ir->sampling = 1;
Index: linux/drivers/media/video/cx88/cx88.h
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88.h,v
retrieving revision 1.91
diff -u -p -r1.91 cx88.h
--- linux/drivers/media/video/cx88/cx88.h	22 Nov 2005 19:32:26 -0000	1.91
+++ linux/drivers/media/video/cx88/cx88.h	28 Nov 2005 23:00:22 -0000
@@ -189,6 +189,7 @@ extern struct sram_channel cx88_sram_cha
 #define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1  37
 #define CX88_BOARD_HAUPPAUGE_NOVASE2_S1    38
 #define CX88_BOARD_KWORLD_DVBS_100         39
+#define CX88_BOARD_HAUPPAUGE_HVR1100       40
 
 enum cx88_itype {
 	CX88_VMUX_COMPOSITE1 = 1,


More information about the linux-dvb mailing list