summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common')
-rw-r--r--linux/drivers/media/common/saa7146.h12
-rw-r--r--linux/drivers/media/common/saa7146_core.c16
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c26
-rw-r--r--linux/drivers/media/common/saa7146_vbi.c2
-rw-r--r--linux/drivers/media/common/saa7146_video.c4
5 files changed, 38 insertions, 22 deletions
diff --git a/linux/drivers/media/common/saa7146.h b/linux/drivers/media/common/saa7146.h
index c650cf70d..4fd023dd5 100644
--- a/linux/drivers/media/common/saa7146.h
+++ b/linux/drivers/media/common/saa7146.h
@@ -38,7 +38,8 @@ from flaws in video-buf.c => Gerd Knorr */
#define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && 0 != dev->ext->vbi)
extern unsigned int saa7146_debug;
-//#define DEBUG_PROLOG printk("(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__)
+
+//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__)
#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__)
#define DEB_S(x) if (0!=(saa7146_debug&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */
@@ -75,13 +76,20 @@ struct saa7146_sub_info {
#define SAA7146_BEFORE 0x2
#define SAA7146_AFTER 0x4
+/* flags */
+#define SAA7146_EXT_PROVIDES_VIDEO 0x1 /* provides vbi device */
+#define SAA7146_EXT_PROVIDES_VBI 0x2 /* provides vbi device */
+#define SAA7146_EXT_SWAP_ODD_EVEN 0x4 /* needs odd/even fields swapped */
+
struct saa7146_extension
{
char name[32]; /* name of the device */
int inputs;
int audios;
u32 capabilities;
-
+
+ int flags;
+
struct list_head item;
/* pairs of subvendor and subdevice ids for
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index 22c7f3e22..50ed45496 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -253,6 +253,7 @@ static int video_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int video_mmap(struct file *file, struct vm_area_struct * vma)
{
struct saa7146_fh *fh = file->private_data;
+ struct saa7146_dev *dev = fh->dev;
struct videobuf_queue *q;
switch (fh->type) {
@@ -276,6 +277,7 @@ static int video_mmap(struct file *file, struct vm_area_struct * vma)
static unsigned int video_poll(struct file *file, struct poll_table_struct *wait)
{
struct saa7146_fh *fh = file->private_data;
+ struct saa7146_dev *dev = fh->dev;
struct videobuf_buffer *buf = NULL;
struct videobuf_queue *q;
@@ -307,6 +309,7 @@ static unsigned int video_poll(struct file *file, struct poll_table_struct *wait
static ssize_t video_read(struct file *file, char *data, size_t count, loff_t *ppos)
{
struct saa7146_fh *fh = file->private_data;
+ struct saa7146_dev *dev = fh->dev;
switch (fh->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
@@ -354,6 +357,7 @@ static void interrupt_hw(int irq, void *dev_id, struct pt_regs *regs)
}
saa7146_write(dev, ISR, isr);
+// DEB_INT(("0x%08x\n",isr));
if( 0 != (dev->ext)) {
if( 0 != (dev->ext->irq_mask & isr )) {
@@ -638,6 +642,7 @@ static int try_match_device_to_extension(struct saa7146_dev *dev)
static int try_match_extension_to_device(struct saa7146_extension *ext)
{
struct list_head *list = NULL;
+ struct saa7146_dev *dev = NULL;
DEB_EE(("ext:%p, num:%d\n",ext,saa7146_num));
@@ -649,7 +654,7 @@ static int try_match_extension_to_device(struct saa7146_extension *ext)
return -ERESTARTSYS;
list_for_each(list,&devices) {
- struct saa7146_dev *dev = list_entry(list, struct saa7146_dev, item);
+ dev = list_entry(list, struct saa7146_dev, item);
try_attach_extension_and_device(dev,ext);
}
@@ -659,6 +664,8 @@ static int try_match_extension_to_device(struct saa7146_extension *ext)
int saa7146_register_extension(struct saa7146_extension* ext)
{
+ struct saa7146_dev *dev = NULL;
+
DEB_EE(("ext:%p\n",ext));
if( 0 == initialized ) {
@@ -705,7 +712,7 @@ int saa7146_unregister_extension(struct saa7146_extension* ext)
/* make sure to erase the minor number... */
dev->video_dev = device_template;
-// dump_registers(dev);
+ dump_registers(dev);
}
list_del(&ext->item);
@@ -892,6 +899,8 @@ static void unconfig_a_device(struct saa7146_dev* dev)
static
int __devinit saa7146_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
+ struct saa7146_dev *dev = NULL;
+
DEB_EE(("pdev:%p\n",pdev));
if (config_a_device(pdev))
@@ -932,6 +941,8 @@ struct pci_driver saa7146_driver = {
static
int __init saa7146_init_module(void)
{
+ struct saa7146_dev *dev = NULL;
+
DEB_EE((".\n"));
if( 0 == initialized ) {
@@ -948,6 +959,7 @@ int __init saa7146_init_module(void)
static
void __exit saa7146_cleanup_module(void)
{
+ struct saa7146_dev *dev = NULL;
DEB_EE((".\n"));
pci_unregister_driver(&saa7146_driver);
}
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index 4ebbfa2ff..ec6b97aa8 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -595,9 +595,10 @@ void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_heigh
/* calculate memory offsets for picture, look if we shall top-down-flip */
vdma1.pitch = 2*b_bpl;
if ( 0 == td_flip ) {
- vdma1.base_odd = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
- vdma1.base_even = vdma1.base_odd + (vdma1.pitch / 2);
- vdma1.prot_addr = vdma1.base_odd + (w_height * (vdma1.pitch / 2));
+ vdma1.base_even = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
+ vdma1.base_odd = vdma1.base_even + (vdma1.pitch / 2);
+ vdma1.prot_addr = vdma1.base_even + (w_height * (vdma1.pitch / 2));
+ printk("0x%08x,0x%08x\n",vdma1.base_even,vdma1.base_odd);
}
else {
vdma1.base_even = (u32)base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
@@ -622,15 +623,7 @@ void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_heigh
vdma1.base_page = 0;
vdma1.num_line_byte = (dev->standard->v_field<<16)+dev->standard->h_pixels;
- saa7146_write(dev, BASE_EVEN1, vdma1.base_even);
- saa7146_write(dev, BASE_ODD1, vdma1.base_odd);
- saa7146_write(dev, PROT_ADDR1, vdma1.prot_addr);
- saa7146_write(dev, BASE_PAGE1, vdma1.base_page);
- saa7146_write(dev, PITCH1, vdma1.pitch);
- saa7146_write(dev, NUM_LINE_BYTE1, vdma1.num_line_byte);
-
- /* update the video dma 1 registers */
- saa7146_write(dev, MC2, (MASK_02 | MASK_18));
+ saa7146_write_out_dma(dev, 1, &vdma1);
}
static
@@ -725,8 +718,13 @@ void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_vi
/* calculate starting address */
where = (which-1)*0x18;
- saa7146_write(dev, where, vdma->base_odd);
- saa7146_write(dev, where+0x04, vdma->base_even);
+ if( 0 != (dev->ext->flags & SAA7146_EXT_SWAP_ODD_EVEN)) {
+ saa7146_write(dev, where, vdma->base_even);
+ saa7146_write(dev, where+0x04, vdma->base_odd);
+ } else {
+ saa7146_write(dev, where, vdma->base_odd);
+ saa7146_write(dev, where+0x04, vdma->base_even);
+ }
saa7146_write(dev, where+0x08, vdma->prot_addr);
saa7146_write(dev, where+0x0c, vdma->pitch);
saa7146_write(dev, where+0x10, vdma->base_page);
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c
index a6f4cb06f..be318cfee 100644
--- a/linux/drivers/media/common/saa7146_vbi.c
+++ b/linux/drivers/media/common/saa7146_vbi.c
@@ -261,10 +261,8 @@ int buffer_prepare(struct file *file, struct videobuf_buffer *vb)
static int
buffer_setup(struct file *file, int *count, int *size)
{
-/*
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
-*/
int llength,lines;
lines = 16 * 2 ; /* 2 fields */
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index c0c01e2bd..8c0f19239 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -1145,8 +1145,8 @@ static
int buffer_setup(struct file *file, int *count, int *size)
{
struct saa7146_fh *fh = file->private_data;
-/*
struct saa7146_dev *dev = fh->dev;
+/*
*/
if (0 == *count || *count > MAX_SAA7146_CAPTURE_BUFFERS)
*count = MAX_SAA7146_CAPTURE_BUFFERS;
@@ -1167,8 +1167,8 @@ static
void buffer_queue(struct file *file, struct videobuf_buffer *vb)
{
struct saa7146_fh *fh = file->private_data;
-/*
struct saa7146_dev *dev = fh->dev;
+/*
*/
struct saa7146_buf *buf = (struct saa7146_buf *)vb;