summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-01-07 16:31:21 +0000
committerMichael Hunold <devnull@localhost>2003-01-07 16:31:21 +0000
commit4c17ef9d42fca347a7c9156ea071c5e374d8cc9c (patch)
tree58a3a5bff4e0f19c9f599d2bc4c340d6edfaf2a9
parentbf378e1286166765aea8a9b28caa84bf6488a768 (diff)
downloadmediapointer-dvb-s2-4c17ef9d42fca347a7c9156ea071c5e374d8cc9c.tar.gz
mediapointer-dvb-s2-4c17ef9d42fca347a7c9156ea071c5e374d8cc9c.tar.bz2
- Fixed all initializers to C99, expect av7110.c
- removed unused variables - other code clenaups - corrected H_PIXELS_PAL to 720 (not used for DVB-cards)
-rw-r--r--linux/drivers/media/common/saa7146_core.c40
-rw-r--r--linux/drivers/media/common/saa7146_fops.c21
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c24
-rw-r--r--linux/drivers/media/common/saa7146_vbi.c6
-rw-r--r--linux/drivers/media/common/saa7146_video.c75
-rw-r--r--linux/drivers/media/common/saa7146_vv.h11
6 files changed, 89 insertions, 88 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index f064b49d0..f45830613 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -1,10 +1,7 @@
/*
- saa7146.c - video4linux driver for saa7146-based video hardware
+ saa7146.o - driver for generic saa7146-based hardware
- Copyright (C) 1998-2002 Michael Hunold <michael@mihu.de>
-
- With ideas taken from: "device driver for philips saa7134 based TV cards"
- (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
+ Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de>
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
@@ -288,8 +285,6 @@ 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 ) {
@@ -326,8 +321,8 @@ int saa7146_unregister_extension(struct saa7146_extension* ext)
DEB_D(("ext->detach() failed. ignoring.\n"));
}
+ dump_registers(dev);
dev->ext = NULL;
-// dump_registers(dev);
}
list_del(&ext->item);
@@ -501,8 +496,6 @@ 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))
@@ -524,29 +517,28 @@ void __devexit saa7146_remove_one(struct pci_dev *pdev)
static
struct pci_device_id saa7146_pci_tbl[] __devinitdata = {
- { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146,
- PCI_ANY_ID, PCI_ANY_ID, },
- { 0,},
+ {
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7146,
+ } , {
+ .vendor = 0,
+ }
};
MODULE_DEVICE_TABLE(pci, saa7146_pci_tbl);
static
struct pci_driver saa7146_driver = {
- .name = "saa7146",
- .id_table = saa7146_pci_tbl,
- .probe = saa7146_init_one,
- .remove = __devexit_p(saa7146_remove_one)
+ .name = "saa7146",
+ .id_table = saa7146_pci_tbl,
+ .probe = saa7146_init_one,
+ .remove = __devexit_p(saa7146_remove_one)
};
static
int __init saa7146_init_module(void)
{
- struct saa7146_dev *dev = NULL;
-
- DEB_EE((".\n"));
-
if( 0 == initialized ) {
INIT_LIST_HEAD(&saa7146_devices);
init_MUTEX(&saa7146_devices_lock);
@@ -561,8 +553,6 @@ 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);
}
@@ -581,12 +571,12 @@ EXPORT_SYMBOL_GPL(saa7146_setgpio);
EXPORT_SYMBOL_GPL(saa7146_i2c_transfer);
EXPORT_SYMBOL_GPL(saa7146_i2c_adapter_prepare);
-EXPORT_SYMBOL_GPL(saa7146_debug);
+EXPORT_SYMBOL_GPL(saa7146_debug);
EXPORT_SYMBOL_GPL(saa7146_devices);
EXPORT_SYMBOL_GPL(saa7146_devices_lock);
MODULE_AUTHOR("Michael Hunold <michael@mihu.de>");
-MODULE_DESCRIPTION("core driver for saa7146-based hardware");
+MODULE_DESCRIPTION("driver for generic saa7146-based hardware");
MODULE_LICENSE("GPL");
diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c
index 594b6a379..2c5596e77 100644
--- a/linux/drivers/media/common/saa7146_fops.c
+++ b/linux/drivers/media/common/saa7146_fops.c
@@ -274,7 +274,6 @@ static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int fops_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) {
@@ -298,7 +297,6 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma)
static unsigned int fops_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;
@@ -330,7 +328,6 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
static ssize_t fops_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: {
@@ -350,21 +347,21 @@ static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *pp
static struct file_operations video_fops =
{
- owner: THIS_MODULE,
- open: fops_open,
- release: fops_release,
- read: fops_read,
- poll: fops_poll,
- mmap: fops_mmap,
- ioctl: fops_ioctl,
- llseek: no_llseek,
+ .owner = THIS_MODULE,
+ .open = fops_open,
+ .release = fops_release,
+ .read = fops_read,
+ .poll = fops_poll,
+ .mmap = fops_mmap,
+ .ioctl = fops_ioctl,
+ .llseek = no_llseek,
};
void vv_callback(struct saa7146_dev *dev, unsigned long status)
{
u32 isr = status;
- DEB_EE(("dev:%p, isr:0x%08x\n",dev,status));
+ DEB_EE(("dev:%p, isr:0x%08x\n",dev,(u32)status));
if (0 != (isr & (MASK_27))) {
DEB_INT(("irq: RPS0 (0x%08x).\n",isr));
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index e2bb66125..884ba270c 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -714,7 +714,6 @@ void saa7146_set_overlay(struct saa7146_dev *dev, struct saa7146_fh *fh, int v)
void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma)
{
- struct saa7146_vv *vv = dev->vv_data;
int where = 0;
if( which < 1 || which > 3) {
@@ -760,15 +759,14 @@ int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa7146_buf
enum v4l2_field field = buf->fmt->field;
int depth = sfmt->depth;
- unsigned long flags = sfmt->flags;
- DEB_CAP(("[size=%dx%d,fields=%s,flags=%lu]\n",
- width,height,v4l2_field_names[field],flags));
+ DEB_CAP(("[size=%dx%d,fields=%s]\n",
+ width,height,v4l2_field_names[field]));
vdma1.pitch = (width*depth*2)/8;
vdma1.num_line_byte = ((vv->standard->v_field<<16) + vv->standard->h_pixels);
- vdma1.base_page = buf->pt[0].dma | ME1 | flags;
-
+ vdma1.base_page = buf->pt[0].dma | ME1;
+
if( 0 != vv->vflip ) {
vdma1.prot_addr = buf->pt[0].offset;
vdma1.base_even = buf->pt[0].offset+(vdma1.pitch/2)*height;
@@ -805,24 +803,20 @@ int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa7146_buf
struct saa7146_video_dma vdma2;
struct saa7146_video_dma vdma3;
- struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
-
int width = buf->fmt->width;
int height = buf->fmt->height;
enum v4l2_field field = buf->fmt->field;
- unsigned long flags = sfmt->flags;
-
BUG_ON(0 == buf->pt[0].dma);
BUG_ON(0 == buf->pt[1].dma);
BUG_ON(0 == buf->pt[2].dma);
- DEB_CAP(("[size=%dx%d,fields=%s,flags=%lu]\n",
- width,height,v4l2_field_names[field],flags));
+ DEB_CAP(("[size=%dx%d,fields=%s]\n",
+ width,height,v4l2_field_names[field]));
vdma1.pitch = width*2;
vdma1.num_line_byte = ((vv->standard->v_field<<16) + vv->standard->h_pixels);
- vdma1.base_page = buf->pt[0].dma | ME1 | flags;
+ vdma1.base_page = buf->pt[0].dma | ME1;
/* fscking saa7146! due to the "byte-swap bug", video-dma2
writes the v data and not the u data, video-dma3 writes
@@ -831,11 +825,11 @@ int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa7146_buf
vdma3.pitch = width;
vdma3.num_line_byte = 0; /* unused */
- vdma3.base_page = buf->pt[1].dma | ME1 | flags;
+ vdma3.base_page = buf->pt[1].dma | ME1;
vdma2.pitch = width;
vdma2.num_line_byte = 0; /* unused */
- vdma2.base_page = buf->pt[2].dma | ME1 | flags;
+ vdma2.base_page = buf->pt[2].dma | ME1;
/* fixme: what happens for user space buffers here?. The offsets are
most likely wrong, this version here only works for page-aligned
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c
index 96ab61028..baee2669f 100644
--- a/linux/drivers/media/common/saa7146_vbi.c
+++ b/linux/drivers/media/common/saa7146_vbi.c
@@ -263,8 +263,6 @@ 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 */
@@ -460,8 +458,8 @@ ssize_t vbi_read(struct file *file, char *data, size_t count, loff_t *ppos)
struct saa7146_use_ops saa7146_vbi_uops = {
.init = vbi_init,
.open = vbi_open,
- .release = vbi_close,
- .irq_done = vbi_irq_done,
+ .release = vbi_close,
+ .irq_done = vbi_irq_done,
.read = vbi_read,
};
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index cb088dd35..e1ce84f4d 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -12,23 +12,54 @@ MODULE_PARM_DESC(memory, "maximum memory usage for capture buffers (default: 32M
/* format descriptions for capture and preview */
static
-struct saa7146_format formats[] =
-{
- {"RGB-8 (3-3-2)", V4L2_PIX_FMT_RGB332, RGB08_COMPOSED, 8, 0},
- {"RGB-16 (5-6-5)", V4L2_PIX_FMT_RGB565, RGB16_COMPOSED, 16, 0},
- {"RGB-24 (B-G-R)", V4L2_PIX_FMT_BGR24, RGB24_COMPOSED, 24, 0},
- {"RGB-32 (B-G-R)", V4L2_PIX_FMT_BGR32, RGB32_COMPOSED, 32, 0},
- {"Greyscale-8", V4L2_PIX_FMT_GREY, Y8, 8, 0},
- {"YUV 4:2:2 planar (Y-Cb-Cr)", V4L2_PIX_FMT_YUV422P, YUV422_DECOMPOSED, 16, 0},
- {"YUV 4:2:0 planar (Y-Cb-Cr)", V4L2_PIX_FMT_YVU420, YUV420_DECOMPOSED, 12, 0},
- {"YUV 4:2:2 (U-Y-V-Y)", V4L2_PIX_FMT_UYVY, YUV422_COMPOSED, 16, 0},
- /* V4L2_PIX_FMT_YUYV must always be the last format in the list. the saa7146 (without "a")
- is not capable of on-the-fly "byte swapping" (see below), so it does not support this
- format... */
- {"YUV 4:2:2 (Y-U-Y-V)", V4L2_PIX_FMT_YUYV, YUV422_COMPOSED, 16, SAA7146_TWO_BYTE_SWAP},
+struct saa7146_format formats[] = {
+ {
+ .name = "RGB-8 (3-3-2)",
+ .pixelformat = V4L2_PIX_FMT_RGB332,
+ .trans = RGB08_COMPOSED,
+ .depth = 8,
+ }, {
+ .name = "RGB-16 (5/B-6/G-5/R)", /* really? */
+ .pixelformat = V4L2_PIX_FMT_RGB565,
+ .trans = RGB16_COMPOSED,
+ .depth = 16,
+ }, {
+ .name = "RGB-24 (B-G-R)",
+ .pixelformat = V4L2_PIX_FMT_BGR24,
+ .trans = RGB24_COMPOSED,
+ .depth = 24,
+ }, {
+ .name = "RGB-32 (B-G-R)",
+ .pixelformat = V4L2_PIX_FMT_BGR32,
+ .trans = RGB32_COMPOSED,
+ .depth = 32,
+ }, {
+ .name = "Greyscale-8",
+ .pixelformat = V4L2_PIX_FMT_GREY,
+ .trans = Y8,
+ .depth = 8,
+ }, {
+ .name = "YUV 4:2:2 planar (Y-Cb-Cr)",
+ .pixelformat = V4L2_PIX_FMT_YUV422P,
+ .trans = YUV422_DECOMPOSED,
+ .depth = 16,
+ }, {
+ .name = "YUV 4:2:0 planar (Y-Cb-Cr)",
+ .pixelformat = V4L2_PIX_FMT_YVU420,
+ .trans = YUV420_DECOMPOSED,
+ .depth = 12,
+ }, {
+ .name = "YUV 4:2:2 (U-Y-V-Y)",
+ .pixelformat = V4L2_PIX_FMT_UYVY,
+ .trans = YUV422_COMPOSED,
+ .depth = 16,
+ }
};
-/* this is only true for saa7146a. for the saa7146 (without "a") this is NUM_CAPPVFMT-1 */
+/* unfortunately, the saa7146 contains a bug which prevents it from doing on-the-fly byte swaps.
+ due to this, it's impossible to provide additional formats, which are simply byte swapped
+ (like V4L2_PIX_FMT_YUYV) ... 8-( */
+
static
int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format);
@@ -36,10 +67,6 @@ struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc)
{
int i, j = NUM_FORMATS;
- if( 0 == dev->revision ) {
- j = NUM_FORMATS-1;
- }
-
for (i = 0; i < j; i++) {
if (formats[i].pixelformat == fourcc) {
return formats+i;
@@ -808,7 +835,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
- case V4L2_BUF_TYPE_VIDEO_OVERLAY:
+ case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
index = f->index;
if (index < 0 || index >= NUM_FORMATS) {
return -EINVAL;
@@ -818,6 +845,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
strncpy(f->description,formats[index].name,31);
f->pixelformat = formats[index].pixelformat;
break;
+ }
default:
return -EINVAL;
}
@@ -1153,9 +1181,7 @@ 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;
@@ -1177,8 +1203,6 @@ 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_vv *vv = dev->vv_data;
-/*
-*/
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
DEB_CAP(("vbuf:%p\n",vb));
@@ -1191,7 +1215,6 @@ void buffer_release(struct file *file, struct videobuf_buffer *vb)
{
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
- struct saa7146_vv *vv = dev->vv_data;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
DEB_CAP(("vbuf:%p\n",vb));
diff --git a/linux/drivers/media/common/saa7146_vv.h b/linux/drivers/media/common/saa7146_vv.h
index 5a924bfd5..917f2b007 100644
--- a/linux/drivers/media/common/saa7146_vv.h
+++ b/linux/drivers/media/common/saa7146_vv.h
@@ -19,11 +19,10 @@ struct saa7146_video_dma {
};
struct saa7146_format {
- char *name;
- int pixelformat;
- u32 trans;
- u8 depth;
- unsigned long flags;
+ char *name;
+ int pixelformat;
+ u32 trans;
+ u8 depth;
};
struct saa7146_standard
@@ -221,7 +220,7 @@ extern struct saa7146_use_ops saa7146_vbi_uops;
#define V_OFFSET_SECAM 0x14
/* number of horizontal pixels to process */
-#define H_PIXELS_PAL 680
+#define H_PIXELS_PAL 720
#define H_PIXELS_NTSC 708
#define H_PIXELS_SECAM 720