/* * $Id: saa7134-dvb.c,v 1.6 2004/12/10 12:33:39 kraxel Exp $ * * (c) 2004 Gerd Knorr [SuSE Labs] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include "saa7134-reg.h" #include "saa7134.h" #include "dvb-pll.h" #include "mt352.h" #include "mt352_priv.h" /* FIXME */ MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); /* ------------------------------------------------------------------ */ static int mt352_init(struct dvb_frontend* fe) { static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; // check static u8 reset [] = { RESET, 0x80 }; // ok static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; // ok #if 0 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; // check static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; // ??? static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; // ??? #endif 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)); #if 0 mt352_write(fe, agc_cfg, sizeof(agc_cfg)); mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); #endif return 0; } static int mt352_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf) { struct saa7134_dev *dev= fe->dvb->priv; printk("%s: %s called\n",dev->name,__FUNCTION__); /* FIXME */ memset(pllbuf,0,5); return 0; } static struct mt352_config pinnacle_300i = { .demod_address = 0x3c >> 1, .demod_init = mt352_init, .pll_set = mt352_pll_set, }; /* ------------------------------------------------------------------ */ static int dvb_init(struct saa7134_dev *dev) { /* init struct videobuf_dvb */ dev->dvb.name = dev->name; videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops, dev->pci, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, sizeof(struct saa7134_buf), dev); switch (dev->board) { case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: printk("%s: pinnacle 300i dvb setup\n",dev->name); dev->dvb.frontend = mt352_attach(&pinnacle_300i, &dev->i2c_adap); break; default: printk("%s: Huh? unknown DVB card?\n",dev->name); break; } if (NULL == dev->dvb.frontend) { printk("%s: frontend initialization failed\n",dev->name); return -1; } /* register everything else */ return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); } static int dvb_fini(struct saa7134_dev *dev) { printk("%s: %s\n",dev->name,__FUNCTION__); videobuf_dvb_unregister(&dev->dvb); return 0; } static struct saa7134_mpeg_ops dvb_ops = { .type = SAA7134_MPEG_DVB, .init = dvb_init, .fini = dvb_fini, }; static int __init dvb_register(void) { return saa7134_ts_register(&dvb_ops); } static void __exit dvb_unregister(void) { saa7134_ts_unregister(&dvb_ops); } module_init(dvb_register); module_exit(dvb_unregister); /* ------------------------------------------------------------------ */ /* * Local variables: * c-basic-offset: 8 * compile-command: "make DVB=1" * End: */