Basic DVB-T and analog TV support for the HVR1300.
authorSteven Toth <stoth@hauppauge.com>
Thu, 14 Sep 2006 14:41:13 -0400
changeset 46383e90edbf7c53
parent 4637 5b55ea2862db
child 4639 aa6ad1941cbf
child 4679 7d6a17f4ed34
Basic DVB-T and analog TV support for the HVR1300.

From: Steven Toth <stoth@hauppauge.com>

This is the first in a series of patches to add full WinTV-HVR1300
support to Linux. This first patch will enable analog TV support
and DVB-T support. Later patches will add the hardware MPEG encoder
support.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
linux/Documentation/video4linux/CARDLIST.cx88
linux/drivers/media/video/cx88/cx88-cards.c
linux/drivers/media/video/cx88/cx88-core.c
linux/drivers/media/video/cx88/cx88-dvb.c
linux/drivers/media/video/cx88/cx88-input.c
linux/drivers/media/video/cx88/cx88.h
     1.1 --- a/linux/Documentation/video4linux/CARDLIST.cx88	Thu Sep 14 13:36:34 2006 -0300
     1.2 +++ b/linux/Documentation/video4linux/CARDLIST.cx88	Thu Sep 14 14:41:13 2006 -0400
     1.3 @@ -54,3 +54,4 @@
     1.4   53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T  [0070:1404]
     1.5   54 -> Norwood Micro TV Tuner
     1.6   55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM  [c180:c980]
     1.7 + 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder   [0070:9600,0070:9601,0070:9602]
     2.1 --- a/linux/drivers/media/video/cx88/cx88-cards.c	Thu Sep 14 13:36:34 2006 -0300
     2.2 +++ b/linux/drivers/media/video/cx88/cx88-cards.c	Thu Sep 14 14:41:13 2006 -0400
     2.3 @@ -1313,6 +1313,29 @@
     2.4  		       .gpio3  = 0x02000000,
     2.5  	       }},
     2.6         },
     2.7 +	[CX88_BOARD_HAUPPAUGE_HVR1300] = {
     2.8 +		.name		= "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
     2.9 +		.tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
    2.10 +		.radio_type	= UNSET,
    2.11 +		.tuner_addr	= ADDR_UNSET,
    2.12 +		.radio_addr	= ADDR_UNSET,
    2.13 +		.tda9887_conf   = TDA9887_PRESENT,
    2.14 +		.input		= {{
    2.15 +			.type   = CX88_VMUX_TELEVISION,
    2.16 +			.vmux   = 0,
    2.17 +			.gpio0	= 0xe780,
    2.18 +		},{
    2.19 +			.type	= CX88_VMUX_COMPOSITE1,
    2.20 +			.vmux	= 1,
    2.21 +			.gpio0	= 0xe780,
    2.22 +		},{
    2.23 +			.type	= CX88_VMUX_SVIDEO,
    2.24 +			.vmux	= 2,
    2.25 +			.gpio0	= 0xe780,
    2.26 +		}},
    2.27 +		/* fixme: Add radio support */
    2.28 +		.dvb		= 1,
    2.29 +	},
    2.30  };
    2.31  const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
    2.32  
    2.33 @@ -1575,6 +1598,18 @@
    2.34  		.subvendor = 0xc180,
    2.35  		.subdevice = 0xc980,
    2.36  		.card      = CX88_BOARD_TE_DTV_250_OEM_SWANN,
    2.37 +	},{
    2.38 +		.subvendor = 0x0070,
    2.39 +		.subdevice = 0x9600,
    2.40 +		.card      = CX88_BOARD_HAUPPAUGE_HVR1300,
    2.41 +	},{
    2.42 +		.subvendor = 0x0070,
    2.43 +		.subdevice = 0x9601,
    2.44 +		.card      = CX88_BOARD_HAUPPAUGE_HVR1300,
    2.45 +	},{
    2.46 +		.subvendor = 0x0070,
    2.47 +		.subdevice = 0x9602,
    2.48 +		.card      = CX88_BOARD_HAUPPAUGE_HVR1300,
    2.49  	},
    2.50  };
    2.51  const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
    2.52 @@ -1630,6 +1665,11 @@
    2.53  	case 92000: /* Nova-SE2 (OEM, No Video or IR) */
    2.54  	case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
    2.55  	case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
    2.56 +	case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
    2.57 +	case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
    2.58 +	case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
    2.59 +	case 96569: /* WinTV-HVR1300 () */
    2.60 +	case 96659: /* WinTV-HVR1300 () */
    2.61  	case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
    2.62  		/* known */
    2.63  		break;
    2.64 @@ -1756,6 +1796,22 @@
    2.65  		       core->name, i, cx88_boards[i].name);
    2.66  }
    2.67  
    2.68 +void cx88_card_setup_pre_i2c(struct cx88_core *core)
    2.69 +{
    2.70 +	switch (core->board) {
    2.71 +	case CX88_BOARD_HAUPPAUGE_HVR1300:
    2.72 +		/* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
    2.73 +		/* We leave here with the 702 on the bus */
    2.74 +		cx_write(MO_GP0_IO, 0x0000e780);
    2.75 +		udelay(1000);
    2.76 +		cx_clear(MO_GP0_IO, 0x00000080);
    2.77 +		udelay(50);
    2.78 +		cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
    2.79 +		udelay(1000);
    2.80 +		break;
    2.81 +	}
    2.82 +}
    2.83 +
    2.84  void cx88_card_setup(struct cx88_core *core)
    2.85  {
    2.86  	static u8 eeprom[256];
    2.87 @@ -1785,6 +1841,7 @@
    2.88  	case CX88_BOARD_HAUPPAUGE_HVR1100:
    2.89  	case CX88_BOARD_HAUPPAUGE_HVR1100LP:
    2.90  	case CX88_BOARD_HAUPPAUGE_HVR3000:
    2.91 +	case CX88_BOARD_HAUPPAUGE_HVR1300:
    2.92  		if (0 == core->i2c_rc)
    2.93  			hauppauge_eeprom(core,eeprom);
    2.94  		break;
     3.1 --- a/linux/drivers/media/video/cx88/cx88-core.c	Thu Sep 14 13:36:34 2006 -0300
     3.2 +++ b/linux/drivers/media/video/cx88/cx88-core.c	Thu Sep 14 14:41:13 2006 -0400
     3.3 @@ -1179,6 +1179,7 @@
     3.4  
     3.5  	/* init hardware */
     3.6  	cx88_reset(core);
     3.7 +	cx88_card_setup_pre_i2c(core);
     3.8  	cx88_i2c_init(core,pci);
     3.9  	cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL);
    3.10  	cx88_card_setup(core);
     4.1 --- a/linux/drivers/media/video/cx88/cx88-dvb.c	Thu Sep 14 13:36:34 2006 -0300
     4.2 +++ b/linux/drivers/media/video/cx88/cx88-dvb.c	Thu Sep 14 14:41:13 2006 -0400
     4.3 @@ -320,6 +320,10 @@
     4.4  	.demod_address = 0x63,
     4.5  	.output_mode   = CX22702_SERIAL_OUTPUT,
     4.6  };
     4.7 +static struct cx22702_config hauppauge_hvr1300_config = {
     4.8 +	.demod_address = 0x63,
     4.9 +	.output_mode   = CX22702_SERIAL_OUTPUT,
    4.10 +};
    4.11  
    4.12  static int or51132_set_ts_param(struct dvb_frontend* fe,
    4.13  				int is_punctured)
    4.14 @@ -545,6 +549,16 @@
    4.15  				   &dvb_pll_fmd1216me);
    4.16  		}
    4.17  		break;
    4.18 +	case CX88_BOARD_HAUPPAUGE_HVR1300:
    4.19 +		dev->dvb.frontend = dvb_attach(cx22702_attach,
    4.20 +					       &hauppauge_hvr1300_config,
    4.21 +					       &dev->core->i2c_adap);
    4.22 +		if (dev->dvb.frontend != NULL) {
    4.23 +			dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
    4.24 +				   &dev->core->i2c_adap,
    4.25 +				   &dvb_pll_fmd1216me);
    4.26 +		}
    4.27 +		break;
    4.28  	case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
    4.29  		dev->dvb.frontend = dvb_attach(mt352_attach,
    4.30  					       &dvico_fusionhdtv,
     5.1 --- a/linux/drivers/media/video/cx88/cx88-input.c	Thu Sep 14 13:36:34 2006 -0300
     5.2 +++ b/linux/drivers/media/video/cx88/cx88-input.c	Thu Sep 14 14:41:13 2006 -0400
     5.3 @@ -196,6 +196,7 @@
     5.4  	case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
     5.5  	case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
     5.6  	case CX88_BOARD_HAUPPAUGE_HVR1100:
     5.7 +	case CX88_BOARD_HAUPPAUGE_HVR1300:
     5.8  		ir_codes = ir_codes_hauppauge_new;
     5.9  		ir_type = IR_TYPE_RC5;
    5.10  		ir->sampling = 1;
    5.11 @@ -424,6 +425,7 @@
    5.12  	case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
    5.13  	case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
    5.14  	case CX88_BOARD_HAUPPAUGE_HVR1100:
    5.15 +	case CX88_BOARD_HAUPPAUGE_HVR1300:
    5.16  		ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
    5.17  		ir_dprintk("biphase decoded: %x\n", ircode);
    5.18  		if ((ircode & 0xfffff000) != 0x3000)
     6.1 --- a/linux/drivers/media/video/cx88/cx88.h	Thu Sep 14 13:36:34 2006 -0300
     6.2 +++ b/linux/drivers/media/video/cx88/cx88.h	Thu Sep 14 14:41:13 2006 -0400
     6.3 @@ -208,6 +208,7 @@
     6.4  #define CX88_BOARD_HAUPPAUGE_HVR3000       53
     6.5  #define CX88_BOARD_NORWOOD_MICRO           54
     6.6  #define CX88_BOARD_TE_DTV_250_OEM_SWANN    55
     6.7 +#define CX88_BOARD_HAUPPAUGE_HVR1300       56
     6.8  
     6.9  enum cx88_itype {
    6.10  	CX88_VMUX_COMPOSITE1 = 1,
    6.11 @@ -590,6 +591,7 @@
    6.12  
    6.13  extern void cx88_card_list(struct cx88_core *core, struct pci_dev *pci);
    6.14  extern void cx88_card_setup(struct cx88_core *core);
    6.15 +extern void cx88_card_setup_pre_i2c(struct cx88_core *core);
    6.16  
    6.17  /* ----------------------------------------------------------- */
    6.18  /* cx88-tvaudio.c                                              */