[linux-dvb] Avermedia 777 DVB-T

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Jose

Jose Alberto Reguero wrote:
> El Domingo, 22 de Enero de 2006 21:15, Ole Reinartz escribi?:
> 
>>[sorry, forgot the list again]
>>
>>Jose Alberto Reguero schrieb:
>>
>>>CLOCK_CTL -> 0x38 ->111000 -> bit 4 ->1
>>
>>Oh, yes, sure ... *blush*
>>
>>I now have the card set up as you described, and that sets up the mt352
>>quite similar as the setup you once sent as a register file. I can tzap
>>channels, but the signal strength is not enough (gave me around 0x5000).
>>I've seen the AGC locked (register 0, bit0) but thats about it.
>>Did you already get some channel locked with your setup?
>>
>>Ole
> 
> With this patch I get a lock.
> 
> tuning to 842000000 Hz
> video pid 0x00a2, audio pid 0x0058
> status 00 | signal 000f | snr 0000 | ber 00000000 | unc 00000000 |
> status 1f | signal 0a2f | snr c8c8 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5b8f | snr c7c7 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5b5f | snr c8c8 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5b4f | snr c7c7 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5b9f | snr c7c7 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5c8f | snr c6c6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> status 1f | signal 5b5f | snr c7c7 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
> 
Wow, finally we have support for this card!

I just had a glance at your patch. Looks good, but i have a question:
Is it really necessary to duplicate the tuning code? It would be good if
you could avoid this.
A Note: When i have time left, i wish to rework the saa7134-dvb module. I hope
that i can move the tunig code to dvb-pll.c to have a central place.

Best regards
   Hartmut
