summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common/saa7146_video.c')
-rw-r--r--linux/drivers/media/common/saa7146_video.c75
1 files changed, 49 insertions, 26 deletions
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));