v4l: #3 - bttv driver update
PATCH 1/1 v4l: #3 - bttv driver update
Hi,
This patch is a update for the bttv driver. It is a big one because alot of changes accumulated over time -- partly because submitting updates in the past didn't work and partly because of some extra work with merging the changes due to the i2c cleanups back into my tree.
Changes:
* splitted some code which can be shared with another driver into the btcx-risc module.
* some new features (field rate capture support for example).
* tv card list updates.
* various bugfixes.
* merged i2c changes back into my tree, there are some no-op changes due to this.
Please apply,
Gerd
drivers/media/video/Makefile +1 -0
@@ -36,4 +36,5 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o tda9887.o obj-$(CONFIG_VIDEO_BUF) += video-buf.o +obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o
drivers/media/video/bt848.h +20 -18
@@ -204,6 +204,9 @@#define BT848_COLOR_FMT_YCrCb411 0x99#define BT848_COLOR_FMT_RAW 0xee +#define BT848_VTOTAL_LO 0xB0 +#define BT848_VTOTAL_HI 0xB4 +#define BT848_COLOR_CTL 0x0D8#define BT848_COLOR_CTL_EXT_FRMRATE (1<<7)#define BT848_COLOR_CTL_COLOR_BARS (1<<6)
@@ -311,29 +314,28 @@/* WRITE and SKIP */ /* disable which bytes of each DWORD */ -#define BT848_RISC_BYTE0 (1<<12) -#define BT848_RISC_BYTE1 (1<<13) -#define BT848_RISC_BYTE2 (1<<14) -#define BT848_RISC_BYTE3 (1<<15) -#define BT848_RISC_BYTE_ALL (0x0f<<12) +#define BT848_RISC_BYTE0 (1U<<12) +#define BT848_RISC_BYTE1 (1U<<13) +#define BT848_RISC_BYTE2 (1U<<14) +#define BT848_RISC_BYTE3 (1U<<15) +#define BT848_RISC_BYTE_ALL (0x0fU<<12)#define BT848_RISC_BYTE_NONE 0/* cause RISCI */ -#define BT848_RISC_IRQ (1<<24) +#define BT848_RISC_IRQ (1U<<24)/* RISC command is last one in this line */ -#define BT848_RISC_EOL (1<<26) +#define BT848_RISC_EOL (1U<<26)/* RISC command is first one in this line */ -#define BT848_RISC_SOL (1<<27) - -#define BT848_RISC_WRITE (0x01<<28) -#define BT848_RISC_SKIP (0x02<<28) -#define BT848_RISC_WRITEC (0x05<<28) -#define BT848_RISC_JUMP (0x07<<28) -#define BT848_RISC_SYNC (0x08<<28) - -#define BT848_RISC_WRITE123 (0x09<<28) -#define BT848_RISC_SKIP123 (0x0a<<28) -#define BT848_RISC_WRITE1S23 (0x0b<<28) +#define BT848_RISC_SOL (1U<<27) +#define BT848_RISC_WRITE (0x01U<<28) +#define BT848_RISC_SKIP (0x02U<<28) +#define BT848_RISC_WRITEC (0x05U<<28) +#define BT848_RISC_JUMP (0x07U<<28) +#define BT848_RISC_SYNC (0x08U<<28) + +#define BT848_RISC_WRITE123 (0x09U<<28) +#define BT848_RISC_SKIP123 (0x0aU<<28) +#define BT848_RISC_WRITE1S23 (0x0bU<<28)/* Bt848A and higher only !! */
drivers/media/video/btcx-risc.c +266 -0
266 lines not on this page · raw message
drivers/media/video/btcx-risc.h +33 -0
@@ -0,0 +1,33 @@ + +struct btcx_riscmem { +unsigned int size; +u32 *cpu; +u32 *jmp; +dma_addr_t dma; +}; + +struct btcx_skiplist { +int start; +int end; +}; + +int btcx_riscmem_alloc (struct pci_dev *pci, +struct btcx_riscmem *risc, +unsigned int size); +void btcx_riscmem_free (struct pci_dev *pci, +struct btcx_riscmem *risc); + +int btcx_screen_clips (int swidth,int sheight,struct v4l2_rect *win, +struct v4l2_clip *clips,unsigned int n); +int btcx_align (struct v4l2_rect *win,struct v4l2_clip *clips, +unsigned int n,int mask); +void btcx_sort_clips (struct v4l2_clip *clips,unsigned int nclips); +void btcx_calc_skips (int line,int width,unsigned int *maxy, +struct btcx_skiplist *skips,unsigned int *nskips, +const struct v4l2_clip *clips,unsigned int nclips); + +/* +* Local variables: +* c-basic-offset: 8 +* End: +*/
drivers/media/video/bttv-cards.c +298 -74
660 lines not on this page · raw message
drivers/media/video/bttv-driver.c +368 -267
1,097 lines not on this page · raw message
drivers/media/video/bttv-if.c +4 -1
@@ -198,6 +198,9 @@if (btv->tuner_type !=UNSET )bttv_call_i2c_clients (btv,TUNER_SET_TYPE ,&btv->tuner_type); +if (btv->pinnacle_id !=UNSET ) +bttv_call_i2c_clients (btv,AUDC_CONFIG_PINNACLE , + &btv->pinnacle_id);if (bttv_debug) printk("bttv%d: i2c attach [client=%s]\n",
@@ -231,9 +234,9 @@static struct i2c_adapter bttv_i2c_adap_template = { .owner =THIS_MODULE , + .class =I2C_ADAP_CLASS_TV_ANALOG ,I2C_DEVNAME ("bt848" ), .id =I2C_HW_B_BT848 , - .class =I2C_ADAP_CLASS_TV_ANALOG , .client_register = attach_inform, };
drivers/media/video/bttv-risc.c +122 -222
488 lines not on this page · raw message
drivers/media/video/bttv-vbi.c +38 -2
@@ -63,7 +63,7 @@ }static int vbi_buffer_setup (struct file *file, -unsigned int *count,unsigned int *size) +unsigned int *count,unsigned int *size) {struct bttv_fh *fh = file->private_data;struct bttv *btv = fh->btv;
@@ -155,7 +155,43 @@ } } -void bttv_vbi_fmt (struct bttv_fh *fh,struct v4l2_format *f) +void bttv_vbi_try_fmt (struct bttv_fh *fh,struct v4l2_format *f) +{ +u32 start0,start1,count0,count1,count; + + f->type =V4L2_BUF_TYPE_VBI_CAPTURE ; + f->fmt.vbi.sampling_rate =35468950 ; + f->fmt.vbi.samples_per_line =2048 ; + f->fmt.vbi.sample_format =V4L2_PIX_FMT_GREY ; + f->fmt.vbi.offset =244 ; + f->fmt.vbi.flags =0 ; +switch (fh->btv->tvnorm) { +case 1 :/* NTSC */ + start0 =10 ; + start1 =273 ; +break ; +case 0 :/* PAL */ +case 2 :/* SECAM */ +default : + start0 =7 ; + start1 =319 ; + } + + count0 = (f->fmt.vbi.start[0 ] + f->fmt.vbi.count[0 ]) - start0; + count1 = (f->fmt.vbi.start[1 ] + f->fmt.vbi.count[1 ]) - start1; + count =max (count0,count1); +if (count >VBI_MAXLINES ) + count =VBI_MAXLINES ; +if (count <1 ) + count =1 ; + + f->fmt.vbi.start[0 ] = start0; + f->fmt.vbi.start[1 ] = start1; + f->fmt.vbi.count[0 ] = count; + f->fmt.vbi.count[1 ] = count; +} + +void bttv_vbi_get_fmt (struct bttv_fh *fh,struct v4l2_format *f) {memset (f,0 ,sizeof (*f)); f->type =V4L2_BUF_TYPE_VBI_CAPTURE ;
drivers/media/video/bttv.h +21 -13
@@ -90,6 +90,7 @@#define BTTV_SENSORAY311 0x49#define BTTV_RV605 0x4a#define BTTV_WINDVR 0x4c +#define BTTV_GRANDTEC 0x4d#define BTTV_KWORLD 0x4e#define BTTV_HAUPPAUGEPVR 0x50#define BTTV_GVBCTV5PCI 0x51
@@ -108,6 +109,11 @@#define BTTV_PINNACLESAT 0x5e#define BTTV_FORMAC_PROTV 0x5f#define BTTV_EURESYS_PICOLO 0x61 +#define BTTV_PV150 0x62 +#define BTTV_AD_TVK503 0x63 +#define BTTV_IVC200 0x66 +#define BTTV_XGUARD 0x67 +#define BTTV_NEBULA_DIGITV 0x68/* i2c address list */ #define I2C_TSA5522 0xc2
@@ -123,6 +129,7 @@#define I2C_STBEE 0xae#define I2C_VHX 0xc0#define I2C_MSP3400 0x80 +#define I2C_MSP3400_ALT 0x88#define I2C_TEA6300 0x80#define I2C_DPL3518 0x84#define I2C_TDA9887 0x86
@@ -145,36 +152,37 @@struct tvcard {char *name; -int video_inputs; -int audio_inputs; -int tuner; -int svhs; -int digital_mode;// DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO +unsigned int video_inputs; +unsigned int audio_inputs; +unsigned int tuner; +unsigned int svhs; +unsigned int digital_mode;// DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO u32 gpiomask;u32 muxsel[16 ];u32 audiomux[6 ];/* Tuner, Radio, external, internal, mute, stereo */ u32 gpiomask2;/* GPIO MUX mask */ /* i2c audio flags */ -int no_msp34xx:1 ; -int no_tda9875:1 ; -int no_tda7432:1 ; -int needs_tvaudio:1 ; +unsigned int no_msp34xx:1 ; +unsigned int no_tda9875:1 ; +unsigned int no_tda7432:1 ; +unsigned int needs_tvaudio:1 ; +unsigned int msp34xx_alt:1 ;/* other settings */ -int pll; +unsigned int pll;#define PLL_NONE 0#define PLL_28 1#define PLL_35 2 -int tuner_type; -int has_radio; +unsigned int tuner_type; +unsigned int has_radio;void (*audio_hook)(struct bttv *btv,struct video_audio *v,int set);void (*muxsel_hook)(struct bttv *btv,unsigned int input); };extern struct tvcard bttv_tvcards[]; -extern const int bttv_num_tvcards; +extern const unsigned int bttv_num_tvcards;/* identification / initialization of the card */ extern void bttv_idcard (struct bttv *btv);
drivers/media/video/bttvp.h +49 -56
220 lines not on this page · raw message
Signature · 1 line
sigfault