diff options
author | Gerd Knorr <devnull@localhost> | 2004-12-09 12:51:35 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-12-09 12:51:35 +0000 |
commit | 17d7470d78bd886cab06e6f0848bac4ac8edf1db (patch) | |
tree | 2e681fb9a605d3e2ba2feb0007aec272c8833431 /linux/drivers/media | |
parent | 39aa684c82354e2c6c357eed2fd37c38f29c461f (diff) | |
download | mediapointer-dvb-s2-17d7470d78bd886cab06e6f0848bac4ac8edf1db.tar.gz mediapointer-dvb-s2-17d7470d78bd886cab06e6f0848bac4ac8edf1db.tar.bz2 |
- work on dvb pll stuff.
- misc dvb updates.
- pinnacle 300i stuff (not working yet).
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/bttv-cards.c | 6 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 47 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-dvb.c | 151 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/ir-kbd-i2c.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/msp3400-driver.c | 5 | ||||
-rw-r--r-- | linux/drivers/media/video/msp3400.c | 5 | ||||
-rw-r--r-- | linux/drivers/media/video/saa6752hs.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa6752hs.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-cards.c | 31 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-dvb.c | 82 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-i2c.c | 31 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-video.c | 5 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 3 | ||||
-rw-r--r-- | linux/drivers/media/video/video-buf-dvb.c | 9 |
15 files changed, 207 insertions, 190 deletions
diff --git a/linux/drivers/media/video/bttv-cards.c b/linux/drivers/media/video/bttv-cards.c index fb799a5a1..0ccd77fc8 100644 --- a/linux/drivers/media/video/bttv-cards.c +++ b/linux/drivers/media/video/bttv-cards.c @@ -1,5 +1,5 @@ /* - $Id: bttv-cards.c,v 1.36 2004/12/02 13:44:44 kraxel Exp $ + $Id: bttv-cards.c,v 1.37 2004/12/09 12:51:35 kraxel Exp $ bttv-cards.c @@ -38,7 +38,9 @@ #include <asm/io.h> #include "bttvp.h" +#if 0 /* not working yet */ #include "bt832.h" +#endif /* fwd decl */ static void boot_msp34xx(struct bttv *btv, int pin); @@ -3195,6 +3197,7 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) static void __devinit boot_bt832(struct bttv *btv) { +#if 0 /* not working yet */ int resetbit=0; switch (btv->c.type) { @@ -3223,6 +3226,7 @@ static void __devinit boot_bt832(struct bttv *btv) // bt832 on pixelview changes from i2c 0x8a to 0x88 after // being reset as above. So we must follow by this: bttv_call_i2c_clients(btv, BT832_REATTACH, NULL); +#endif } /* ----------------------------------------------------------------------- */ diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 3ad9c2c40..0f8463a7b 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-cards.c,v 1.51 2004/11/30 17:00:13 kraxel Exp $ + * $Id: cx88-cards.c,v 1.52 2004/12/09 12:51:35 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff. @@ -32,7 +32,8 @@ #include "cx88.h" #ifdef WITH_DVB -#include "cx22702.h" +# include "dvb-pll.h" +# include "cx22702.h" #endif /* ------------------------------------------------------------------ */ @@ -700,7 +701,6 @@ static int hauppauge_eeprom_dvb(struct cx88_core *core, u8 *ee) { int model; int tuner; - char *tname; /* Make sure we support the board model */ model = ee[0x1f] << 24 | ee[0x1e] << 16 | ee[0x1d] << 8 | ee[0x1c]; @@ -719,21 +719,18 @@ static int hauppauge_eeprom_dvb(struct cx88_core *core, u8 *ee) /* Make sure we support the tuner */ tuner = ee[0x2d]; switch(tuner) { - case 0x4B: - tname = "Thomson DTT 7595"; - core->pll_type = PLLTYPE_DTT7595; - break; - case 0x4C: - tname = "Thomson DTT 7592"; - core->pll_type = PLLTYPE_DTT7592; + case 0x4B: /* ddt 7595 */ + case 0x4C: /* dtt 7592 */ + core->pll_desc = &dvb_pll_thomson_dtt759x; break; default: printk("%s: error: unknown hauppauge tuner 0x%02x\n", core->name, tuner); return -ENODEV; } - printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%s (%d)\n", - core->name, model, tname, tuner); + printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d (%s)\n", + core->name, model, tuner, + core->pll_desc ? core->pll_desc->name : "UNKNOWN"); core->pll_addr = 0x61; core->demod_addr = 0x43; @@ -869,13 +866,6 @@ void cx88_card_setup(struct cx88_core *core) i2c_eeprom(&core->i2c_client,eeprom,sizeof(eeprom)); leadtek_eeprom(core,eeprom); break; - case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: - /* Tuner reset is hooked to the tuner out of reset */ - cx_set(MO_GP0_IO, 0x00000101); - cx_clear(MO_GP0_IO, 0x00000001); - msleep(1); - cx_set(MO_GP0_IO, 0x00000101); - break; #ifdef WITH_DVB case CX88_BOARD_HAUPPAUGE_DVB_T1: if (0 == core->i2c_rc) @@ -883,11 +873,23 @@ void cx88_card_setup(struct cx88_core *core) hauppauge_eeprom_dvb(core,eeprom); break; case CX88_BOARD_CONEXANT_DVB_T1: - core->pll_type = PLLTYPE_DTT7579; + core->pll_desc = &dvb_pll_thomson_dtt7579; core->pll_addr = 0x60; core->demod_addr = 0x43; break; -#endif + case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: + /* Tuner reset is hooked to the tuner out of reset */ + cx_set(MO_GP0_IO, 0x00000101); + cx_clear(MO_GP0_IO, 0x00000001); + msleep(1); + cx_set(MO_GP0_IO, 0x00000101); + core->pll_addr = 0x61; + core->pll_desc = &dvb_pll_lg_z201; + break; + case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: + core->pll_addr = 0x60; + core->pll_desc = &dvb_pll_thomson_dtt7579; + break; case CX88_BOARD_DNTV_LIVE_DVB_T: cx_set(MO_GP0_IO, 0x00000707); cx_set(MO_GP2_IO, 0x00000101); @@ -895,7 +897,10 @@ void cx88_card_setup(struct cx88_core *core) msleep(1); cx_clear(MO_GP0_IO, 0x00000007); cx_set(MO_GP2_IO, 0x00000101); + core->pll_addr = 0x61; + core->pll_desc = &dvb_pll_unknown_1; break; +#endif } if (cx88_boards[core->board].radio.type == CX88_RADIO) core->has_radio = 1; diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 25632897c..b467c9b75 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.20 2004/11/30 17:00:13 kraxel Exp $ + * $Id: cx88-dvb.c,v 1.21 2004/12/09 12:51:35 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -31,6 +31,7 @@ #include <linux/suspend.h> #include "cx88.h" +#include "dvb-pll.h" #include "cx22702.h" #include "mt352.h" #include "mt352_priv.h" /* FIXME */ @@ -110,74 +111,6 @@ static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) return 0; } -#define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ - -static int lg_z201_pll_set(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params, u8* pllbuf) -{ - u32 div; - unsigned char cp = 0; - unsigned char bs = 0; - - div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; - - if (params->frequency < 542000000) cp = 0xbc; - else if (params->frequency < 830000000) cp = 0xf4; - else cp = 0xfc; - - if (params->frequency == 0) bs = 0x03; - else if (params->frequency < 157500000) bs = 0x01; - else if (params->frequency < 443250000) bs = 0x02; - else bs = 0x04; - - pllbuf[0] = 0xC2; /* Note: non-linux standard PLL I2C address */ - pllbuf[1] = div >> 8; - pllbuf[2] = div & 0xff; - pllbuf[3] = cp; - pllbuf[4] = bs; - - return 0; -} - -static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params, - u8* pllbuf) -{ - u32 div; - unsigned char cp = 0; - unsigned char bs = 0; - - div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; - - if (params->frequency < 542000000) cp = 0xb4; - else if (params->frequency < 771000000) cp = 0xbc; - else cp = 0xf4; - - if (params->frequency == 0) bs = 0x03; - else if (params->frequency < 443250000) bs = 0x02; - else bs = 0x08; - - pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address - pllbuf[1] = div >> 8; - pllbuf[2] = div & 0xff; - pllbuf[3] = cp; - pllbuf[4] = bs; - - return 0; -} - -struct mt352_config dvico_fusionhdtv_dvbt1 = { - .demod_address = 0x0F, - .demod_init = dvico_fusionhdtv_demod_init, - .pll_set = lg_z201_pll_set, -}; - -struct mt352_config dvico_fusionhdtv_dvbt_plus = { - .demod_address = 0x0F, - .demod_init = dvico_fusionhdtv_demod_init, - .pll_set = thomson_dtt7579_pll_set, -}; - static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) { static u8 clock_config [] = { 0x89, 0x38, 0x39 }; @@ -201,49 +134,29 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) return 0; } -static int dntv_live_dvbt_pll_set(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params, - u8* pllbuf) +static int mt352_pll_set(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params, + u8* pllbuf) { - u32 div; - unsigned char bs = 0; - unsigned char cp = 0; - - div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; - - if (params->frequency < 150000000) cp = 0xB4; - else if (params->frequency < 173000000) cp = 0xBC; - else if (params->frequency < 250000000) cp = 0xB4; - else if (params->frequency < 400000000) cp = 0xBC; - else if (params->frequency < 420000000) cp = 0xF4; - else if (params->frequency < 470000000) cp = 0xFC; - else if (params->frequency < 600000000) cp = 0xBC; - else if (params->frequency < 730000000) cp = 0xF4; - else cp = 0xFC; - - if (params->frequency < 150000000) bs = 0x01; - else if (params->frequency < 173000000) bs = 0x01; - else if (params->frequency < 250000000) bs = 0x02; - else if (params->frequency < 400000000) bs = 0x02; - else if (params->frequency < 420000000) bs = 0x02; - else if (params->frequency < 470000000) bs = 0x02; - else if (params->frequency < 600000000) bs = 0x08; - else if (params->frequency < 730000000) bs = 0x08; - else bs = 0x08; - - pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address - pllbuf[1] = div >> 8; - pllbuf[2] = div & 0xff; - pllbuf[3] = cp; - pllbuf[4] = bs; + struct cx8802_dev *dev= fe->dvb->priv; + pllbuf[0] = dev->core->pll_addr << 1; + dvb_pll_configure(dev->core->pll_desc, pllbuf+1, + params->frequency, + params->u.ofdm.bandwidth); return 0; } +static struct mt352_config dvico_fusionhdtv = { + .demod_address = 0x0F, + .demod_init = dvico_fusionhdtv_demod_init, + .pll_set = mt352_pll_set, +}; + static struct mt352_config dntv_live_dvbt_config = { .demod_address = 0x0f, .demod_init = dntv_live_dvbt_demod_init, - .pll_set = dntv_live_dvbt_pll_set, + .pll_set = mt352_pll_set, }; static int dvb_register(struct cx8802_dev *dev) @@ -257,40 +170,32 @@ static int dvb_register(struct cx8802_dev *dev) case CX88_BOARD_CONEXANT_DVB_T1: dev->dvb.frontend = cx22702_create(&dev->core->i2c_adap, dev->core->pll_addr, - dev->core->pll_type, + dev->core->pll_desc, dev->core->demod_addr); break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: - dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt1, - &dev->core->i2c_adap); - if (dev->dvb.frontend) { - dev->dvb.frontend->ops->info.frequency_min = 174000000; - dev->dvb.frontend->ops->info.frequency_max = 862000000; - } - break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: - dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt_plus, + dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv, &dev->core->i2c_adap); - if (dev->dvb.frontend) { - dev->dvb.frontend->ops->info.frequency_min = 174000000; - dev->dvb.frontend->ops->info.frequency_max = 862000000; - } break; case CX88_BOARD_DNTV_LIVE_DVB_T: dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, &dev->core->i2c_adap); - if (dev->dvb.frontend) { - dev->dvb.frontend->ops->info.frequency_min = 174000000; - dev->dvb.frontend->ops->info.frequency_max = 862000000; - } break; default: printk("%s: FIXME: frontend handling not here yet ...\n", dev->core->name); break; } - if (NULL == dev->dvb.frontend) + if (NULL == dev->dvb.frontend) { + printk("%s: frontend initialization failed\n",dev->core->name); return -1; + } + + if (dev->core->pll_desc) { + dev->dvb.frontend->ops->info.frequency_min = dev->core->pll_desc->min; + dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max; + } /* Copy the board name into the DVB structure */ strlcpy(dev->dvb.frontend->ops->info.name, @@ -298,7 +203,7 @@ static int dvb_register(struct cx8802_dev *dev) sizeof(dev->dvb.frontend->ops->info.name)); /* register everything */ - return videobuf_dvb_register(&dev->dvb); + return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); } /* ----------------------------------------------------------- */ diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 6643f69c2..6a62739e7 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -1,5 +1,5 @@ /* - * $Id: cx88.h,v 1.45 2004/12/07 13:17:57 kraxel Exp $ + * $Id: cx88.h,v 1.46 2004/12/09 12:51:35 kraxel Exp $ * * v4l2 device driver for cx2388x based TV cards * @@ -256,7 +256,7 @@ struct cx88_core { unsigned int has_radio; /* config info -- dvb */ - unsigned int pll_type; + struct dvb_pll_desc *pll_desc; unsigned int pll_addr; unsigned int demod_addr; diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index ada90d489..92664f75d 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: ir-kbd-i2c.c,v 1.9 2004/11/03 09:04:51 kraxel Exp $ + * $Id: ir-kbd-i2c.c,v 1.10 2004/12/09 12:51:35 kraxel Exp $ * * keyboard input driver for i2c IR remote controls * @@ -433,7 +433,7 @@ static int ir_probe(struct i2c_adapter *adap) */ static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; - static const int probe_saa7134[] = { 0x7a, -1}; + static const int probe_saa7134[] = { 0x7a, -1 }; const int *probe = NULL; struct i2c_client c; char buf; int i,rc; diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 224a0f791..5c4433cf5 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -1504,9 +1504,12 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) msp->opmode = opmode; if (OPMODE_AUTO == msp->opmode) { +#if 0 /* seems to work for ivtv only, disable by default for now ... */ if (HAVE_SIMPLER(msp)) msp->opmode = OPMODE_SIMPLER; - else if (HAVE_SIMPLE(msp)) + else +#endif + if (HAVE_SIMPLE(msp)) msp->opmode = OPMODE_SIMPLE; else msp->opmode = OPMODE_MANUAL; diff --git a/linux/drivers/media/video/msp3400.c b/linux/drivers/media/video/msp3400.c index 224a0f791..5c4433cf5 100644 --- a/linux/drivers/media/video/msp3400.c +++ b/linux/drivers/media/video/msp3400.c @@ -1504,9 +1504,12 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) msp->opmode = opmode; if (OPMODE_AUTO == msp->opmode) { +#if 0 /* seems to work for ivtv only, disable by default for now ... */ if (HAVE_SIMPLER(msp)) msp->opmode = OPMODE_SIMPLER; - else if (HAVE_SIMPLE(msp)) + else +#endif + if (HAVE_SIMPLE(msp)) msp->opmode = OPMODE_SIMPLE; else msp->opmode = OPMODE_MANUAL; diff --git a/linux/drivers/media/video/saa6752hs.c b/linux/drivers/media/video/saa6752hs.c index dc35bf34d..943ddd41c 100644 --- a/linux/drivers/media/video/saa6752hs.c +++ b/linux/drivers/media/video/saa6752hs.c @@ -428,12 +428,13 @@ static int saa6752hs_init(struct i2c_client* client) buf[4] = 0xB0; buf[5] = buf2[0]; switch(h->params.vi_aspect_ratio) { + case V4L2_MPEG_ASPECT_16_9: + buf[6] = buf2[1] | 0x40; + break; case V4L2_MPEG_ASPECT_4_3: + default: buf[6] = buf2[1] & 0xBF; break; - - case V4L2_MPEG_ASPECT_16_9: - buf[6] = buf2[1] | 0x40; break; } buf[7] = buf2[2]; diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c index dc35bf34d..943ddd41c 100644 --- a/linux/drivers/media/video/saa7134/saa6752hs.c +++ b/linux/drivers/media/video/saa7134/saa6752hs.c @@ -428,12 +428,13 @@ static int saa6752hs_init(struct i2c_client* client) buf[4] = 0xB0; buf[5] = buf2[0]; switch(h->params.vi_aspect_ratio) { + case V4L2_MPEG_ASPECT_16_9: + buf[6] = buf2[1] | 0x40; + break; case V4L2_MPEG_ASPECT_4_3: + default: buf[6] = buf2[1] & 0xBF; break; - - case V4L2_MPEG_ASPECT_16_9: - buf[6] = buf2[1] | 0x40; break; } buf[7] = buf2[2]; diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index 493fcc84f..02c17edd5 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -1,6 +1,6 @@ /* - * $Id: saa7134-cards.c,v 1.44 2004/11/30 11:26:38 kraxel Exp $ + * $Id: saa7134-cards.c,v 1.45 2004/12/09 12:51:35 kraxel Exp $ * * device driver for philips saa7134 based TV cards * card-specific stuff. @@ -1354,6 +1354,31 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x0c8000, }, }, + [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { + .name = "Pinnacle PCTV 300i DVB-T + PAL", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_MT2032, + .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_comp2, + .vmux = 1, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -1565,8 +1590,8 @@ struct pci_device_id saa7134_pci_tbl[] = { .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x11bd, - .subdevice = 0x002d, /* 300i DVB-T + PAL */ - .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, + .subdevice = 0x002d, + .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL, },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c index b51f0acb1..b2cbaee4c 100644 --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-dvb.c,v 1.4 2004/11/07 14:44:59 kraxel Exp $ + * $Id: saa7134-dvb.c,v 1.5 2004/12/09 12:51:35 kraxel Exp $ * * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] * @@ -30,15 +30,65 @@ #include "saa7134-reg.h" #include "saa7134.h" +#include "dvb-pll.h" +#include "mt352.h" +#include "mt352_priv.h" /* FIXME */ + MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); MODULE_LICENSE("GPL"); /* ------------------------------------------------------------------ */ -static int dvb_init(struct saa7134_dev *dev) +static int mt352_init(struct dvb_frontend* fe) { - printk("%s: %s\n",dev->name,__FUNCTION__); + static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; + static u8 reset [] = { RESET, 0x80 }; +#if 0 + static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; + static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; + 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)); +#if 0 + mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); + + 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_address = 0x1e >> 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, @@ -48,12 +98,32 @@ static int dvb_init(struct saa7134_dev *dev) sizeof(struct saa7134_buf), dev); - /* TODO: init frontend */ - if (NULL == dev->dvb.frontend) + switch (dev->board) { + case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: + printk("%s: pinnacle 300i dvb setup\n",dev->name); + { + u8 buf[16]; + dev->i2c_client.addr = 0x3c >> 1; + memset(buf,0,sizeof(buf)); + buf[0] = CHIP_ID; + i2c_master_send(&dev->i2c_client,buf,1); + i2c_master_recv(&dev->i2c_client,buf,1); + } + 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); + return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); } static int dvb_fini(struct saa7134_dev *dev) diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c index cce9ddc3e..78c07db8a 100644 --- a/linux/drivers/media/video/saa7134/saa7134-i2c.c +++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-i2c.c,v 1.7 2004/11/07 13:17:15 kraxel Exp $ + * $Id: saa7134-i2c.c,v 1.8 2004/12/09 12:51:35 kraxel Exp $ * * device driver for philips saa7134 based TV cards * i2c interface support @@ -214,6 +214,13 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, if (!i2c_is_busy_wait(dev)) return -EIO; status = i2c_get_status(dev); +#if 1 /* debug */ + if (DONE_READ == status) { + unsigned char data = saa_readb(SAA7134_I2C_DATA); + d2printk(KERN_DEBUG "%s: i2c data <= 0x%x\n",dev->name,data); + d1printk(" [%02x]",data); + } +#endif if (i2c_is_error(status)) return -EIO; return 0; @@ -248,10 +255,12 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, if (!i2c_reset(dev)) return -EIO; + d2printk("start xfer\n"); d1printk(KERN_DEBUG "%s: i2c xfer:",dev->name); for (i = 0; i < num; i++) { if (!(msgs[i].flags & I2C_M_NOSTART) || 0 == i) { /* send address */ + d2printk("send address\n"); addr = msgs[i].addr << 1; if (msgs[i].flags & I2C_M_RD) addr |= 1; @@ -262,6 +271,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, } if (msgs[i].flags & I2C_M_RD) { /* read bytes */ + d2printk("read bytes\n"); for (byte = 0; byte < msgs[i].len; byte++) { d1printk(" ="); rc = i2c_recv_byte(dev); @@ -272,6 +282,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, } } else { /* write bytes */ + d2printk("write bytes\n"); for (byte = 0; byte < msgs[i].len; byte++) { data = msgs[i].buf[byte]; d1printk(" %02x", data); @@ -281,6 +292,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, } } } + d2printk("xfer done\n"); d1printk(" >"); i2c_set_attr(dev,STOP); rc = -EIO; @@ -313,18 +325,6 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -#ifndef I2C_PEC -static void inc_use(struct i2c_adapter *adap) -{ - MOD_INC_USE_COUNT; -} - -static void dec_use(struct i2c_adapter *adap) -{ - MOD_DEC_USE_COUNT; -} -#endif - static int attach_inform(struct i2c_client *client) { struct saa7134_dev *dev = client->adapter->algo_data; @@ -345,12 +345,7 @@ static struct i2c_algorithm saa7134_algo = { }; static struct i2c_adapter saa7134_adap_template = { -#ifdef I2C_PEC .owner = THIS_MODULE, -#else - .inc_use = inc_use, - .dec_use = dec_use, -#endif #ifdef I2C_CLASS_TV_ANALOG .class = I2C_CLASS_TV_ANALOG, #endif diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c index 36a623fca..c3164350b 100644 --- a/linux/drivers/media/video/saa7134/saa7134-video.c +++ b/linux/drivers/media/video/saa7134/saa7134-video.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-video.c,v 1.23 2004/12/02 14:23:54 kraxel Exp $ + * $Id: saa7134-video.c,v 1.24 2004/12/09 12:51:35 kraxel Exp $ * * device driver for philips saa7134 based TV cards * video4linux video interface @@ -1474,6 +1474,7 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, f->fmt.pix.width = maxw; if (f->fmt.pix.height > maxh) f->fmt.pix.height = maxh; + f->fmt.pix.width &= ~0x03; f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3; f->fmt.pix.sizeimage = @@ -2269,7 +2270,7 @@ int saa7134_video_init1(struct saa7134_dev *dev) dev->ctl_hue = ctrl_by_id(V4L2_CID_HUE)->default_value; dev->ctl_saturation = ctrl_by_id(V4L2_CID_SATURATION)->default_value; dev->ctl_volume = ctrl_by_id(V4L2_CID_AUDIO_VOLUME)->default_value; - dev->ctl_mute = ctrl_by_id(V4L2_CID_AUDIO_MUTE)->default_value; + dev->ctl_mute = 1; // ctrl_by_id(V4L2_CID_AUDIO_MUTE)->default_value; dev->ctl_invert = ctrl_by_id(V4L2_CID_PRIVATE_INVERT)->default_value; dev->ctl_automute = ctrl_by_id(V4L2_CID_PRIVATE_AUTOMUTE)->default_value; diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index f0e4bd6d5..29b041093 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -1,5 +1,5 @@ /* - * $Id: saa7134.h,v 1.32 2004/11/30 11:26:38 kraxel Exp $ + * $Id: saa7134.h,v 1.33 2004/12/09 12:51:35 kraxel Exp $ * * v4l2 device driver for philips saa7134 based TV cards * @@ -191,6 +191,7 @@ struct saa7134_format { #define SAA7134_BOARD_CINERGY400_CARDBUS 47 #define SAA7134_BOARD_CINERGY600_MK3 48 #define SAA7134_BOARD_VIDEOMATE_GOLD_PLUS 49 +#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 diff --git a/linux/drivers/media/video/video-buf-dvb.c b/linux/drivers/media/video/video-buf-dvb.c index 175a17271..31cc4ed9b 100644 --- a/linux/drivers/media/video/video-buf-dvb.c +++ b/linux/drivers/media/video/video-buf-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: video-buf-dvb.c,v 1.6 2004/11/18 14:05:57 kraxel Exp $ + * $Id: video-buf-dvb.c,v 1.7 2004/12/09 12:51:35 kraxel Exp $ * * some helper function for simple DVB cards which simply DMA the * complete transport stream and let the computer sort everything else @@ -134,19 +134,22 @@ static int videobuf_dvb_stop_feed(struct dvb_demux_feed *feed) /* ------------------------------------------------------------------ */ -int videobuf_dvb_register(struct videobuf_dvb *dvb) +int videobuf_dvb_register(struct videobuf_dvb *dvb, + struct module *module, + void *adapter_priv) { int result; init_MUTEX(&dvb->lock); /* register adapter */ - result = dvb_register_adapter(&dvb->adapter, dvb->name, THIS_MODULE); + result = dvb_register_adapter(&dvb->adapter, dvb->name, module); if (result < 0) { printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n", dvb->name, result); goto fail_adapter; } + dvb->adapter->priv = adapter_priv; /* register frontend */ result = dvb_register_frontend(dvb->adapter, dvb->frontend); |