zc0301.txt 8.4 KB

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