Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a78d0bfa authored by Jose Alberto Reguero's avatar Jose Alberto Reguero Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (3267): Add support for the Avermedia 777 DVB-T card

parent 17801f5f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -83,3 +83,4 @@
 82 -> MSI TV@Anywhere plus                     [1462:6231]
 83 -> Terratec Cinergy 250 PCI TV              [153b:1160]
 84 -> LifeView FlyDVB Trio                     [5168:0319]
 85 -> AverTV DVB-T 777                         [1461:2c05]
+42 −0
Original line number Diff line number Diff line
@@ -362,6 +362,48 @@ struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
};
EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);

/*
 * Philips TD1316 Tuner.
 */
static void td1316_bw(u8 *buf, u32 freq, int bandwidth)
{
	u8 band;

	/* determine band */
	if (freq < 161000000)
		band = 1;
	else if (freq < 444000000)
		band = 2;
	else
		band = 4;

	buf[3] |= band;

	/* setup PLL filter */
	if (bandwidth == BANDWIDTH_8_MHZ)
		buf[3] |= 1 << 3;
}

struct dvb_pll_desc dvb_pll_philips_td1316 = {
	.name  = "Philips TD1316",
	.min   =  87000000,
	.max   = 895000000,
	.setbw = td1316_bw,
	.count = 9,
	.entries = {
		{  93834000, 36166000, 166666, 0xca, 0x60},
		{ 123834000, 36166000, 166666, 0xca, 0xa0},
		{ 163834000, 36166000, 166666, 0xca, 0xc0},
		{ 253834000, 36166000, 166666, 0xca, 0x60},
		{ 383834000, 36166000, 166666, 0xca, 0xa0},
		{ 443834000, 36166000, 166666, 0xca, 0xc0},
		{ 583834000, 36166000, 166666, 0xca, 0x60},
		{ 793834000, 36166000, 166666, 0xca, 0xa0},
		{ 858834000, 36166000, 166666, 0xca, 0xe0},
	},
};
EXPORT_SYMBOL(dvb_pll_philips_td1316);

/* ----------------------------------------------------------- */
/* code                                                        */

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ extern struct dvb_pll_desc dvb_pll_tuv1236d;
extern struct dvb_pll_desc dvb_pll_tdhu2;
extern struct dvb_pll_desc dvb_pll_samsung_tbmv;
extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
extern struct dvb_pll_desc dvb_pll_philips_td1316;

int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
		      u32 freq, int bandwidth);
+24 −0
Original line number Diff line number Diff line
@@ -2619,6 +2619,24 @@ struct saa7134_board saa7134_boards[] = {
			.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);
@@ -3089,6 +3107,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
		.subvendor    = 0x5168,
		.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,
+40 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
#include "dvb-pll.h"

#ifdef HAVE_MT352
# include "mt352.h"
@@ -42,7 +43,6 @@
#endif
#ifdef HAVE_NXT200X
# include "nxt200x.h"
# include "dvb-pll.h"
#endif

MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -113,6 +113,24 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
	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 };

	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)
@@ -142,6 +160,15 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
	return 0;
}

static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf)
{
	pllbuf[0] = 0xc2;
	dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1,
			  params->frequency,
			  params->u.ofdm.bandwidth);
	return 0;
}

static struct mt352_config pinnacle_300i = {
	.demod_address = 0x3c >> 1,
	.adc_clock     = 20333,
@@ -150,6 +177,12 @@ static struct mt352_config pinnacle_300i = {
	.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

/* ------------------------------------------------------------------ */
@@ -847,6 +880,12 @@ static int dvb_init(struct saa7134_dev *dev)
		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:
Loading