2 SN9C10[12] PC Camera Controllers
4 ================================
14 4. Module dependencies
17 7. Optional device control through "sysfs"
19 9. How to add support for new image sensors
20 10. Notes for V4L2 application developers
21 11. Contact information
27 Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it>
29 SONiX is a trademark of SONiX Technology Company Limited, inc.
30 This driver is not sponsored or developed by SONiX.
35 This program is free software; you can redistribute it and/or modify
36 it under the terms of the GNU General Public License as published by
37 the Free Software Foundation; either version 2 of the License, or
38 (at your option) any later version.
40 This program is distributed in the hope that it will be useful,
41 but WITHOUT ANY WARRANTY; without even the implied warranty of
42 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 GNU General Public License for more details.
45 You should have received a copy of the GNU General Public License
46 along with this program; if not, write to the Free Software
47 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
52 This driver attempts to support the video streaming capabilities of the devices
53 mounting the SONiX SN9C101 or SONiX SN9C102 PC Camera Controllers.
55 - It's worth to note that SONiX has never collaborated with me during the
56 development of this project, despite of several requests for enough detailed
57 specifications of the register tables, compression engine and video data format
60 Up to 64 cameras can be handled at the same time. They can be connected and
61 disconnected from the host many times without turning off the computer, if
62 your system supports the hotplug facility.
64 The driver relies on the Video4Linux2 and USB core modules. It has been
65 designed to run properly on SMP systems as well.
67 The latest version of the SN9C10[12] driver can be found at the following URL:
68 http://go.lamarinapunto.com/
71 4. Module dependencies
72 ======================
73 For it to work properly, the driver needs kernel support for Video4Linux and
76 The following options of the kernel configuration file must be enabled and
77 corresponding modules must be compiled:
87 In addition, depending on the hardware being used, the modules below are
90 # USB Host Controller Drivers
98 # USB Multimedia devices
105 To use the driver, it is necessary to load the "sn9c102" module into memory
106 after every other module required: "videodev", "usbcore" and, depending on
107 the USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd".
109 Loading can be done as shown below:
111 [root@localhost home]# modprobe usbcore
112 [root@localhost home]# modprobe sn9c102
114 At this point the devices should be recognized. You can invoke "dmesg" to
115 analyze kernel messages and verify that the loading process has gone well:
117 [user@localhost home]$ dmesg
122 Module parameters are listed below:
123 -------------------------------------------------------------------------------
125 Type: int array (min = 0, max = 32)
127 Description: Specify V4L2 minor mode number:
128 -1 = use next available
129 n = use minor number n
130 You can specify up to 32 cameras this way.
132 video_nr=-1,2,-1 would assign minor number 2 to the second
133 recognized camera and use auto for the first one and for every
136 -------------------------------------------------------------------------------
140 Description: Debugging information level, from 0 to 3:
141 0 = none (use carefully)
143 2 = significant informations
144 3 = more verbose messages
145 Level 3 is useful for testing only, when only one device
148 -------------------------------------------------------------------------------
151 7. Optional device control through "sysfs"
152 ==========================================
153 It is possible to read and write both the SN9C10[12] and the image sensor
154 registers by using the "sysfs" filesystem interface.
156 Every time a supported device is recognized, a read-only file named "green" is
157 created in the /sys/class/video4linux/videoX directory. You can set the green
158 channel's gain by writing the desired value to it. The value may range from 0
161 There are other four entries in the directory above for each registered camera:
162 "reg", "val", "i2c_reg" and "i2c_val". The first two files control the
163 SN9C10[12] bridge, while the other two control the sensor chip. "reg" and
164 "i2c_reg" hold the values of the current register index where the following
165 reading/writing operations are addressed at through "val" and "i2c_val". Their
166 use is not intended for end-users, unless you know what you are doing. Note
167 that "i2c_reg" and "i2c_val" won't be created if the sensor does not actually
168 support the standard I2C protocol. Also, remember that you must be logged in as
169 root before writing to them.
171 As an example, suppose we were to want to read the value contained in the
172 register number 1 of the sensor register table - which usually is the product
173 identifier - of the camera registered as "/dev/video0":
175 [root@localhost #] cd /sys/class/video4linux/video0
176 [root@localhost #] echo 1 > i2c_reg
177 [root@localhost #] cat i2c_val
179 Now let's set the green gain's register of the SN9C10[12] chip to 2:
181 [root@localhost #] echo 0x11 > reg
182 [root@localhost #] echo 2 > val
184 Note that the SN9C10[12] always returns 0 when some of its registers are read.
185 To avoid race conditions, all the I/O accesses to the files are serialized.
190 - I won't mention any of the names of the companies as well as their products
191 here. They have never collaborated with me, so no advertising -
193 From the point of view of a driver, what unambiguously identify a device are
194 its vendor and product USB identifiers. Below is a list of known identifiers of
195 devices mounting the SN9C10[12] PC camera controllers:
211 The list above does NOT imply that all those devices work with this driver: up
212 until now only the ones that mount the following image sensors are supported.
213 Kernel messages will always tell you whether this is the case:
217 PAS106B PixArt Imaging Inc.
218 PAS202BCB PixArt Imaging Inc.
219 TAS5110C1B Taiwan Advanced Sensor Corporation
220 TAS5130D1B Taiwan Advanced Sensor Corporation
222 If you think your camera is based on the above hardware and is not actually
223 listed in the above table, you may try to add the specific USB VendorID and
224 ProductID identifiers to the sn9c102_id_table[] in the file "sn9c102_sensor.h";
225 then compile, load the module again and look at the kernel output.
226 If this works, please send an email to me reporting the kernel messages, so
227 that I will add a new entry in the list of supported devices.
229 Donations of new models for further testing and support would be much
230 appreciated. I won't add official support for hardware that I don't actually
234 9. How to add support for new image sensors
235 ===========================================
236 It should be easy to write code for new sensors by using the small API that I
237 have created for this purpose, which is present in "sn9c102_sensor.h"
238 (documentation is included there). As an example, have a look at the code in
239 "sn9c102_pas106b.c", which uses the mentioned interface.
241 At the moment, not yet supported image sensors are: HV7131[D|E1] (VGA),
242 MI03 (VGA), OV7620 (VGA).
245 10. Notes for V4L2 application developers
246 =========================================
247 This driver follows the V4L2 API specifications. In particular, it enforces two
250 - exactly one I/O method, either "mmap" or "read", is associated with each
251 file descriptor. Once it is selected, the application must close and reopen the
252 device to switch to the other I/O method;
254 - previously mapped buffer memory must always be unmapped before calling any
255 of the "VIDIOC_S_CROP", "VIDIOC_TRY_FMT" and "VIDIOC_S_FMT" ioctl's. The same
256 number of buffers as before will be allocated again to match the size of the
257 new video frames, so you have to map them again before any I/O attempts.
259 Consistently with the hardware limits, this driver also supports image
260 downscaling with arbitrary scaling factors from 1, 2 and 4 in both directions.
261 However the V4L2 API specifications don't correctly define how the scaling
262 factor can be choosen arbitrarily by the "negotiation" of the "source" and
263 "target" rectangles. To work around this flaw, we have added the convention
264 that, during the negotiation, whenever the "VIDIOC_S_CROP" ioctl is issued, the
265 scaling factor is restored to 1.
268 11. Contact information
269 =======================
270 I may be contacted by e-mail at <luca.risolia@studio.unibo.it>.
272 I can accept GPG/PGP encrypted e-mail. My GPG key ID is 'FCE635A4'.
273 My public 1024-bit key should be available at any keyserver; the fingerprint
274 is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.
279 I would thank the following persons:
281 - Stefano Mozzi, who donated 45 EU;
282 - Luca Capello for the donation of a webcam;
283 - Mizuno Takafumi for the donation of a webcam;
284 - Carlos Eduardo Medaglia Dyonisio, who added the support for the PAS202BCB