Commit 66332b52 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: bttv driver update

 * the usual pile of tv card database updates.
 * various signed/unsigned fixups (fix gcc 3.3 warnings)
   and releated cleanups (use ARRAY_SIZE macro, ...).
 * moved some code which can be shared with the new,
   upcoming cx2388x driver to a separate module.
 * split the irq handler into smaller functions.
 * some new features (field rate capture support for example).
 * simplified i2c code a bit by removing redundant
   bookkeeping of attached i2c clients.
 * merged i2c changes back into my tree, there are some no-op
   changes due to this.
 * various other bugfixes.
 * fix build failure with CONFIG_FW_LOADER enabled
parent d0c54b7a
...@@ -38,4 +38,4 @@ obj-$(CONFIG_TUNER_3036) += tuner-3036.o ...@@ -38,4 +38,4 @@ obj-$(CONFIG_TUNER_3036) += tuner-3036.o
obj-$(CONFIG_VIDEO_TUNER) += tuner.o tda9887.o obj-$(CONFIG_VIDEO_TUNER) += tuner.o tda9887.o
obj-$(CONFIG_VIDEO_BUF) += video-buf.o obj-$(CONFIG_VIDEO_BUF) += video-buf.o
obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o
...@@ -204,6 +204,9 @@ ...@@ -204,6 +204,9 @@
#define BT848_COLOR_FMT_YCrCb411 0x99 #define BT848_COLOR_FMT_YCrCb411 0x99
#define BT848_COLOR_FMT_RAW 0xee #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 0x0D8
#define BT848_COLOR_CTL_EXT_FRMRATE (1<<7) #define BT848_COLOR_CTL_EXT_FRMRATE (1<<7)
#define BT848_COLOR_CTL_COLOR_BARS (1<<6) #define BT848_COLOR_CTL_COLOR_BARS (1<<6)
...@@ -311,29 +314,28 @@ ...@@ -311,29 +314,28 @@
/* WRITE and SKIP */ /* WRITE and SKIP */
/* disable which bytes of each DWORD */ /* disable which bytes of each DWORD */
#define BT848_RISC_BYTE0 (1<<12) #define BT848_RISC_BYTE0 (1U<<12)
#define BT848_RISC_BYTE1 (1<<13) #define BT848_RISC_BYTE1 (1U<<13)
#define BT848_RISC_BYTE2 (1<<14) #define BT848_RISC_BYTE2 (1U<<14)
#define BT848_RISC_BYTE3 (1<<15) #define BT848_RISC_BYTE3 (1U<<15)
#define BT848_RISC_BYTE_ALL (0x0f<<12) #define BT848_RISC_BYTE_ALL (0x0fU<<12)
#define BT848_RISC_BYTE_NONE 0 #define BT848_RISC_BYTE_NONE 0
/* cause RISCI */ /* cause RISCI */
#define BT848_RISC_IRQ (1<<24) #define BT848_RISC_IRQ (1U<<24)
/* RISC command is last one in this line */ /* 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 */ /* RISC command is first one in this line */
#define BT848_RISC_SOL (1<<27) #define BT848_RISC_SOL (1U<<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_WRITE (0x01U<<28)
#define BT848_RISC_SKIP123 (0x0a<<28) #define BT848_RISC_SKIP (0x02U<<28)
#define BT848_RISC_WRITE1S23 (0x0b<<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 !! */ /* Bt848A and higher only !! */
......
/*
btcx-risc.c
bt848/bt878/cx2388x risc code generator.
(c) 2000-03 Gerd Knorr <kraxel@bytesex.org> [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 <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/videodev2.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include "btcx-risc.h"
MODULE_DESCRIPTION("some code shared by bttv and cx88xx drivers");
MODULE_AUTHOR("Gerd Knorr");
MODULE_LICENSE("GPL");
static unsigned int debug = 0;
MODULE_PARM(debug,"i");
MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");
/* ---------------------------------------------------------- */
/* allocate/free risc memory */
static int memcnt;
int btcx_riscmem_alloc(struct pci_dev *pci,
struct btcx_riscmem *risc,
unsigned int size)
{
u32 *cpu;
dma_addr_t dma;
cpu = pci_alloc_consistent(pci, size, &dma);
if (NULL == cpu)
return -ENOMEM;
memset(cpu,0,size);
#if 0
if (risc->cpu && risc->size < size) {
/* realloc (enlarge buffer) -- copy old stuff */
memcpy(cpu,risc->cpu,risc->size);
btcx_riscmem_free(pci,risc);
}
#else
BUG_ON(NULL != risc->cpu);
#endif
risc->cpu = cpu;
risc->dma = dma;
risc->size = size;
if (debug) {
memcnt++;
printk("btcx: riscmem alloc size=%d [%d]\n",size,memcnt);
}
return 0;
}
void btcx_riscmem_free(struct pci_dev *pci,
struct btcx_riscmem *risc)
{
if (NULL == risc->cpu)
return;
pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
memset(risc,0,sizeof(*risc));
if (debug) {
memcnt--;
printk("btcx: riscmem free [%d]\n",memcnt);
}
}
/* ---------------------------------------------------------- */
/* screen overlay helpers */
int
btcx_screen_clips(int swidth, int sheight, struct v4l2_rect *win,
struct v4l2_clip *clips, unsigned int n)
{
if (win->left < 0) {
/* left */
clips[n].c.left = 0;
clips[n].c.top = 0;
clips[n].c.width = -win->left;
clips[n].c.height = win->height;
n++;
}
if (win->left + win->width > swidth) {
/* right */
clips[n].c.left = swidth - win->left;
clips[n].c.top = 0;
clips[n].c.width = win->width - clips[n].c.left;
clips[n].c.height = win->height;
n++;
}
if (win->top < 0) {
/* top */
clips[n].c.left = 0;
clips[n].c.top = 0;
clips[n].c.width = win->width;
clips[n].c.height = -win->top;
n++;
}
if (win->top + win->height > sheight) {
/* bottom */
clips[n].c.left = 0;
clips[n].c.top = sheight - win->top;
clips[n].c.width = win->width;
clips[n].c.height = win->height - clips[n].c.top;
n++;
}
return n;
}
int
btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips, unsigned int n, int mask)
{
s32 nx,nw,dx;
unsigned int i;
/* fixup window */
nx = (win->left + mask) & ~mask;
nw = (win->width) & ~mask;
if (nx + nw > win->left + win->width)
nw -= mask+1;
dx = nx - win->left;
win->left = nx;
win->width = nw;
if (debug)
printk(KERN_DEBUG "btcx: window align %dx%d+%d+%d [dx=%d]\n",
win->width, win->height, win->left, win->top, dx);
/* fixup clips */
for (i = 0; i < n; i++) {
nx = (clips[i].c.left-dx) & ~mask;
nw = (clips[i].c.width) & ~mask;
if (nx + nw < clips[i].c.left-dx + clips[i].c.width)
nw += mask+1;
clips[i].c.left = nx;
clips[i].c.width = nw;
if (debug)
printk(KERN_DEBUG "btcx: clip align %dx%d+%d+%d\n",
clips[i].c.width, clips[i].c.height,
clips[i].c.left, clips[i].c.top);
}
return 0;
}
void
btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips)
{
struct v4l2_clip swap;
int i,j,n;
if (nclips < 2)
return;
for (i = nclips-2; i >= 0; i--) {
for (n = 0, j = 0; j <= i; j++) {
if (clips[j].c.left > clips[j+1].c.left) {
swap = clips[j];
clips[j] = clips[j+1];
clips[j+1] = swap;
n++;
}
}
if (0 == n)
break;
}
}
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)
{
unsigned int clip,skip;
int end,maxline;
skip=0;
maxline = 9999;
for (clip = 0; clip < nclips; clip++) {
/* sanity checks */
if (clips[clip].c.left + clips[clip].c.width <= 0)
continue;
if (clips[clip].c.left > (signed)width)
break;
/* vertical range */
if (line > clips[clip].c.top+clips[clip].c.height-1)
continue;
if (line < clips[clip].c.top) {
if (maxline > clips[clip].c.top-1)
maxline = clips[clip].c.top-1;
continue;
}
if (maxline > clips[clip].c.top+clips[clip].c.height-1)
maxline = clips[clip].c.top+clips[clip].c.height-1;
/* horizontal range */
if (0 == skip || clips[clip].c.left > skips[skip-1].end) {
/* new one */
skips[skip].start = clips[clip].c.left;
if (skips[skip].start < 0)
skips[skip].start = 0;
skips[skip].end = clips[clip].c.left + clips[clip].c.width;
if (skips[skip].end > width)
skips[skip].end = width;
skip++;
} else {
/* overlaps -- expand last one */
end = clips[clip].c.left + clips[clip].c.width;
if (skips[skip-1].end < end)
skips[skip-1].end = end;
if (skips[skip-1].end > width)
skips[skip-1].end = width;
}
}
*nskips = skip;
*maxy = maxline;
if (debug) {
printk(KERN_DEBUG "btcx: skips line %d-%d:",line,maxline);
for (skip = 0; skip < *nskips; skip++) {
printk(" %d-%d",skips[skip].start,skips[skip].end);
}
printk("\n");
}
}
/* ---------------------------------------------------------- */
EXPORT_SYMBOL(btcx_riscmem_alloc);
EXPORT_SYMBOL(btcx_riscmem_free);
EXPORT_SYMBOL(btcx_screen_clips);
EXPORT_SYMBOL(btcx_align);
EXPORT_SYMBOL(btcx_sort_clips);
EXPORT_SYMBOL(btcx_calc_skips);
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
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:
*/
This diff is collapsed.
This diff is collapsed.
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -198,6 +197,9 @@ static int attach_inform(struct i2c_client *client) ...@@ -198,6 +197,9 @@ static int attach_inform(struct i2c_client *client)
if (btv->tuner_type != UNSET) if (btv->tuner_type != UNSET)
bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); 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) if (bttv_debug)
printk("bttv%d: i2c attach [client=%s]\n", printk("bttv%d: i2c attach [client=%s]\n",
...@@ -231,9 +233,9 @@ static struct i2c_algo_bit_data bttv_i2c_algo_template = { ...@@ -231,9 +233,9 @@ static struct i2c_algo_bit_data bttv_i2c_algo_template = {
static struct i2c_adapter bttv_i2c_adap_template = { static struct i2c_adapter bttv_i2c_adap_template = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.class = I2C_ADAP_CLASS_TV_ANALOG,
I2C_DEVNAME("bt848"), I2C_DEVNAME("bt848"),
.id = I2C_HW_B_BT848, .id = I2C_HW_B_BT848,
.class = I2C_ADAP_CLASS_TV_ANALOG,
.client_register = attach_inform, .client_register = attach_inform,
}; };
...@@ -314,6 +316,7 @@ int __devinit init_bttv_i2c(struct bttv *btv) ...@@ -314,6 +316,7 @@ int __devinit init_bttv_i2c(struct bttv *btv)
sizeof(struct i2c_client)); sizeof(struct i2c_client));
sprintf(btv->i2c_adap.dev.name, "bt848 #%d", btv->nr); sprintf(btv->i2c_adap.dev.name, "bt848 #%d", btv->nr);
btv->i2c_adap.dev.parent = &btv->dev->dev;
btv->i2c_algo.data = btv; btv->i2c_algo.data = btv;
i2c_set_adapdata(&btv->i2c_adap, btv); i2c_set_adapdata(&btv->i2c_adap, btv);
......
This diff is collapsed.
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h> #include <linux/fs.h>
...@@ -63,7 +62,7 @@ vbi_buffer_risc(struct bttv *btv, struct bttv_buffer *buf, int lines) ...@@ -63,7 +62,7 @@ vbi_buffer_risc(struct bttv *btv, struct bttv_buffer *buf, int lines)
} }
static int vbi_buffer_setup(struct file *file, 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_fh *fh = file->private_data;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
...@@ -155,11 +154,53 @@ void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines) ...@@ -155,11 +154,53 @@ void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines)
} }
} }
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)
{ {
const struct bttv_tvnorm *tvnorm;
u32 start0,start1;
s32 count0,count1,count;
tvnorm = &bttv_tvnorms[fh->btv->tvnorm];
f->type = V4L2_BUF_TYPE_VBI_CAPTURE;
f->fmt.vbi.sampling_rate = tvnorm->Fsc;
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)
{
const struct bttv_tvnorm *tvnorm;
tvnorm = &bttv_tvnorms[fh->btv->tvnorm];
memset(f,0,sizeof(*f)); memset(f,0,sizeof(*f));
f->type = V4L2_BUF_TYPE_VBI_CAPTURE; f->type = V4L2_BUF_TYPE_VBI_CAPTURE;
f->fmt.vbi.sampling_rate = 35468950; f->fmt.vbi.sampling_rate = tvnorm->Fsc;
f->fmt.vbi.samples_per_line = 2048; f->fmt.vbi.samples_per_line = 2048;
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
f->fmt.vbi.offset = 244; f->fmt.vbi.offset = 244;
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
#define BTTV_SENSORAY311 0x49 #define BTTV_SENSORAY311 0x49
#define BTTV_RV605 0x4a #define BTTV_RV605 0x4a
#define BTTV_WINDVR 0x4c #define BTTV_WINDVR 0x4c
#define BTTV_GRANDTEC 0x4d
#define BTTV_KWORLD 0x4e #define BTTV_KWORLD 0x4e
#define BTTV_HAUPPAUGEPVR 0x50 #define BTTV_HAUPPAUGEPVR 0x50
#define BTTV_GVBCTV5PCI 0x51 #define BTTV_GVBCTV5PCI 0x51
...@@ -108,6 +109,12 @@ ...@@ -108,6 +109,12 @@
#define BTTV_PINNACLESAT 0x5e #define BTTV_PINNACLESAT 0x5e
#define BTTV_FORMAC_PROTV 0x5f #define BTTV_FORMAC_PROTV 0x5f
#define BTTV_EURESYS_PICOLO 0x61 #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
#define BTTV_PV143 0x69
/* i2c address list */ /* i2c address list */
#define I2C_TSA5522 0xc2 #define I2C_TSA5522 0xc2
...@@ -123,6 +130,7 @@ ...@@ -123,6 +130,7 @@
#define I2C_STBEE 0xae #define I2C_STBEE 0xae
#define I2C_VHX 0xc0 #define I2C_VHX 0xc0
#define I2C_MSP3400 0x80 #define I2C_MSP3400 0x80
#define I2C_MSP3400_ALT 0x88
#define I2C_TEA6300 0x80 #define I2C_TEA6300 0x80
#define I2C_DPL3518 0x84 #define I2C_DPL3518 0x84
#define I2C_TDA9887 0x86 #define I2C_TDA9887 0x86
...@@ -145,36 +153,37 @@ struct bttv; ...@@ -145,36 +153,37 @@ struct bttv;
struct tvcard struct tvcard
{ {
char *name; char *name;
int video_inputs; unsigned int video_inputs;
int audio_inputs; unsigned int audio_inputs;
int tuner; unsigned int tuner;
int svhs; unsigned int svhs;
int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO
u32 gpiomask; u32 gpiomask;
u32 muxsel[16]; u32 muxsel[16];
u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
u32 gpiomask2; /* GPIO MUX mask */ u32 gpiomask2; /* GPIO MUX mask */
/* i2c audio flags */ /* i2c audio flags */
int no_msp34xx:1; unsigned int no_msp34xx:1;
int no_tda9875:1; unsigned int no_tda9875:1;
int no_tda7432:1; unsigned int no_tda7432:1;
int needs_tvaudio:1; unsigned int needs_tvaudio:1;
unsigned int msp34xx_alt:1;
/* other settings */ /* other settings */
int pll; unsigned int pll;
#define PLL_NONE 0 #define PLL_NONE 0
#define PLL_28 1 #define PLL_28 1
#define PLL_35 2 #define PLL_35 2
int tuner_type; unsigned int tuner_type;
int has_radio; unsigned int has_radio;
void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set);
void (*muxsel_hook)(struct bttv *btv, unsigned int input); void (*muxsel_hook)(struct bttv *btv, unsigned int input);
}; };
extern struct tvcard bttv_tvcards[]; extern struct tvcard bttv_tvcards[];
extern const int bttv_num_tvcards; extern const unsigned int bttv_num_tvcards;
/* identification / initialization of the card */ /* identification / initialization of the card */
extern void bttv_idcard(struct bttv *btv); extern void bttv_idcard(struct bttv *btv);
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#ifndef _BTTVP_H_ #ifndef _BTTVP_H_
#define _BTTVP_H_ #define _BTTVP_H_
#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,4) #include <linux/version.h>
#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,11)
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -41,6 +42,7 @@ ...@@ -41,6 +42,7 @@
#include "bt848.h" #include "bt848.h"
#include "bttv.h" #include "bttv.h"
#include "btcx-risc.h"
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -67,8 +69,7 @@ ...@@ -67,8 +69,7 @@
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
struct bttv_tvnorm struct bttv_tvnorm {
{
int v4l2_id; int v4l2_id;
char *name; char *name;
u32 Fsc; u32 Fsc;
...@@ -79,10 +80,11 @@ struct bttv_tvnorm ...@@ -79,10 +80,11 @@ struct bttv_tvnorm
u16 hdelayx1, hactivex1; u16 hdelayx1, hactivex1;
u16 vdelay; u16 vdelay;
u8 vbipack; u8 vbipack;
u16 vtotal;
int sram; int sram;
}; };
extern const struct bttv_tvnorm bttv_tvnorms[]; extern const struct bttv_tvnorm bttv_tvnorms[];
extern const int BTTV_TVNORMS; extern const unsigned int BTTV_TVNORMS;
struct bttv_format { struct bttv_format {
char *name; char *name;
...@@ -95,21 +97,14 @@ struct bttv_format { ...@@ -95,21 +97,14 @@ struct bttv_format {
int hshift,vshift; /* for planar modes */ int hshift,vshift; /* for planar modes */
}; };
extern const struct bttv_format bttv_formats[]; extern const struct bttv_format bttv_formats[];
extern const int BTTV_FORMATS; extern const unsigned int BTTV_FORMATS;
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
struct bttv_geometry { struct bttv_geometry {
u8 vtc,crop,comb; u8 vtc,crop,comb;
u16 width,hscale,hdelay; u16 width,hscale,hdelay;
u16 sheight,vscale,vdelay; u16 sheight,vscale,vdelay,vtotal;
};
struct bttv_riscmem {
unsigned int size;
u32 *cpu;
u32 *jmp;
dma_addr_t dma;
}; };
struct bttv_buffer { struct bttv_buffer {
...@@ -122,16 +117,25 @@ struct bttv_buffer { ...@@ -122,16 +117,25 @@ struct bttv_buffer {
int btformat; int btformat;
int btswap; int btswap;
struct bttv_geometry geo; struct bttv_geometry geo;
struct bttv_riscmem top; struct btcx_riscmem top;
struct bttv_riscmem bottom; struct btcx_riscmem bottom;
};
struct bttv_buffer_set {
struct bttv_buffer *top; /* top field buffer */
struct bttv_buffer *bottom; /* bottom field buffer */
struct bttv_buffer *vbi; /* vbi buffer */
unsigned int irqflags;
unsigned int topirq;
}; };
struct bttv_overlay { struct bttv_overlay {
int tvnorm; int tvnorm;
struct v4l2_rect w; struct v4l2_rect w;
enum v4l2_field field; enum v4l2_field field;
struct v4l2_clip *clips; struct v4l2_clip *clips;
int nclips; int nclips;
int setup_ok;
}; };
struct bttv_fh { struct bttv_fh {
...@@ -141,7 +145,6 @@ struct bttv_fh { ...@@ -141,7 +145,6 @@ struct bttv_fh {
/* video capture */ /* video capture */
struct videobuf_queue cap; struct videobuf_queue cap;
/* struct bttv_buffer buf; */
const struct bttv_format *fmt; const struct bttv_format *fmt;
int width; int width;
int height; int height;
...@@ -158,28 +161,19 @@ struct bttv_fh { ...@@ -158,28 +161,19 @@ struct bttv_fh {
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* bttv-risc.c */ /* bttv-risc.c */
/* alloc/free memory */
int bttv_riscmem_alloc(struct pci_dev *pci,
struct bttv_riscmem *risc,
unsigned int size);
void bttv_riscmem_free(struct pci_dev *pci,
struct bttv_riscmem *risc);
/* risc code generators - capture */ /* risc code generators - capture */
int bttv_risc_packed(struct bttv *btv, struct bttv_riscmem *risc, int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
struct scatterlist *sglist, struct scatterlist *sglist,
int offset, int bpl, int pitch, int lines); unsigned int offset, unsigned int bpl,
int bttv_risc_planar(struct bttv *btv, struct bttv_riscmem *risc, unsigned int pitch, unsigned int lines);
int bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
struct scatterlist *sglist, struct scatterlist *sglist,
int yoffset, int ybpl, int ypadding, int ylines, unsigned int yoffset, unsigned int ybpl,
int uoffset, int voffset, int hshift, int vshift, unsigned int ypadding, unsigned int ylines,
int cpadding); unsigned int uoffset, unsigned int voffset,
unsigned int hshift, unsigned int vshift,
/* risc code generator + helpers - screen overlay */ unsigned int cpadding);
int bttv_screen_clips(int swidth, int sheight, struct v4l2_rect *win, int bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
struct v4l2_clip *clips, int n);
void bttv_sort_clips(struct v4l2_clip *clips, int nclips);
int bttv_risc_overlay(struct bttv *btv, struct bttv_riscmem *risc,
const struct bttv_format *fmt, const struct bttv_format *fmt,
struct bttv_overlay *ov, struct bttv_overlay *ov,
int skip_top, int skip_bottom); int skip_top, int skip_bottom);
...@@ -192,13 +186,13 @@ void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int top); ...@@ -192,13 +186,13 @@ void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int top);
/* control dma register + risc main loop */ /* control dma register + risc main loop */
void bttv_set_dma(struct bttv *btv, int override, int irqflags); void bttv_set_dma(struct bttv *btv, int override, int irqflags);
int bttv_risc_init_main(struct bttv *btv); int bttv_risc_init_main(struct bttv *btv);
int bttv_risc_hook(struct bttv *btv, int slot, struct bttv_riscmem *risc, int bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
int irqflags); int irqflags);
/* capture buffer handling */ /* capture buffer handling */
int bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf); int bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf);
int bttv_buffer_activate(struct bttv *btv, struct bttv_buffer *top, int bttv_buffer_set_activate(struct bttv *btv,
struct bttv_buffer *bottom); struct bttv_buffer_set *set);
void bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf); void bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf);
/* overlay handling */ /* overlay handling */
...@@ -210,7 +204,8 @@ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, ...@@ -210,7 +204,8 @@ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov,
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* bttv-vbi.c */ /* bttv-vbi.c */
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);
void bttv_vbi_get_fmt(struct bttv_fh *fh, struct v4l2_format *f);
void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines); void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines);
extern struct videobuf_queue_ops bttv_vbi_qops; extern struct videobuf_queue_ops bttv_vbi_qops;
...@@ -236,8 +231,8 @@ extern void bttv_field_count(struct bttv *btv); ...@@ -236,8 +231,8 @@ extern void bttv_field_count(struct bttv *btv);
#define d2printk if (bttv_debug >= 2) printk #define d2printk if (bttv_debug >= 2) printk
/* our devices */ /* our devices */
#define BTTV_MAX 4 #define BTTV_MAX 16
extern int bttv_num; extern unsigned int bttv_num;
extern struct bttv bttvs[BTTV_MAX]; extern struct bttv bttvs[BTTV_MAX];
#define BTTV_MAX_FBUF 0x208000 #define BTTV_MAX_FBUF 0x208000
...@@ -264,8 +259,9 @@ struct bttv { ...@@ -264,8 +259,9 @@ struct bttv {
unsigned int nr; /* dev nr (for printk("bttv%d: ..."); */ unsigned int nr; /* dev nr (for printk("bttv%d: ..."); */
char name[8]; /* dev name */ char name[8]; /* dev name */
unsigned int cardid; /* pci subsystem id (bt878 based ones) */ unsigned int cardid; /* pci subsystem id (bt878 based ones) */
int type; /* card type (pointer into tvcards[]) */ unsigned int type; /* card type (pointer into tvcards[]) */
int tuner_type; /* tuner chip type */ unsigned int tuner_type; /* tuner chip type */
unsigned int pinnacle_id;
struct bttv_pll_info pll; struct bttv_pll_info pll;
int triton1; int triton1;
...@@ -292,12 +288,12 @@ struct bttv { ...@@ -292,12 +288,12 @@ struct bttv {
struct semaphore reslock; struct semaphore reslock;
/* video state */ /* video state */
int input; unsigned int input;
int audio; unsigned int audio;
unsigned long freq; unsigned long freq;
int tvnorm,hue,contrast,bright,saturation; int tvnorm,hue,contrast,bright,saturation;
struct video_buffer fbuf; struct video_buffer fbuf;
int field_count; unsigned int field_count;
/* various options */ /* various options */
int opt_combfilter; int opt_combfilter;
...@@ -326,21 +322,19 @@ struct bttv { ...@@ -326,21 +322,19 @@ struct bttv {
/* risc memory management data /* risc memory management data
- must aquire s_lock before changing these - must aquire s_lock before changing these
- only the irq handler is supported to touch odd + even */ - only the irq handler is supported to touch top + bottom + vcurr */
struct bttv_riscmem main; struct btcx_riscmem main;
struct bttv_buffer *top; /* current active top field */ struct bttv_buffer *screen; /* overlay */
struct bttv_buffer *bottom; /* current active bottom field */ struct list_head capture; /* video capture queue */
struct bttv_buffer *screen; /* overlay */ struct list_head vcapture; /* vbi capture queue */
struct list_head capture; /* capture buffer queue */ struct bttv_buffer_set curr; /* active buffers */
struct bttv_buffer *vcurr;
struct list_head vcapture;
unsigned long cap_ctl; unsigned long cap_ctl;
unsigned long dma_on; unsigned long dma_on;
struct timer_list timeout; struct timer_list timeout;
int errors; unsigned int errors;
int users; unsigned int users;
struct bttv_fh init; struct bttv_fh init;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment