V4L CX88 Update
PATCH 3/14 V4L CX88 Update
- Removed unused structures.
- Removed BTTV version check.
- Some debug structs moved to their own .c file and converted to static
- Comment changed to express better when attach_inform is running
- set_freq removed from set_mode at tuner-core.c.
- I2C cleanups and converged to a basic reference structure.
- Rename tuner structures fields.
- It calls VIDIOC_G_FREQUENCY to get tuner freq from tuner.
- added missing contrast offset value, set to 0.
- Let Kconfig decide whether to include frontend-specific code.
Signed-off-by Nickolay V. Shmyrev <[email protected]>
Signed-off-by Michael Krufky <[email protected]>
Signed-off-by Mauro Carvalho Chehab <[email protected]>
linux/drivers/media/video/cx88/cx88-blackbird.c | 5 linux/drivers/media/video/cx88/cx88-core.c | 48 - linux/drivers/media/video/cx88/cx88-dvb.c | 36 - linux/drivers/media/video/cx88/cx88-i2c.c | 31 - linux/drivers/media/video/cx88/cx88-input.c | 448 ++++++++-------- linux/drivers/media/video/cx88/cx88-mpeg.c | 26 linux/drivers/media/video/cx88/cx88-reg.h | 11 linux/drivers/media/video/cx88/cx88-tvaudio.c | 76 -- linux/drivers/media/video/cx88/cx88-video.c | 303 ---------- linux/drivers/media/video/cx88/cx88.h | 12 10 files changed, 296 insertions(+), 700 deletions(-)
drivers/media/video/cx88/cx88.h +2 -10
@@ -1,5 +1,5 @@/* -* $Id: cx88.h,v 1.67 2005/07/01 12:10:07 mkrufky Exp $ +* $Id: cx88.h,v 1.68 2005/07/07 14:17:47 mchehab Exp $ * * v4l2 device driver for cx2388x based TV cards *
@@ -82,9 +82,9 @@static unsigned int inline norm_maxw (struct cx88_tvnorm *norm) {return (norm->id &V4L2_STD_625_50 ) ?768 :640 ; -// return (norm->id & V4L2_STD_625_50) ? 720 : 640; } +static unsigned int inline norm_maxh (struct cx88_tvnorm *norm) {return (norm->id &V4L2_STD_625_50 ) ?576 :480 ;
@@ -220,7 +220,6 @@#define RESOURCE_VBI 4#define BUFFER_TIMEOUT (HZ/2)/* 0.5 seconds */ -//#define BUFFER_TIMEOUT (HZ*2) /* buffer for one video frame */ struct cx88_buffer {
@@ -336,11 +335,6 @@struct pci_dev *pci;unsigned char pci_rev,pci_lat; -#if 0 -/* video overlay */ -struct v4l2_framebuffer fbuf; -struct cx88_buffer *screen; -#endif /* capture queues */ struct cx88_dmaqueue vidq;
@@ -435,8 +429,6 @@/* ----------------------------------------------------------- */ /* cx88-core.c */ -extern char *cx88_vid_irqs[32 ]; -extern char *cx88_mpeg_irqs[32 ];extern void cx88_print_irqbits (char *name,char *tag,char **strings,u32 bits,u32 mask);extern void cx88_print_ioctl (char *name,unsigned int cmd);
drivers/media/video/cx88/cx88-reg.h +1 -10
@@ -1,5 +1,5 @@/* -$Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $ +$Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $ cx88x-hw.h - CX2388x register offsets
@@ -604,20 +604,11 @@#define EN_I2SIN_STR2DAC 0x00004000#define EN_I2SIN_ENABLE 0x00008000 -#if 0 -/* old */ -#define EN_DMTRX_SUMDIFF 0x00000800 -#define EN_DMTRX_SUMR 0x00000880 -#define EN_DMTRX_LR 0x00000900 -#define EN_DMTRX_MONO 0x00000980 -#else -/* dscaler cvs */ #define EN_DMTRX_SUMDIFF (0 << 7)#define EN_DMTRX_SUMR (1 << 7)#define EN_DMTRX_LR (2 << 7)#define EN_DMTRX_MONO (3 << 7)#define EN_DMTRX_BYPASS (1 << 11) -#endif // Video #define VID_CAPTURE_CONTROL 0x310180
drivers/media/video/cx88/cx88-core.c +1 -47
97 lines not on this page · raw message
drivers/media/video/cx88/cx88-i2c.c +19 -12
@@ -1,5 +1,5 @@/* -$Id: cx88-i2c.c,v 1.24 2005/06/17 18:46:23 mkrufky Exp $ +$Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $ cx88-i2c.c -- all the i2c code is here
@@ -91,25 +91,32 @@static int attach_inform (struct i2c_client *client) { -struct tuner_addr tun_addr; +struct tuner_setup tun_setup;struct cx88_core *core =i2c_get_adapdata (client->adapter); -dprintk (1 ,"i2c attach [addr=0x%x,client=%s]\n" , - client->addr,i2c_clientname (client)); +dprintk (1 ,"%s i2c attach [addr=0x%x,client=%s]\n" , + client->driver->name,client->addr,i2c_clientname (client));if (!client->driver->command)return 0 ;if (core->radio_type !=UNSET ) { - tun_addr.v4l2_tuner =V4L2_TUNER_RADIO ; - tun_addr.type = core->radio_type; - tun_addr.addr = core->radio_addr; - client->driver->command (client,TUNER_SET_TYPE_ADDR , &tun_addr); +if ((core->radio_addr==ADDR_UNSET )||(core->radio_addr==client->addr)) { + tun_setup.mode_mask =T_RADIO ; + tun_setup.type = core->radio_type; + tun_setup.addr = core->radio_addr; + + client->driver->command (client,TUNER_SET_TYPE_ADDR , &tun_setup); + } }if (core->tuner_type !=UNSET ) { - tun_addr.v4l2_tuner =V4L2_TUNER_ANALOG_TV ; - tun_addr.type = core->tuner_type; - tun_addr.addr = core->tuner_addr; - client->driver->command (client,TUNER_SET_TYPE_ADDR , &tun_addr); +if ((core->tuner_addr==ADDR_UNSET )||(core->tuner_addr==client->addr)) { + + tun_setup.mode_mask =T_ANALOG_TV ; + tun_setup.type = core->tuner_type; + tun_setup.addr = core->tuner_addr; + + client->driver->command (client,TUNER_SET_TYPE_ADDR , &tun_setup); + } }if (core->tda9887_conf)
drivers/media/video/cx88/cx88-tvaudio.c +1 -75
86 lines not on this page · raw message
drivers/media/video/cx88/cx88-video.c +13 -290
383 lines not on this page · raw message
drivers/media/video/cx88/cx88-input.c +227 -221
597 lines not on this page · raw message
drivers/media/video/cx88/cx88-mpeg.c +13 -13
@@ -1,5 +1,5 @@/* -* $Id: cx88-mpeg.c,v 1.30 2005/07/05 19:44:40 mkrufky Exp $ +* $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $ * * Support for the mpeg transport stream transfers * PCI function #2 of the cx2388x.
@@ -64,7 +64,6 @@/* write TS length to chip */ cx_write (MO_TS_LNGTH , buf->vb.width); -#if 1 /* FIXME: this needs a review. * also: move to cx88-blackbird + cx88-dvb source files? */
@@ -76,9 +75,9 @@cx_write (TS_HW_SOP_CNTRL ,0x47 <<16 |188 <<4 |0x01 );if ((core->board ==CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q ) || (core->board ==CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T )) { -cx_write (TS_SOP_STAT ,0 <<16 |0 <<14 |1 <<13 |0 <<12 ); +cx_write (TS_SOP_STAT ,1 <<13 ); }else { -cx_write (TS_SOP_STAT ,0x00 ); +cx_write (TS_SOP_STAT ,0x00 ); }cx_write (TS_GEN_CNTRL , dev->ts_gen_cntrl);udelay (100 );
@@ -98,7 +97,6 @@cx_write (TS_GEN_CNTRL ,0x06 );/* punctured clock TS & posedge driven */ udelay (100 ); } -#endif /* reset counter */ cx_write (MO_TS_GPCNTRL ,GP_COUNT_CONTROL_RESET );
@@ -270,6 +268,15 @@do_cancel_buffers (dev,"timeout" ,1 ); } +static char *cx88_mpeg_irqs[32 ] = { +"ts_risci1" ,NULL ,NULL ,NULL , +"ts_risci2" ,NULL ,NULL ,NULL , +"ts_oflow" ,NULL ,NULL ,NULL , +"ts_sync" ,NULL ,NULL ,NULL , +"opc_err" ,"par_err" ,"rip_err" ,"pci_abort" , +"ts_err?" , +}; +static void cx8802_mpeg_irq (struct cx8802_dev *dev) {struct cx88_core *core = dev->core;
@@ -282,10 +289,7 @@return ;cx_write (MO_TS_INTSTAT , status); -#if 0 -cx88_print_irqbits (core->name,"irq mpeg " , - cx88_mpeg_irqs, status, mask); -#endif +if (debug || (status & mask & ~0xff ))cx88_print_irqbits (core->name,"irq mpeg " , cx88_mpeg_irqs, status, mask);
@@ -441,10 +445,8 @@ }spin_unlock (&dev->slock); -#if 1 /* FIXME -- shutdown device */ cx88_shutdown (dev->core); -#endif pci_save_state (pci_dev);if (0 !=pci_set_power_state (pci_dev,pci_choose_state (pci_dev, state))) {
@@ -466,10 +468,8 @@pci_set_power_state (pci_dev,PCI_D0 );pci_restore_state (pci_dev); -#if 1 /* FIXME: re-initialize hardware */ cx88_reset (dev->core); -#endif /* restart video+vbi capture */ spin_lock (&dev->slock);
drivers/media/video/cx88/cx88-dvb.c +19 -17
@@ -1,5 +1,5 @@/* -* $Id: cx88-dvb.c,v 1.39 2005/07/02 20:00:46 mkrufky Exp $ +* $Id: cx88-dvb.c,v 1.41 2005/07/04 19:35:05 mkrufky Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines
@@ -30,22 +30,20 @@#include <linux/file.h> #include <linux/suspend.h> -/* these three frontends need merging via linuxtv cvs ... */ -#define HAVE_CX22702 1 -#define HAVE_OR51132 1 -#define HAVE_LGDT3302 1 -#include "cx88.h" #include "dvb-pll.h" -#include "mt352.h" -#include "mt352_priv.h" -#if HAVE_CX22702 + +#if CONFIG_DVB_MT352 +# include "mt352.h" +# include "mt352_priv.h" +#endif +#if CONFIG_DVB_CX22702 # include "cx22702.h" #endif -#if HAVE_OR51132 +#if CONFIG_DVB_OR51132 # include "or51132.h" #endif -#if HAVE_LGDT3302 +#if CONFIG_DVB_LGDT3302 # include "lgdt3302.h" #endif
@@ -104,6 +102,7 @@/* ------------------------------------------------------------------ */ +#if CONFIG_DVB_MT352 static int dvico_fusionhdtv_demod_init (struct dvb_frontend * fe) {static u8 clock_config [] = {CLOCK_CTL ,0x38 ,0x39 };
@@ -171,8 +170,9 @@ .demod_init = dntv_live_dvbt_demod_init, .pll_set = mt352_pll_set, }; +#endif -#if HAVE_CX22702 +#if CONFIG_DVB_CX22702 static struct cx22702_config connexant_refboard_config = { .demod_address =0x43 , .pll_address = 0x60,
@@ -186,7 +186,7 @@ };#endif -#if HAVE_OR51132 +#if CONFIG_DVB_OR51132 static int or51132_set_ts_param (struct dvb_frontend * fe,int is_punctured) {
@@ -203,7 +203,7 @@ };#endif -#if HAVE_LGDT3302 +#if CONFIG_DVB_LGDT3302 static int lgdt3302_set_ts_param (struct dvb_frontend * fe,int is_punctured) {struct cx8802_dev *dev= fe->dvb->priv;
@@ -237,7 +237,7 @@/* init frontend */ switch (dev->core->board) { -#if HAVE_CX22702 +#if CONFIG_DVB_CX22702 case CX88_BOARD_HAUPPAUGE_DVB_T1 : dev->dvb.frontend =cx22702_attach (&hauppauge_novat_config, &dev->core->i2c_adap);
@@ -248,6 +248,7 @@ &dev->core->i2c_adap);break ;#endif +#if CONFIG_DVB_MT352 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 : dev->core->pll_addr =0x61 ; dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -268,13 +269,14 @@ dev->dvb.frontend =mt352_attach (&dntv_live_dvbt_config, &dev->core->i2c_adap);break ; -#if HAVE_OR51132 +#endif +#if CONFIG_DVB_OR51132 case CX88_BOARD_PCHDTV_HD3000 : dev->dvb.frontend =or51132_attach (&pchdtv_hd3000, &dev->core->i2c_adap);break ;#endif -#if HAVE_LGDT3302 +#if CONFIG_DVB_LGDT3302 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q : dev->ts_gen_cntrl =0x08 ; {
drivers/media/video/cx88/cx88-blackbird.c +0 -5
@@ -690,11 +690,9 @@int bitrate_mode =1 ;int bitrate =7500000 ;int bitrate_peak =7500000 ; -#if 1 bitrate_mode =BLACKBIRD_VIDEO_CBR ; bitrate =4000 *1024 ; bitrate_peak =4000 *1024 ; -#endif /* assign stream type */ blackbird_api_cmd (dev,BLACKBIRD_API_SET_STREAM_TYPE ,1 ,0 ,BLACKBIRD_STREAM_PROGRAM );
@@ -810,9 +808,6 @@cx_write (MO_VBOS_CONTROL ,0x84A00 );/* no 656 mode, 8-bit pixels, disable VBI */ cx_clear (MO_OUTPUT_FORMAT ,0x0008 );/* Normal Y-limits to let the mpeg encoder sync */ -#if 0 /* FIXME */ -set_scale (dev,720 ,480 ,V4L2_FIELD_INTERLACED ); -#endif blackbird_codec_settings (dev);msleep (1 );