aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Risolia <luca.risolia@studio.unibo.it>2007-01-08 09:34:35 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:19 -0500
commit7e3a0660700ad47ee6e296fe7090d771becfcf96 (patch)
tree562ca1d5f649db663d941fe3bc269c07a029bdb6
parentf327ebbd004fb2f08291ca4c6637f5f27319683c (diff)
V4L/DVB (5063): ZC0301 driver updates.
- Implement audio ioctl's and VIDIOC_ENUM_FRAMESIZES - Documentation updates - Generic improvements Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--Documentation/video4linux/zc0301.txt10
-rw-r--r--drivers/media/video/zc0301/zc0301.h4
-rw-r--r--drivers/media/video/zc0301/zc0301_core.c55
-rw-r--r--drivers/media/video/zc0301/zc0301_pas202bcb.c4
-rw-r--r--drivers/media/video/zc0301/zc0301_pb0330.c4
-rw-r--r--drivers/media/video/zc0301/zc0301_sensor.h12
6 files changed, 64 insertions, 25 deletions
diff --git a/Documentation/video4linux/zc0301.txt b/Documentation/video4linux/zc0301.txt
index f406f5e80046..befdfdacdc5b 100644
--- a/Documentation/video4linux/zc0301.txt
+++ b/Documentation/video4linux/zc0301.txt
@@ -23,7 +23,7 @@ Index
23 23
241. Copyright 241. Copyright
25============ 25============
26Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> 26Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it>
27 27
28 28
292. Disclaimer 292. Disclaimer
@@ -125,8 +125,9 @@ And finally:
1256. Module loading 1256. Module loading
126================= 126=================
127To use the driver, it is necessary to load the "zc0301" module into memory 127To use the driver, it is necessary to load the "zc0301" module into memory
128after every other module required: "videodev", "usbcore" and, depending on 128after every other module required: "videodev", "v4l2_common", "compat_ioctl32",
129the USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd". 129"usbcore" and, depending on the USB host controller you have, "ehci-hcd",
130"uhci-hcd" or "ohci-hcd".
130 131
131Loading can be done as shown below: 132Loading can be done as shown below:
132 133
@@ -211,12 +212,11 @@ Vendor ID Product ID
2110x041e 0x4036 2120x041e 0x4036
2120x041e 0x403a 2130x041e 0x403a
2130x0458 0x7007 2140x0458 0x7007
2140x0458 0x700C 2150x0458 0x700c
2150x0458 0x700f 2160x0458 0x700f
2160x046d 0x08ae 2170x046d 0x08ae
2170x055f 0xd003 2180x055f 0xd003
2180x055f 0xd004 2190x055f 0xd004
2190x046d 0x08ae
2200x0ac8 0x0301 2200x0ac8 0x0301
2210x0ac8 0x301b 2210x0ac8 0x301b
2220x0ac8 0x303b 2220x0ac8 0x303b
diff --git a/drivers/media/video/zc0301/zc0301.h b/drivers/media/video/zc0301/zc0301.h
index b9c93b8c16f7..710f12eb9126 100644
--- a/drivers/media/video/zc0301/zc0301.h
+++ b/drivers/media/video/zc0301/zc0301.h
@@ -1,7 +1,7 @@
1/*************************************************************************** 1/***************************************************************************
2 * V4L2 driver for ZC0301 Image Processor and Control Chip * 2 * V4L2 driver for ZC0301[P] Image Processor and Control Chip *
3 * * 3 * *
4 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 4 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c
index 8da7f15f6290..f1120551c70c 100644
--- a/drivers/media/video/zc0301/zc0301_core.c
+++ b/drivers/media/video/zc0301/zc0301_core.c
@@ -1,7 +1,7 @@
1/*************************************************************************** 1/***************************************************************************
2 * Video4Linux2 driver for ZC0301[P] Image Processor and Control Chip * 2 * Video4Linux2 driver for ZC0301[P] Image Processor and Control Chip *
3 * * 3 * *
4 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 4 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
5 * * 5 * *
6 * Informations about the chip internals needed to enable the I2C protocol * 6 * Informations about the chip internals needed to enable the I2C protocol *
7 * have been taken from the documentation of the ZC030x Video4Linux1 * 7 * have been taken from the documentation of the ZC030x Video4Linux1 *
@@ -52,8 +52,8 @@
52#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" 52#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"
53#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" 53#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
54#define ZC0301_MODULE_LICENSE "GPL" 54#define ZC0301_MODULE_LICENSE "GPL"
55#define ZC0301_MODULE_VERSION "1:1.05" 55#define ZC0301_MODULE_VERSION "1:1.07"
56#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 5) 56#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 7)
57 57
58/*****************************************************************************/ 58/*****************************************************************************/
59 59
@@ -89,7 +89,7 @@ MODULE_PARM_DESC(force_munmap,
89 "\ndetected camera." 89 "\ndetected camera."
90 "\n 0 = do not force memory unmapping" 90 "\n 0 = do not force memory unmapping"
91 "\n 1 = force memory unmapping (save memory)" 91 "\n 1 = force memory unmapping (save memory)"
92 "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." 92 "\nDefault value is "__MODULE_STRING(ZC0301_FORCE_MUNMAP)"."
93 "\n"); 93 "\n");
94 94
95static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = 95static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] =
@@ -136,7 +136,8 @@ zc0301_request_buffers(struct zc0301_device* cam, u32 count,
136 136
137 cam->nbuffers = count; 137 cam->nbuffers = count;
138 while (cam->nbuffers > 0) { 138 while (cam->nbuffers > 0) {
139 if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize)))) 139 if ((buff = vmalloc_32_user(cam->nbuffers *
140 PAGE_ALIGN(imagesize))))
140 break; 141 break;
141 cam->nbuffers--; 142 cam->nbuffers--;
142 } 143 }
@@ -430,7 +431,8 @@ static int zc0301_start_transfer(struct zc0301_device* cam)
430 struct usb_host_interface* altsetting = usb_altnum_to_altsetting( 431 struct usb_host_interface* altsetting = usb_altnum_to_altsetting(
431 usb_ifnum_to_if(udev, 0), 432 usb_ifnum_to_if(udev, 0),
432 ZC0301_ALTERNATE_SETTING); 433 ZC0301_ALTERNATE_SETTING);
433 const unsigned int psz = altsetting->endpoint[0].desc.wMaxPacketSize; 434 const unsigned int psz = le16_to_cpu(altsetting->
435 endpoint[0].desc.wMaxPacketSize);
434 struct urb* urb; 436 struct urb* urb;
435 s8 i, j; 437 s8 i, j;
436 int err = 0; 438 int err = 0;
@@ -489,7 +491,7 @@ static int zc0301_start_transfer(struct zc0301_device* cam)
489 return 0; 491 return 0;
490 492
491free_urbs: 493free_urbs:
492 for (i = 0; i < ZC0301_URBS; i++) 494 for (i = 0; (i < ZC0301_URBS) && cam->urb[i]; i++)
493 usb_free_urb(cam->urb[i]); 495 usb_free_urb(cam->urb[i]);
494 496
495free_buffers: 497free_buffers:
@@ -1288,6 +1290,35 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg)
1288 1290
1289 1291
1290static int 1292static int
1293zc0301_vidioc_enum_framesizes(struct zc0301_device* cam, void __user * arg)
1294{
1295 struct v4l2_frmsizeenum frmsize;
1296
1297 if (copy_from_user(&frmsize, arg, sizeof(frmsize)))
1298 return -EFAULT;
1299
1300 if (frmsize.index != 0 && frmsize.index != 1)
1301 return -EINVAL;
1302
1303 if (frmsize.pixel_format != V4L2_PIX_FMT_JPEG)
1304 return -EINVAL;
1305
1306 frmsize.type = V4L2_FRMSIZE_TYPE_DISCRETE;
1307
1308 if (frmsize.index == 1) {
1309 frmsize.discrete.width = cam->sensor.cropcap.defrect.width;
1310 frmsize.discrete.height = cam->sensor.cropcap.defrect.height;
1311 }
1312 memset(&frmsize.reserved, 0, sizeof(frmsize.reserved));
1313
1314 if (copy_to_user(arg, &frmsize, sizeof(frmsize)))
1315 return -EFAULT;
1316
1317 return 0;
1318}
1319
1320
1321static int
1291zc0301_vidioc_enum_fmt(struct zc0301_device* cam, void __user * arg) 1322zc0301_vidioc_enum_fmt(struct zc0301_device* cam, void __user * arg)
1292{ 1323{
1293 struct v4l2_fmtdesc fmtd; 1324 struct v4l2_fmtdesc fmtd;
@@ -1295,6 +1326,9 @@ zc0301_vidioc_enum_fmt(struct zc0301_device* cam, void __user * arg)
1295 if (copy_from_user(&fmtd, arg, sizeof(fmtd))) 1326 if (copy_from_user(&fmtd, arg, sizeof(fmtd)))
1296 return -EFAULT; 1327 return -EFAULT;
1297 1328
1329 if (fmtd.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1330 return -EINVAL;
1331
1298 if (fmtd.index == 0) { 1332 if (fmtd.index == 0) {
1299 strcpy(fmtd.description, "JPEG"); 1333 strcpy(fmtd.description, "JPEG");
1300 fmtd.pixelformat = V4L2_PIX_FMT_JPEG; 1334 fmtd.pixelformat = V4L2_PIX_FMT_JPEG;
@@ -1795,6 +1829,9 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
1795 case VIDIOC_S_FMT: 1829 case VIDIOC_S_FMT:
1796 return zc0301_vidioc_try_s_fmt(cam, cmd, arg); 1830 return zc0301_vidioc_try_s_fmt(cam, cmd, arg);
1797 1831
1832 case VIDIOC_ENUM_FRAMESIZES:
1833 return zc0301_vidioc_enum_framesizes(cam, arg);
1834
1798 case VIDIOC_G_JPEGCOMP: 1835 case VIDIOC_G_JPEGCOMP:
1799 return zc0301_vidioc_g_jpegcomp(cam, arg); 1836 return zc0301_vidioc_g_jpegcomp(cam, arg);
1800 1837
@@ -1830,6 +1867,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
1830 case VIDIOC_QUERYSTD: 1867 case VIDIOC_QUERYSTD:
1831 case VIDIOC_ENUMSTD: 1868 case VIDIOC_ENUMSTD:
1832 case VIDIOC_QUERYMENU: 1869 case VIDIOC_QUERYMENU:
1870 case VIDIOC_ENUM_FRAMEINTERVALS:
1833 return -EINVAL; 1871 return -EINVAL;
1834 1872
1835 default: 1873 default:
@@ -1876,6 +1914,7 @@ static const struct file_operations zc0301_fops = {
1876 .open = zc0301_open, 1914 .open = zc0301_open,
1877 .release = zc0301_release, 1915 .release = zc0301_release,
1878 .ioctl = zc0301_ioctl, 1916 .ioctl = zc0301_ioctl,
1917 .compat_ioctl = v4l_compat_ioctl32,
1879 .read = zc0301_read, 1918 .read = zc0301_read,
1880 .poll = zc0301_poll, 1919 .poll = zc0301_poll,
1881 .mmap = zc0301_mmap, 1920 .mmap = zc0301_mmap,
@@ -1913,7 +1952,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
1913 mutex_init(&cam->dev_mutex); 1952 mutex_init(&cam->dev_mutex);
1914 1953
1915 DBG(2, "ZC0301[P] Image Processor and Control Chip detected " 1954 DBG(2, "ZC0301[P] Image Processor and Control Chip detected "
1916 "(vid/pid 0x%04X/0x%04X)",id->idVendor, id->idProduct); 1955 "(vid/pid 0x%04X:0x%04X)",id->idVendor, id->idProduct);
1917 1956
1918 for (i = 0; zc0301_sensor_table[i]; i++) { 1957 for (i = 0; zc0301_sensor_table[i]; i++) {
1919 err = zc0301_sensor_table[i](cam); 1958 err = zc0301_sensor_table[i](cam);
diff --git a/drivers/media/video/zc0301/zc0301_pas202bcb.c b/drivers/media/video/zc0301/zc0301_pas202bcb.c
index ecfd39a56df1..3efb92a0d0da 100644
--- a/drivers/media/video/zc0301/zc0301_pas202bcb.c
+++ b/drivers/media/video/zc0301/zc0301_pas202bcb.c
@@ -1,8 +1,8 @@
1/*************************************************************************** 1/***************************************************************************
2 * Plug-in for PAS202BCB image sensor connected to the ZC0301[P] Image * 2 * Plug-in for PAS202BCB image sensor connected to the ZC0301 Image *
3 * Processor and Control Chip * 3 * Processor and Control Chip *
4 * * 4 * *
5 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
6 * * 6 * *
7 * Initialization values of the ZC0301[P] have been taken from the SPCA5XX * 7 * Initialization values of the ZC0301[P] have been taken from the SPCA5XX *
8 * driver maintained by Michel Xhaard <mxhaard@magic.fr> * 8 * driver maintained by Michel Xhaard <mxhaard@magic.fr> *
diff --git a/drivers/media/video/zc0301/zc0301_pb0330.c b/drivers/media/video/zc0301/zc0301_pb0330.c
index ed8542e6c50f..5784b1d1491c 100644
--- a/drivers/media/video/zc0301/zc0301_pb0330.c
+++ b/drivers/media/video/zc0301/zc0301_pb0330.c
@@ -1,8 +1,8 @@
1/*************************************************************************** 1/***************************************************************************
2 * Plug-in for PB-0330 image sensor connected to the ZC0301[P] Image * 2 * Plug-in for PB-0330 image sensor connected to the ZC0301P Image *
3 * Processor and Control Chip * 3 * Processor and Control Chip *
4 * * 4 * *
5 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
6 * * 6 * *
7 * Initialization values of the ZC0301[P] have been taken from the SPCA5XX * 7 * Initialization values of the ZC0301[P] have been taken from the SPCA5XX *
8 * driver maintained by Michel Xhaard <mxhaard@magic.fr> * 8 * driver maintained by Michel Xhaard <mxhaard@magic.fr> *
diff --git a/drivers/media/video/zc0301/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h
index 3daf049a288a..44e82cff9319 100644
--- a/drivers/media/video/zc0301/zc0301_sensor.h
+++ b/drivers/media/video/zc0301/zc0301_sensor.h
@@ -1,8 +1,8 @@
1/*************************************************************************** 1/***************************************************************************
2 * API for image sensors connected to the ZC0301 Image Processor and * 2 * API for image sensors connected to the ZC0301[P] Image Processor and *
3 * Control Chip * 3 * Control Chip *
4 * * 4 * *
5 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * 5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
@@ -70,7 +70,7 @@ static const struct usb_device_id zc0301_id_table[] = { \
70 { ZC0301_USB_DEVICE(0x041e, 0x4036, 0xff), }, /* HV7131 */ \ 70 { ZC0301_USB_DEVICE(0x041e, 0x4036, 0xff), }, /* HV7131 */ \
71 { ZC0301_USB_DEVICE(0x041e, 0x403a, 0xff), }, /* HV7131 */ \ 71 { ZC0301_USB_DEVICE(0x041e, 0x403a, 0xff), }, /* HV7131 */ \
72 { ZC0301_USB_DEVICE(0x0458, 0x7007, 0xff), }, /* TAS5130 */ \ 72 { ZC0301_USB_DEVICE(0x0458, 0x7007, 0xff), }, /* TAS5130 */ \
73 { ZC0301_USB_DEVICE(0x0458, 0x700C, 0xff), }, /* TAS5130 */ \ 73 { ZC0301_USB_DEVICE(0x0458, 0x700c, 0xff), }, /* TAS5130 */ \
74 { ZC0301_USB_DEVICE(0x0458, 0x700f, 0xff), }, /* TAS5130 */ \ 74 { ZC0301_USB_DEVICE(0x0458, 0x700f, 0xff), }, /* TAS5130 */ \
75 { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202 */ \ 75 { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202 */ \
76 { ZC0301_USB_DEVICE(0x055f, 0xd003, 0xff), }, /* TAS5130 */ \ 76 { ZC0301_USB_DEVICE(0x055f, 0xd003, 0xff), }, /* TAS5130 */ \
@@ -93,9 +93,9 @@ extern int zc0301_i2c_read(struct zc0301_device*, u16 address, u8 length);
93 93
94/*****************************************************************************/ 94/*****************************************************************************/
95 95
96#define ZC0301_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10 96#define ZC0301_MAX_CTRLS (V4L2_CID_LASTP1 - V4L2_CID_BASE + 10)
97#define ZC0301_V4L2_CID_DAC_MAGNITUDE V4L2_CID_PRIVATE_BASE 97#define ZC0301_V4L2_CID_DAC_MAGNITUDE (V4L2_CID_PRIVATE_BASE + 0)
98#define ZC0301_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1 98#define ZC0301_V4L2_CID_GREEN_BALANCE (V4L2_CID_PRIVATE_BASE + 1)
99 99
100struct zc0301_sensor { 100struct zc0301_sensor {
101 char name[32]; 101 char name[32];