http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / Documentation / usb / sn9c102.txt
1
2                         SN9C10[12] PC Camera Controllers
3                                 Driver for Linux
4                         ================================
5
6                                - Documentation -
7
8
9 Index
10 =====
11 1.  Copyright
12 2.  License
13 3.  Overview
14 4.  Module dependencies
15 5.  Module loading
16 6.  Module parameters
17 7.  Device control through "sysfs"
18 8.  Supported devices
19 9.  How to add support for new image sensors
20 10. Note for V4L2 developers
21 11. Contact information
22 12. Credits
23
24
25 1. Copyright
26 ============
27 Copyright (C) 2004 by Luca Risolia <luca.risolia@studio.unibo.it>
28
29 SONiX is a trademark of SONiX Technology Company Limited, inc.
30 This driver is not sponsored or developed by SONiX.
31
32
33 2. License
34 ==========
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.
39
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.
44
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.
48
49
50 3. Overview
51 ===========
52 This driver attempts to support the video streaming capabilities of the devices
53 mounting the SONiX SN9C101 or SONiX SN9C102 PC Camera Controllers.
54
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
58 of the above chips -
59
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.
63
64 The driver relies on the Video4Linux2 and USB core modules. It has been
65 designed to run properly on SMP systems as well.
66
67 The latest version of the SN9C10[12] driver can be found at the following URL:
68 http://go.lamarinapunto.com/
69
70
71 4. Module dependencies
72 ======================
73 For it to work properly, the driver needs kernel support for Video4Linux and
74 USB.
75
76 The following options of the kernel configuration file must be enabled and
77 corresponding modules must be compiled:
78
79         # Multimedia devices
80         #
81         CONFIG_VIDEO_DEV=m
82
83         # USB support
84         #
85         CONFIG_USB=m
86
87 In addition, depending on the hardware being used, the modules below are
88 necessary:
89
90         # USB Host Controller Drivers
91         #
92         CONFIG_USB_EHCI_HCD=m
93         CONFIG_USB_UHCI_HCD=m
94         CONFIG_USB_OHCI_HCD=m
95
96 And finally:
97
98         # USB Multimedia devices
99         #
100         CONFIG_USB_SN9C102=m
101
102
103 5. Module loading
104 =================
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".
108
109 Loading can be done as shown below:
110
111         [root@localhost home]# modprobe usbcore
112         [root@localhost home]# modprobe sn9c102
113
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:
116
117         [user@localhost home]$ dmesg
118
119
120 6. Module parameters
121 ====================
122 Module parameters are listed below:
123 -------------------------------------------------------------------------------
124 Name:           video_nr
125 Type:           int array (min = 0, max = 32)
126 Syntax:         <-1|n[,...]> 
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.
131                 For example:
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
134                 other camera.
135 Default:        -1
136 -------------------------------------------------------------------------------
137 Name:           debug
138 Type:           int
139 Syntax:         <n> 
140 Description:    Debugging information level, from 0 to 3:
141                 0 = none (use carefully)
142                 1 = critical errors
143                 2 = significant informations
144                 3 = more verbose messages
145                 Level 3 is useful for testing only, when just one device
146                 is used.
147 Default:        2
148 -------------------------------------------------------------------------------
149
150
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.
155
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
161 the others for blue.
162
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.
172
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":
176
177         [root@localhost #] cd /sys/class/video4linux/video0
178         [root@localhost #] echo 1 > i2c_reg
179         [root@localhost #] cat i2c_val
180
181 Now let's set the green gain's register of the SN9C10[12] chip to 2:
182
183         [root@localhost #] echo 0x11 > reg
184         [root@localhost #] echo 2 > val
185
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.
188
189
190 8. Supported devices
191 ====================
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 -
194
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:
198
199 Vendor ID  Product ID
200 ---------  ----------
201 0xc45      0x6001
202 0xc45      0x6005
203 0xc45      0x6009
204 0xc45      0x600d
205 0xc45      0x6024
206 0xc45      0x6025
207 0xc45      0x6028
208 0xc45      0x6029
209 0xc45      0x602a
210 0xc45      0x602c
211 0xc45      0x8001
212
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:
216
217 Model       Manufacturer
218 -----       ------------
219 PAS106B     PixArt Imaging Inc.
220 TAS5110C1B  Taiwan Advanced Sensor Corporation
221 TAS5130D1B  Taiwan Advanced Sensor Corporation
222
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.
229
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
232 have.
233
234
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.
241
242 At the moment, not yet supported image sensors are: PAS202B (VGA),
243 HV7131[D|E1] (VGA), MI03 (VGA), OV7620 (VGA).
244
245
246 10. Note for V4L2 developers
247 ============================
248 This driver follows the V4L2 API specifications. In particular, it enforces two
249 rules:
250
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.
254
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.
259
260
261 11. Contact information
262 =======================
263 I may be contacted by e-mail at <luca.risolia@studio.unibo.it>.
264
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'.
268
269
270 12. Credits
271 ===========
272 I would thank the following persons:
273
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.