2 SN9C10[12] PC Camera Controllers
4 ================================
14 4. Module dependencies
17 7. Device control through "sysfs"
19 9. How to add support for new image sensors
20 10. Note for V4L2 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 just one device
148 -------------------------------------------------------------------------------
151 7. 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, read-only files named "redblue"
157 and "green" are created in the /sys/class/video4linux/videoX directory. You can
158 set the red, blue and green channel's gain by writing the desired value to
159 them. The value may range from 0 to 15 for each channel; this means that
160 "redblue" accepts 8-bit values, where the low 4 bits are reserved for red and
163 There are other four entries in the directory above for each registered camera:
164 "reg", "val", "i2c_reg" and "i2c_val". The first two files control the
165 SN9C10[12] bridge, while the other two control the sensor chip. "reg" and
166 "i2c_reg" hold the values of the current register index where the following
167 reading/writing operations are addressed at through "val" and "i2c_val". Their
168 use is not intended for end-users, unless you know what you are doing. Note
169 that "i2c_reg" and "i2c_val" won't be created if the sensor does not actually
170 support the standard I2C protocol. Also, remember that you must be logged in as
171 root before writing to them.
173 As an example, suppose we were to want to read the value contained in the
174 register number 1 of the sensor register table - which usually is the product
175 identifier - of the camera registered as "/dev/video0":
177 [root@localhost #] cd /sys/class/video4linux/video0
178 [root@localhost #] echo 1 > i2c_reg
179 [root@localhost #] cat i2c_val
181 Now let's set the green gain's register of the SN9C10[12] chip to 2:
183 [root@localhost #] echo 0x11 > reg
184 [root@localhost #] echo 2 > val
186 Note that the SN9C10[12] always returns 0 when some of its registers are read.
187 To avoid race conditions, all the I/O accesses to the files are serialized.
192 - I won't mention any of the names of the companies as well as their products
193 here. They have never collaborated with me, so no advertising -
195 From the point of view of a driver, what unambiguously identify a device are
196 its vendor and product USB identifiers. Below is a list of known identifiers of
197 devices mounting the SN9C10[12] PC camera controllers:
213 The list above does NOT imply that all those devices work with this driver: up
214 until now only the ones that mount the following image sensors are supported.
215 Kernel messages will always tell you whether this is the case:
219 PAS106B PixArt Imaging Inc.
220 TAS5110C1B Taiwan Advanced Sensor Corporation
221 TAS5130D1B Taiwan Advanced Sensor Corporation
223 If you think your camera is based on the above hardware and is not actually
224 listed in the above table, you may try to add the specific USB VendorID and
225 ProductID identifiers to the sn9c102_id_table[] in the file "sn9c102_sensor.h";
226 then compile, load the module again and look at the kernel output.
227 If this works, please send an email to me reporting the kernel messages, so
228 that I will add a new entry in the list of supported devices.
230 Donations of new models for further testing and support would be much
231 appreciated. I won't add official support for hardware that I don't actually
235 9. How to add support for new image sensors
236 ===========================================
237 It should be easy to write code for new sensors by using the small API that I
238 have created for this purpose, which is present in "sn9c102_sensor.h"
239 (documentation is included there). As an example, have a look at the code in
240 "sn9c102_pas106b.c", which uses the mentioned interface.
242 At the moment, not yet supported image sensors are: PAS202B (VGA),
243 HV7131[D|E1] (VGA), MI03 (VGA), OV7620 (VGA).
246 10. Note for V4L2 developers
247 ============================
248 This driver follows the V4L2 API specifications. In particular, it enforces two
251 1) Exactly one I/O method, either "mmap" or "read", is associated with each
252 file descriptor. Once it is selected, the application must close and reopen the
253 device to switch to the other I/O method.
255 2) Previously mapped buffer memory must always be unmapped before calling any
256 of the "VIDIOC_S_CROP", "VIDIOC_TRY_FMT" and "VIDIOC_S_FMT" ioctl's. In case,
257 the same number of buffers as before will be allocated again to match the size
258 of the new video frames, so you have to map them again before any I/O attempts.
261 11. Contact information
262 =======================
263 I may be contacted by e-mail at <luca.risolia@studio.unibo.it>.
265 I can accept GPG/PGP encrypted e-mail. My GPG key ID is 'FCE635A4'.
266 My public 1024-bit key should be available at any keyserver; the fingerprint
267 is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.
272 I would thank the following persons:
274 - Stefano Mozzi, who donated 45 EU;
275 - Luca Capello for the donation of a webcam;
276 - Mizuno Takafumi for the donation of a webcam.