Luca Risolia | 60f7805 | 2006-02-06 16:29:35 +0000 | [diff] [blame^] | 1 | |
| 2 | ZC0301 Image Processor and Control Chip |
| 3 | Driver for Linux |
| 4 | ======================================= |
| 5 | |
| 6 | - Documentation - |
| 7 | |
| 8 | |
| 9 | Index |
| 10 | ===== |
| 11 | 1. Copyright |
| 12 | 2. Disclaimer |
| 13 | 3. License |
| 14 | 4. Overview and features |
| 15 | 5. Module dependencies |
| 16 | 6. Module loading |
| 17 | 7. Module parameters |
| 18 | 8. Supported devices |
| 19 | 9. Notes for V4L2 application developers |
| 20 | 10. Contact information |
| 21 | 11. Credits |
| 22 | |
| 23 | |
| 24 | 1. Copyright |
| 25 | ============ |
| 26 | Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> |
| 27 | |
| 28 | |
| 29 | 2. Disclaimer |
| 30 | ============= |
| 31 | This software is not developed or sponsored by Z-Star Microelectronics Corp. |
| 32 | Trademarks are property of their respective owner. |
| 33 | |
| 34 | |
| 35 | 3. License |
| 36 | ========== |
| 37 | This program is free software; you can redistribute it and/or modify |
| 38 | it under the terms of the GNU General Public License as published by |
| 39 | the Free Software Foundation; either version 2 of the License, or |
| 40 | (at your option) any later version. |
| 41 | |
| 42 | This program is distributed in the hope that it will be useful, |
| 43 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 44 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 45 | GNU General Public License for more details. |
| 46 | |
| 47 | You should have received a copy of the GNU General Public License |
| 48 | along with this program; if not, write to the Free Software |
| 49 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 50 | |
| 51 | |
| 52 | 4. Overview and features |
| 53 | ======================== |
| 54 | This driver supports the video interface of the devices mounting the ZC0301 |
| 55 | Image Processor and Control Chip. |
| 56 | |
| 57 | The driver relies on the Video4Linux2 and USB core modules. It has been |
| 58 | designed to run properly on SMP systems as well. |
| 59 | |
| 60 | The latest version of the ZC0301 driver can be found at the following URL: |
| 61 | http://www.linux-projects.org/ |
| 62 | |
| 63 | Some of the features of the driver are: |
| 64 | |
| 65 | - full compliance with the Video4Linux2 API (see also "Notes for V4L2 |
| 66 | application developers" paragraph); |
| 67 | - available mmap or read/poll methods for video streaming through isochronous |
| 68 | data transfers; |
| 69 | - automatic detection of image sensor; |
| 70 | - video formats is standard JPEG in various compression qualities |
| 71 | (see also "Notes for V4L2 application developers" paragraph); |
| 72 | - full support for the capabilities of every possible image sensors that can |
| 73 | be connected to the ZC0301 bridges, including, for istance, red, green, |
| 74 | blue and global gain adjustments and exposure control (see "Supported |
| 75 | devices" paragraph for details); |
| 76 | - use of default color settings for sunlight conditions; |
| 77 | - dynamic driver control thanks to various module parameters (see "Module |
| 78 | parameters" paragraph); |
| 79 | - up to 64 cameras can be handled at the same time; they can be connected and |
| 80 | disconnected from the host many times without turning off the computer, if |
| 81 | the system supports hotplugging; |
| 82 | |
| 83 | |
| 84 | 5. Module dependencies |
| 85 | ====================== |
| 86 | For it to work properly, the driver needs kernel support for Video4Linux and |
| 87 | USB. |
| 88 | |
| 89 | The following options of the kernel configuration file must be enabled and |
| 90 | corresponding modules must be compiled: |
| 91 | |
| 92 | # Multimedia devices |
| 93 | # |
| 94 | CONFIG_VIDEO_DEV=m |
| 95 | |
| 96 | # USB support |
| 97 | # |
| 98 | CONFIG_USB=m |
| 99 | |
| 100 | In addition, depending on the hardware being used, the modules below are |
| 101 | necessary: |
| 102 | |
| 103 | # USB Host Controller Drivers |
| 104 | # |
| 105 | CONFIG_USB_EHCI_HCD=m |
| 106 | CONFIG_USB_UHCI_HCD=m |
| 107 | CONFIG_USB_OHCI_HCD=m |
| 108 | |
| 109 | The ZC0301 controller also provides a built-in microphone interface. It is |
| 110 | supported by the USB Audio driver thanks to the ALSA API: |
| 111 | |
| 112 | # Sound |
| 113 | # |
| 114 | CONFIG_SOUND=y |
| 115 | |
| 116 | # Advanced Linux Sound Architecture |
| 117 | # |
| 118 | CONFIG_SND=m |
| 119 | |
| 120 | # USB devices |
| 121 | # |
| 122 | CONFIG_SND_USB_AUDIO=m |
| 123 | |
| 124 | And finally: |
| 125 | |
| 126 | # USB Multimedia devices |
| 127 | # |
| 128 | CONFIG_USB_ZC0301=m |
| 129 | |
| 130 | |
| 131 | 6. Module loading |
| 132 | ================= |
| 133 | To use the driver, it is necessary to load the "zc0301" module into memory |
| 134 | after every other module required: "videodev", "usbcore" and, depending on |
| 135 | the USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd". |
| 136 | |
| 137 | Loading can be done as shown below: |
| 138 | |
| 139 | [root@localhost home]# modprobe zc0301 |
| 140 | |
| 141 | At this point the devices should be recognized. You can invoke "dmesg" to |
| 142 | analyze kernel messages and verify that the loading process has gone well: |
| 143 | |
| 144 | [user@localhost home]$ dmesg |
| 145 | |
| 146 | |
| 147 | 7. Module parameters |
| 148 | ==================== |
| 149 | Module parameters are listed below: |
| 150 | ------------------------------------------------------------------------------- |
| 151 | Name: video_nr |
| 152 | Type: short array (min = 0, max = 64) |
| 153 | Syntax: <-1|n[,...]> |
| 154 | Description: Specify V4L2 minor mode number: |
| 155 | -1 = use next available |
| 156 | n = use minor number n |
| 157 | You can specify up to 64 cameras this way. |
| 158 | For example: |
| 159 | video_nr=-1,2,-1 would assign minor number 2 to the second |
| 160 | registered camera and use auto for the first one and for every |
| 161 | other camera. |
| 162 | Default: -1 |
| 163 | ------------------------------------------------------------------------------- |
| 164 | Name: force_munmap |
| 165 | Type: bool array (min = 0, max = 64) |
| 166 | Syntax: <0|1[,...]> |
| 167 | Description: Force the application to unmap previously mapped buffer memory |
| 168 | before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not |
| 169 | all the applications support this feature. This parameter is |
| 170 | specific for each detected camera. |
| 171 | 0 = do not force memory unmapping |
| 172 | 1 = force memory unmapping (save memory) |
| 173 | Default: 0 |
| 174 | ------------------------------------------------------------------------------- |
| 175 | Name: debug |
| 176 | Type: ushort |
| 177 | Syntax: <n> |
| 178 | Description: Debugging information level, from 0 to 3: |
| 179 | 0 = none (use carefully) |
| 180 | 1 = critical errors |
| 181 | 2 = significant informations |
| 182 | 3 = more verbose messages |
| 183 | Level 3 is useful for testing only, when only one device |
| 184 | is used at the same time. It also shows some more informations |
| 185 | about the hardware being detected. This module parameter can be |
| 186 | changed at runtime thanks to the /sys filesystem interface. |
| 187 | Default: 2 |
| 188 | ------------------------------------------------------------------------------- |
| 189 | |
| 190 | |
| 191 | 8. Supported devices |
| 192 | ==================== |
| 193 | None of the names of the companies as well as their products will be mentioned |
| 194 | here. They have never collaborated with the author, so no advertising. |
| 195 | |
| 196 | From the point of view of a driver, what unambiguously identify a device are |
| 197 | its vendor and product USB identifiers. Below is a list of known identifiers of |
| 198 | devices mounting the ZC0301 Image Processor and Control Chips: |
| 199 | |
| 200 | Vendor ID Product ID |
| 201 | --------- ---------- |
| 202 | 0x046d 0x08ae |
| 203 | |
| 204 | The following image sensors are supported: |
| 205 | |
| 206 | Model Manufacturer |
| 207 | ----- ------------ |
| 208 | PAS202BCB PixArt Imaging, Inc. |
| 209 | |
| 210 | All the available control settings of each image sensor are supported through |
| 211 | the V4L2 interface. |
| 212 | |
| 213 | |
| 214 | 9. Notes for V4L2 application developers |
| 215 | ======================================== |
| 216 | This driver follows the V4L2 API specifications. In particular, it enforces two |
| 217 | rules: |
| 218 | |
| 219 | - exactly one I/O method, either "mmap" or "read", is associated with each |
| 220 | file descriptor. Once it is selected, the application must close and reopen the |
| 221 | device to switch to the other I/O method; |
| 222 | |
| 223 | - although it is not mandatory, previously mapped buffer memory should always |
| 224 | be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's. |
| 225 | The same number of buffers as before will be allocated again to match the size |
| 226 | of the new video frames, so you have to map the buffers again before any I/O |
| 227 | attempts on them. |
| 228 | |
| 229 | This driver supports the standard JPEG video format. The current compression |
| 230 | quality may vary from 0 to 3 and can be selected or queried thanks to the |
| 231 | VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP V4L2 ioctl's. |
| 232 | |
| 233 | |
| 234 | 10. Contact information |
| 235 | ======================= |
| 236 | The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. |
| 237 | |
| 238 | GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is |
| 239 | 'FCE635A4'; the public 1024-bit key should be available at any keyserver; |
| 240 | the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'. |
| 241 | |
| 242 | |
| 243 | 11. Credits |
| 244 | =========== |
| 245 | - Informations about the chip internals to enable the I2C protocol have been |
| 246 | taken from the documentation of the ZC030x Video4Linux1 driver written by |
| 247 | Andrew Birkett <andy@nobugs.org>; |
| 248 | - Initialization values of the ZC0301 connected to the PAS202BCB image sensor |
| 249 | have been taken from the SPCA5XX driver maintained by |
| 250 | Michel Xhaard <mxhaard@magic.fr> |