video4linux-cvs-sender@xxxxxxxxxxx wrote: > From: Jose Alberto Reguero <jareguero@xxxxxxxxxxxxxx> > Add support for the Avermedia 777 DVB-T card > > Signed-off-by: Jose Alberto Reguero <jareguero@xxxxxxxxxxxxxx> > Signed-off-by: Hartmut Hackmann <hartmut.hackmann@xxxxxxxxxxx> This patch causes the following warnings during the build: saa7134-tvaudio.c: In function 'tvaudio_setmode': saa7134-tvaudio.c:309: warning: enumeration value 'TVAUDIO_AM_MONO' not handled in switch saa7134-tvaudio.c: In function 'tvaudio_getstereo': saa7134-tvaudio.c:439: warning: enumeration value 'TVAUDIO_AM_MONO' not handled in switch saa7134-tvaudio.c: In function 'tvaudio_setstereo': saa7134-tvaudio.c:505: warning: enumeration value 'TVAUDIO_AM_MONO' not handled in switch Also, please skip below to the function: static int mt352_aver777_pll_set , for more comments. > Changeset=3267 commited by Hartmut Hackmann > > linux/Documentation/video4linux/CARDLIST.saa7134 | 1 > linux/drivers/media/video/saa7134/saa7134-cards.c | 24 +++ > linux/drivers/media/video/saa7134/saa7134-dvb.c | 108 ++++++++++++++ > linux/drivers/media/video/saa7134/saa7134.h | 2 > 4 files changed, 135 insertions(+) > > diff -r c60422d55d2c -r 5d9b4019d44e linux/Documentation/video4linux/CARDLIST.saa7134 > --- a/linux/Documentation/video4linux/CARDLIST.saa7134 Sun Jan 29 22:27:06 2006 > +++ b/linux/Documentation/video4linux/CARDLIST.saa7134 Sun Jan 29 23:57:55 2006 > @@ -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] > diff -r c60422d55d2c -r 5d9b4019d44e linux/drivers/media/video/saa7134/saa7134-cards.c > --- a/linux/drivers/media/video/saa7134/saa7134-cards.c Sun Jan 29 22:27:06 2006 > +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c Sun Jan 29 23:57:55 2006 > @@ -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); > @@ -3094,6 +3112,12 @@ > .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, > diff -r c60422d55d2c -r 5d9b4019d44e linux/drivers/media/video/saa7134/saa7134-dvb.c > --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c Sun Jan 29 22:27:06 2006 > +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c Sun Jan 29 23:57:55 2006 > @@ -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; > } > Why is all this tuner programming (below) hardcoded into the card driver? I've noticed a LOT of this in saa7134-dvb.c Most of these can be converted to use dvb-pll, and I see no reason why new code should be accepted this way. We are trying to have consistant looking code, and this is counter-productive. Please re-do this function to use dvb-pll, so that other devices that have the same tuner can share its programming. > +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, > @@ -151,6 +247,12 @@ > .no_tuner = 1, > .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: > diff -r c60422d55d2c -r 5d9b4019d44e linux/drivers/media/video/saa7134/saa7134.h > --- a/linux/drivers/media/video/saa7134/saa7134.h Sun Jan 29 22:27:06 2006 > +++ b/linux/drivers/media/video/saa7134/saa7134.h Sun Jan 29 23:57:55 2006 > @@ -68,6 +68,7 @@ > TVAUDIO_FM_K_STEREO = 4, > TVAUDIO_NICAM_AM = 5, > TVAUDIO_NICAM_FM = 6, > + TVAUDIO_AM_MONO = 7 > }; > > enum saa7134_audio_in { > @@ -218,6 +219,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 > > _______________________________________________ > video4linux-cvs mailing list > video4linux-cvs@xxxxxxxxxxx > http://www.linuxtv.org/cgi-bin/mailman/listinfo/video4linux-cvs