> 
> 
> ------------------------------------------------------------------------
> 
> Index: linux/drivers/media/video/saa7134/saa7134-cards.c
> ===================================================================
> RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c,v
> retrieving revision 1.124
> diff -u -w -r1.124 saa7134-cards.c
> --- linux/drivers/media/video/saa7134/saa7134-cards.c	19 Jan 2006 15:33:09 -0000	1.124
> +++ linux/drivers/media/video/saa7134/saa7134-cards.c	24 Jan 2006 19:25:07 -0000
> @@ -2624,6 +2624,24 @@
>  			.gpio = 0x000000,	/* GPIO21=Low for FM radio antenna */
>  		},
>  	},
> +	[SAA7134_BOARD_AVERMEDIA_777] = {
> +		.name           = "AverTV DVB-T 777",
> +		.audio_clock    = 0x00187de7,
> +		.tuner_type     = TUNER_ABSENT,
> +		.radio_type     = UNSET,
> +		.tuner_addr	= ADDR_UNSET,
> +		.radio_addr	= ADDR_UNSET,
> +		.mpeg           = SAA7134_MPEG_DVB,
> +		.inputs = {{
> +			.name   = name_comp1,
> +			.vmux   = 0,
> +			.amux   = LINE1,
> +		},{
> +			.name   = name_svideo,
> +			.vmux   = 8,
> +			.amux   = LINE1,
> +		}},
> +	},
>  };
>  
>  const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
> @@ -3095,6 +3113,12 @@
>  		.subdevice    = 0x0319,
>  		.driver_data  = SAA7134_BOARD_FLYDVB_TRIO,
>  	},{
> +		.vendor       = PCI_VENDOR_ID_PHILIPS,
> +		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,	/* SAA 7131E */
> +		.subvendor    = 0x1461,
> +		.subdevice    = 0x2c05,
> +		.driver_data  = SAA7134_BOARD_AVERMEDIA_777,
> +	},{
>  		/* --- boards without eeprom + subsystem ID --- */
>  		.vendor       = PCI_VENDOR_ID_PHILIPS,
>  		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
> Index: linux/drivers/media/video/saa7134/saa7134-dvb.c
> ===================================================================
> RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134-dvb.c,v
> retrieving revision 1.38
> diff -u -w -r1.38 saa7134-dvb.c
> --- linux/drivers/media/video/saa7134/saa7134-dvb.c	19 Jan 2006 15:33:09 -0000	1.38
> +++ linux/drivers/media/video/saa7134/saa7134-dvb.c	24 Jan 2006 19:25:07 -0000
> @@ -115,6 +115,27 @@
>  	return 0;
>  }
>  
> +static int mt352_aver777_init(struct dvb_frontend* fe)
> +{
> +	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x2d };
> +	static u8 reset []         = { RESET,      0x80 };
> +	static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };
> +	static u8 agc_cfg []       = { AGC_TARGET, 0x28, 0xa0 };
> +	static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
> +	struct saa7134_dev *dev= fe->dvb->priv;
> +
> +	printk("%s: %s called\n",dev->name,__FUNCTION__);
> +
> +	mt352_write(fe, clock_config,   sizeof(clock_config));
> +	udelay(200);
> +	mt352_write(fe, reset,          sizeof(reset));
> +	mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
> +	mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
> +	mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
> +
> +	return 0;
> +}
> +
>  static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
>  				  struct dvb_frontend_parameters* params,
>  				  u8* pllbuf)
> @@ -144,6 +165,81 @@
>  	return 0;
>  }
>  
> +static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf)
> +{
> +	int tuner_frequency = 0;
> +	u8 band, cp, filter;
> +
> +	/* determine charge pump */
> +	tuner_frequency = params->frequency + 36166000;
> +	if (tuner_frequency < 87000000)
> +		return -EINVAL;
> +	else if (tuner_frequency < 130000000)
> +		cp = 3;
> +	else if (tuner_frequency < 160000000)
> +		cp = 5;
> +	else if (tuner_frequency < 200000000)
> +		cp = 6;
> +	else if (tuner_frequency < 290000000)
> +		cp = 3;
> +	else if (tuner_frequency < 420000000)
> +		cp = 5;
> +	else if (tuner_frequency < 480000000)
> +		cp = 6;
> +	else if (tuner_frequency < 620000000)
> +		cp = 3;
> +	else if (tuner_frequency < 830000000)
> +		cp = 5;
> +	else if (tuner_frequency < 895000000)
> +		cp = 7;
> +	else
> +		return -EINVAL;
> +
> +	/* determine band */
> +	if (params->frequency < 49000000)
> +		return -EINVAL;
> +	else if (params->frequency < 161000000)
> +		band = 1;
> +	else if (params->frequency < 444000000)
> +		band = 2;
> +	else if (params->frequency < 861000000)
> +		band = 4;
> +	else
> +		return -EINVAL;
> +
> +	/* setup PLL filter */
> +	switch (params->u.ofdm.bandwidth) {
> +	case BANDWIDTH_6_MHZ:
> +		filter = 0;
> +		break;
> +
> +	case BANDWIDTH_7_MHZ:
> +		filter = 0;
> +		break;
> +
> +	case BANDWIDTH_8_MHZ:
> +		filter = 1;
> +		break;
> +
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	/* calculate divisor
> +	 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
> +	 */
> +	tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
> +
> +	/* setup tuner buffer */
> +	pllbuf[0] = 0xc2;
> +	pllbuf[1] = (tuner_frequency >> 8) & 0x7f;
> +	pllbuf[2] = tuner_frequency & 0xff;
> +	pllbuf[3] = 0xca;
> +	pllbuf[4] = (cp << 5) | (filter << 3) | band;
> +
> +	return 0;
> +}
> +
>  static struct mt352_config pinnacle_300i = {
>  	.demod_address = 0x3c >> 1,
>  	.adc_clock     = 20333,
> @@ -152,6 +248,12 @@
>  	.demod_init    = mt352_pinnacle_init,
>  	.pll_set       = mt352_pinnacle_pll_set,
>  };
> +
> +static struct mt352_config avermedia_777 = {
> +	.demod_address = 0xf,
> +	.demod_init    = mt352_aver777_init,
> +	.pll_set       = mt352_aver777_pll_set,
> +};
>  #endif
>  
>  /* ------------------------------------------------------------------ */
> @@ -849,6 +951,12 @@
>  		dev->dvb.frontend = mt352_attach(&pinnacle_300i,
>  						 &dev->i2c_adap);
>  		break;
> +
> +	case SAA7134_BOARD_AVERMEDIA_777:
> +		printk("%s: avertv 777 dvb setup\n",dev->name);
> +		dev->dvb.frontend = mt352_attach(&avermedia_777,
> +						 &dev->i2c_adap);
> +		break;
>  #endif
>  #ifdef HAVE_TDA1004X
>  	case SAA7134_BOARD_MD7134:
> Index: linux/drivers/media/video/saa7134/saa7134.h
> ===================================================================
> RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/saa7134/saa7134.h,v
> retrieving revision 1.89
> diff -u -w -r1.89 saa7134.h
> --- linux/drivers/media/video/saa7134/saa7134.h	19 Jan 2006 15:33:09 -0000	1.89
> +++ linux/drivers/media/video/saa7134/saa7134.h	24 Jan 2006 19:25:07 -0000
> @@ -218,6 +218,7 @@
>  #define SAA7134_BOARD_MSI_TVATANYWHERE_PLUS  82
>  #define SAA7134_BOARD_CINERGY250PCI 83
>  #define SAA7134_BOARD_FLYDVB_TRIO 84
> +#define SAA7134_BOARD_AVERMEDIA_777 85
>  
>  #define SAA7134_MAXBOARDS 8
>  #define SAA7134_INPUT_MAX 8
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 
> linux-dvb@xxxxxxxxxxx
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux