diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-27 12:55:37 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-27 12:55:37 -0200 |
commit | 91df4049ebb4764105976c5affe3e751c55c1b61 (patch) | |
tree | 8360dba2980857b77a7882586d0f1f9119408279 /linux/drivers/media/video | |
parent | 1c69201771496c109803ae50019c64ef4b014df6 (diff) | |
download | mediapointer-dvb-s2-91df4049ebb4764105976c5affe3e751c55c1b61.tar.gz mediapointer-dvb-s2-91df4049ebb4764105976c5affe3e751c55c1b61.tar.bz2 |
Update zr364xx V4L2 driver
From: Antoine Jacquet <royale@zerezo.com>
I did some change on the zr364xx driver following your comments:
* I replaced hardcoded values for initialization methods,
unfortunately I don't have nicer names to give for now.
* I removed the DBG() on all ioctl2 functions and used the .debug var
instead.
* Following a comment on linux-usb-devel I misunderstood, I added an
endianness test which was an error, so I removed it (the order of
the bytes in the JPEG header should not depend on endianness).
Signed-off-by: Antoine Jacquet <royale@zerezo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/zr364xx.c | 76 |
1 files changed, 26 insertions, 50 deletions
diff --git a/linux/drivers/media/video/zr364xx.c b/linux/drivers/media/video/zr364xx.c index 2c9ac4cd2..fcbe085ef 100644 --- a/linux/drivers/media/video/zr364xx.c +++ b/linux/drivers/media/video/zr364xx.c @@ -54,6 +54,13 @@ #define DBG(x...) if (debug) info(x) +/* Init methods, need to find nicer names for these + * the exact names of the chipsets would be the best if someone finds it */ +#define METHOD0 0 +#define METHOD1 1 +#define METHOD2 2 + + /* Module parameters */ static int debug = 0; static int mode = 0; @@ -69,22 +76,22 @@ MODULE_PARM_DESC(mode, "0 = 320x240, 1 = 160x120, 2 = 640x480"); /* Devices supported by this driver * .driver_info contains the init method used by the camera */ static struct usb_device_id device_table[] = { - {USB_DEVICE(0x08ca, 0x0109), .driver_info = 0 }, - {USB_DEVICE(0x041e, 0x4024), .driver_info = 0 }, - {USB_DEVICE(0x0d64, 0x0108), .driver_info = 0 }, - {USB_DEVICE(0x0546, 0x3187), .driver_info = 0 }, - {USB_DEVICE(0x0d64, 0x3108), .driver_info = 0 }, - {USB_DEVICE(0x0595, 0x4343), .driver_info = 0 }, - {USB_DEVICE(0x0bb0, 0x500d), .driver_info = 0 }, - {USB_DEVICE(0x0feb, 0x2004), .driver_info = 0 }, - {USB_DEVICE(0x055f, 0xb500), .driver_info = 0 }, - {USB_DEVICE(0x08ca, 0x2062), .driver_info = 2 }, - {USB_DEVICE(0x052b, 0x1a18), .driver_info = 1 }, - {USB_DEVICE(0x04c8, 0x0729), .driver_info = 0 }, - {USB_DEVICE(0x04f2, 0xa208), .driver_info = 0 }, - {USB_DEVICE(0x0784, 0x0040), .driver_info = 1 }, - {USB_DEVICE(0x06d6, 0x0034), .driver_info = 0 }, - {USB_DEVICE(0x0a17, 0x0062), .driver_info = 2 }, + {USB_DEVICE(0x08ca, 0x0109), .driver_info = METHOD0 }, + {USB_DEVICE(0x041e, 0x4024), .driver_info = METHOD0 }, + {USB_DEVICE(0x0d64, 0x0108), .driver_info = METHOD0 }, + {USB_DEVICE(0x0546, 0x3187), .driver_info = METHOD0 }, + {USB_DEVICE(0x0d64, 0x3108), .driver_info = METHOD0 }, + {USB_DEVICE(0x0595, 0x4343), .driver_info = METHOD0 }, + {USB_DEVICE(0x0bb0, 0x500d), .driver_info = METHOD0 }, + {USB_DEVICE(0x0feb, 0x2004), .driver_info = METHOD0 }, + {USB_DEVICE(0x055f, 0xb500), .driver_info = METHOD0 }, + {USB_DEVICE(0x08ca, 0x2062), .driver_info = METHOD2 }, + {USB_DEVICE(0x052b, 0x1a18), .driver_info = METHOD1 }, + {USB_DEVICE(0x04c8, 0x0729), .driver_info = METHOD0 }, + {USB_DEVICE(0x04f2, 0xa208), .driver_info = METHOD0 }, + {USB_DEVICE(0x0784, 0x0040), .driver_info = METHOD1 }, + {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, + {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, {} /* Terminating entry */ }; @@ -305,7 +312,7 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) } /* swap bytes if camera needs it */ - if (cam->method == 0) + if (cam->method == METHOD0) for (i = 0; i < BUFFER_SIZE; i += 2) { swap = cam->buffer[i]; cam->buffer[i] = cam->buffer[i + 1]; @@ -417,7 +424,6 @@ static ssize_t zr364xx_read(struct file *file, char *buf, size_t cnt, static int zr364xx_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - DBG("VIDIOC_QUERYCAP"); memset(cap, 0, sizeof(*cap)); strcpy(cap->driver, DRIVER_DESC); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; @@ -427,7 +433,6 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, static int zr364xx_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) { - DBG("VIDIOC_ENUMINPUT"); if (i->index != 0) return -EINVAL; memset(i, 0, sizeof(*i)); @@ -440,7 +445,6 @@ static int zr364xx_vidioc_enum_input(struct file *file, void *priv, static int zr364xx_vidioc_g_input(struct file *file, void *priv, unsigned int *i) { - DBG("VIDIOC_G_INPUT"); *i = 0; return 0; } @@ -448,7 +452,6 @@ static int zr364xx_vidioc_g_input(struct file *file, void *priv, static int zr364xx_vidioc_s_input(struct file *file, void *priv, unsigned int i) { - DBG("VIDIOC_S_INPUT: %d", i); if (i != 0) return -EINVAL; return 0; @@ -460,8 +463,6 @@ static int zr364xx_vidioc_queryctrl(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_QUERYCTRL: %d", c->id); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -488,8 +489,6 @@ static int zr364xx_vidioc_s_ctrl(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_S_CTRL: %d <- %d", c->id, c->value); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -510,8 +509,6 @@ static int zr364xx_vidioc_g_ctrl(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_G_CTRL: %d -> %d", c->id, c->value); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -529,7 +526,6 @@ static int zr364xx_vidioc_g_ctrl(struct file *file, void *priv, static int zr364xx_vidioc_enum_fmt_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - DBG("VIDIOC_ENUM_FMT: index = %d type = %d", f->index, f->type); if (f->index > 0) return -EINVAL; if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -549,8 +545,6 @@ static int zr364xx_vidioc_try_fmt_cap(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_TRY_FMT: type = %d", f->type); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -578,9 +572,6 @@ static int zr364xx_vidioc_g_fmt_cap(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_G_FMT: type = %d (should be %d)", - f->type, V4L2_BUF_TYPE_VIDEO_CAPTURE); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -606,14 +597,6 @@ static int zr364xx_vidioc_s_fmt_cap(struct file *file, void *priv, struct video_device *vdev = video_devdata(file); struct zr364xx_camera *cam; - DBG("VIDIOC_S_FMT: type = %d (should be %d), " - "pixelformat = %d (should be %d), " - "field = %d (should be %d or %d) ", - f->type, V4L2_BUF_TYPE_VIDEO_CAPTURE, - f->fmt.pix.pixelformat, - V4L2_PIX_FMT_JPEG, f->fmt.pix.field, - V4L2_FIELD_ANY, V4L2_FIELD_NONE); - if (vdev == NULL) return -ENODEV; cam = video_get_drvdata(vdev); @@ -639,14 +622,12 @@ static int zr364xx_vidioc_s_fmt_cap(struct file *file, void *priv, static int zr364xx_vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { - DBG("VIDIOC_STREAMON"); return 0; } static int zr364xx_vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { - DBG("VIDIOC_STREAMOFF"); return 0; } @@ -840,6 +821,8 @@ static int zr364xx_probe(struct usb_interface *intf, } memcpy(cam->vdev, &zr364xx_template, sizeof(zr364xx_template)); video_set_drvdata(cam->vdev, cam); + if (debug) + cam->vdev->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; cam->udev = udev; @@ -871,17 +854,10 @@ static int zr364xx_probe(struct usb_interface *intf, m0d1[0] = mode; m1[2].value = 0xf000 + mode; m2[1].value = 0xf000 + mode; -#ifdef __LITTLE_ENDIAN header2[437] = cam->height / 256; header2[438] = cam->height % 256; header2[439] = cam->width / 256; header2[440] = cam->width % 256; -#else - header2[437] = cam->height % 256; - header2[438] = cam->height / 256; - header2[439] = cam->width % 256; - header2[440] = cam->width / 256; -#endif cam->nb = 0; cam->brightness = 64; |