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

Mauro Carvalho Chehab mchehab at brturbo.com.br
Mon Dec 5 00:34:41 CET 2005


Em Qui, 2005-12-01 às 15:01 -0500, Steve Toth escreveu:
> > Anyway, enable/disable_plli2c() should then probably be named
> > i2c_gate_ctrl(..., int enable) or something like that if it
> > doesn't deal with just plls.
> >   
> Done. See attached.
> 
> [Patch] Adding support for the Hauppauge HVR1100 and HVR1100-LP products
> 
> Signed-off-by: Steven Toth <stoth at hauppauge.com>
> 
	Signed-off-by: Mauro Carvalho Chehab <mchehab at brturbo.com.br>

	Johannes, is it ok for you?


> 
> anexo Documento somente texto (hvr1100-i2cgate.patch)
> 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	1 Dec 2005 19:54:24 -0000
> @@ -38,3 +38,5 @@
>   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]
> + 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)  [0070:9800,0070:9802]
> Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.h
> ===================================================================
> RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/dvb-core/dvb_frontend.h,v
> retrieving revision 1.25
> diff -u -p -r1.25 dvb_frontend.h
> --- linux/drivers/media/dvb/dvb-core/dvb_frontend.h	26 Nov 2005 23:46:56 -0000	1.25
> +++ linux/drivers/media/dvb/dvb-core/dvb_frontend.h	1 Dec 2005 19:54:25 -0000
> @@ -85,6 +85,7 @@ struct dvb_frontend_ops {
>  	int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
>  	int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg);
>  	int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
> +	int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
>  };
>  
>  #define MAX_EVENT 8
> 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	1 Dec 2005 19:54:25 -0000
> @@ -195,6 +195,16 @@ static int cx22702_get_tps (struct cx227
>  	return 0;
>  }
>  
> +static int cx22702_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
> +{
> +	struct cx22702_state* state = fe->demodulator_priv;
> +	dprintk ("%s(%d)\n", __FUNCTION__, enable);
> +	if (enable)
> +		return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) & 0xfe);
> +	else
> +		return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) | 1);
> +}
> +
>  /* Talk to the demod, set the FEC, GUARD, QAM settings etc */
>  static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
>  {
> @@ -202,7 +212,7 @@ 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);
> +	cx22702_i2c_gate_ctrl(fe, 1);
>  	if (state->config->pll_set) {
>  		state->config->pll_set(fe, p);
>  	} else if (state->config->pll_desc) {
> @@ -216,7 +226,7 @@ static int cx22702_set_tps (struct dvb_f
>  	} else {
>  		BUG();
>  	}
> -	cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
> +	cx22702_i2c_gate_ctrl(fe, 0);
>  
>  	/* set inversion */
>  	cx22702_set_inversion (state, p->inversion);
> @@ -349,11 +359,10 @@ 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);
> -		cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
> -	}
> +
> +	cx22702_i2c_gate_ctrl(fe, 0);
>  
>  	return 0;
>  }
> @@ -531,6 +540,7 @@ static struct dvb_frontend_ops cx22702_o
>  	.read_signal_strength = cx22702_read_signal_strength,
>  	.read_snr = cx22702_read_snr,
>  	.read_ucblocks = cx22702_read_ucblocks,
> +	.i2c_gate_ctrl = cx22702_i2c_gate_ctrl,
>  };
>  
>  module_param(debug, int, 0644);
> 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	1 Dec 2005 19:54:25 -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,43 @@ 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,
> +	},
> +	[CX88_BOARD_HAUPPAUGE_HVR1100LP] = {
> +		.name		= "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)",
> +		.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,
> +		}},
> +		/* fixme: Add radio support */
> +		.dvb		= 1,
> +	},
>  };
>  const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
>  
> @@ -1109,6 +1145,22 @@ 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,
> +	},{
> +		.subvendor = 0x0070,
> +		.subdevice = 0x9800,
> +		.card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
> +	},{
> +		.subvendor = 0x0070,
> +		.subdevice = 0x9802,
> +		.card      = CX88_BOARD_HAUPPAUGE_HVR1100LP,
>  	},
>  };
>  const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
> @@ -1140,9 +1192,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 +1210,9 @@ 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) */
> +	case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
>  		/* known */
>  		break;
>  	default:
> @@ -1279,6 +1330,8 @@ 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:
> +	case CX88_BOARD_HAUPPAUGE_HVR1100LP:
>  		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	1 Dec 2005 19:54:26 -0000
> @@ -197,6 +197,14 @@ static struct cx22702_config hauppauge_n
>  	.pll_address   = 0x61,
>  	.pll_desc      = &dvb_pll_thomson_dtt759x,
>  };
> +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,
> +};
>  #endif
>  
>  #ifdef HAVE_OR51132
> @@ -376,6 +384,11 @@ 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:
> +	case CX88_BOARD_HAUPPAUGE_HVR1100LP:
> +		dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config,
> +						   &dev->core->i2c_adap);
> +		break;
>  #endif
>  #ifdef HAVE_MT352
>  	case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
> @@ -538,6 +551,9 @@ static int __devinit dvb_probe(struct pc
>  	err = dvb_register(dev);
>  	if (0 != err)
>  		goto fail_fini;
> +
> +	/* Maintain a reference to cx88-video can query the 8802 device. */
> +	core->dvbdev = dev;
>  	return 0;
>  
>   fail_fini:
> @@ -553,6 +569,9 @@ static void __devexit dvb_remove(struct 
>  {
>  	struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
>  
> +	/* Destroy any 8802 reference. */
> +	dev->core->dvbdev = NULL;
> +
>  	/* dvb */
>  	videobuf_dvb_unregister(&dev->dvb);
>  
> Index: linux/drivers/media/video/cx88/cx88-i2c.c
> ===================================================================
> RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-i2c.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 cx88-i2c.c
> --- linux/drivers/media/video/cx88/cx88-i2c.c	16 Oct 2005 12:13:58 -0000	1.33
> +++ linux/drivers/media/video/cx88/cx88-i2c.c	1 Dec 2005 19:54:26 -0000
> @@ -140,7 +140,20 @@ void cx88_call_i2c_clients(struct cx88_c
>  {
>  	if (0 != core->i2c_rc)
>  		return;
> -	i2c_clients_command(&core->i2c_adap, cmd, arg);
> +
> +	if (core->dvbdev == NULL) {
> +		i2c_clients_command(&core->i2c_adap, cmd, arg);
> +	} else {
> +
> +		if (core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl)
> +			core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1);
> +
> +		i2c_clients_command(&core->i2c_adap, cmd, arg);
> +
> +		if (core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl)
> +			core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl(core->dvbdev->dvb.frontend, 0);
> +	}
> +
>  }
>  
>  static struct i2c_algo_bit_data cx8800_i2c_algo_template = {
> 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	1 Dec 2005 19:54:26 -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	1 Dec 2005 19:54:26 -0000
> @@ -189,6 +189,8 @@ 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
> +#define CX88_BOARD_HAUPPAUGE_HVR1100LP     41
>  
>  enum cx88_itype {
>  	CX88_VMUX_COMPOSITE1 = 1,
> @@ -314,6 +316,9 @@ struct cx88_core {
>  
>  	/* various v4l controls */
>  	u32                        freq;
> +
> +	/* cx88-video needs to access cx8802 for hybrid tuner pll access. */
> +	struct cx8802_dev          *dvbdev;
>  };
>  
>  struct cx8800_dev;
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list
Cheers, 
Mauro.




More information about the linux-dvb mailing list