diff options
Diffstat (limited to 'Documentation/video4linux')
53 files changed, 2811 insertions, 3129 deletions
diff --git a/Documentation/video4linux/4CCs.txt b/Documentation/video4linux/4CCs.txt new file mode 100644 index 00000000000..41241af1ebf --- /dev/null +++ b/Documentation/video4linux/4CCs.txt @@ -0,0 +1,32 @@ +Guidelines for Linux4Linux pixel format 4CCs +============================================ + +Guidelines for Video4Linux 4CC codes defined using v4l2_fourcc() are +specified in this document. First of the characters defines the nature of +the pixel format, compression and colour space. The interpretation of the +other three characters depends on the first one. + +Existing 4CCs may not obey these guidelines. + +Formats +======= + +Raw bayer +--------- + +The following first characters are used by raw bayer formats: + +	B: raw bayer, uncompressed +	b: raw bayer, DPCM compressed +	a: A-law compressed +	u: u-law compressed + +2nd character: pixel order +	B: BGGR +	G: GBRG +	g: GRBG +	R: RGGB + +3rd character: uncompressed bits-per-pixel 0--9, A-- + +4th character: compressed bits-per-pixel 0--9, A-- diff --git a/Documentation/video4linux/API.html b/Documentation/video4linux/API.html index d72fd2aa915..256f8efa992 100644 --- a/Documentation/video4linux/API.html +++ b/Documentation/video4linux/API.html @@ -9,7 +9,7 @@    <table border="0">     <tr>      <td> -     <a href="http://www.linuxtv.org/downloads/video4linux/API/V4L1_API.html">V4L original API</a> +     <a href="http://linuxtv.org/downloads/legacy/video4linux/API/V4L1_API.html">V4L original API</a>      </td>      <td>       Obsoleted by V4L2 API diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828 index d5cb4ea287b..55a21deab7d 100644 --- a/Documentation/video4linux/CARDLIST.au0828 +++ b/Documentation/video4linux/CARDLIST.au0828 @@ -1,6 +1,6 @@    0 -> Unknown board                            (au0828) -  1 -> Hauppauge HVR950Q                        (au0828)        [2040:7200,2040:7210,2040:7217,2040:721b,2040:721e,2040:721f,2040:7280,0fd9:0008] +  1 -> Hauppauge HVR950Q                        (au0828)        [2040:7200,2040:7210,2040:7217,2040:721b,2040:721e,2040:721f,2040:7280,0fd9:0008,2040:7260,2040:7213,2040:7270]    2 -> Hauppauge HVR850                         (au0828)        [2040:7240]    3 -> DViCO FusionHDTV USB                     (au0828)        [0fe9:d620]    4 -> Hauppauge HVR950Q rev xxF8               (au0828)        [2040:7201,2040:7211,2040:7281] -  5 -> Hauppauge Woodbury                       (au0828)        [2040:8200] +  5 -> Hauppauge Woodbury                       (au0828)        [05e1:0480,2040:8200] diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index 4739d568430..b092c0a14df 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -71,7 +71,7 @@   70 -> Prolink Pixelview PV-BT878P+ (Rev.4C,8E)   71 -> Lifeview FlyVideo 98EZ (capture only) LR51          [1851:1851]   72 -> Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM) [1554:4011] - 73 -> Sensoray 311                                        [6000:0311] + 73 -> Sensoray 311/611                                    [6000:0311,6000:0611]   74 -> RemoteVision MX (RV605)   75 -> Powercolor MTV878/ MTV878R/ MTV878F   76 -> Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP) [0e11:0079] @@ -158,3 +158,10 @@  157 -> Geovision GV-800(S) (master)                        [800a:763d]  158 -> Geovision GV-800(S) (slave)                         [800b:763d,800c:763d,800d:763d]  159 -> ProVideo PV183                                      [1830:1540,1831:1540,1832:1540,1833:1540,1834:1540,1835:1540,1836:1540,1837:1540] +160 -> Tongwei Video Technology TD-3116                    [f200:3116] +161 -> Aposonic W-DVR                                      [0279:0228] +162 -> Adlink MPG24 +163 -> Bt848 Capture 14MHz +164 -> CyberVision CV06 (SV) +165 -> Kworld V-Stream Xpert TV PVR878 +166 -> PCI-8604PW diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 87c46347bd6..fc009d0ee7d 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 @@ -18,7 +18,7 @@   17 -> NetUP Dual DVB-S2 CI                                [1b55:2a2c]   18 -> Hauppauge WinTV-HVR1270                             [0070:2211]   19 -> Hauppauge WinTV-HVR1275                             [0070:2215,0070:221d,0070:22f2] - 20 -> Hauppauge WinTV-HVR1255                             [0070:2251,0070:2259,0070:22f1] + 20 -> Hauppauge WinTV-HVR1255                             [0070:2251,0070:22f1]   21 -> Hauppauge WinTV-HVR1210                             [0070:2291,0070:2295,0070:2299,0070:229d,0070:22f0,0070:22f3,0070:22f4,0070:22f5]   22 -> Mygica X8506 DMB-TH                                 [14f1:8651]   23 -> Magic-Pro ProHDTV Extreme 2                         [14f1:8657] @@ -27,3 +27,17 @@   26 -> Hauppauge WinTV-HVR1290                             [0070:8551]   27 -> Mygica X8558 PRO DMB-TH                             [14f1:8578]   28 -> LEADTEK WinFast PxTV1200                            [107d:6f22] + 29 -> GoTView X5 3D Hybrid                                [5654:2390] + 30 -> NetUP Dual DVB-T/C-CI RF                            [1b55:e2e4] + 31 -> Leadtek Winfast PxDVR3200 H XC4000                  [107d:6f39] + 32 -> MPX-885 + 33 -> Mygica X8502/X8507 ISDB-T                           [14f1:8502] + 34 -> TerraTec Cinergy T PCIe Dual                        [153b:117e] + 35 -> TeVii S471                                          [d471:9022] + 36 -> Hauppauge WinTV-HVR1255                             [0070:2259] + 37 -> Prof Revolution DVB-S2 8000                         [8000:3034] + 38 -> Hauppauge WinTV-HVR4400                             [0070:c108,0070:c138,0070:c12a,0070:c1f8] + 39 -> AVerTV Hybrid Express Slim HC81R                    [1461:d939] + 40 -> TurboSight TBS 6981                                 [6981:8888] + 41 -> TurboSight TBS 6980                                 [6980:8888] + 42 -> Leadtek Winfast PxPVR2200                           [107d:6f21] diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 42517d9121d..fa4b3f94746 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -59,7 +59,7 @@   58 -> Pinnacle PCTV HD 800i                               [11bd:0051]   59 -> DViCO FusionHDTV 5 PCI nano                         [18ac:d530]   60 -> Pinnacle Hybrid PCTV                                [12ab:1788] - 61 -> Leadtek TV2000 XP Global                            [107d:6f18,107d:6618] + 61 -> Leadtek TV2000 XP Global                            [107d:6f18,107d:6618,107d:6619]   62 -> PowerColor RA330                                    [14f1:ea3d]   63 -> Geniatech X8000-MT DVBT                             [14f1:8852]   64 -> DViCO FusionHDTV DVB-T PRO                          [18ac:db30] @@ -84,3 +84,8 @@   83 -> Prof 7301 DVB-S/S2                                  [b034:3034]   84 -> Samsung SMT 7020 DVB-S                              [18ac:dc00,18ac:dccd]   85 -> Twinhan VP-1027 DVB-S                               [1822:0023] + 86 -> TeVii S464 DVB-S/S2                                 [d464:9022] + 87 -> Leadtek WinFast DTV2000 H PLUS                      [107d:6f42] + 88 -> Leadtek WinFast DTV1800 H (XC4000)                  [107d:6f38] + 89 -> Leadtek TV2000 XP Global (SC4100)                   [107d:6f36] + 90 -> Leadtek TV2000 XP Global (XC4100)                   [107d:6f43] diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index ac2616a62fc..5a3ddcd340d 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -1,5 +1,5 @@    0 -> Unknown EM2800 video grabber             (em2800)        [eb1a:2800] -  1 -> Unknown EM2750/28xx video grabber        (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2863,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868] +  1 -> Unknown EM2750/28xx video grabber        (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2863,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868,eb1a:2875]    2 -> Terratec Cinergy 250 USB                 (em2820/em2840) [0ccd:0036]    3 -> Pinnacle PCTV USB 2                      (em2820/em2840) [2304:0208]    4 -> Hauppauge WinTV USB 2                    (em2820/em2840) [2040:4200,2040:4201] @@ -7,11 +7,11 @@    6 -> Terratec Cinergy 200 USB                 (em2800)    7 -> Leadtek Winfast USB II                   (em2800)        [0413:6023]    8 -> Kworld USB2800                           (em2800) -  9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker  (em2820/em2840) [1b80:e302,1b80:e304,2304:0207,2304:021a] +  9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker  (em2820/em2840) [1b80:e302,1b80:e304,2304:0207,2304:021a,093b:a003]   10 -> Hauppauge WinTV HVR 900                  (em2880)        [2040:6500] - 11 -> Terratec Hybrid XS                       (em2880)        [0ccd:0042] + 11 -> Terratec Hybrid XS                       (em2880)   12 -> Kworld PVR TV 2800 RF                    (em2820/em2840) - 13 -> Terratec Prodigy XS                      (em2880)        [0ccd:0047] + 13 -> Terratec Prodigy XS                      (em2880)   14 -> SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0 (em2820/em2840)   15 -> V-Gear PocketTV                          (em2800)   16 -> Hauppauge WinTV HVR 950                  (em2883)        [2040:6513,2040:6517,2040:651b] @@ -40,7 +40,7 @@   39 -> KWorld PVRTV 300U                        (em2861)        [eb1a:e300]   40 -> Plextor ConvertX PX-TV100U               (em2861)        [093b:a005]   41 -> Kworld 350 U DVB-T                       (em2870)        [eb1a:e350] - 42 -> Kworld 355 U DVB-T                       (em2870)        [eb1a:e355,eb1a:e357] + 42 -> Kworld 355 U DVB-T                       (em2870)        [eb1a:e355,eb1a:e357,eb1a:e359]   43 -> Terratec Cinergy T XS                    (em2870)        [0ccd:0043]   44 -> Terratec Cinergy T XS (MT2060)           (em2870)   45 -> Pinnacle PCTV DVB-T                      (em2870) @@ -53,18 +53,19 @@   52 -> DNT DA2 Hybrid                           (em2881)   53 -> Pinnacle Hybrid Pro                      (em2881)   54 -> Kworld VS-DVB-T 323UR                    (em2882)        [eb1a:e323] - 55 -> Terratec Hybrid XS (em2882)              (em2882)        [0ccd:005e] - 56 -> Pinnacle Hybrid Pro (2)                  (em2882)        [2304:0226] + 55 -> Terratec Cinnergy Hybrid T USB XS (em2882) (em2882)        [0ccd:005e,0ccd:0042] + 56 -> Pinnacle Hybrid Pro (330e)               (em2882)        [2304:0226]   57 -> Kworld PlusTV HD Hybrid 330              (em2883)        [eb1a:a316]   58 -> Compro VideoMate ForYou/Stereo           (em2820/em2840) [185b:2041] + 59 -> Pinnacle PCTV HD Mini                    (em2874)        [2304:023f]   60 -> Hauppauge WinTV HVR 850                  (em2883)        [2040:651f]   61 -> Pixelview PlayTV Box 4 USB 2.0           (em2820/em2840)   62 -> Gadmei TVR200                            (em2820/em2840)   63 -> Kaiomy TVnPC U2                          (em2860)        [eb1a:e303] - 64 -> Easy Cap Capture DC-60                   (em2860) + 64 -> Easy Cap Capture DC-60                   (em2860)        [1b80:e309]   65 -> IO-DATA GV-MVP/SZ                        (em2820/em2840) [04bb:0515]   66 -> Empire dual TV                           (em2880) - 67 -> Terratec Grabby                          (em2860)        [0ccd:0096] + 67 -> Terratec Grabby                          (em2860)        [0ccd:0096,0ccd:10AF]   68 -> Terratec AV350                           (em2860)        [0ccd:0084]   69 -> KWorld ATSC 315U HDTV TV Box             (em2882)        [eb1a:a313]   70 -> Evga inDtube                             (em2882) @@ -74,3 +75,21 @@   74 -> Actionmaster/LinXcel/Digitus VC211A      (em2800)   75 -> Dikom DK300                              (em2882)   76 -> KWorld PlusTV 340U or UB435-Q (ATSC)     (em2870)        [1b80:a340] + 77 -> EM2874 Leadership ISDBT                  (em2874) + 78 -> PCTV nanoStick T2 290e                   (em28174) + 79 -> Terratec Cinergy H5                      (em2884)        [0ccd:10a2,0ccd:10ad,0ccd:10b6] + 80 -> PCTV DVB-S2 Stick (460e)                 (em28174) + 81 -> Hauppauge WinTV HVR 930C                 (em2884)        [2040:1605] + 82 -> Terratec Cinergy HTC Stick               (em2884)        [0ccd:00b2] + 83 -> Honestech Vidbox NW03                    (em2860)        [eb1a:5006] + 84 -> MaxMedia UB425-TC                        (em2874)        [1b80:e425] + 85 -> PCTV QuatroStick (510e)                  (em2884)        [2304:0242] + 86 -> PCTV QuatroStick nano (520e)             (em2884)        [2013:0251] + 87 -> Terratec Cinergy HTC USB XS              (em2884)        [0ccd:008e,0ccd:00ac] + 88 -> C3 Tech Digital Duo HDTV/SDTV USB        (em2884)        [1b80:e755] + 89 -> Delock 61959                             (em2874)        [1b80:e1cc] + 90 -> KWorld USB ATSC TV Stick UB435-Q V2      (em2874)        [1b80:e346] + 91 -> SpeedLink Vicious And Devine Laplace webcam (em2765)        [1ae7:9003,1ae7:9004] + 92 -> PCTV DVB-S2 Stick (461e)                 (em28178) + 93 -> KWorld USB ATSC TV Stick UB435-Q V3      (em2874)        [1b80:e34c] + 94 -> PCTV tripleStick (292e)                  (em28178) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 8d9afc7d801..8df17d06349 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -180,3 +180,14 @@  179 -> Beholder BeholdTV A7                     [5ace:7090]  180 -> Avermedia PCI M733A                      [1461:4155,1461:4255]  181 -> TechoTrend TT-budget T-3000              [13c2:2804] +182 -> Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid  [17de:b136] +183 -> Compro VideoMate Vista M1F               [185b:c900] +184 -> Encore ENLTV-FM 3                        [1a7f:2108] +185 -> MagicPro ProHDTV Pro2 DMB-TH/Hybrid      [17de:d136] +186 -> Beholder BeholdTV 501                    [5ace:5010] +187 -> Beholder BeholdTV 503 FM                 [5ace:5030] +188 -> Sensoray 811/911                         [6000:0811,6000:0911] +189 -> Kworld PC150-U                           [17de:a134] +190 -> Asus My Cinema PS3-100                   [1043:48cd] +191 -> Hawell HW-9004V1 +192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055] diff --git a/Documentation/video4linux/CARDLIST.saa7164 b/Documentation/video4linux/CARDLIST.saa7164 index 152bd7b781c..2205e8d5553 100644 --- a/Documentation/video4linux/CARDLIST.saa7164 +++ b/Documentation/video4linux/CARDLIST.saa7164 @@ -7,3 +7,5 @@    6 -> Hauppauge WinTV-HVR2200                             [0070:8901]    7 -> Hauppauge WinTV-HVR2250                             [0070:8891,0070:8851]    8 -> Hauppauge WinTV-HVR2250                             [0070:88A1] +  9 -> Hauppauge WinTV-HVR2200                             [0070:8940] + 10 -> Hauppauge WinTV-HVR2200                             [0070:8953] diff --git a/Documentation/video4linux/CARDLIST.tm6000 b/Documentation/video4linux/CARDLIST.tm6000 new file mode 100644 index 00000000000..b5edce48799 --- /dev/null +++ b/Documentation/video4linux/CARDLIST.tm6000 @@ -0,0 +1,16 @@ +  1 -> Generic tm5600 board                   (tm5600)          [6000:0001] +  2 -> Generic tm6000 board                   (tm6000)          [6000:0001] +  3 -> Generic tm6010 board                   (tm6010)          [6000:0002] +  4 -> 10Moons UT821                          (tm5600)          [6000:0001] +  5 -> 10Moons UT330                          (tm5600) +  6 -> ADSTech Dual TV                        (tm6000)          [06e1:f332] +  7 -> FreeCom and similar                    (tm6000)          [14aa:0620] +  8 -> ADSTech Mini Dual TV                   (tm6000)          [06e1:b339] +  9 -> Hauppauge WinTV HVR-900H/USB2 Stick    (tm6010)          [2040:6600,2040:6601,2040:6610,2040:6611] + 10 -> Beholder Wander                        (tm6010)          [6000:dec0] + 11 -> Beholder Voyager                       (tm6010)          [6000:dec1] + 12 -> TerraTec Cinergy Hybrid XE/Cinergy Hybrid Stick (tm6010) [0ccd:0086,0ccd:00a5] + 13 -> TwinHan TU501                          (tm6010)          [13d3:3240,13d3:3241,13d3:3243,13d3:3264] + 14 -> Beholder Wander Lite                   (tm6010)          [6000:dec2] + 15 -> Beholder Voyager Lite                  (tm6010)          [6000:dec3] + diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index e67c1db9685..ac886218496 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -83,3 +83,9 @@ tuner=82 - Philips CU1216L  tuner=83 - NXP TDA18271  tuner=84 - Sony BTF-Pxn01Z  tuner=85 - Philips FQ1236 MK5 +tuner=86 - Tena TNF5337 MFD +tuner=87 - Xceive 4000 tuner +tuner=88 - Xceive 5000C tuner +tuner=89 - Sony BTF-PG472Z PAL/SECAM +tuner=90 - Sony BTF-PK467Z NTSC-M-JP +tuner=91 - Sony BTF-PB463Z NTSC-M diff --git a/Documentation/video4linux/CARDLIST.usbvision b/Documentation/video4linux/CARDLIST.usbvision index 0b72d3fee17..6fd1af36514 100644 --- a/Documentation/video4linux/CARDLIST.usbvision +++ b/Documentation/video4linux/CARDLIST.usbvision @@ -63,3 +63,5 @@   62 -> Pinnacle PCTV Bungee USB (PAL) FM                        [2304:0419]   63 -> Hauppauge WinTv-USB                                      [2400:4200]   64 -> Pinnacle Studio PCTV USB (NTSC) FM V3                    [2304:0113] + 65 -> Nogatech USB MicroCam NTSC (NV3000N)                     [0573:3000] + 66 -> Nogatech USB MicroCam PAL (NV3001P)                      [0573:3001] diff --git a/Documentation/video4linux/CQcam.txt b/Documentation/video4linux/CQcam.txt index 8977e7ce4da..0b69e4ee8e3 100644 --- a/Documentation/video4linux/CQcam.txt +++ b/Documentation/video4linux/CQcam.txt @@ -18,7 +18,7 @@ Table of Contents  1.0 Introduction -  The file ../../drivers/media/video/c-qcam.c is a device driver for +  The file ../../drivers/media/parport/c-qcam.c is a device driver for  the Logitech (nee Connectix) parallel port interface color CCD camera.  This is a fairly inexpensive device for capturing images.  Logitech  does not currently provide information for developers, but many people @@ -61,29 +61,19 @@ But that is my personal preference.  2.2 Configuration    The configuration requires module configuration and device -configuration.  I like kmod or kerneld process with the -/etc/modprobe.conf file so the modules can automatically load/unload as -they are used.  The video devices could already exist, be generated -using MAKEDEV, or need to be created.  The following sections detail -these procedures. +configuration.  The following sections detail these procedures.  2.1 Module Configuration    Using modules requires a bit of work to install and pass the -parameters.  Understand that entries in /etc/modprobe.conf of: +parameters.  Understand that entries in /etc/modprobe.d/*.conf of:     alias parport_lowlevel parport_pc     options parport_pc io=0x378 irq=none     alias char-major-81 videodev     alias char-major-81-0 c-qcam -will cause the kmod/modprobe to do certain things.  If you are -using kmod, then a request for a 'char-major-81-0' will cause -the 'c-qcam' module to load.  If you have other video sources with -modules, you might want to assign the different minor numbers to -different modules. -  2.2 Device Configuration    At this point, we need to ensure that the device files exist. diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile deleted file mode 100644 index 1ed0e98d057..00000000000 --- a/Documentation/video4linux/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# kbuild trick to avoid linker error. Can be omitted if a module is built. -obj- := dummy.o - -# List of programs to build -hostprogs-y := v4lgrab - -# Tell kbuild to always build the programs -always := $(hostprogs-y) diff --git a/Documentation/video4linux/README.cpia b/Documentation/video4linux/README.cpia deleted file mode 100644 index 8a747fee661..00000000000 --- a/Documentation/video4linux/README.cpia +++ /dev/null @@ -1,191 +0,0 @@ -This is a driver for the CPiA PPC2 driven parallel connected -Camera. For example the Creative WebcamII is CPiA driven. - -   ) [1]Peter Pregler, Linz 2000, published under the [2]GNU GPL - ---------------------------------------------------------------------------- - -USAGE: - -General: -======== - -1) Make sure you have created the video devices (/dev/video*): - -- if you have a recent MAKEDEV do a 'cd /dev;./MAKEDEV video' -- otherwise do a: - -cd /dev -mknod video0 c 81 0 -ln -s video0 video - -2) Compile the kernel (see below for the list of options to use), -   configure your parport and reboot. - -3) If all worked well you should get messages similar -   to the following (your versions may be different) on the console: - -V4L-Driver for Vision CPiA based cameras v0.7.4 -parport0: read2 timeout. -parport0: Multimedia device, VLSI Vision Ltd PPC2 -Parallel port driver for Vision CPiA based camera -  CPIA Version: 1.20 (2.0) -  CPIA PnP-ID: 0553:0002:0100 -  VP-Version: 1.0 0100 -  1 camera(s) found - - -As modules: -=========== - -Make sure you have selected the following kernel options (you can -select all stuff as modules): - -The cpia-stuff is in the section 'Character devices -> Video For Linux'. - -CONFIG_PARPORT=m -CONFIG_PARPORT_PC=m -CONFIG_PARPORT_PC_FIFO=y -CONFIG_PARPORT_1284=y -CONFIG_VIDEO_DEV=m -CONFIG_VIDEO_CPIA=m -CONFIG_VIDEO_CPIA_PP=m - -For autoloading of all those modules you need to tell module-init-tools -some stuff. Add the following line to your module-init-tools config-file -(e.g. /etc/modprobe.conf or wherever your distribution does store that -stuff): - -options parport_pc io=0x378 irq=7 dma=3 -alias char-major-81 cpia_pp - -The first line tells the dma/irq channels to use. Those _must_ match -the settings of your BIOS. Do NOT simply use the values above.  See -Documentation/parport.txt for more information about this. The second -line associates the video-device file with the driver. Of cause you -can also load the modules once upon boot (usually done in /etc/modules). - -Linked into the kernel: -======================= - -Make sure you have selected the following kernel options. Note that -you cannot compile the parport-stuff as modules and the cpia-driver -statically (the other way round is okay though). - -The cpia-stuff is in the section 'Character devices -> Video For Linux'. - -CONFIG_PARPORT=y -CONFIG_PARPORT_PC=y -CONFIG_PARPORT_PC_FIFO=y -CONFIG_PARPORT_1284=y -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_CPIA=y -CONFIG_VIDEO_CPIA_PP=y - -To use DMA/irq you will need to tell the kernel upon boot time the -hardware configuration of the parport. You can give the boot-parameter -at the LILO-prompt or specify it in lilo.conf. I use the following -append-line in lilo.conf: - -	append="parport=0x378,7,3" - -See Documentation/parport.txt for more information about the -configuration of the parport and the values given above. Do not simply -use the values given above. - ---------------------------------------------------------------------------- -FEATURES: - -- mmap/read v4l-interface (but no overlay) -- image formats: CIF/QCIF, SIF/QSIF, various others used by isabel; -  note: all sizes except CIF/QCIF are implemented by clipping, i.e. -  pixels are not uploaded from the camera -- palettes: VIDEO_PALETTE_GRAY, VIDEO_PALETTE_RGB565, VIDEO_PALETTE_RGB555, -  VIDEO_PALETTE_RGB24, VIDEO_PALETTE_RGB32, VIDEO_PALETTE_YUYV, -  VIDEO_PALETTE_UYVY, VIDEO_PALETTE_YUV422 -- state information (color balance, exposure, ...) is preserved between -  device opens -- complete control over camera via proc-interface (_all_ camera settings are -  supported), there is also a python-gtk application available for this [3] -- works under SMP (but the driver is completely serialized and synchronous) -  so you get no benefit from SMP, but at least it does not crash your box -- might work for non-Intel architecture, let us know about this - ---------------------------------------------------------------------------- -TESTED APPLICATIONS: - -- a simple test application based on Xt is available at [3] -- another test-application based on gqcam-0.4 (uses GTK) -- gqcam-0.6 should work -- xawtv-3.x (also the webcam software) -- xawtv-2.46 -- w3cam (cgi-interface and vidcat, e.g. you may try out 'vidcat  |xv -  -maxpect -root -quit +noresetroot -rmode 5 -') -- vic, the MBONE video conferencing tool (version 2.8ucl4-1) -- isabel 3R4beta (barely working, but AFAICT all the problems are on -  their side) -- camserv-0.40 - -See [3] for pointers to v4l-applications. - ---------------------------------------------------------------------------- -KNOWN PROBLEMS: - -- some applications do not handle the image format correctly, you will -  see strange horizontal stripes instead of a nice picture -> make sure -  your application does use a supported image size or queries the driver -  for the actually used size (reason behind this: the camera cannot -  provide any image format, so if size NxM is requested the driver will -  use a format to the closest fitting N1xM1, the application should now -  query for this granted size, most applications do not). -- all the todo ;) -- if there is not enough light and the picture is too dark try to -  adjust the SetSensorFPS setting, automatic frame rate adjustment -  has its price -- do not try out isabel 3R4beta (built 135), you will be disappointed - ---------------------------------------------------------------------------- -TODO: - -- multiple camera support (struct camera or something) - This should work, -  but hasn't been tested yet. -- architecture independence? -- SMP-safe asynchronous mmap interface -- nibble mode for old parport interfaces -- streaming capture, this should give a performance gain - ---------------------------------------------------------------------------- -IMPLEMENTATION NOTES: - -The camera can act in two modes, streaming or grabbing. Right now a -polling grab-scheme is used. Maybe interrupt driven streaming will be -used for a asynchronous mmap interface in the next major release of the -driver. This might give a better frame rate. - ---------------------------------------------------------------------------- -THANKS (in no particular order): - -- Scott J. Bertin <sbertin@mindspring.com> for cleanups, the proc-filesystem -  and much more -- Henry Bruce <whb@vvl.co.uk> for providing developers information about -  the CPiA chip, I wish all companies would treat Linux as seriously -- Karoly Erdei <Karoly.Erdei@risc.uni-linz.ac.at> and RISC-Linz for being -  my boss ;) resp. my employer and for providing me the hardware and -  allow me to devote some working time to this project -- Manuel J. Petit de Gabriel <mpetit@dit.upm.es> for providing help -  with Isabel (http://isabel.dit.upm.es/) -- Bas Huisman <bhuism@cs.utwente.nl> for writing the initial parport code -- Jarl Totland <Jarl.Totland@bdc.no> for setting up the mailing list -  and maintaining the web-server[3] -- Chris Whiteford <Chris@informinteractive.com> for fixes related to the -  1.02 firmware -- special kudos to all the tester whose machines crashed and/or -  will crash. :) - ---------------------------------------------------------------------------- -REFERENCES - -   1. http://www.risc.uni-linz.ac.at/ -      mailto:Peter_Pregler@email.com -   2. see the file COPYING in the top directory of the kernel tree -   3. http://webcam.sourceforge.net/ diff --git a/Documentation/video4linux/README.cpia2 b/Documentation/video4linux/README.cpia2 index ce8213d28b6..38e742fd0df 100644 --- a/Documentation/video4linux/README.cpia2 +++ b/Documentation/video4linux/README.cpia2 @@ -12,7 +12,7 @@ gqcam application to view this stream.  	The driver is implemented as two kernel modules. The cpia2 module  contains the camera functions and the V4L interface.  The cpia2_usb module  contains usb specific functions.  The main reason for this was the size of the -module was getting out of hand, so I separted them.  It is not likely that +module was getting out of hand, so I separated them.  It is not likely that  there will be a parallel port version.  FEATURES: diff --git a/Documentation/video4linux/README.davinci-vpbe b/Documentation/video4linux/README.davinci-vpbe new file mode 100644 index 00000000000..dc9a297f49c --- /dev/null +++ b/Documentation/video4linux/README.davinci-vpbe @@ -0,0 +1,93 @@ + +                VPBE V4L2 driver design + ====================================================================== + + File partitioning + ----------------- + V4L2 display device driver +         drivers/media/platform/davinci/vpbe_display.c +         drivers/media/platform/davinci/vpbe_display.h + + VPBE display controller +         drivers/media/platform/davinci/vpbe.c +         drivers/media/platform/davinci/vpbe.h + + VPBE venc sub device driver +         drivers/media/platform/davinci/vpbe_venc.c +         drivers/media/platform/davinci/vpbe_venc.h +         drivers/media/platform/davinci/vpbe_venc_regs.h + + VPBE osd driver +         drivers/media/platform/davinci/vpbe_osd.c +         drivers/media/platform/davinci/vpbe_osd.h +         drivers/media/platform/davinci/vpbe_osd_regs.h + + Functional partitioning + ----------------------- + + Consists of the following (in the same order as the list under file + partitioning):- + + 1. V4L2 display driver +    Implements creation of video2 and video3 device nodes and +    provides v4l2 device interface to manage VID0 and VID1 layers. + + 2. Display controller +    Loads up VENC, OSD and external encoders such as ths8200. It provides +    a set of API calls to V4L2 drivers to set the output/standards +    in the VENC or external sub devices. It also provides +    a device object to access the services from OSD subdevice +    using sub device ops. The connection of external encoders to VENC LCD +    controller port is done at init time based on default output and standard +    selection or at run time when application change the output through +    V4L2 IOCTLs. + +    When connected to an external encoder, vpbe controller is also responsible +    for setting up the interface between VENC and external encoders based on +    board specific settings (specified in board-xxx-evm.c). This allows +    interfacing external encoders such as ths8200. The setup_if_config() +    is implemented for this as well as configure_venc() (part of the next patch) +    API to set timings in VENC for a specific display resolution. As of this +    patch series, the interconnection and enabling and setting of the external +    encoders is not present, and would be a part of the next patch series. + + 3. VENC subdevice module +    Responsible for setting outputs provided through internal DACs and also +    setting timings at LCD controller port when external encoders are connected +    at the port or LCD panel timings required. When external encoder/LCD panel +    is connected, the timings for a specific standard/preset is retrieved from +    the board specific table and the values are used to set the timings in +    venc using non-standard timing mode. + +    Support LCD Panel displays using the VENC. For example to support a Logic +    PD display, it requires setting up the LCD controller port with a set of +    timings for the resolution supported and setting the dot clock. So we could +    add the available outputs as a board specific entry (i.e add the "LogicPD" +    output name to board-xxx-evm.c). A table of timings for various LCDs +    supported can be maintained in the board specific setup file to support +    various LCD displays.As of this patch a basic driver is present, and this +    support for external encoders and displays forms a part of the next +    patch series. + + 4. OSD module +    OSD module implements all OSD layer management and hardware specific +    features. The VPBE module interacts with the OSD for enabling and +    disabling appropriate features of the OSD. + + Current status:- + + A fully functional working version of the V4L2 driver is available. This + driver has been tested with NTSC and PAL standards and buffer streaming. + + Following are TBDs. + + vpbe display controller +    - Add support for external encoders. +    - add support for selecting external encoder as default at probe time. + + vpbe venc sub device +    - add timings for supporting ths8200 +    - add support for LogicPD LCD. + + FB drivers +    - Add support for fbdev drivers.- Ready and part of subsequent patches. diff --git a/Documentation/video4linux/README.ivtv b/Documentation/video4linux/README.ivtv index 42b06686eb7..2579b5b709e 100644 --- a/Documentation/video4linux/README.ivtv +++ b/Documentation/video4linux/README.ivtv @@ -36,8 +36,7 @@ Additional features for the PVR-350 (CX23415 based):   * Provides comprehensive OSD (On Screen Display: ie. graphics overlaying the     video signal)   * Provides a framebuffer (allowing X applications to appear on the video -   device) (this framebuffer is not yet part of the kernel. In the meantime it -   is available from www.ivtvdriver.org). +   device)   * Supports raw YUV output.  IMPORTANT: In case of problems first read this page: diff --git a/Documentation/video4linux/README.pvrusb2 b/Documentation/video4linux/README.pvrusb2 index a747200fe67..2137b589276 100644 --- a/Documentation/video4linux/README.pvrusb2 +++ b/Documentation/video4linux/README.pvrusb2 @@ -172,7 +172,7 @@ Source file list / functional overview:      to provide a streaming API usable by a read() system call style of      I/O.  Right now this is the only layer on top of pvrusb2-io.[ch],      however the underlying architecture here was intended to allow for -    other styles of I/O to be implemented with additonal modules, like +    other styles of I/O to be implemented with additional modules, like      mmap()'ed buffers or something even more exotic.    pvrusb2-main.c - This is the top level of the driver.  Module level diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran index 00e3f926781..b5a911fd060 100644 --- a/Documentation/video4linux/Zoran +++ b/Documentation/video4linux/Zoran @@ -130,7 +130,6 @@ Card number: 4  Note: No module for the mse3000 is available yet  Note: No module for the vpx3224 is available yet -Note: use encoder=X or decoder=X for non-default i2c chips (see i2c-id.h)  =========================== @@ -256,7 +255,7 @@ Load zr36067.o. If it can't autodetect your card, use the card=X insmod  option with X being the card number as given in the previous section.  To have more than one card, use card=X1[,X2[,X3,[X4[..]]]] -To automate this, add the following to your /etc/modprobe.conf: +To automate this, add the following to your /etc/modprobe.d/zoran.conf:  options zr36067 card=X1[,X2[,X3[,X4[..]]]]  alias char-major-81-0 zr36067 @@ -322,76 +321,11 @@ your IRQs and make sure the card has its own interrupts.  4. Programming interface -This driver conforms to video4linux and video4linux2, both can be used to -use the driver. Since video4linux didn't provide adequate calls to fully -use the cards' features, we've introduced several programming extensions, -which are currently officially accepted in the 2.4.x branch of the kernel. -These extensions are known as the v4l/mjpeg extensions. See zoran.h for -details (structs/ioctls). - -Information - video4linux: -http://linux.bytesex.org/v4l2/API.html -Documentation/video4linux/API.html -/usr/include/linux/videodev.h - -Information - video4linux/mjpeg extensions: -./zoran.h -(also see below) - -Information - video4linux2: -http://linuxtv.org -http://v4l2spec.bytesex.org/ -/usr/include/linux/videodev2.h - -More information on the video4linux/mjpeg extensions, by Serguei -Miridonovi and Rainer Johanni: --- -The ioctls for that interface are as follows: - -BUZIOC_G_PARAMS -BUZIOC_S_PARAMS - -Get and set the parameters of the buz. The user should always do a -BUZIOC_G_PARAMS (with a struct buz_params) to obtain the default -settings, change what he likes and then make a BUZIOC_S_PARAMS call. - -BUZIOC_REQBUFS - -Before being able to capture/playback, the user has to request -the buffers he is wanting to use. Fill the structure -zoran_requestbuffers with the size (recommended: 256*1024) and -the number (recommended 32 up to 256). There are no such restrictions -as for the Video for Linux buffers, you should LEAVE SUFFICIENT -MEMORY for your system however, else strange things will happen .... -On return, the zoran_requestbuffers structure contains number and -size of the actually allocated buffers. -You should use these numbers for doing a mmap of the buffers -into the user space. -The BUZIOC_REQBUFS ioctl also makes it happen, that the next mmap -maps the MJPEG buffer instead of the V4L buffers. - -BUZIOC_QBUF_CAPT -BUZIOC_QBUF_PLAY - -Queue a buffer for capture or playback. The first call also starts -streaming capture. When streaming capture is going on, you may -only queue further buffers or issue syncs until streaming -capture is switched off again with a argument of -1 to -a BUZIOC_QBUF_CAPT/BUZIOC_QBUF_PLAY ioctl. - -BUZIOC_SYNC - -Issue this ioctl when all buffers are queued. This ioctl will -block until the first buffer becomes free for saving its -data to disk (after BUZIOC_QBUF_CAPT) or for reuse (after BUZIOC_QBUF_PLAY). - -BUZIOC_G_STATUS - -Get the status of the input lines (video source connected/norm). +This driver conforms to video4linux2. Support for V4L1 and for the custom +zoran ioctls has been removed in kernel 2.6.38.  For programming example, please, look at lavrec.c and lavplay.c code in -lavtools-1.2p2 package (URL: http://www.cicese.mx/) -and the 'examples' directory in the original Buz driver distribution. +the MJPEG-tools (http://mjpeg.sf.net/).  Additional notes for software developers: @@ -402,9 +336,6 @@ Additional notes for software developers:     standard is "more constant" for current country than geometry     settings of a variety of TV capture cards which may work in ITU or     square pixel format. --- -Please note that lavplay/lavrec are also included in the MJPEG-tools -(http://mjpeg.sf.net/).  =========================== diff --git a/Documentation/video4linux/bttv/Cards b/Documentation/video4linux/bttv/Cards index 12217fc4972..a8fb6e2d3c8 100644 --- a/Documentation/video4linux/bttv/Cards +++ b/Documentation/video4linux/bttv/Cards @@ -43,7 +43,7 @@ Very nice card if you only have satellite TV but several tuners connected  to the card via composite.  Many thanks to Matrix-Vision for giving us 2 cards for free which made -Bt848a/Bt849 single crytal operation support possible!!! +Bt848a/Bt849 single crystal operation support possible!!! @@ -464,10 +464,6 @@ Siemens  -------     Multimedia eXtension Board (MXB) (SAA7146, SAA7111) -Stradis -------- -   SDM275,SDM250,SDM026,SDM025 (SAA7146, IBMMPEG2): MPEG2 decoder only -  Powercolor  ----------     MTV878 diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options index bbe3ed667d9..14c065fa23e 100644 --- a/Documentation/video4linux/bttv/Insmod-options +++ b/Documentation/video4linux/bttv/Insmod-options @@ -1,5 +1,5 @@ -Note: "modinfo <module>" prints various informations about a kernel +Note: "modinfo <module>" prints various information about a kernel  module, among them a complete and up-to-date list of insmod options.  This list tends to be outdated because it is updated manually ... diff --git a/Documentation/video4linux/bttv/Modules.conf b/Documentation/video4linux/bttv/Modules.conf index 753f15956eb..8f258faf18f 100644 --- a/Documentation/video4linux/bttv/Modules.conf +++ b/Documentation/video4linux/bttv/Modules.conf @@ -1,4 +1,4 @@ -# For modern kernels (2.6 or above), this belongs in /etc/modprobe.conf +# For modern kernels (2.6 or above), this belongs in /etc/modprobe.d/*.conf  # For for 2.4 kernels or earlier, this belongs in /etc/modules.conf.  # i2c diff --git a/Documentation/video4linux/bttv/README b/Documentation/video4linux/bttv/README index 3a367cdb664..7cbf4fb6cf3 100644 --- a/Documentation/video4linux/bttv/README +++ b/Documentation/video4linux/bttv/README @@ -70,7 +70,7 @@ If you have trouble with some specific TV card, try to ask there  instead of mailing me directly.  The chance that someone with the  same card listens there is much higher... -For problems with sound:  There are alot of different systems used +For problems with sound:  There are a lot of different systems used  for TV sound all over the world.  And there are also different chips  which decode the audio signal.  Reports about sound problems ("stereo  does'nt work") are pretty useless unless you include some details diff --git a/Documentation/video4linux/bttv/README.freeze b/Documentation/video4linux/bttv/README.freeze index 4259dccc828..5eddfa076cf 100644 --- a/Documentation/video4linux/bttv/README.freeze +++ b/Documentation/video4linux/bttv/README.freeze @@ -33,7 +33,7 @@ state is stuck.  I've seen reports that bttv 0.7.x crashes whereas 0.8.x works rock solid  for some people.  Thus probably a small buglet left somewhere in bttv -0.7.x.  I have no idea where exactly, it works stable for me and alot of +0.7.x.  I have no idea where exactly, it works stable for me and a lot of  other people.  But in case you have problems with the 0.7.x versions you  can give 0.8.x a try ... diff --git a/Documentation/video4linux/bttv/Sound-FAQ b/Documentation/video4linux/bttv/Sound-FAQ index 1e6328f9108..d3f1d7783d1 100644 --- a/Documentation/video4linux/bttv/Sound-FAQ +++ b/Documentation/video4linux/bttv/Sound-FAQ @@ -2,13 +2,13 @@  bttv and sound mini howto  ========================= -There are alot of different bt848/849/878/879 based boards available. +There are a lot of different bt848/849/878/879 based boards available.  Making video work often is not a big deal, because this is handled  completely by the bt8xx chip, which is common on all boards.  But  sound is handled in slightly different ways on each board.  To handle the grabber boards correctly, there is a array tvcards[] in -bttv-cards.c, which holds the informations required for each board. +bttv-cards.c, which holds the information required for each board.  Sound will work only, if the correct entry is used (for video it often  makes no difference).  The bttv driver prints a line to the kernel  log, telling which card type is used.  Like this one: @@ -82,7 +82,7 @@ card installed, you might to check out if you can read these registers  values used by the windows driver.  A tool to do this is available  from ftp://telepresence.dmem.strath.ac.uk/pub/bt848/winutil, but it  does'nt work with bt878 boards according to some reports I received. -Another one with bt878 suport is available from +Another one with bt878 support is available from  http://btwincap.sourceforge.net/Files/btspy2.00.zip  You might also dig around in the *.ini files of the Windows applications. diff --git a/Documentation/video4linux/cpia2_overview.txt b/Documentation/video4linux/cpia2_overview.txt index a6e53665216..ad6adbedfe5 100644 --- a/Documentation/video4linux/cpia2_overview.txt +++ b/Documentation/video4linux/cpia2_overview.txt @@ -35,4 +35,4 @@ the camera.  There are three modes for this.  Block mode requests a number  of contiguous registers.  Random mode reads or writes random registers with  a tuple structure containing address/value pairs.  The repeat mode is only  used by VP4 to load a firmware patch.  It contains a starting address and -a sequence of bytes to be written into a gpio port.
\ No newline at end of file +a sequence of bytes to be written into a gpio port. diff --git a/Documentation/video4linux/et61x251.txt b/Documentation/video4linux/et61x251.txt deleted file mode 100644 index 1247566c4de..00000000000 --- a/Documentation/video4linux/et61x251.txt +++ /dev/null @@ -1,315 +0,0 @@ - -		       ET61X[12]51 PC Camera Controllers -				Driver for Linux -		       ================================= - -			       - Documentation - - - -Index -===== -1.  Copyright -2.  Disclaimer -3.  License -4.  Overview and features -5.  Module dependencies -6.  Module loading -7.  Module parameters -8.  Optional device control through "sysfs" -9.  Supported devices -10. Notes for V4L2 application developers -11. Contact information - - -1. Copyright -============ -Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> - - -2. Disclaimer -============= -Etoms is a trademark of Etoms Electronics Corp. -This software is not developed or sponsored by Etoms Electronics. - - -3. License -========== -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -4. Overview and features -======================== -This driver supports the video interface of the devices mounting the ET61X151 -or ET61X251 PC Camera Controllers. - -It's worth to note that Etoms Electronics has never collaborated with the -author during the development of this project; despite several requests, -Etoms Electronics also refused to release enough detailed specifications of -the video compression engine. - -The driver relies on the Video4Linux2 and USB core modules. It has been -designed to run properly on SMP systems as well. - -The latest version of the ET61X[12]51 driver can be found at the following URL: -http://www.linux-projects.org/ - -Some of the features of the driver are: - -- full compliance with the Video4Linux2 API (see also "Notes for V4L2 -  application developers" paragraph); -- available mmap or read/poll methods for video streaming through isochronous -  data transfers; -- automatic detection of image sensor; -- support for any window resolutions and optional panning within the maximum -  pixel area of image sensor; -- image downscaling with arbitrary scaling factors from 1 and 2 in both -  directions (see "Notes for V4L2 application developers" paragraph); -- two different video formats for uncompressed or compressed data in low or -  high compression quality (see also "Notes for V4L2 application developers" -  paragraph); -- full support for the capabilities of every possible image sensors that can -  be connected to the ET61X[12]51 bridges, including, for instance, red, green, -  blue and global gain adjustments and exposure control (see "Supported -  devices" paragraph for details); -- use of default color settings for sunlight conditions; -- dynamic I/O interface for both ET61X[12]51 and image sensor control (see -  "Optional device control through 'sysfs'" paragraph); -- dynamic driver control thanks to various module parameters (see "Module -  parameters" paragraph); -- up to 64 cameras can be handled at the same time; they can be connected and -  disconnected from the host many times without turning off the computer, if -  the system supports hotplugging; -- no known bugs. - - -5. Module dependencies -====================== -For it to work properly, the driver needs kernel support for Video4Linux and -USB. - -The following options of the kernel configuration file must be enabled and -corresponding modules must be compiled: - -	# Multimedia devices -	# -	CONFIG_VIDEO_DEV=m - -To enable advanced debugging functionality on the device through /sysfs: - -	# Multimedia devices -	# -	CONFIG_VIDEO_ADV_DEBUG=y - -	# USB support -	# -	CONFIG_USB=m - -In addition, depending on the hardware being used, the modules below are -necessary: - -	# USB Host Controller Drivers -	# -	CONFIG_USB_EHCI_HCD=m -	CONFIG_USB_UHCI_HCD=m -	CONFIG_USB_OHCI_HCD=m - -And finally: - -	# USB Multimedia devices -	# -	CONFIG_USB_ET61X251=m - - -6. Module loading -================= -To use the driver, it is necessary to load the "et61x251" module into memory -after every other module required: "videodev", "v4l2_common", "compat_ioctl32", -"usbcore" and, depending on the USB host controller you have, "ehci-hcd", -"uhci-hcd" or "ohci-hcd". - -Loading can be done as shown below: - -	[root@localhost home]# modprobe et61x251 - -At this point the devices should be recognized. You can invoke "dmesg" to -analyze kernel messages and verify that the loading process has gone well: - -	[user@localhost home]$ dmesg - - -7. Module parameters -==================== -Module parameters are listed below: -------------------------------------------------------------------------------- -Name:           video_nr -Type:           short array (min = 0, max = 64) -Syntax:         <-1|n[,...]> -Description:    Specify V4L2 minor mode number: -		-1 = use next available -		 n = use minor number n -		You can specify up to 64 cameras this way. -		For example: -		video_nr=-1,2,-1 would assign minor number 2 to the second -		registered camera and use auto for the first one and for every -		other camera. -Default:        -1 -------------------------------------------------------------------------------- -Name:           force_munmap -Type:           bool array (min = 0, max = 64) -Syntax:         <0|1[,...]> -Description:    Force the application to unmap previously mapped buffer memory -		before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not -		all the applications support this feature. This parameter is -		specific for each detected camera. -		0 = do not force memory unmapping -		1 = force memory unmapping (save memory) -Default:        0 -------------------------------------------------------------------------------- -Name:           frame_timeout -Type:           uint array (min = 0, max = 64) -Syntax:         <n[,...]> -Description:    Timeout for a video frame in seconds. This parameter is -		specific for each detected camera. This parameter can be -		changed at runtime thanks to the /sys filesystem interface. -Default:        2 -------------------------------------------------------------------------------- -Name:           debug -Type:           ushort -Syntax:         <n> -Description:    Debugging information level, from 0 to 3: -		0 = none (use carefully) -		1 = critical errors -		2 = significant informations -		3 = more verbose messages -		Level 3 is useful for testing only, when only one device -		is used at the same time. It also shows some more informations -		about the hardware being detected. This module parameter can be -		changed at runtime thanks to the /sys filesystem interface. -Default:        2 -------------------------------------------------------------------------------- - - -8. Optional device control through "sysfs" -========================================== -If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled, -it is possible to read and write both the ET61X[12]51 and the image sensor -registers by using the "sysfs" filesystem interface. - -There are four files in the /sys/class/video4linux/videoX directory for each -registered camera: "reg", "val", "i2c_reg" and "i2c_val". The first two files -control the ET61X[12]51 bridge, while the other two control the sensor chip. -"reg" and "i2c_reg" hold the values of the current register index where the -following reading/writing operations are addressed at through "val" and -"i2c_val". Their use is not intended for end-users, unless you know what you -are doing. Remember that you must be logged in as root before writing to them. - -As an example, suppose we were to want to read the value contained in the -register number 1 of the sensor register table - which is usually the product -identifier - of the camera registered as "/dev/video0": - -	[root@localhost #] cd /sys/class/video4linux/video0 -	[root@localhost #] echo 1 > i2c_reg -	[root@localhost #] cat i2c_val - -Note that if the sensor registers cannot be read, "cat" will fail. -To avoid race conditions, all the I/O accesses to the files are serialized. - - -9. Supported devices -==================== -None of the names of the companies as well as their products will be mentioned -here. They have never collaborated with the author, so no advertising. - -From the point of view of a driver, what unambiguously identify a device are -its vendor and product USB identifiers. Below is a list of known identifiers of -devices mounting the ET61X[12]51 PC camera controllers: - -Vendor ID  Product ID ----------  ---------- -0x102c     0x6151 -0x102c     0x6251 -0x102c     0x6253 -0x102c     0x6254 -0x102c     0x6255 -0x102c     0x6256 -0x102c     0x6257 -0x102c     0x6258 -0x102c     0x6259 -0x102c     0x625a -0x102c     0x625b -0x102c     0x625c -0x102c     0x625d -0x102c     0x625e -0x102c     0x625f -0x102c     0x6260 -0x102c     0x6261 -0x102c     0x6262 -0x102c     0x6263 -0x102c     0x6264 -0x102c     0x6265 -0x102c     0x6266 -0x102c     0x6267 -0x102c     0x6268 -0x102c     0x6269 - -The following image sensors are supported: - -Model       Manufacturer ------       ------------ -TAS5130D1B  Taiwan Advanced Sensor Corporation - -All the available control settings of each image sensor are supported through -the V4L2 interface. - - -10. Notes for V4L2 application developers -========================================= -This driver follows the V4L2 API specifications. In particular, it enforces two -rules: - -- exactly one I/O method, either "mmap" or "read", is associated with each -file descriptor. Once it is selected, the application must close and reopen the -device to switch to the other I/O method; - -- although it is not mandatory, previously mapped buffer memory should always -be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's. -The same number of buffers as before will be allocated again to match the size -of the new video frames, so you have to map the buffers again before any I/O -attempts on them. - -Consistently with the hardware limits, this driver also supports image -downscaling with arbitrary scaling factors from 1 and 2 in both directions. -However, the V4L2 API specifications don't correctly define how the scaling -factor can be chosen arbitrarily by the "negotiation" of the "source" and -"target" rectangles. To work around this flaw, we have added the convention -that, during the negotiation, whenever the "VIDIOC_S_CROP" ioctl is issued, the -scaling factor is restored to 1. - -This driver supports two different video formats: the first one is the "8-bit -Sequential Bayer" format and can be used to obtain uncompressed video data -from the device through the current I/O method, while the second one provides -"raw" compressed video data (without frame headers not related to the -compressed data). The current compression quality may vary from 0 to 1 and can -be selected or queried thanks to the VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP -V4L2 ioctl's. - - -11. Contact information -======================= -The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. - -GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is -'FCE635A4'; the public 1024-bit key should be available at any keyserver; -the fingerprint is: '88E8 F32F 7244 68BA 3958  5D40 99DA 5D2A FCE6 35A4'. diff --git a/Documentation/video4linux/extract_xc3028.pl b/Documentation/video4linux/extract_xc3028.pl index 47877deae6d..47877deae6d 100644..100755 --- a/Documentation/video4linux/extract_xc3028.pl +++ b/Documentation/video4linux/extract_xc3028.pl diff --git a/Documentation/video4linux/fimc.txt b/Documentation/video4linux/fimc.txt new file mode 100644 index 00000000000..e0c6b8bc474 --- /dev/null +++ b/Documentation/video4linux/fimc.txt @@ -0,0 +1,148 @@ +Samsung S5P/EXYNOS4 FIMC driver + +Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd. +--------------------------------------------------------------------------- + +The FIMC (Fully Interactive Mobile Camera) device available in Samsung +SoC Application Processors is an integrated camera host interface, color +space converter, image resizer and rotator.  It's also capable of capturing +data from LCD controller (FIMD) through the SoC internal writeback data +path.  There are multiple FIMC instances in the SoCs (up to 4), having +slightly different capabilities, like pixel alignment constraints, rotator +availability, LCD writeback support, etc. The driver is located at +drivers/media/platform/exynos4-is directory. + +1. Supported SoCs +================= + +S5PC100 (mem-to-mem only), S5PV210, EXYNOS4210 + +2. Supported features +===================== + + - camera parallel interface capture (ITU-R.BT601/565); + - camera serial interface capture (MIPI-CSI2); + - memory-to-memory processing (color space conversion, scaling, mirror +   and rotation); + - dynamic pipeline re-configuration at runtime (re-attachment of any FIMC +   instance to any parallel video input or any MIPI-CSI front-end); + - runtime PM and system wide suspend/resume + +Not currently supported: + - LCD writeback input + - per frame clock gating (mem-to-mem) + +3. Files partitioning +===================== + +- media device driver +  drivers/media/platform/exynos4-is/media-dev.[ch] + + - camera capture video device driver +  drivers/media/platform/exynos4-is/fimc-capture.c + + - MIPI-CSI2 receiver subdev +  drivers/media/platform/exynos4-is/mipi-csis.[ch] + + - video post-processor (mem-to-mem) +  drivers/media/platform/exynos4-is/fimc-core.c + + - common files +  drivers/media/platform/exynos4-is/fimc-core.h +  drivers/media/platform/exynos4-is/fimc-reg.h +  drivers/media/platform/exynos4-is/regs-fimc.h + +4. User space interfaces +======================== + +4.1. Media device interface + +The driver supports Media Controller API as defined at +http://linuxtv.org/downloads/v4l-dvb-apis/media_common.html +The media device driver name is "SAMSUNG S5P FIMC". + +The purpose of this interface is to allow changing assignment of FIMC instances +to the SoC peripheral camera input at runtime and optionally to control internal +connections of the MIPI-CSIS device(s) to the FIMC entities. + +The media device interface allows to configure the SoC for capturing image +data from the sensor through more than one FIMC instance (e.g. for simultaneous +viewfinder and still capture setup). +Reconfiguration is done by enabling/disabling media links created by the driver +during initialization. The internal device topology can be easily discovered +through media entity and links enumeration. + +4.2. Memory-to-memory video node + +V4L2 memory-to-memory interface at /dev/video? device node.  This is standalone +video device, it has no media pads. However please note the mem-to-mem and +capture video node operation on same FIMC instance is not allowed.  The driver +detects such cases but the applications should prevent them to avoid an +undefined behaviour. + +4.3. Capture video node + +The driver supports V4L2 Video Capture Interface as defined at: +http://linuxtv.org/downloads/v4l-dvb-apis/devices.html + +At the capture and mem-to-mem video nodes only the multi-planar API is +supported. For more details see: +http://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html + +4.4. Camera capture subdevs + +Each FIMC instance exports a sub-device node (/dev/v4l-subdev?), a sub-device +node is also created per each available and enabled at the platform level +MIPI-CSI receiver device (currently up to two). + +4.5. sysfs + +In order to enable more precise camera pipeline control through the sub-device +API the driver creates a sysfs entry associated with "s5p-fimc-md" platform +device. The entry path is: /sys/platform/devices/s5p-fimc-md/subdev_conf_mode. + +In typical use case there could be a following capture pipeline configuration: +sensor subdev -> mipi-csi subdev -> fimc subdev -> video node + +When we configure these devices through sub-device API at user space, the +configuration flow must be from left to right, and the video node is +configured as last one. +When we don't use sub-device user space API the whole configuration of all +devices belonging to the pipeline is done at the video node driver. +The sysfs entry allows to instruct the capture node driver not to configure +the sub-devices (format, crop), to avoid resetting the subdevs' configuration +when the last configuration steps at the video node is performed. + +For full sub-device control support (subdevs configured at user space before +starting streaming): +# echo "sub-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode + +For V4L2 video node control only (subdevs configured internally by the host +driver): +# echo "vid-dev" > /sys/platform/devices/s5p-fimc-md/subdev_conf_mode +This is a default option. + +5. Device mapping to video and subdev device nodes +================================================== + +There are associated two video device nodes with each device instance in +hardware - video capture and mem-to-mem and additionally a subdev node for +more precise FIMC capture subsystem control. In addition a separate v4l2 +sub-device node is created per each MIPI-CSIS device. + +How to find out which /dev/video? or /dev/v4l-subdev? is assigned to which +device? + +You can either grep through the kernel log to find relevant information, i.e. +# dmesg | grep -i fimc +(note that udev, if present, might still have rearranged the video nodes), + +or retrieve the information from /dev/media? with help of the media-ctl tool: +# media-ctl -p + +7. Build +======== + +If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m) +two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and +optional s5p-csis.ko (MIPI-CSI receiver subdev). diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 6a562eeeb4c..d2ba80bb7af 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -8,6 +8,7 @@ xxxx		vend:prod  ----  spca501		0000:0000	MystFromOri Unknown Camera  spca508		0130:0130	Clone Digital Webcam 11043 +zc3xx		03f0:1b07	HP Premium Starter Cam  m5602		0402:5602	ALi Video Camera Controller  spca501		040a:0002	Kodak DVC-325  spca500		040a:0300	Kodak EZ200 @@ -54,6 +55,7 @@ zc3xx		0458:700f	Genius VideoCam Web V2  sonixj		0458:7025	Genius Eye 311Q  sn9c20x		0458:7029	Genius Look 320s  sonixj		0458:702e	Genius Slim 310 NB +sn9c20x		0458:7045	Genius Look 1320 V2  sn9c20x		0458:704a	Genius Slim 1320  sn9c20x		0458:704c	Genius i-Look 1321  sn9c20x		045e:00f4	LifeCam VX-6000 (SN9C20x + OV9650) @@ -103,6 +105,7 @@ spca561		046d:092d	Logitech QC Elch2  spca561		046d:092e	Logitech QC Elch2  spca561		046d:092f	Logitech QuickCam Express Plus  sunplus		046d:0960	Logitech ClickSmart 420 +nw80x		046d:d001	Logitech QuickCam Pro (dark focus ring)  sunplus		0471:0322	Philips DMVC1300K  zc3xx		0471:0325	Philips SPC 200 NC  zc3xx		0471:0326	Philips SPC 300 NC @@ -150,10 +153,12 @@ sunplus		04fc:5330	Digitrex 2110  sunplus		04fc:5360	Sunplus Generic  spca500		04fc:7333	PalmPixDC85  sunplus		04fc:ffff	Pure DigitalDakota +nw80x		0502:d001	DVC V6  spca501		0506:00df	3Com HomeConnect Lite  sunplus		052b:1507	Megapixel 5 Pretec DC-1007  sunplus		052b:1513	Megapix V4  sunplus		052b:1803	MegaImage VI +nw80x		052b:d001	EZCam Pro p35u  tv8532		0545:808b	Veo Stingray  tv8532		0545:8333	Veo Stingray  sunplus		0546:3155	Polaroid PDC3070 @@ -177,6 +182,7 @@ sunplus		055f:c530	Mustek Gsmart LCD 3  sunplus		055f:c540	Gsmart D30  sunplus		055f:c630	Mustek MDC4000  sunplus		055f:c650	Mustek MDC5500Z +nw80x		055f:d001	Mustek Wcam 300 mini  zc3xx		055f:d003	Mustek WCam300A  zc3xx		055f:d004	Mustek WCam300 AN  conex		0572:0041	Creative Notebook cx11646 @@ -184,8 +190,10 @@ ov519		05a9:0511	Video Blaster WebCam 3/WebCam Plus, D-Link USB Digital Video Ca  ov519		05a9:0518	Creative WebCam  ov519		05a9:0519	OV519 Microphone  ov519		05a9:0530	OmniVision +ov534_9		05a9:1550	OmniVision VEHO Filmscanner  ov519		05a9:2800	OmniVision SuperCAM  ov519		05a9:4519	Webcam Classic +ov534_9		05a9:8065	OmniVision test kit ov538+ov9712  ov519		05a9:8519	OmniVision  ov519		05a9:a511	D-Link USB Digital Video Camera  ov519		05a9:a518	D-Link DSB-C310 Webcam @@ -195,14 +203,23 @@ gl860		05e3:0503	Genesys Logic PC Camera  gl860		05e3:f191	Genesys Logic PC Camera  spca561		060b:a001	Maxell Compact Pc PM3  zc3xx		0698:2003	CTX M730V built in +topro		06a2:0003	TP6800 PC Camera, CmoX CX0342 webcam +topro		06a2:6810	Creative Qmax +nw80x		06a5:0000	Typhoon Webcam 100 USB +nw80x		06a5:d001	Divio based webcams +nw80x		06a5:d800	Divio Chicony TwinkleCam, Trust SpaceCam  spca500		06bd:0404	Agfa CL20  spca500		06be:0800	Optimedia +nw80x		06be:d001	EZCam Pro p35u  sunplus		06d6:0031	Trust 610 LCD PowerC@m Zoom  spca506		06e1:a190	ADS Instant VCD +ov534		06f8:3002	Hercules Blog Webcam  ov534_9		06f8:3003	Hercules Dualpix HD Weblog  sonixj		06f8:3004	Hercules Classic Silver  sonixj		06f8:3008	Hercules Deluxe Optical Glass  pac7302		06f8:3009	Hercules Classic Link +pac7302		06f8:301b	Hercules Link +nw80x		0728:d001	AVerMedia Camguard  spca508		0733:0110	ViewQuest VQ110  spca501		0733:0401	Intel Create and Share  spca501		0733:0402	ViewQuest M318B @@ -260,11 +277,14 @@ pac7302		093a:2622	Genius Eye 312  pac7302		093a:2624	PAC7302  pac7302		093a:2625	Genius iSlim 310  pac7302		093a:2626	Labtec 2200 +pac7302		093a:2627	Genius FaceCam 300  pac7302		093a:2628	Genius iLook 300  pac7302		093a:2629	Genious iSlim 300  pac7302		093a:262a	Webcam 300k  pac7302		093a:262c	Philips SPC 230 NC +jl2005bcd	0979:0227	Various brands, 19 known cameras supported  jeilinj		0979:0280	Sakar 57379 +jeilinj		0979:0280	Sportscam DV15  zc3xx		0ac8:0302	Z-star Vimicro zc0302  vc032x		0ac8:0321	Vimicro generic vc0321  vc032x		0ac8:0323	Vimicro Vc0323 @@ -366,6 +386,7 @@ t613		17a1:0128	TASCORP JPEG Webcam, NGS Cyclops  vc032x		17ef:4802	Lenovo Vc0323+MI1310_SOC  pac207		2001:f115	D-Link DSB-C120  sq905c		2770:9050	Disney pix micro (CIF) +sq905c		2770:9051	Lego Bionicle  sq905c		2770:9052	Disney pix micro 2 (VGA)  sq905c		2770:905c	All 11 known cameras with this ID  sq905		2770:9120	All 24 known cameras with this ID diff --git a/Documentation/video4linux/ibmcam.txt b/Documentation/video4linux/ibmcam.txt deleted file mode 100644 index a51055211e6..00000000000 --- a/Documentation/video4linux/ibmcam.txt +++ /dev/null @@ -1,323 +0,0 @@ -README for Linux device driver for the IBM "C-It" USB video camera - -INTRODUCTION: - -This driver does not use all features known to exist in -the IBM camera. However most of needed features work well. - -This driver was developed using logs of observed USB traffic -which was produced by standard Windows driver (c-it98.sys). -I did not have data sheets from Xirlink. - -Video formats: -      128x96  [model 1] -      176x144 -      320x240 [model 2] -      352x240 [model 2] -      352x288 -Frame rate: 3 - 30 frames per second (FPS) -External interface: USB -Internal interface: Video For Linux (V4L) -Supported controls: -- by V4L: Contrast,  Brightness, Color, Hue -- by driver options: frame rate, lighting conditions, video format, -		     default picture settings, sharpness. - -SUPPORTED CAMERAS: - -Xirlink "C-It" camera, also known as "IBM PC Camera". -The device uses proprietary ASIC (and compression method); -it is manufactured by Xirlink. See http://xirlinkwebcam.sourceforge.net,  -http://www.ibmpccamera.com, or http://www.c-itnow.com/ for details and pictures. - -This very chipset ("X Chip", as marked at the factory) -is used in several other cameras, and they are supported -as well: - -- IBM NetCamera -- Veo Stingray - -The Linux driver was developed with camera with following -model number (or FCC ID): KSX-XVP510. This camera has three -interfaces, each with one endpoint (control, iso, iso). This -type of cameras is referred to as "model 1". These cameras are -no longer manufactured. - -Xirlink now manufactures new cameras which are somewhat different. -In particular, following models [FCC ID] belong to that category: - -XVP300 [KSX-X9903] -XVP600 [KSX-X9902] -XVP610 [KSX-X9902] - -(see http://www.xirlink.com/ibmpccamera/ for updates, they refer -to these new cameras by Windows driver dated 12-27-99, v3005 BETA) -These cameras have two interfaces, one endpoint in each (iso, bulk). -Such type of cameras is referred to as "model 2". They are supported -(with exception of 352x288 native mode). - -Some IBM NetCameras (Model 4) are made to generate only compressed -video streams. This is great for performance, but unfortunately -nobody knows how to decompress the stream :-( Therefore, these -cameras are *unsupported* and if you try to use one of those, all -you get is random colored horizontal streaks, not the image! -If you have one of those cameras, you probably should return it -to the store and get something that is supported. - -Tell me more about all that "model" business --------------------------------------------- - -I just invented model numbers to uniquely identify flavors of the -hardware/firmware that were sold. It was very confusing to use -brand names or some other internal numbering schemes. So I found -by experimentation that all Xirlink chipsets fall into four big -classes, and I called them "models". Each model is programmed in -its own way, and each model sends back the video in its own way. - -Quirks of Model 2 cameras: -------------------------- - -Model 2 does not have hardware contrast control. Corresponding V4L -control is implemented in software, which is not very nice to your -CPU, but at least it works. - -This driver provides 352x288 mode by switching the camera into -quasi-352x288 RGB mode (800 Kbits per frame) essentially limiting -this mode to 10 frames per second or less, in ideal conditions on -the bus (USB is shared, after all). The frame rate -has to be programmed very conservatively. Additional concern is that -frame rate depends on brightness setting; therefore the picture can -be good at one brightness and broken at another! I did not want to fix -the frame rate at slowest setting, but I had to move it pretty much down -the scale (so that framerate option barely matters). I also noticed that -camera after first powering up produces frames slightly faster than during -consecutive uses. All this means that if you use 352x288 (which is -default), be warned - you may encounter broken picture on first connect; -try to adjust brightness - brighter image is slower, so USB will be able -to send all data. However if you regularly use Model 2 cameras you may -prefer 176x144 which makes perfectly good I420, with no scaling and -lesser demands on USB (300 Kbits per second, or 26 frames per second). - -Another strange effect of 352x288 mode is the fine vertical grid visible -on some colored surfaces. I am sure it is caused by me not understanding -what the camera is trying to say. Blame trade secrets for that. - -The camera that I had also has a hardware quirk: if disconnected, -it needs few minutes to "relax" before it can be plugged in again -(poorly designed USB processor reset circuit?) - -[Veo Stingray with Product ID 0x800C is also Model 2, but I haven't -observed this particular flaw in it.] - -Model 2 camera can be programmed for very high sensitivity (even starlight -may be enough), this makes it convenient for tinkering with. The driver -code has enough comments to help a programmer to tweak the camera -as s/he feels necessary. - -WHAT YOU NEED: - -- A supported IBM PC (C-it) camera (model 1 or 2) - -- A Linux box with USB support (2.3/2.4; 2.2 w/backport may work) - -- A Video4Linux compatible frame grabber program such as xawtv. - -HOW TO COMPILE THE DRIVER: - -You need to compile the driver only if you are a developer -or if you want to make changes to the code. Most distributions -precompile all modules, so you can go directly to the next -section "HOW TO USE THE DRIVER". - -The ibmcam driver uses usbvideo helper library (module), -so if you are studying the ibmcam code you will be led there. - -The driver itself consists of only one file in usb/ directory: -ibmcam.c. This file is included into the Linux kernel build -process if you configure the kernel for CONFIG_USB_IBMCAM. -Run "make xconfig" and in USB section you will find the IBM -camera driver. Select it, save the configuration and recompile. - -HOW TO USE THE DRIVER: - -I recommend to compile driver as a module. This gives you an -easier access to its configuration. The camera has many more -settings than V4L can operate, so some settings are done using -module options. - -To begin with, on most modern Linux distributions the driver -will be automatically loaded whenever you plug the supported -camera in. Therefore, you don't need to do anything. However -if you want to experiment with some module parameters then -you can load and unload the driver manually, with camera -plugged in or unplugged. - -Typically module is installed with command 'modprobe', like this: - -# modprobe ibmcam framerate=1 - -Alternatively you can use 'insmod' in similar fashion: - -# insmod /lib/modules/2.x.y/usb/ibmcam.o framerate=1 - -Module can be inserted with camera connected or disconnected. - -The driver can have options, though some defaults are provided. - -Driver options: (* indicates that option is model-dependent) - -Name            Type            Range [default] Example ---------------  --------------  --------------  ------------------ -debug           Integer         0-9 [0]         debug=1 -flags           Integer         0-0xFF [0]      flags=0x0d -framerate       Integer         0-6 [2]         framerate=1 -hue_correction  Integer         0-255 [128]     hue_correction=115 -init_brightness Integer         0-255 [128]     init_brightness=100 -init_contrast   Integer         0-255 [192]     init_contrast=200 -init_color      Integer         0-255 [128]     init_color=130 -init_hue        Integer         0-255 [128]     init_hue=115 -lighting        Integer         0-2* [1]        lighting=2 -sharpness       Integer         0-6* [4]        sharpness=3 -size            Integer         0-2* [2]        size=1 - -Options for Model 2 only: - -Name            Type            Range [default] Example ---------------  --------------  --------------  ------------------ -init_model2_rg  Integer         0..255 [0x70]   init_model2_rg=128 -init_model2_rg2 Integer         0..255 [0x2f]   init_model2_rg2=50 -init_model2_sat Integer         0..255 [0x34]   init_model2_sat=65 -init_model2_yb  Integer         0..255 [0xa0]   init_model2_yb=200 - -debug           You don't need this option unless you are a developer. -		If you are a developer then you will see in the code -		what values do what. 0=off. - -flags           This is a bit mask, and you can combine any number of -		bits to produce what you want. Usually you don't want -		any of extra features this option provides: - -		FLAGS_RETRY_VIDIOCSYNC  1  This bit allows to retry failed -					   VIDIOCSYNC ioctls without failing. -					   Will work with xawtv, will not -					   with xrealproducer. Default is -					   not set. -		FLAGS_MONOCHROME        2  Activates monochrome (b/w) mode. -		FLAGS_DISPLAY_HINTS     4  Shows colored pixels which have -					   magic meaning to developers. -		FLAGS_OVERLAY_STATS     8  Shows tiny numbers on screen, -					   useful only for debugging. -		FLAGS_FORCE_TESTPATTERN 16 Shows blue screen with numbers. -		FLAGS_SEPARATE_FRAMES   32 Shows each frame separately, as -					   it was received from the camera. -					   Default (not set) is to mix the -					   preceding frame in to compensate -					   for occasional loss of Isoc data -					   on high frame rates. -		FLAGS_CLEAN_FRAMES      64 Forces "cleanup" of each frame -					   prior to use; relevant only if -					   FLAGS_SEPARATE_FRAMES is set. -					   Default is not to clean frames, -					   this is a little faster but may -					   produce flicker if frame rate is -					   too high and Isoc data gets lost. -		FLAGS_NO_DECODING      128 This flag turns the video stream -					   decoder off, and dumps the raw -					   Isoc data from the camera into -					   the reading process. Useful to -					   developers, but not to users. - -framerate       This setting controls frame rate of the camera. This is -		an approximate setting (in terms of "worst" ... "best") -		because camera changes frame rate depending on amount -		of light available. Setting 0 is slowest, 6 is fastest. -		Beware - fast settings are very demanding and may not -		work well with all video sizes. Be conservative. - -hue_correction  This highly optional setting allows to adjust the -		hue of the image in a way slightly different from -		what usual "hue" control does. Both controls affect -		YUV colorspace: regular "hue" control adjusts only -		U component, and this "hue_correction" option similarly -		adjusts only V component. However usually it is enough -		to tweak only U or V to compensate for colored light or -		color temperature; this option simply allows more -		complicated correction when and if it is necessary. - -init_brightness These settings specify _initial_ values which will be -init_contrast   used to set up the camera. If your V4L application has -init_color      its own controls to adjust the picture then these -init_hue        controls will be used too. These options allow you to -		preconfigure the camera when it gets connected, before -		any V4L application connects to it. Good for webcams. - -init_model2_rg  These initial settings alter color balance of the -init_model2_rg2 camera on hardware level. All four settings may be used -init_model2_sat to tune the camera to specific lighting conditions. These -init_model2_yb  settings only apply to Model 2 cameras. - -lighting        This option selects one of three hardware-defined -		photosensitivity settings of the camera. 0=bright light, -		1=Medium (default), 2=Low light. This setting affects -		frame rate: the dimmer the lighting the lower the frame -		rate (because longer exposition time is needed). The -		Model 2 cameras allow values more than 2 for this option, -		thus enabling extremely high sensitivity at cost of frame -		rate, color saturation and imaging sensor noise. - -sharpness       This option controls smoothing (noise reduction) -		made by camera. Setting 0 is most smooth, setting 6 -		is most sharp. Be aware that CMOS sensor used in the -		camera is pretty noisy, so if you choose 6 you will -		be greeted with "snowy" image. Default is 4. Model 2 -		cameras do not support this feature. - -size            This setting chooses one of several image sizes that are -		supported by this driver. Cameras may support more, but -		it's difficult to reverse-engineer all formats. -		Following video sizes are supported: - -		size=0     128x96  (Model 1 only) -		size=1     160x120 -		size=2     176x144 -		size=3     320x240 (Model 2 only) -		size=4     352x240 (Model 2 only) -		size=5     352x288 -		size=6     640x480 (Model 3 only) - -		The 352x288 is the native size of the Model 1 sensor -		array, so it's the best resolution the camera can -		yield. The best resolution of Model 2 is 176x144, and -		larger images are produced by stretching the bitmap. -		Model 3 has sensor with 640x480 grid, and it works too, -		but the frame rate will be exceptionally low (1-2 FPS); -		it may be still OK for some applications, like security. -		Choose the image size you need. The smaller image can -		support faster frame rate. Default is 352x288. - -For more information and the Troubleshooting FAQ visit this URL: - -		http://www.linux-usb.org/ibmcam/ - -WHAT NEEDS TO BE DONE: - -- The button on the camera is not used. I don't know how to get to it. -  I know now how to read button on Model 2, but what to do with it? - -- Camera reports its status back to the driver; however I don't know -  what returned data means. If camera fails at some initialization -  stage then something should be done, and I don't do that because -  I don't even know that some command failed. This is mostly Model 1 -  concern because Model 2 uses different commands which do not return -  status (and seem to complete successfully every time). - -- Some flavors of Model 4 NetCameras produce only compressed video -  streams, and I don't know how to decode them. - -CREDITS: - -The code is based in no small part on the CPiA driver by Johannes Erdfelt, -Randy Dunlap, and others. Big thanks to them for their pioneering work on that -and the USB stack. - -I also thank John Lightsey for his donation of the Veo Stingray camera. diff --git a/Documentation/video4linux/m5602.txt b/Documentation/video4linux/m5602.txt deleted file mode 100644 index 4450ab13f37..00000000000 --- a/Documentation/video4linux/m5602.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document describes the ALi m5602 bridge connected -to the following supported sensors: -OmniVision OV9650, -Samsung s5k83a, -Samsung s5k4aa, -Micron mt9m111, -Pixel plus PO1030 - -This driver mimics the windows drivers, which have a braindead implementation sending bayer-encoded frames at VGA resolution. -In a perfect world we should be able to reprogram the m5602 and the connected sensor in hardware instead, supporting a range of resolutions and pixelformats - -Anyway, have fun and please report any bugs to m560x-driver-devel@lists.sourceforge.net diff --git a/Documentation/video4linux/meye.txt b/Documentation/video4linux/meye.txt index bf3af5fe558..a051152ea99 100644 --- a/Documentation/video4linux/meye.txt +++ b/Documentation/video4linux/meye.txt @@ -45,8 +45,6 @@ module argument syntax (<param>=<value> when passing the option to the  module or meye.<param>=<value> on the kernel boot line when meye is  statically linked into the kernel). Those options are: -	forcev4l1:	force use of V4L1 API instead of V4L2 -  	gbuffers:	number of capture buffers, default is 2 (32 max)  	gbufsize:	size of each capture buffer, default is 614400 @@ -57,7 +55,7 @@ Module use:  -----------  In order to automatically load the meye module on use, you can put those lines -in your /etc/modprobe.conf file: +in your /etc/modprobe.d/meye.conf file:  	alias char-major-81 videodev  	alias char-major-81-0 meye @@ -79,9 +77,8 @@ Usage:  Private API:  ------------ -	The driver supports frame grabbing with the video4linux API -	(either v4l1 or v4l2), so all video4linux tools (like xawtv) -	should work with this driver. +	The driver supports frame grabbing with the video4linux API, +	so all video4linux tools (like xawtv) should work with this driver.  	Besides the video4linux interface, the driver has a private interface  	for accessing the Motion Eye extended parameters (camera sharpness, @@ -123,7 +120,4 @@ Private API:  Bugs / Todo:  ------------ -	- the driver could be much cleaned up by removing the v4l1 support. -	  However, this means all v4l1-only applications will stop working. -  	- 'motioneye' still uses the meye private v4l1 API extensions. diff --git a/Documentation/video4linux/omap3isp.txt b/Documentation/video4linux/omap3isp.txt new file mode 100644 index 00000000000..b9a9f83b158 --- /dev/null +++ b/Documentation/video4linux/omap3isp.txt @@ -0,0 +1,279 @@ +OMAP 3 Image Signal Processor (ISP) driver + +Copyright (C) 2010 Nokia Corporation +Copyright (C) 2009 Texas Instruments, Inc. + +Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> +	  Sakari Ailus <sakari.ailus@iki.fi> +	  David Cohen <dacohen@gmail.com> + + +Introduction +============ + +This file documents the Texas Instruments OMAP 3 Image Signal Processor (ISP) +driver located under drivers/media/platform/omap3isp. The original driver was +written by Texas Instruments but since that it has been rewritten (twice) at +Nokia. + +The driver has been successfully used on the following versions of OMAP 3: + +	3430 +	3530 +	3630 + +The driver implements V4L2, Media controller and v4l2_subdev interfaces. +Sensor, lens and flash drivers using the v4l2_subdev interface in the kernel +are supported. + + +Split to subdevs +================ + +The OMAP 3 ISP is split into V4L2 subdevs, each of the blocks inside the ISP +having one subdev to represent it. Each of the subdevs provide a V4L2 subdev +interface to userspace. + +	OMAP3 ISP CCP2 +	OMAP3 ISP CSI2a +	OMAP3 ISP CCDC +	OMAP3 ISP preview +	OMAP3 ISP resizer +	OMAP3 ISP AEWB +	OMAP3 ISP AF +	OMAP3 ISP histogram + +Each possible link in the ISP is modelled by a link in the Media controller +interface. For an example program see [2]. + + +Controlling the OMAP 3 ISP +========================== + +In general, the settings given to the OMAP 3 ISP take effect at the beginning +of the following frame. This is done when the module becomes idle during the +vertical blanking period on the sensor. In memory-to-memory operation the pipe +is run one frame at a time. Applying the settings is done between the frames. + +All the blocks in the ISP, excluding the CSI-2 and possibly the CCP2 receiver, +insist on receiving complete frames. Sensors must thus never send the ISP +partial frames. + +Autoidle does have issues with some ISP blocks on the 3430, at least. +Autoidle is only enabled on 3630 when the omap3isp module parameter autoidle +is non-zero. + + +Events +====== + +The OMAP 3 ISP driver does support the V4L2 event interface on CCDC and +statistics (AEWB, AF and histogram) subdevs. + +The CCDC subdev produces V4L2_EVENT_FRAME_SYNC type event on HS_VS +interrupt which is used to signal frame start. Earlier version of this +driver used V4L2_EVENT_OMAP3ISP_HS_VS for this purpose. The event is +triggered exactly when the reception of the first line of the frame starts +in the CCDC module. The event can be subscribed on the CCDC subdev. + +(When using parallel interface one must pay account to correct configuration +of the VS signal polarity. This is automatically correct when using the serial +receivers.) + +Each of the statistics subdevs is able to produce events. An event is +generated whenever a statistics buffer can be dequeued by a user space +application using the VIDIOC_OMAP3ISP_STAT_REQ IOCTL. The events available +are: + +	V4L2_EVENT_OMAP3ISP_AEWB +	V4L2_EVENT_OMAP3ISP_AF +	V4L2_EVENT_OMAP3ISP_HIST + +The type of the event data is struct omap3isp_stat_event_status for these +ioctls. If there is an error calculating the statistics, there will be an +event as usual, but no related statistics buffer. In this case +omap3isp_stat_event_status.buf_err is set to non-zero. + + +Private IOCTLs +============== + +The OMAP 3 ISP driver supports standard V4L2 IOCTLs and controls where +possible and practical. Much of the functions provided by the ISP, however, +does not fall under the standard IOCTLs --- gamma tables and configuration of +statistics collection are examples of such. + +In general, there is a private ioctl for configuring each of the blocks +containing hardware-dependent functions. + +The following private IOCTLs are supported: + +	VIDIOC_OMAP3ISP_CCDC_CFG +	VIDIOC_OMAP3ISP_PRV_CFG +	VIDIOC_OMAP3ISP_AEWB_CFG +	VIDIOC_OMAP3ISP_HIST_CFG +	VIDIOC_OMAP3ISP_AF_CFG +	VIDIOC_OMAP3ISP_STAT_REQ +	VIDIOC_OMAP3ISP_STAT_EN + +The parameter structures used by these ioctls are described in +include/linux/omap3isp.h. The detailed functions of the ISP itself related to +a given ISP block is described in the Technical Reference Manuals (TRMs) --- +see the end of the document for those. + +While it is possible to use the ISP driver without any use of these private +IOCTLs it is not possible to obtain optimal image quality this way. The AEWB, +AF and histogram modules cannot be used without configuring them using the +appropriate private IOCTLs. + + +CCDC and preview block IOCTLs +============================= + +The VIDIOC_OMAP3ISP_CCDC_CFG and VIDIOC_OMAP3ISP_PRV_CFG IOCTLs are used to +configure, enable and disable functions in the CCDC and preview blocks, +respectively. Both IOCTLs control several functions in the blocks they +control. VIDIOC_OMAP3ISP_CCDC_CFG IOCTL accepts a pointer to struct +omap3isp_ccdc_update_config as its argument. Similarly VIDIOC_OMAP3ISP_PRV_CFG +accepts a pointer to struct omap3isp_prev_update_config. The definition of +both structures is available in [1]. + +The update field in the structures tells whether to update the configuration +for the specific function and the flag tells whether to enable or disable the +function. + +The update and flag bit masks accept the following values. Each separate +functions in the CCDC and preview blocks is associated with a flag (either +disable or enable; part of the flag field in the structure) and a pointer to +configuration data for the function. + +Valid values for the update and flag fields are listed here for +VIDIOC_OMAP3ISP_CCDC_CFG. Values may be or'ed to configure more than one +function in the same IOCTL call. + +        OMAP3ISP_CCDC_ALAW +        OMAP3ISP_CCDC_LPF +        OMAP3ISP_CCDC_BLCLAMP +        OMAP3ISP_CCDC_BCOMP +        OMAP3ISP_CCDC_FPC +        OMAP3ISP_CCDC_CULL +        OMAP3ISP_CCDC_CONFIG_LSC +        OMAP3ISP_CCDC_TBL_LSC + +The corresponding values for the VIDIOC_OMAP3ISP_PRV_CFG are here: + +        OMAP3ISP_PREV_LUMAENH +        OMAP3ISP_PREV_INVALAW +        OMAP3ISP_PREV_HRZ_MED +        OMAP3ISP_PREV_CFA +        OMAP3ISP_PREV_CHROMA_SUPP +        OMAP3ISP_PREV_WB +        OMAP3ISP_PREV_BLKADJ +        OMAP3ISP_PREV_RGB2RGB +        OMAP3ISP_PREV_COLOR_CONV +        OMAP3ISP_PREV_YC_LIMIT +        OMAP3ISP_PREV_DEFECT_COR +        OMAP3ISP_PREV_GAMMABYPASS +        OMAP3ISP_PREV_DRK_FRM_CAPTURE +        OMAP3ISP_PREV_DRK_FRM_SUBTRACT +        OMAP3ISP_PREV_LENS_SHADING +        OMAP3ISP_PREV_NF +        OMAP3ISP_PREV_GAMMA + +The associated configuration pointer for the function may not be NULL when +enabling the function. When disabling a function the configuration pointer is +ignored. + + +Statistic blocks IOCTLs +======================= + +The statistics subdevs do offer more dynamic configuration options than the +other subdevs. They can be enabled, disable and reconfigured when the pipeline +is in streaming state. + +The statistics blocks always get the input image data from the CCDC (as the +histogram memory read isn't implemented). The statistics are dequeueable by +the user from the statistics subdev nodes using private IOCTLs. + +The private IOCTLs offered by the AEWB, AF and histogram subdevs are heavily +reflected by the register level interface offered by the ISP hardware. There +are aspects that are purely related to the driver implementation and these are +discussed next. + +VIDIOC_OMAP3ISP_STAT_EN +----------------------- + +This private IOCTL enables/disables a statistic module. If this request is +done before streaming, it will take effect as soon as the pipeline starts to +stream.  If the pipeline is already streaming, it will take effect as soon as +the CCDC becomes idle. + +VIDIOC_OMAP3ISP_AEWB_CFG, VIDIOC_OMAP3ISP_HIST_CFG and VIDIOC_OMAP3ISP_AF_CFG +----------------------------------------------------------------------------- + +Those IOCTLs are used to configure the modules. They require user applications +to have an in-depth knowledge of the hardware. Most of the fields explanation +can be found on OMAP's TRMs. The two following fields common to all the above +configure private IOCTLs require explanation for better understanding as they +are not part of the TRM. + +omap3isp_[h3a_af/h3a_aewb/hist]_config.buf_size: + +The modules handle their buffers internally. The necessary buffer size for the +module's data output depends on the requested configuration. Although the +driver supports reconfiguration while streaming, it does not support a +reconfiguration which requires bigger buffer size than what is already +internally allocated if the module is enabled. It will return -EBUSY on this +case. In order to avoid such condition, either disable/reconfigure/enable the +module or request the necessary buffer size during the first configuration +while the module is disabled. + +The internal buffer size allocation considers the requested configuration's +minimum buffer size and the value set on buf_size field. If buf_size field is +out of [minimum, maximum] buffer size range, it's clamped to fit in there. +The driver then selects the biggest value. The corrected buf_size value is +written back to user application. + +omap3isp_[h3a_af/h3a_aewb/hist]_config.config_counter: + +As the configuration doesn't take effect synchronously to the request, the +driver must provide a way to track this information to provide more accurate +data. After a configuration is requested, the config_counter returned to user +space application will be an unique value associated to that request. When +user application receives an event for buffer availability or when a new +buffer is requested, this config_counter is used to match a buffer data and a +configuration. + +VIDIOC_OMAP3ISP_STAT_REQ +------------------------ + +Send to user space the oldest data available in the internal buffer queue and +discards such buffer afterwards. The field omap3isp_stat_data.frame_number +matches with the video buffer's field_count. + + +Technical reference manuals (TRMs) and other documentation +========================================================== + +OMAP 3430 TRM: +<URL:http://focus.ti.com/pdfs/wtbu/OMAP34xx_ES3.1.x_PUBLIC_TRM_vZM.zip> +Referenced 2011-03-05. + +OMAP 35xx TRM: +<URL:http://www.ti.com/litv/pdf/spruf98o> Referenced 2011-03-05. + +OMAP 3630 TRM: +<URL:http://focus.ti.com/pdfs/wtbu/OMAP36xx_ES1.x_PUBLIC_TRM_vQ.zip> +Referenced 2011-03-05. + +DM 3730 TRM: +<URL:http://www.ti.com/litv/pdf/sprugn4h> Referenced 2011-03-06. + + +References +========== + +[1] include/linux/omap3isp.h + +[2] http://git.ideasonboard.org/?p=media-ctl.git;a=summary diff --git a/Documentation/video4linux/omap4_camera.txt b/Documentation/video4linux/omap4_camera.txt new file mode 100644 index 00000000000..25d9b40a465 --- /dev/null +++ b/Documentation/video4linux/omap4_camera.txt @@ -0,0 +1,60 @@ +                              OMAP4 ISS Driver +                              ================ + +Introduction +------------ + +The OMAP44XX family of chips contains the Imaging SubSystem (a.k.a. ISS), +Which contains several components that can be categorized in 3 big groups: + +- Interfaces (2 Interfaces: CSI2-A & CSI2-B/CCP2) +- ISP (Image Signal Processor) +- SIMCOP (Still Image Coprocessor) + +For more information, please look in [1] for latest version of: +	"OMAP4430 Multimedia Device Silicon Revision 2.x" + +As of Revision AB, the ISS is described in detail in section 8. + +This driver is supporting _only_ the CSI2-A/B interfaces for now. + +It makes use of the Media Controller framework [2], and inherited most of the +code from OMAP3 ISP driver (found under drivers/media/platform/omap3isp/*), +except that it doesn't need an IOMMU now for ISS buffers memory mapping. + +Supports usage of MMAP buffers only (for now). + +Tested platforms +---------------- + +- OMAP4430SDP, w/ ES2.1 GP & SEVM4430-CAM-V1-0 (Contains IMX060 & OV5640, in +  which only the last one is supported, outputting YUV422 frames). + +- TI Blaze MDP, w/ OMAP4430 ES2.2 EMU (Contains 1 IMX060 & 2 OV5650 sensors, in +  which only the OV5650 are supported, outputting RAW10 frames). + +- PandaBoard, Rev. A2, w/ OMAP4430 ES2.1 GP & OV adapter board, tested with +  following sensors: +  * OV5640 +  * OV5650 + +- Tested on mainline kernel: + +	http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary + +  Tag: v3.3 (commit c16fa4f2ad19908a47c63d8fa436a1178438c7e7) + +File list +--------- +drivers/staging/media/omap4iss/ +include/media/omap4iss.h + +References +---------- + +[1] http://focus.ti.com/general/docs/wtbu/wtbudocumentcenter.tsp?navigationId=12037&templateId=6123#62 +[2] http://lwn.net/Articles/420485/ +[3] http://www.spinics.net/lists/linux-media/msg44370.html +-- +Author: Sergio Aguirre <sergio.a.aguirre@gmail.com> +Copyright (C) 2012, Texas Instruments diff --git a/Documentation/video4linux/ov511.txt b/Documentation/video4linux/ov511.txt deleted file mode 100644 index b3326b167ad..00000000000 --- a/Documentation/video4linux/ov511.txt +++ /dev/null @@ -1,288 +0,0 @@ -------------------------------------------------------------------------------- -Readme for Linux device driver for the OmniVision OV511 USB to camera bridge IC -------------------------------------------------------------------------------- - -Author: Mark McClelland -Homepage: http://alpha.dyndns.org/ov511 - -INTRODUCTION: - -This is a driver for the OV511, a USB-only chip used in many "webcam" devices. -Any camera using the OV511/OV511+ and the OV6620/OV7610/20/20AE should work. -Video capture devices that use the Philips SAA7111A decoder also work. It -supports streaming and capture of color or monochrome video via the Video4Linux -API. Most V4L apps are compatible with it. Most resolutions with a width and -height that are a multiple of 8 are supported. - -If you need more information, please visit the OV511 homepage at the above URL. - -WHAT YOU NEED: - -- If you want to help with the development, get the chip's specification docs at -  http://www.ovt.com/omniusbp.html - -- A Video4Linux compatible frame grabber program (I recommend vidcat and xawtv) -    vidcat is part of the w3cam package:  http://mpx.freeshell.net/ -    xawtv is available at:  http://linux.bytesex.org/xawtv/ - -HOW TO USE IT: - -Note: These are simplified instructions. For complete instructions see: -	http://alpha.dyndns.org/ov511/install.html - -You must have first compiled USB support, support for your specific USB host -controller (UHCI or OHCI), and Video4Linux support for your kernel (I recommend -making them modules.) Make sure "Enforce bandwidth allocation" is NOT enabled. - -Next, (as root): - -	modprobe usbcore -	modprobe usb-uhci  <OR>  modprobe usb-ohci -	modprobe videodev -	modprobe ov511 - -If it is not already there (it usually is), create the video device: - -	mknod /dev/video0 c 81 0 - -Optionally, symlink /dev/video to /dev/video0 - -You will have to set permissions on this device to allow you to read/write -from it: - -	chmod 666 /dev/video -	chmod 666 /dev/video0 (if necessary) - -Now you are ready to run a video app! Both vidcat and xawtv work well for me -at 640x480. - -[Using vidcat:] - -	vidcat -s 640x480 -p c > test.jpg -	xview test.jpg - -[Using xawtv:] - -From the main xawtv directory: - -	make clean -	./configure -	make -	make install - -Now you should be able to run xawtv. Right click for the options dialog. - -MODULE PARAMETERS: - -  You can set these with:  insmod ov511 NAME=VALUE -  There is currently no way to set these on a per-camera basis. - -  NAME: autobright -  TYPE: integer (Boolean) -  DEFAULT: 1 -  DESC: Brightness is normally under automatic control and can't be set -	manually by the video app. Set to 0 for manual control. - -  NAME: autogain -  TYPE: integer (Boolean) -  DEFAULT: 1 -  DESC: Auto Gain Control enable. This feature is not yet implemented. - -  NAME: autoexp -  TYPE: integer (Boolean) -  DEFAULT: 1 -  DESC: Auto Exposure Control enable. This feature is not yet implemented. - -  NAME: debug -  TYPE: integer (0-6) -  DEFAULT: 3 -  DESC: Sets the threshold for printing debug messages. The higher the value, -	the more is printed. The levels are cumulative, and are as follows: -	  0=no debug messages -	  1=init/detection/unload and other significant messages -	  2=some warning messages -	  3=config/control function calls -	  4=most function calls and data parsing messages -	  5=highly repetitive mesgs - -  NAME: snapshot -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: Set to 1 to enable snapshot mode. read()/VIDIOCSYNC will block until -	the snapshot button is pressed. Note: enabling this mode disables -	/proc/video/ov511/<minor#>/button - -  NAME: cams -  TYPE: integer (1-4 for OV511, 1-31 for OV511+) -  DEFAULT: 1 -  DESC: Number of cameras allowed to stream simultaneously on a single bus. -	Values higher than 1 reduce the data rate of each camera, allowing two -	or more to be used at once. If you have a complicated setup involving -	both OV511 and OV511+ cameras, trial-and-error may be necessary for -	finding the optimum setting. - -  NAME: compress -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: Set this to 1 to turn on the camera's compression engine. This can -	potentially increase the frame rate at the expense of quality, if you -	have a fast CPU. You must load the proper compression module for your -	camera before starting your application (ov511_decomp or ov518_decomp). - -  NAME: testpat -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: This configures the camera's sensor to transmit a colored test-pattern -	instead of an image. This does not work correctly yet. - -  NAME: dumppix -  TYPE: integer (0-2) -  DEFAULT: 0 -  DESC: Dumps raw pixel data and skips post-processing and format conversion. -	It is for debugging purposes only. Options are: -		0: Disable (default) -		1: Dump raw data from camera, excluding headers and trailers -		2: Dumps data exactly as received from camera - -  NAME: led -  TYPE: integer (0-2) -  DEFAULT: 1 (Always on) -  DESC: Controls whether the LED (the little light) on the front of the camera -	is always off (0), always on (1), or only on when driver is open (2). -	This is not supported with the OV511, and might only work with certain -	cameras (ones that actually have the LED wired to the control pin, and -	not just hard-wired to be on all the time). - -  NAME: dump_bridge -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: Dumps the bridge (OV511[+] or OV518[+]) register values to the system -	log. Only useful for serious debugging/development purposes. - -  NAME: dump_sensor -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: Dumps the sensor register values to the system log. Only useful for -	serious debugging/development purposes. - -  NAME: printph -  TYPE: integer (Boolean) -  DEFAULT: 0 -  DESC: Setting this to 1 will dump the first 12 bytes of each isoc frame. This -	is only useful if you are trying to debug problems with the isoc data -	stream (i.e.: camera initializes, but vidcat hangs until Ctrl-C). Be -	warned that this dumps a large number of messages to your kernel log. - -  NAME: phy, phuv, pvy, pvuv, qhy, qhuv, qvy, qvuv -  TYPE: integer (0-63 for phy and phuv, 0-255 for rest) -  DEFAULT: OV511 default values -  DESC: These are registers 70h - 77h of the OV511, which control the -	prediction ranges and quantization thresholds of the compressor, for -	the Y and UV channels in the horizontal and vertical directions. See -	the OV511 or OV511+ data sheet for more detailed descriptions. These -	normally do not need to be changed. - -  NAME: lightfreq -  TYPE: integer (0, 50, or 60) -  DEFAULT: 0 (use sensor default) -  DESC: Sets the sensor to match your lighting frequency. This can reduce the -	appearance of "banding", i.e. horizontal lines or waves of light and -	dark that are often caused by artificial lighting. Valid values are: -		0 - Use default (depends on sensor, most likely 60 Hz) -		50 - For European and Asian 50 Hz power -		60 - For American 60 Hz power - -  NAME: bandingfilter -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Enables the sensor´s banding filter exposure algorithm. This reduces -	or stabilizes the "banding" caused by some artificial light sources -	(especially fluorescent). You might have to set lightfreq correctly for -	this to work right. As an added bonus, this sometimes makes it -	possible to capture your monitor´s output. - -  NAME: fastset -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Allows picture settings (brightness, contrast, color, and hue) to take -	effect immediately, even in the middle of a frame. This reduces the -	time to change settings, but can ruin frames during the change. Only -	affects OmniVision sensors. - -  NAME: force_palette -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Forces the palette (color format) to a specific value. If an -	application requests a different palette, it will be rejected, thereby -	forcing it to try others until it succeeds. This is useful for forcing -	greyscale mode with a color camera, for example. Supported modes are: -		0                           (Allows all the following formats) -		1   VIDEO_PALETTE_GREY      (Linear greyscale) -		10  VIDEO_PALETTE_YUV420    (YUV 4:2:0 Planar) -		15  VIDEO_PALETTE_YUV420P   (YUV 4:2:0 Planar, same as 10) - -  NAME: backlight -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Setting this flag changes the exposure algorithm for OmniVision sensors -	such that objects in the camera's view (i.e. your head) can be clearly -	seen when they are illuminated from behind. It reduces or eliminates -	the sensor's auto-exposure function, so it should only be used when -	needed. Additionally, it is only supported with the OV6620 and OV7620. - -  NAME: unit_video -  TYPE: Up to 16 comma-separated integers -  DEFAULT: 0,0,0... (automatically assign the next available minor(s)) -  DESC: You can specify up to 16 minor numbers to be assigned to ov511 devices. -	For example, "unit_video=1,3" will make the driver use /dev/video1 and -	/dev/video3 for the first two devices it detects. Additional devices -	will be assigned automatically starting at the first available device -	node (/dev/video0 in this case). Note that you cannot specify 0 as a -	minor number. This feature requires kernel version 2.4.5 or higher. - -  NAME: remove_zeros -  TYPE: integer (Boolean) -  DEFAULT: 0 (do not skip any incoming data) -  DESC: Setting this to 1 will remove zero-padding from incoming data. This -	will compensate for the blocks of corruption that can appear when the -	camera cannot keep up with the speed of the USB bus (eg. at low frame -	resolutions). This feature is always enabled when compression is on. - -  NAME: mirror -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Setting this to 1 will reverse ("mirror") the image horizontally. This -	might be necessary if your camera has a custom lens assembly. This has -	no effect with video capture devices. - -  NAME: ov518_color -  TYPE: integer (Boolean) -  DEFAULT: 0 (off) -  DESC: Enable OV518 color support. This is off by default since it doesn't -	work most of the time. If you want to try it, you must also load -	ov518_decomp with the "nouv=0" parameter. If you get improper colors or -	diagonal lines through the image, restart your video app and try again. -	Repeat as necessary. - -WORKING FEATURES: - o Color streaming/capture at most widths and heights that are multiples of 8. - o Monochrome (use force_palette=1 to enable) - o Setting/getting of saturation, contrast, brightness, and hue (only some of -   them work the OV7620 and OV7620AE) - o /proc status reporting - o SAA7111A video capture support at 320x240 and 640x480 - o Compression support - o SMP compatibility - -HOW TO CONTACT ME: - -You can email me at mark@alpha.dyndns.org . Please prefix the subject line -with "OV511: " so that I am certain to notice your message. - -CREDITS: - -The code is based in no small part on the CPiA driver by Johannes Erdfelt, -Randy Dunlap, and others. Big thanks to them for their pioneering work on that -and the USB stack. Thanks to Bret Wallach for getting camera reg IO, ISOC, and -image capture working. Thanks to Orion Sky Lawlor, Kevin Moore, and Claudio -Matsuoka for their work as well. diff --git a/Documentation/video4linux/pxa_camera.txt b/Documentation/video4linux/pxa_camera.txt index 4f6d0ca0195..51ed1578b0e 100644 --- a/Documentation/video4linux/pxa_camera.txt +++ b/Documentation/video4linux/pxa_camera.txt @@ -84,12 +84,12 @@ DMA usage         transfer is not started. On "End Of Frame" interrupt, the irq handler         starts the DMA chain.       - capture of one videobuffer -       The DMA chain starts transfering data into videobuffer RAM pages. -       When all pages are transfered, the DMA irq is raised on "ENDINTR" status +       The DMA chain starts transferring data into videobuffer RAM pages. +       When all pages are transferred, the DMA irq is raised on "ENDINTR" status       - finishing one videobuffer         The DMA irq handler marks the videobuffer as "done", and removes it from         the active running queue -       Meanwhile, the next videobuffer (if there is one), is transfered by DMA +       Meanwhile, the next videobuffer (if there is one), is transferred by DMA       - finishing the last videobuffer         On the DMA irq of the last videobuffer, the QCI is stopped. @@ -101,7 +101,7 @@ DMA usage       This structure is pointed by dma->sg_cpu.       The descriptors are used as follows : -      - desc-sg[i]: i-th descriptor, transfering the i-th sg +      - desc-sg[i]: i-th descriptor, transferring the i-th sg          element to the video buffer scatter gather        - finisher: has ddadr=DADDR_STOP, dcmd=ENDIRQEN        - linker: has ddadr= desc-sg[0] of next video buffer, dcmd=0 diff --git a/Documentation/video4linux/se401.txt b/Documentation/video4linux/se401.txt deleted file mode 100644 index bd6526ec8dd..00000000000 --- a/Documentation/video4linux/se401.txt +++ /dev/null @@ -1,54 +0,0 @@ -Linux driver for SE401 based USB cameras - -Copyright, 2001, Jeroen Vreeken - - -INTRODUCTION: - -The SE401 chip is the used in low-cost usb webcams. -It is produced by Endpoints Inc. (www.endpoints.com). -It interfaces directly to a cmos image sensor and USB. The only other major -part in a se401 based camera is a dram chip. - -The following cameras are known to work with this driver: - -Aox se401 (non-branded) cameras -Philips PVCV665 USB VGA webcam 'Vesta Fun' -Kensington VideoCAM PC Camera Model 67014 -Kensington VideoCAM PC Camera Model 67015 -Kensington VideoCAM PC Camera Model 67016 -Kensington VideoCAM PC Camera Model 67017 - - -WHAT YOU NEED: - --	USB support --	VIDEO4LINUX support - -More information about USB support for linux can be found at: -http://www.linux-usb.org - - -MODULE OPTIONS: - -When the driver is compiled as a module you can also use the 'flickerless' -option. With it exposure is limited to values that do not interfere with the -net frequency. Valid options for this option are 0, 50 and 60. (0=disable, -50=50hz, 60=60hz) - - -KNOWN PROBLEMS: - -The driver works fine with the usb-ohci and uhci host controller drivers, -the default settings also work with usb-uhci. But sending more than one bulk -transfer at a time with usb-uhci doesn't work yet. -Users of usb-ohci and uhci can safely enlarge SE401_NUMSBUF in se401.h in -order to increase the throughput (and thus framerate). - - -HELP: - -The latest info on this driver can be found at: -http://members.chello.nl/~j.vreeken/se401/ -And questions to me can be send to: -pe1rxq@amsat.org diff --git a/Documentation/video4linux/sh_mobile_ceu_camera.txt b/Documentation/video4linux/sh_mobile_ceu_camera.txt index cb47e723af7..1e96ce6e2d2 100644 --- a/Documentation/video4linux/sh_mobile_ceu_camera.txt +++ b/Documentation/video4linux/sh_mobile_ceu_camera.txt @@ -37,7 +37,7 @@ Generic scaling / cropping scheme  -1'-  In the above chart minuses and slashes represent "real" data amounts, points and -accents represent "useful" data, basically, CEU scaled amd cropped output, +accents represent "useful" data, basically, CEU scaled and cropped output,  mapped back onto the client's source plane.  Such a configuration can be produced by user requests: @@ -65,7 +65,7 @@ Do not touch input rectangle - it is already optimal.  1. Calculate current sensor scales: -	scale_s = ((3') - (3)) / ((2') - (2)) +	scale_s = ((2') - (2)) / ((3') - (3))  2. Calculate "effective" input crop (sensor subwindow) - CEU crop scaled back at  current sensor scales onto input window - this is user S_CROP: @@ -80,7 +80,7 @@ window:  4. Calculate sensor output window by applying combined scales to real input  window: -	width_s_out = ((2') - (2)) / scale_comb +	width_s_out = ((7') - (7)) = ((2') - (2)) / scale_comb  5. Apply iterative sensor S_FMT for sensor output window. diff --git a/Documentation/video4linux/si470x.txt b/Documentation/video4linux/si470x.txt index 3a7823e01b4..98c32925eb3 100644 --- a/Documentation/video4linux/si470x.txt +++ b/Documentation/video4linux/si470x.txt @@ -53,6 +53,9 @@ Testing is usually done with most application under Debian/testing:  - kradio - Comfortable Radio Application for KDE  - radio - ncurses-based radio application  - mplayer - The Ultimate Movie Player For Linux +- v4l2-ctl - Collection of command line video4linux utilities +For example, you can use: +v4l2-ctl -d /dev/radio0 --set-ctrl=volume=10,mute=0 --set-freq=95.21 --all  There is also a library libv4l, which can be used. It's going to have a function  for frequency seeking, either by using hardware functionality as in radio-si470x @@ -75,8 +78,10 @@ commands. Please adjust the audio devices to your needs (/dev/dsp* and hw:x,x).  If you just want to test audio (very poor quality):  cat /dev/dsp1 > /dev/dsp -If you use OSS try: +If you use sox + OSS try:  sox -2 --endian little -r 96000 -t oss /dev/dsp1 -t oss /dev/dsp +or using sox + alsa: +sox --endian little -c 2 -S -r 96000 -t alsa hw:1 -t alsa -r 96000 hw:0  If you use arts try:  arecord -D hw:1,0 -r96000 -c2 -f S16_LE | artsdsp aplay -B - diff --git a/Documentation/video4linux/si476x.txt b/Documentation/video4linux/si476x.txt new file mode 100644 index 00000000000..616607955aa --- /dev/null +++ b/Documentation/video4linux/si476x.txt @@ -0,0 +1,187 @@ +SI476x Driver Readme +------------------------------------------------ +	Copyright (C) 2013 Andrey Smirnov <andrew.smirnov@gmail.com> + +TODO for the driver +------------------------------ + +- According to the SiLabs' datasheet it is possible to update the +  firmware of the radio chip in the run-time, thus bringing it to the +  most recent version. Unfortunately I couldn't find any mentioning of +  the said firmware update for the old chips that I tested the driver +  against, so for chips like that the driver only exposes the old +  functionality. + + +Parameters exposed over debugfs +------------------------------- +SI476x allow user to get multiple characteristics that can be very +useful for EoL testing/RF performance estimation, parameters that have +very little to do with V4L2 subsystem. Such parameters are exposed via +debugfs and can be accessed via regular file I/O operations. + +The drivers exposes following files: + +* /sys/kernel/debug/<device-name>/acf +  This file contains ACF(Automatically Controlled Features) status +  information. The contents of the file is binary data of the +  following layout: + +  Offset	| Name		| Description +  ==================================================================== +  0x00		| blend_int	| Flag, set when stereo separation has +  		|  		| crossed below the blend threshold +  -------------------------------------------------------------------- +  0x01		| hblend_int	| Flag, set when HiBlend cutoff +  		| 		| frequency is lower than threshold +  -------------------------------------------------------------------- +  0x02		| hicut_int	| Flag, set when HiCut cutoff +  		| 		| frequency is lower than threshold +  -------------------------------------------------------------------- +  0x03		| chbw_int	| Flag, set when channel filter +  		| 		| bandwidth is less than threshold +  -------------------------------------------------------------------- +  0x04		| softmute_int	| Flag indicating that softmute +  		| 		| attenuation has increased above +		|		| softmute threshold +  -------------------------------------------------------------------- +  0x05		| smute		| 0 - Audio is not soft muted +  		| 		| 1 - Audio is soft muted +  -------------------------------------------------------------------- +  0x06		| smattn	| Soft mute attenuation level in dB +  -------------------------------------------------------------------- +  0x07		| chbw		| Channel filter bandwidth in kHz +  -------------------------------------------------------------------- +  0x08		| hicut		| HiCut cutoff frequency in units of +  		| 		| 100Hz +  -------------------------------------------------------------------- +  0x09		| hiblend	| HiBlend cutoff frequency in units +  		| 		| of 100 Hz +  -------------------------------------------------------------------- +  0x10		| pilot		| 0 - Stereo pilot is not present +  		| 		| 1 - Stereo pilot is present +  -------------------------------------------------------------------- +  0x11		| stblend	| Stereo blend in % +  -------------------------------------------------------------------- + + +* /sys/kernel/debug/<device-name>/rds_blckcnt +  This file contains statistics about RDS receptions. It's binary data +  has the following layout: + +  Offset	| Name		| Description +  ==================================================================== +  0x00		| expected	| Number of expected RDS blocks +  -------------------------------------------------------------------- +  0x02		| received	| Number of received RDS blocks +  -------------------------------------------------------------------- +  0x04		| uncorrectable	| Number of uncorrectable RDS blocks +  -------------------------------------------------------------------- + +* /sys/kernel/debug/<device-name>/agc +  This file contains information about parameters pertaining to +  AGC(Automatic Gain Control) + +  The layout is: +  Offset	| Name		| Description +  ==================================================================== +  0x00		| mxhi		| 0 - FM Mixer PD high threshold is +  		| 		| not tripped +		|		| 1 - FM Mixer PD high threshold is +		|		| tripped +  -------------------------------------------------------------------- +  0x01		| mxlo		| ditto for FM Mixer PD low +  -------------------------------------------------------------------- +  0x02		| lnahi		| ditto for FM LNA PD high +  -------------------------------------------------------------------- +  0x03		| lnalo		| ditto for FM LNA PD low +  -------------------------------------------------------------------- +  0x04		| fmagc1	| FMAGC1 attenuator resistance +  		| 		| (see datasheet for more detail) +  -------------------------------------------------------------------- +  0x05		| fmagc2	| ditto for FMAGC2 +  -------------------------------------------------------------------- +  0x06		| pgagain	| PGA gain in dB +  -------------------------------------------------------------------- +  0x07		| fmwblang	| FM/WB LNA Gain in dB +  -------------------------------------------------------------------- + +* /sys/kernel/debug/<device-name>/rsq +  This file contains information about parameters pertaining to +  RSQ(Received Signal Quality) + +  The layout is: +  Offset	| Name		| Description +  ==================================================================== +  0x00		| multhint	| 0 - multipath value has not crossed +  		| 		| the Multipath high threshold +		|		| 1 - multipath value has crossed +  		| 		| the Multipath high threshold +  -------------------------------------------------------------------- +  0x01		| multlint	| ditto for Multipath low threshold +  -------------------------------------------------------------------- +  0x02		| snrhint	| 0 - received signal's SNR has not +  		| 		| crossed high threshold +		|		| 1 - received signal's SNR has +  		| 		| crossed high threshold +  -------------------------------------------------------------------- +  0x03		| snrlint	| ditto for low threshold +  -------------------------------------------------------------------- +  0x04		| rssihint	| ditto for RSSI high threshold +  -------------------------------------------------------------------- +  0x05		| rssilint	| ditto for RSSI low threshold +  -------------------------------------------------------------------- +  0x06		| bltf		| Flag indicating if seek command +  		| 		| reached/wrapped seek band limit +  -------------------------------------------------------------------- +  0x07		| snr_ready	| Indicates that SNR metrics is ready +  -------------------------------------------------------------------- +  0x08		| rssiready	| ditto for RSSI metrics +  -------------------------------------------------------------------- +  0x09		| injside	| 0 - Low-side injection is being used +  		| 		| 1 - High-side injection is used +  -------------------------------------------------------------------- +  0x10		| afcrl		| Flag indicating if AFC rails +  -------------------------------------------------------------------- +  0x11		| valid		| Flag indicating if channel is valid +  -------------------------------------------------------------------- +  0x12		| readfreq	| Current tuned frequency +  -------------------------------------------------------------------- +  0x14		| freqoff	| Signed frequency offset in units of +  		| 		| 2ppm +  -------------------------------------------------------------------- +  0x15		| rssi		| Signed value of RSSI in dBuV +  -------------------------------------------------------------------- +  0x16		| snr		| Signed RF SNR in dB +  -------------------------------------------------------------------- +  0x17		| issi		| Signed Image Strength Signal +  		| 		| indicator +  -------------------------------------------------------------------- +  0x18		| lassi		| Signed Low side adjacent Channel +  		| 		| Strength indicator +  -------------------------------------------------------------------- +  0x19		| hassi		| ditto fpr High side +  -------------------------------------------------------------------- +  0x20		| mult		| Multipath indicator +  -------------------------------------------------------------------- +  0x21		| dev		| Frequency deviation +  -------------------------------------------------------------------- +  0x24		| assi		| Adjacent channel SSI +  -------------------------------------------------------------------- +  0x25		| usn		| Ultrasonic noise indicator +  -------------------------------------------------------------------- +  0x26		| pilotdev	| Pilot deviation in units of 100 Hz +  -------------------------------------------------------------------- +  0x27		| rdsdev	| ditto for RDS +  -------------------------------------------------------------------- +  0x28		| assidev	| ditto for ASSI +  -------------------------------------------------------------------- +  0x29		| strongdev	| Frequency deviation +  -------------------------------------------------------------------- +  0x30		| rdspi		| RDS PI code +  -------------------------------------------------------------------- + +* /sys/kernel/debug/<device-name>/rsq_primary +  This file contains information about parameters pertaining to +  RSQ(Received Signal Quality) for primary tuner only. Layout is as +  the one above. diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt deleted file mode 100644 index 73de4050d63..00000000000 --- a/Documentation/video4linux/sn9c102.txt +++ /dev/null @@ -1,592 +0,0 @@ - -			 SN9C1xx PC Camera Controllers -				Driver for Linux -			 ============================= - -			       - Documentation - - - -Index -===== -1.  Copyright -2.  Disclaimer -3.  License -4.  Overview and features -5.  Module dependencies -6.  Module loading -7.  Module parameters -8.  Optional device control through "sysfs" -9.  Supported devices -10. Notes for V4L2 application developers -11. Video frame formats -12. Contact information -13. Credits - - -1. Copyright -============ -Copyright (C) 2004-2007 by Luca Risolia <luca.risolia@studio.unibo.it> - - -2. Disclaimer -============= -SONiX is a trademark of SONiX Technology Company Limited, inc. -This software is not sponsored or developed by SONiX. - - -3. License -========== -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -4. Overview and features -======================== -This driver attempts to support the video interface of the devices assembling -the SONiX SN9C101, SN9C102, SN9C103, SN9C105 and SN9C120 PC Camera Controllers -("SN9C1xx" from now on). - -The driver relies on the Video4Linux2 and USB core modules. It has been -designed to run properly on SMP systems as well. - -The latest version of the SN9C1xx driver can be found at the following URL: -http://www.linux-projects.org/ - -Some of the features of the driver are: - -- full compliance with the Video4Linux2 API (see also "Notes for V4L2 -  application developers" paragraph); -- available mmap or read/poll methods for video streaming through isochronous -  data transfers; -- automatic detection of image sensor; -- support for built-in microphone interface; -- support for any window resolutions and optional panning within the maximum -  pixel area of image sensor; -- image downscaling with arbitrary scaling factors from 1, 2 and 4 in both -  directions (see "Notes for V4L2 application developers" paragraph); -- two different video formats for uncompressed or compressed data in low or -  high compression quality (see also "Notes for V4L2 application developers" -  and "Video frame formats" paragraphs); -- full support for the capabilities of many of the possible image sensors that -  can be connected to the SN9C1xx bridges, including, for instance, red, green, -  blue and global gain adjustments and exposure (see "Supported devices" -  paragraph for details); -- use of default color settings for sunlight conditions; -- dynamic I/O interface for both SN9C1xx and image sensor control and -  monitoring (see "Optional device control through 'sysfs'" paragraph); -- dynamic driver control thanks to various module parameters (see "Module -  parameters" paragraph); -- up to 64 cameras can be handled at the same time; they can be connected and -  disconnected from the host many times without turning off the computer, if -  the system supports hotplugging; -- no known bugs. - - -5. Module dependencies -====================== -For it to work properly, the driver needs kernel support for Video4Linux and -USB. - -The following options of the kernel configuration file must be enabled and -corresponding modules must be compiled: - -	# Multimedia devices -	# -	CONFIG_VIDEO_DEV=m - -To enable advanced debugging functionality on the device through /sysfs: - -	# Multimedia devices -	# -	CONFIG_VIDEO_ADV_DEBUG=y - -	# USB support -	# -	CONFIG_USB=m - -In addition, depending on the hardware being used, the modules below are -necessary: - -	# USB Host Controller Drivers -	# -	CONFIG_USB_EHCI_HCD=m -	CONFIG_USB_UHCI_HCD=m -	CONFIG_USB_OHCI_HCD=m - -The SN9C103, SN9c105 and SN9C120 controllers also provide a built-in microphone -interface. It is supported by the USB Audio driver thanks to the ALSA API: - -	# Sound -	# -	CONFIG_SOUND=y - -	# Advanced Linux Sound Architecture -	# -	CONFIG_SND=m - -	# USB devices -	# -	CONFIG_SND_USB_AUDIO=m - -And finally: - -	# USB Multimedia devices -	# -	CONFIG_USB_SN9C102=m - - -6. Module loading -================= -To use the driver, it is necessary to load the "sn9c102" module into memory -after every other module required: "videodev", "v4l2_common", "compat_ioctl32", -"usbcore" and, depending on the USB host controller you have, "ehci-hcd", -"uhci-hcd" or "ohci-hcd". - -Loading can be done as shown below: - -	[root@localhost home]# modprobe sn9c102 - -Note that the module is called "sn9c102" for historic reasons, although it -does not just support the SN9C102. - -At this point all the devices supported by the driver and connected to the USB -ports should be recognized. You can invoke "dmesg" to analyze kernel messages -and verify that the loading process has gone well: - -	[user@localhost home]$ dmesg - -or, to isolate all the kernel messages generated by the driver: - -	[user@localhost home]$ dmesg | grep sn9c102 - - -7. Module parameters -==================== -Module parameters are listed below: -------------------------------------------------------------------------------- -Name:           video_nr -Type:           short array (min = 0, max = 64) -Syntax:         <-1|n[,...]> -Description:    Specify V4L2 minor mode number: -		-1 = use next available -		 n = use minor number n -		You can specify up to 64 cameras this way. -		For example: -		video_nr=-1,2,-1 would assign minor number 2 to the second -		recognized camera and use auto for the first one and for every -		other camera. -Default:        -1 -------------------------------------------------------------------------------- -Name:           force_munmap -Type:           bool array (min = 0, max = 64) -Syntax:         <0|1[,...]> -Description:    Force the application to unmap previously mapped buffer memory -		before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not -		all the applications support this feature. This parameter is -		specific for each detected camera. -		0 = do not force memory unmapping -		1 = force memory unmapping (save memory) -Default:        0 -------------------------------------------------------------------------------- -Name:           frame_timeout -Type:           uint array (min = 0, max = 64) -Syntax:         <0|n[,...]> -Description:    Timeout for a video frame in seconds before returning an I/O -		error; 0 for infinity. This parameter is specific for each -		detected camera and can be changed at runtime thanks to the -		/sys filesystem interface. -Default:        2 -------------------------------------------------------------------------------- -Name:           debug -Type:           ushort -Syntax:         <n> -Description:    Debugging information level, from 0 to 3: -		0 = none (use carefully) -		1 = critical errors -		2 = significant informations -		3 = more verbose messages -		Level 3 is useful for testing only. It also shows some more -		informations about the hardware being detected. -		This parameter can be changed at runtime thanks to the /sys -		filesystem interface. -Default:        2 -------------------------------------------------------------------------------- - - -8. Optional device control through "sysfs" [1] -========================================== -If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled, -it is possible to read and write both the SN9C1xx and the image sensor -registers by using the "sysfs" filesystem interface. - -Every time a supported device is recognized, a write-only file named "green" is -created in the /sys/class/video4linux/videoX directory. You can set the green -channel's gain by writing the desired value to it. The value may range from 0 -to 15 for the SN9C101 or SN9C102 bridges, from 0 to 127 for the SN9C103, -SN9C105 and SN9C120 bridges. -Similarly, only for the SN9C103, SN9C105 and SN9C120 controllers, blue and red -gain control files are available in the same directory, for which accepted -values may range from 0 to 127. - -There are other four entries in the directory above for each registered camera: -"reg", "val", "i2c_reg" and "i2c_val". The first two files control the -SN9C1xx bridge, while the other two control the sensor chip. "reg" and -"i2c_reg" hold the values of the current register index where the following -reading/writing operations are addressed at through "val" and "i2c_val". Their -use is not intended for end-users. Note that "i2c_reg" and "i2c_val" will not -be created if the sensor does not actually support the standard I2C protocol or -its registers are not 8-bit long. Also, remember that you must be logged in as -root before writing to them. - -As an example, suppose we were to want to read the value contained in the -register number 1 of the sensor register table - which is usually the product -identifier - of the camera registered as "/dev/video0": - -	[root@localhost #] cd /sys/class/video4linux/video0 -	[root@localhost #] echo 1 > i2c_reg -	[root@localhost #] cat i2c_val - -Note that "cat" will fail if sensor registers cannot be read. - -Now let's set the green gain's register of the SN9C101 or SN9C102 chips to 2: - -	[root@localhost #] echo 0x11 > reg -	[root@localhost #] echo 2 > val - -Note that the SN9C1xx always returns 0 when some of its registers are read. -To avoid race conditions, all the I/O accesses to the above files are -serialized. -The sysfs interface also provides the "frame_header" entry, which exports the -frame header of the most recent requested and captured video frame. The header -is always 18-bytes long and is appended to every video frame by the SN9C1xx -controllers. As an example, this additional information can be used by the user -application for implementing auto-exposure features via software. - -The following table describes the frame header exported by the SN9C101 and -SN9C102: - -Byte #  Value or bits Description -------  ------------- ----------- -0x00    0xFF          Frame synchronisation pattern -0x01    0xFF          Frame synchronisation pattern -0x02    0x00          Frame synchronisation pattern -0x03    0xC4          Frame synchronisation pattern -0x04    0xC4          Frame synchronisation pattern -0x05    0x96          Frame synchronisation pattern -0x06    [3:0]         Read channel gain control = (1+R_GAIN/8) -	[7:4]         Blue channel gain control = (1+B_GAIN/8) -0x07    [ 0 ]         Compression mode. 0=No compression, 1=Compression enabled -	[2:1]         Maximum scale factor for compression -	[ 3 ]         1 = USB fifo(2K bytes) is full -	[ 4 ]         1 = Digital gain is finish -	[ 5 ]         1 = Exposure is finish -	[7:6]         Frame index -0x08    [7:0]         Y sum inside Auto-Exposure area (low-byte) -0x09    [7:0]         Y sum inside Auto-Exposure area (high-byte) -		      where Y sum = (R/4 + 5G/16 + B/8) / 32 -0x0A    [7:0]         Y sum outside Auto-Exposure area (low-byte) -0x0B    [7:0]         Y sum outside Auto-Exposure area (high-byte) -		      where Y sum = (R/4 + 5G/16 + B/8) / 128 -0x0C    0xXX          Not used -0x0D    0xXX          Not used -0x0E    0xXX          Not used -0x0F    0xXX          Not used -0x10    0xXX          Not used -0x11    0xXX          Not used - -The following table describes the frame header exported by the SN9C103: - -Byte #  Value or bits Description -------  ------------- ----------- -0x00    0xFF          Frame synchronisation pattern -0x01    0xFF          Frame synchronisation pattern -0x02    0x00          Frame synchronisation pattern -0x03    0xC4          Frame synchronisation pattern -0x04    0xC4          Frame synchronisation pattern -0x05    0x96          Frame synchronisation pattern -0x06    [6:0]         Read channel gain control = (1/2+R_GAIN/64) -0x07    [6:0]         Blue channel gain control = (1/2+B_GAIN/64) -	[7:4] -0x08    [ 0 ]         Compression mode. 0=No compression, 1=Compression enabled -	[2:1]         Maximum scale factor for compression -	[ 3 ]         1 = USB fifo(2K bytes) is full -	[ 4 ]         1 = Digital gain is finish -	[ 5 ]         1 = Exposure is finish -	[7:6]         Frame index -0x09    [7:0]         Y sum inside Auto-Exposure area (low-byte) -0x0A    [7:0]         Y sum inside Auto-Exposure area (high-byte) -		      where Y sum = (R/4 + 5G/16 + B/8) / 32 -0x0B    [7:0]         Y sum outside Auto-Exposure area (low-byte) -0x0C    [7:0]         Y sum outside Auto-Exposure area (high-byte) -		      where Y sum = (R/4 + 5G/16 + B/8) / 128 -0x0D    [1:0]         Audio frame number -	[ 2 ]         1 = Audio is recording -0x0E    [7:0]         Audio summation (low-byte) -0x0F    [7:0]         Audio summation (high-byte) -0x10    [7:0]         Audio sample count -0x11    [7:0]         Audio peak data in audio frame - -The AE area (sx, sy, ex, ey) in the active window can be set by programming the -registers 0x1c, 0x1d, 0x1e and 0x1f of the SN9C1xx controllers, where one unit -corresponds to 32 pixels. - -[1] The frame headers exported by the SN9C105 and SN9C120 are not described. - - -9. Supported devices -==================== -None of the names of the companies as well as their products will be mentioned -here. They have never collaborated with the author, so no advertising. - -From the point of view of a driver, what unambiguously identify a device are -its vendor and product USB identifiers. Below is a list of known identifiers of -devices assembling the SN9C1xx PC camera controllers: - -Vendor ID  Product ID ----------  ---------- -0x0458     0x7025 -0x045e     0x00f5 -0x045e     0x00f7 -0x0471     0x0327 -0x0471     0x0328 -0x0c45     0x6001 -0x0c45     0x6005 -0x0c45     0x6007 -0x0c45     0x6009 -0x0c45     0x600d -0x0c45     0x6011 -0x0c45     0x6019 -0x0c45     0x6024 -0x0c45     0x6025 -0x0c45     0x6028 -0x0c45     0x6029 -0x0c45     0x602a -0x0c45     0x602b -0x0c45     0x602c -0x0c45     0x602d -0x0c45     0x602e -0x0c45     0x6030 -0x0c45     0x603f -0x0c45     0x6080 -0x0c45     0x6082 -0x0c45     0x6083 -0x0c45     0x6088 -0x0c45     0x608a -0x0c45     0x608b -0x0c45     0x608c -0x0c45     0x608e -0x0c45     0x608f -0x0c45     0x60a0 -0x0c45     0x60a2 -0x0c45     0x60a3 -0x0c45     0x60a8 -0x0c45     0x60aa -0x0c45     0x60ab -0x0c45     0x60ac -0x0c45     0x60ae -0x0c45     0x60af -0x0c45     0x60b0 -0x0c45     0x60b2 -0x0c45     0x60b3 -0x0c45     0x60b8 -0x0c45     0x60ba -0x0c45     0x60bb -0x0c45     0x60bc -0x0c45     0x60be -0x0c45     0x60c0 -0x0c45     0x60c2 -0x0c45     0x60c8 -0x0c45     0x60cc -0x0c45     0x60ea -0x0c45     0x60ec -0x0c45     0x60ef -0x0c45     0x60fa -0x0c45     0x60fb -0x0c45     0x60fc -0x0c45     0x60fe -0x0c45     0x6102 -0x0c45     0x6108 -0x0c45     0x610f -0x0c45     0x6130 -0x0c45     0x6138 -0x0c45     0x613a -0x0c45     0x613b -0x0c45     0x613c -0x0c45     0x613e - -The list above does not imply that all those devices work with this driver: up -until now only the ones that assemble the following pairs of SN9C1xx bridges -and image sensors are supported; kernel messages will always tell you whether -this is the case (see "Module loading" paragraph): - -Image sensor / SN9C1xx bridge      | SN9C10[12]  SN9C103  SN9C105  SN9C120 -------------------------------------------------------------------------------- -HV7131D    Hynix Semiconductor     | Yes         No       No       No -HV7131R    Hynix Semiconductor     | No          Yes      Yes      Yes -MI-0343    Micron Technology       | Yes         No       No       No -MI-0360    Micron Technology       | No          Yes      Yes      Yes -OV7630     OmniVision Technologies | Yes         Yes      Yes      Yes -OV7660     OmniVision Technologies | No          No       Yes      Yes -PAS106B    PixArt Imaging          | Yes         No       No       No -PAS202B    PixArt Imaging          | Yes         Yes      No       No -TAS5110C1B Taiwan Advanced Sensor  | Yes         No       No       No -TAS5110D   Taiwan Advanced Sensor  | Yes         No       No       No -TAS5130D1B Taiwan Advanced Sensor  | Yes         No       No       No - -"Yes" means that the pair is supported by the driver, while "No" means that the -pair does not exist or is not supported by the driver. - -Only some of the available control settings of each image sensor are supported -through the V4L2 interface. - -Donations of new models for further testing and support would be much -appreciated. Non-available hardware will not be supported by the author of this -driver. - - -10. Notes for V4L2 application developers -========================================= -This driver follows the V4L2 API specifications. In particular, it enforces two -rules: - -- exactly one I/O method, either "mmap" or "read", is associated with each -file descriptor. Once it is selected, the application must close and reopen the -device to switch to the other I/O method; - -- although it is not mandatory, previously mapped buffer memory should always -be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's. -The same number of buffers as before will be allocated again to match the size -of the new video frames, so you have to map the buffers again before any I/O -attempts on them. - -Consistently with the hardware limits, this driver also supports image -downscaling with arbitrary scaling factors from 1, 2 and 4 in both directions. -However, the V4L2 API specifications don't correctly define how the scaling -factor can be chosen arbitrarily by the "negotiation" of the "source" and -"target" rectangles. To work around this flaw, we have added the convention -that, during the negotiation, whenever the "VIDIOC_S_CROP" ioctl is issued, the -scaling factor is restored to 1. - -This driver supports two different video formats: the first one is the "8-bit -Sequential Bayer" format and can be used to obtain uncompressed video data -from the device through the current I/O method, while the second one provides -either "raw" compressed video data (without frame headers not related to the -compressed data) or standard JPEG (with frame headers). The compression quality -may vary from 0 to 1 and can be selected or queried thanks to the -VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP V4L2 ioctl's. For maximum flexibility, -both the default active video format and the default compression quality -depend on how the image sensor being used is initialized. - - -11. Video frame formats [1] -======================= -The SN9C1xx PC Camera Controllers can send images in two possible video -formats over the USB: either native "Sequential RGB Bayer" or compressed. -The compression is used to achieve high frame rates. With regard to the -SN9C101, SN9C102 and SN9C103, the compression is based on the Huffman encoding -algorithm described below, while with regard to the SN9C105 and SN9C120 the -compression is based on the JPEG standard. -The current video format may be selected or queried from the user application -by calling the VIDIOC_S_FMT or VIDIOC_G_FMT ioctl's, as described in the V4L2 -API specifications. - -The name "Sequential Bayer" indicates the organization of the red, green and -blue pixels in one video frame. Each pixel is associated with a 8-bit long -value and is disposed in memory according to the pattern shown below: - -B[0]   G[1]    B[2]    G[3]    ...   B[m-2]         G[m-1] -G[m]   R[m+1]  G[m+2]  R[m+2]  ...   G[2m-2]        R[2m-1] -... -...                                  B[(n-1)(m-2)]  G[(n-1)(m-1)] -...                                  G[n(m-2)]      R[n(m-1)] - -The above matrix also represents the sequential or progressive read-out mode of -the (n, m) Bayer color filter array used in many CCD or CMOS image sensors. - -The Huffman compressed video frame consists of a bitstream that encodes for -every R, G, or B pixel the difference between the value of the pixel itself and -some reference pixel value. Pixels are organised in the Bayer pattern and the -Bayer sub-pixels are tracked individually and alternatingly. For example, in -the first line values for the B and G1 pixels are alternatingly encoded, while -in the second line values for the G2 and R pixels are alternatingly encoded. - -The pixel reference value is calculated as follows: -- the 4 top left pixels are encoded in raw uncompressed 8-bit format; -- the value in the top two rows is the value of the pixel left of the current -  pixel; -- the value in the left column is the value of the pixel above the current -  pixel; -- for all other pixels, the reference value is the average of the value of the -  pixel on the left and the value of the pixel above the current pixel; -- there is one code in the bitstream that specifies the value of a pixel -  directly (in 4-bit resolution); -- pixel values need to be clamped inside the range [0..255] for proper -  decoding. - -The algorithm purely describes the conversion from compressed Bayer code used -in the SN9C101, SN9C102 and SN9C103 chips to uncompressed Bayer. Additional -steps are required to convert this to a color image (i.e. a color interpolation -algorithm). - -The following Huffman codes have been found: -0: +0 (relative to reference pixel value) -100: +4 -101: -4? -1110xxxx: set absolute value to xxxx.0000 -1101: +11 -1111: -11 -11001: +20 -110000: -20 -110001: ??? - these codes are apparently not used - -[1] The Huffman compression algorithm has been reverse-engineered and -    documented by Bertrik Sikken. - - -12. Contact information -======================= -The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. - -GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is -'FCE635A4'; the public 1024-bit key should be available at any keyserver; -the fingerprint is: '88E8 F32F 7244 68BA 3958  5D40 99DA 5D2A FCE6 35A4'. - - -13. Credits -=========== -Many thanks to following persons for their contribute (listed in alphabetical -order): - -- David Anderson for the donation of a webcam; -- Luca Capello for the donation of a webcam; -- Philippe Coval for having helped testing the PAS202BCA image sensor; -- Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the -  donation of a webcam; -- Dennis Heitmann for the donation of a webcam; -- Jon Hollstrom for the donation of a webcam; -- Nick McGill for the donation of a webcam; -- Carlos Eduardo Medaglia Dyonisio, who added the support for the PAS202BCB -  image sensor; -- Stefano Mozzi, who donated 45 EU; -- Andrew Pearce for the donation of a webcam; -- John Pullan for the donation of a webcam; -- Bertrik Sikken, who reverse-engineered and documented the Huffman compression -  algorithm used in the SN9C101, SN9C102 and SN9C103 controllers and -  implemented the first decoder; -- Ronny Standke for the donation of a webcam; -- Mizuno Takafumi for the donation of a webcam; -- an "anonymous" donator (who didn't want his name to be revealed) for the -  donation of a webcam. -- an anonymous donator for the donation of four webcams and two boards with ten -  image sensors. diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt index 3f87c7da4ca..daa9e2ac162 100644 --- a/Documentation/video4linux/soc-camera.txt +++ b/Documentation/video4linux/soc-camera.txt @@ -9,32 +9,36 @@ The following terms are used in this document:     of connecting to a variety of systems and interfaces, typically uses i2c for     control and configuration, and a parallel or a serial bus for data.   - camera host - an interface, to which a camera is connected. Typically a -   specialised interface, present on many SoCs, e.g., PXA27x and PXA3xx, SuperH, +   specialised interface, present on many SoCs, e.g. PXA27x and PXA3xx, SuperH,     AVR32, i.MX27, i.MX31.   - camera host bus - a connection between a camera host and a camera. Can be -   parallel or serial, consists of data and control lines, e.g., clock, vertical +   parallel or serial, consists of data and control lines, e.g. clock, vertical     and horizontal synchronization signals.  Purpose of the soc-camera subsystem  ----------------------------------- -The soc-camera subsystem provides a unified API between camera host drivers and -camera sensor drivers. It implements a V4L2 interface to the user, currently -only the mmap method is supported. +The soc-camera subsystem initially provided a unified API between camera host +drivers and camera sensor drivers. Later the soc-camera sensor API has been +replaced with the V4L2 standard subdev API. This also made camera driver re-use +with non-soc-camera hosts possible. The camera host API to the soc-camera core +has been preserved. -This subsystem has been written to connect drivers for System-on-Chip (SoC) -video capture interfaces with drivers for CMOS camera sensor chips to enable -the reuse of sensor drivers with various hosts. The subsystem has been designed -to support multiple camera host interfaces and multiple cameras per interface, -although most applications have only one camera sensor. +Soc-camera implements a V4L2 interface to the user, currently only the "mmap" +method is supported by host drivers. However, the soc-camera core also provides +support for the "read" method. + +The subsystem has been designed to support multiple camera host interfaces and +multiple cameras per interface, although most applications have only one camera +sensor.  Existing drivers  ---------------- -As of 2.6.27-rc4 there are two host drivers in the mainline: pxa_camera.c for -PXA27x SoCs and sh_mobile_ceu_camera.c for SuperH SoCs, and four sensor drivers: -mt9m001.c, mt9m111.c, mt9v022.c and a generic soc_camera_platform.c driver. This -list is not supposed to be updated, look for more examples in your tree. +As of 3.7 there are seven host drivers in the mainline: atmel-isi.c, +mx1_camera.c (broken, scheduled for removal), mx2_camera.c, mx3_camera.c, +omap1_camera.c, pxa_camera.c, sh_mobile_ceu_camera.c, and multiple sensor +drivers under drivers/media/i2c/soc_camera/.  Camera host API  --------------- @@ -45,38 +49,37 @@ soc_camera_host_register(struct soc_camera_host *);  function. The host object can be initialized as follows: -static struct soc_camera_host pxa_soc_camera_host = { -	.drv_name	= PXA_CAM_DRV_NAME, -	.ops		= &pxa_soc_camera_host_ops, -}; +	struct soc_camera_host	*ici; +	ici->drv_name		= DRV_NAME; +	ici->ops		= &camera_host_ops; +	ici->priv		= pcdev; +	ici->v4l2_dev.dev	= &pdev->dev; +	ici->nr			= pdev->id;  All camera host methods are passed in a struct soc_camera_host_ops: -static struct soc_camera_host_ops pxa_soc_camera_host_ops = { +static struct soc_camera_host_ops camera_host_ops = {  	.owner		= THIS_MODULE, -	.add		= pxa_camera_add_device, -	.remove		= pxa_camera_remove_device, -	.suspend	= pxa_camera_suspend, -	.resume		= pxa_camera_resume, -	.set_fmt_cap	= pxa_camera_set_fmt_cap, -	.try_fmt_cap	= pxa_camera_try_fmt_cap, -	.init_videobuf	= pxa_camera_init_videobuf, -	.reqbufs	= pxa_camera_reqbufs, -	.poll		= pxa_camera_poll, -	.querycap	= pxa_camera_querycap, -	.try_bus_param	= pxa_camera_try_bus_param, -	.set_bus_param	= pxa_camera_set_bus_param, +	.add		= camera_add_device, +	.remove		= camera_remove_device, +	.set_fmt	= camera_set_fmt_cap, +	.try_fmt	= camera_try_fmt_cap, +	.init_videobuf2	= camera_init_videobuf2, +	.poll		= camera_poll, +	.querycap	= camera_querycap, +	.set_bus_param	= camera_set_bus_param, +	/* The rest of host operations are optional */  };  .add and .remove methods are called when a sensor is attached to or detached -from the host, apart from performing host-internal tasks they shall also call -sensor driver's .init and .release methods respectively. .suspend and .resume -methods implement host's power-management functionality and its their -responsibility to call respective sensor's methods. .try_bus_param and -.set_bus_param are used to negotiate physical connection parameters between the -host and the sensor. .init_videobuf is called by soc-camera core when a -video-device is opened, further video-buffer management is implemented completely -by the specific camera host driver. The rest of the methods are called from +from the host. .set_bus_param is used to configure physical connection +parameters between the host and the sensor. .init_videobuf2 is called by +soc-camera core when a video-device is opened, the host driver would typically +call vb2_queue_init() in this method. Further video-buffer management is +implemented completely by the specific camera host driver. If the host driver +supports non-standard pixel format conversion, it should implement a +.get_formats and, possibly, a .put_formats operations. See below for more +details about format conversion. The rest of the methods are called from  respective V4L2 operations.  Camera API @@ -84,37 +87,21 @@ Camera API  Sensor drivers can use struct soc_camera_link, typically provided by the  platform, and used to specify to which camera host bus the sensor is connected, -and arbitrarily provide platform .power and .reset methods for the camera. -soc_camera_device_register() and soc_camera_device_unregister() functions are -used to add a sensor driver to or remove one from the system. The registration -function takes a pointer to struct soc_camera_device as the only parameter. -This struct can be initialized as follows: - -	/* link to driver operations */ -	icd->ops	= &mt9m001_ops; -	/* link to the underlying physical (e.g., i2c) device */ -	icd->control	= &client->dev; -	/* window geometry */ -	icd->x_min	= 20; -	icd->y_min	= 12; -	icd->x_current	= 20; -	icd->y_current	= 12; -	icd->width_min	= 48; -	icd->width_max	= 1280; -	icd->height_min	= 32; -	icd->height_max	= 1024; -	icd->y_skip_top	= 1; -	/* camera bus ID, typically obtained from platform data */ -	icd->iface	= icl->bus_id; - -struct soc_camera_ops provides .probe and .remove methods, which are called by -the soc-camera core, when a camera is matched against or removed from a camera -host bus, .init, .release, .suspend, and .resume are called from the camera host -driver as discussed above. Other members of this struct provide respective V4L2 -functionality. - -struct soc_camera_device also links to an array of struct soc_camera_data_format, -listing pixel formats, supported by the camera. +and optionally provide platform .power and .reset methods for the camera. This +struct is provided to the camera driver via the I2C client device platform data +and can be obtained, using the soc_camera_i2c_to_link() macro. Care should be +taken, when using soc_camera_vdev_to_subdev() and when accessing struct +soc_camera_device, using v4l2_get_subdev_hostdata(): both only work, when +running on an soc-camera host. The actual camera driver operation is implemented +using the V4L2 subdev API. Additionally soc-camera camera drivers can use +auxiliary soc-camera helper functions like soc_camera_power_on() and +soc_camera_power_off(), which switch regulators, provided by the platform and call +board-specific power switching methods. soc_camera_apply_board_flags() takes +camera bus configuration capability flags and applies any board transformations, +e.g. signal polarity inversion. soc_mbus_get_fmtdesc() can be used to obtain a +pixel format descriptor, corresponding to a certain media-bus pixel format code. +soc_camera_limit_side() can be used to restrict beginning and length of a frame +side, based on camera capabilities.  VIDIOC_S_CROP and VIDIOC_S_FMT behaviour  ---------------------------------------- @@ -129,7 +116,7 @@ VIDIOC_S_FMT: sets user window. Should preserve previously set sensor window as  much as possible by modifying scaling factors. If the sensor window cannot be  preserved precisely, it may be changed too. -In soc-camera there are two locations, where scaling and cropping can taks +In soc-camera there are two locations, where scaling and cropping can take  place: in the camera driver and in the host driver. User ioctls are first passed  to the host driver, which then generally passes them down to the camera driver.  It is more efficient to perform scaling and cropping in the camera driver to @@ -153,8 +140,25 @@ implemented.  User window geometry is kept in .user_width and .user_height fields in struct  soc_camera_device and used by the soc-camera core and host drivers. The core  updates these fields upon successful completion of a .s_fmt() call, but if these -fields change elsewhere, e.g., during .s_crop() processing, the host driver is +fields change elsewhere, e.g. during .s_crop() processing, the host driver is  responsible for updating them. +Format conversion +----------------- + +V4L2 distinguishes between pixel formats, as they are stored in memory, and as +they are transferred over a media bus. Soc-camera provides support to +conveniently manage these formats. A table of standard transformations is +maintained by soc-camera core, which describes, what FOURCC pixel format will +be obtained, if a media-bus pixel format is stored in memory according to +certain rules. E.g. if V4L2_MBUS_FMT_YUYV8_2X8 data is sampled with 8 bits per +sample and stored in memory in the little-endian order with no gaps between +bytes, data in memory will represent the V4L2_PIX_FMT_YUYV FOURCC format. These +standard transformations will be used by soc-camera or by camera host drivers to +configure camera drivers to produce the FOURCC format, requested by the user, +using the VIDIOC_S_FMT ioctl(). Apart from those standard format conversions, +host drivers can also provide their own conversion rules by implementing a +.get_formats and, if required, a .put_formats methods. +  --  Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> diff --git a/Documentation/video4linux/stv680.txt b/Documentation/video4linux/stv680.txt deleted file mode 100644 index 4f8946f32f5..00000000000 --- a/Documentation/video4linux/stv680.txt +++ /dev/null @@ -1,53 +0,0 @@ -Linux driver for STV0680 based USB cameras - -Copyright, 2001, Kevin Sisson - - -INTRODUCTION: - -STMicroelectronics produces the STV0680B chip, which comes in two -types, -001 and -003. The -003 version allows the recording and downloading -of sound clips from the camera, and allows a flash attachment. Otherwise, -it uses the same commands as the -001 version. Both versions support a -variety of SDRAM sizes and sensors, allowing for a maximum of 26 VGA or 20 -CIF pictures. The STV0680 supports either a serial or a usb interface, and -video is possible through the usb interface. - -The following cameras are known to work with this driver, although any -camera with Vendor/Product codes of 0553/0202 should work: - -Aiptek Pencam (various models) -Nisis QuickPix 2 -Radio Shack 'Kid's digital camera' (#60-1207) -At least one Trust Spycam model -Several other European brand models - -WHAT YOU NEED: - --	USB support --	VIDEO4LINUX support - -More information about USB support for linux can be found at: -http://www.linux-usb.org - - -MODULE OPTIONS: - -When the driver is compiled as a module, you can set a "swapRGB=1" -option, if necessary, for those applications that require it -(such as xawtv). However, the driver should detect and set this -automatically, so this option should not normally be used. - - -KNOWN PROBLEMS: - -The driver seems to work better with the usb-ohci than the usb-uhci host -controller driver. - -HELP: - -The latest info on this driver can be found at: -http://personal.clt.bellsouth.net/~kjsisson or at -http://stv0680-usb.sourceforge.net - -Any questions to me can be send to:  kjsisson@bellsouth.net
\ No newline at end of file diff --git a/Documentation/video4linux/uvcvideo.txt b/Documentation/video4linux/uvcvideo.txt new file mode 100644 index 00000000000..35ce19cddcf --- /dev/null +++ b/Documentation/video4linux/uvcvideo.txt @@ -0,0 +1,239 @@ +Linux USB Video Class (UVC) driver +================================== + +This file documents some driver-specific aspects of the UVC driver, such as +driver-specific ioctls and implementation notes. + +Questions and remarks can be sent to the Linux UVC development mailing list at +linux-uvc-devel@lists.berlios.de. + + +Extension Unit (XU) support +--------------------------- + +1. Introduction + +The UVC specification allows for vendor-specific extensions through extension +units (XUs). The Linux UVC driver supports extension unit controls (XU controls) +through two separate mechanisms: + +  - through mappings of XU controls to V4L2 controls +  - through a driver-specific ioctl interface + +The first one allows generic V4L2 applications to use XU controls by mapping +certain XU controls onto V4L2 controls, which then show up during ordinary +control enumeration. + +The second mechanism requires uvcvideo-specific knowledge for the application to +access XU controls but exposes the entire UVC XU concept to user space for +maximum flexibility. + +Both mechanisms complement each other and are described in more detail below. + + +2. Control mappings + +The UVC driver provides an API for user space applications to define so-called +control mappings at runtime. These allow for individual XU controls or byte +ranges thereof to be mapped to new V4L2 controls. Such controls appear and +function exactly like normal V4L2 controls (i.e. the stock controls, such as +brightness, contrast, etc.). However, reading or writing of such a V4L2 controls +triggers a read or write of the associated XU control. + +The ioctl used to create these control mappings is called UVCIOC_CTRL_MAP. +Previous driver versions (before 0.2.0) required another ioctl to be used +beforehand (UVCIOC_CTRL_ADD) to pass XU control information to the UVC driver. +This is no longer necessary as newer uvcvideo versions query the information +directly from the device. + +For details on the UVCIOC_CTRL_MAP ioctl please refer to the section titled +"IOCTL reference" below. + + +3. Driver specific XU control interface + +For applications that need to access XU controls directly, e.g. for testing +purposes, firmware upload, or accessing binary controls, a second mechanism to +access XU controls is provided in the form of a driver-specific ioctl, namely +UVCIOC_CTRL_QUERY. + +A call to this ioctl allows applications to send queries to the UVC driver that +directly map to the low-level UVC control requests. + +In order to make such a request the UVC unit ID of the control's extension unit +and the control selector need to be known. This information either needs to be +hardcoded in the application or queried using other ways such as by parsing the +UVC descriptor or, if available, using the media controller API to enumerate a +device's entities. + +Unless the control size is already known it is necessary to first make a +UVC_GET_LEN requests in order to be able to allocate a sufficiently large buffer +and set the buffer size to the correct value. Similarly, to find out whether +UVC_GET_CUR or UVC_SET_CUR are valid requests for a given control, a +UVC_GET_INFO request should be made. The bits 0 (GET supported) and 1 (SET +supported) of the resulting byte indicate which requests are valid. + +With the addition of the UVCIOC_CTRL_QUERY ioctl the UVCIOC_CTRL_GET and +UVCIOC_CTRL_SET ioctls have become obsolete since their functionality is a +subset of the former ioctl. For the time being they are still supported but +application developers are encouraged to use UVCIOC_CTRL_QUERY instead. + +For details on the UVCIOC_CTRL_QUERY ioctl please refer to the section titled +"IOCTL reference" below. + + +4. Security + +The API doesn't currently provide a fine-grained access control facility. The +UVCIOC_CTRL_ADD and UVCIOC_CTRL_MAP ioctls require super user permissions. + +Suggestions on how to improve this are welcome. + + +5. Debugging + +In order to debug problems related to XU controls or controls in general it is +recommended to enable the UVC_TRACE_CONTROL bit in the module parameter 'trace'. +This causes extra output to be written into the system log. + + +6. IOCTL reference + +---- UVCIOC_CTRL_MAP - Map a UVC control to a V4L2 control ---- + +Argument: struct uvc_xu_control_mapping + +Description: +	This ioctl creates a mapping between a UVC control or part of a UVC +	control and a V4L2 control. Once mappings are defined, userspace +	applications can access vendor-defined UVC control through the V4L2 +	control API. + +	To create a mapping, applications fill the uvc_xu_control_mapping +	structure with information about an existing UVC control defined with +	UVCIOC_CTRL_ADD and a new V4L2 control. + +	A UVC control can be mapped to several V4L2 controls. For instance, +	a UVC pan/tilt control could be mapped to separate pan and tilt V4L2 +	controls. The UVC control is divided into non overlapping fields using +	the 'size' and 'offset' fields and are then independently mapped to +	V4L2 control. + +	For signed integer V4L2 controls the data_type field should be set to +	UVC_CTRL_DATA_TYPE_SIGNED. Other values are currently ignored. + +Return value: +	On success 0 is returned. On error -1 is returned and errno is set +	appropriately. + +	ENOMEM +		Not enough memory to perform the operation. +	EPERM +		Insufficient privileges (super user privileges are required). +	EINVAL +		No such UVC control. +	EOVERFLOW +		The requested offset and size would overflow the UVC control. +	EEXIST +		Mapping already exists. + +Data types: +	* struct uvc_xu_control_mapping + +	__u32	id		V4L2 control identifier +	__u8	name[32]	V4L2 control name +	__u8	entity[16]	UVC extension unit GUID +	__u8	selector	UVC control selector +	__u8	size		V4L2 control size (in bits) +	__u8	offset		V4L2 control offset (in bits) +	enum v4l2_ctrl_type +		v4l2_type	V4L2 control type +	enum uvc_control_data_type +		data_type	UVC control data type +	struct uvc_menu_info +		*menu_info	Array of menu entries (for menu controls only) +	__u32	menu_count	Number of menu entries (for menu controls only) + +	* struct uvc_menu_info + +	__u32	value		Menu entry value used by the device +	__u8	name[32]	Menu entry name + + +	* enum uvc_control_data_type + +	UVC_CTRL_DATA_TYPE_RAW		Raw control (byte array) +	UVC_CTRL_DATA_TYPE_SIGNED	Signed integer +	UVC_CTRL_DATA_TYPE_UNSIGNED	Unsigned integer +	UVC_CTRL_DATA_TYPE_BOOLEAN	Boolean +	UVC_CTRL_DATA_TYPE_ENUM		Enumeration +	UVC_CTRL_DATA_TYPE_BITMASK	Bitmask + + +---- UVCIOC_CTRL_QUERY - Query a UVC XU control ---- + +Argument: struct uvc_xu_control_query + +Description: +	This ioctl queries a UVC XU control identified by its extension unit ID +	and control selector. + +	There are a number of different queries available that closely +	correspond to the low-level control requests described in the UVC +	specification. These requests are: + +	UVC_GET_CUR +		Obtain the current value of the control. +	UVC_GET_MIN +		Obtain the minimum value of the control. +	UVC_GET_MAX +		Obtain the maximum value of the control. +	UVC_GET_DEF +		Obtain the default value of the control. +	UVC_GET_RES +		Query the resolution of the control, i.e. the step size of the +		allowed control values. +	UVC_GET_LEN +		Query the size of the control in bytes. +	UVC_GET_INFO +		Query the control information bitmap, which indicates whether +		get/set requests are supported. +	UVC_SET_CUR +		Update the value of the control. + +	Applications must set the 'size' field to the correct length for the +	control. Exceptions are the UVC_GET_LEN and UVC_GET_INFO queries, for +	which the size must be set to 2 and 1, respectively. The 'data' field +	must point to a valid writable buffer big enough to hold the indicated +	number of data bytes. + +	Data is copied directly from the device without any driver-side +	processing. Applications are responsible for data buffer formatting, +	including little-endian/big-endian conversion. This is particularly +	important for the result of the UVC_GET_LEN requests, which is always +	returned as a little-endian 16-bit integer by the device. + +Return value: +	On success 0 is returned. On error -1 is returned and errno is set +	appropriately. + +	ENOENT +		The device does not support the given control or the specified +		extension unit could not be found. +	ENOBUFS +		The specified buffer size is incorrect (too big or too small). +	EINVAL +		An invalid request code was passed. +	EBADRQC +		The given request is not supported by the given control. +	EFAULT +		The data pointer references an inaccessible memory area. + +Data types: +	* struct uvc_xu_control_query + +	__u8	unit		Extension unit ID +	__u8	selector	Control selector +	__u8	query		Request code to send to the device +	__u16	size		Control data size (in bytes) +	__u8	*data		Control value diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt index 8773778d23f..06cf3ac8363 100644 --- a/Documentation/video4linux/v4l2-controls.txt +++ b/Documentation/video4linux/v4l2-controls.txt @@ -124,14 +124,39 @@ You add non-menu controls by calling v4l2_ctrl_new_std:  			const struct v4l2_ctrl_ops *ops,  			u32 id, s32 min, s32 max, u32 step, s32 def); -Menu controls are added by calling v4l2_ctrl_new_std_menu: +Menu and integer menu controls are added by calling v4l2_ctrl_new_std_menu:  	struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,  			const struct v4l2_ctrl_ops *ops,  			u32 id, s32 max, s32 skip_mask, s32 def); +Menu controls with a driver specific menu are added by calling +v4l2_ctrl_new_std_menu_items: + +       struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items( +                       struct v4l2_ctrl_handler *hdl, +                       const struct v4l2_ctrl_ops *ops, u32 id, s32 max, +                       s32 skip_mask, s32 def, const char * const *qmenu); + +Integer menu controls with a driver specific menu can be added by calling +v4l2_ctrl_new_int_menu: + +	struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, +			const struct v4l2_ctrl_ops *ops, +			u32 id, s32 max, s32 def, const s64 *qmenu_int); +  These functions are typically called right after the v4l2_ctrl_handler_init: +	static const s64 exp_bias_qmenu[] = { +	       -2, -1, 0, 1, 2 +	}; +	static const char * const test_pattern[] = { +		"Disabled", +		"Vertical Bars", +		"Solid Black", +		"Solid White", +	}; +  	v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls);  	v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops,  			V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); @@ -141,6 +166,14 @@ These functions are typically called right after the v4l2_ctrl_handler_init:  			V4L2_CID_POWER_LINE_FREQUENCY,  			V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,  			V4L2_CID_POWER_LINE_FREQUENCY_DISABLED); +	v4l2_ctrl_new_int_menu(&foo->ctrl_handler, &foo_ctrl_ops, +			V4L2_CID_EXPOSURE_BIAS, +			ARRAY_SIZE(exp_bias_qmenu) - 1, +			ARRAY_SIZE(exp_bias_qmenu) / 2 - 1, +			exp_bias_qmenu); +	v4l2_ctrl_new_std_menu_items(&foo->ctrl_handler, &foo_ctrl_ops, +			V4L2_CID_TEST_PATTERN, ARRAY_SIZE(test_pattern) - 1, 0, +			0, test_pattern);  	...  	if (foo->ctrl_handler.error) {  		int err = foo->ctrl_handler.error; @@ -164,6 +197,19 @@ controls. There is no min argument since that is always 0 for menu controls,  and instead of a step there is a skip_mask argument: if bit X is 1, then menu  item X is skipped. +The v4l2_ctrl_new_int_menu function creates a new standard integer menu +control with driver-specific items in the menu. It differs from +v4l2_ctrl_new_std_menu in that it doesn't have the mask argument and takes +as the last argument an array of signed 64-bit integers that form an exact +menu item list. + +The v4l2_ctrl_new_std_menu_items function is very similar to +v4l2_ctrl_new_std_menu but takes an extra parameter qmenu, which is the driver +specific menu for an otherwise standard menu control. A good example for this +control is the test pattern control for capture/display/sensors devices that +have the capability to generate test patterns. These test patterns are hardware +specific, so the contents of the menu will vary from device to device. +  Note that if something fails, the function will return NULL or an error and  set ctrl_handler->error to the error code. If ctrl_handler->error was already  set, then it will just return and do nothing. This is also true for @@ -277,19 +323,19 @@ implement g_volatile_ctrl like this:  	{  		switch (ctrl->id) {  		case V4L2_CID_BRIGHTNESS: -			ctrl->cur.val = read_reg(0x123); +			ctrl->val = read_reg(0x123);  			break;  		}  	} -The 'new value' union is not used in g_volatile_ctrl. In general controls -that need to implement g_volatile_ctrl are read-only controls. +Note that you use the 'new value' union as well in g_volatile_ctrl. In general +controls that need to implement g_volatile_ctrl are read-only controls. -To mark a control as volatile you have to set the is_volatile flag: +To mark a control as volatile you have to set V4L2_CTRL_FLAG_VOLATILE:  	ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...);  	if (ctrl) -		ctrl->is_volatile = 1; +		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;  For try/s_ctrl the new values (i.e. as passed by the user) are filled in and  you can modify them in try_ctrl or set them in s_ctrl. The 'cur' union @@ -367,8 +413,7 @@ Driver specific controls can be created using v4l2_ctrl_new_custom():  The last argument is the priv pointer which can be set to driver-specific  private data. -The v4l2_ctrl_config struct also has fields to set the is_private and is_volatile -flags. +The v4l2_ctrl_config struct also has a field to set the is_private flag.  If the name field is not set, then the framework will assume this is a standard  control and will fill in the name, type and flags fields accordingly. @@ -450,6 +495,25 @@ In the example above the following are equivalent for the VOLUME case:  	ctrl == ctrl->cluster[AUDIO_CL_VOLUME] == state->audio_cluster[AUDIO_CL_VOLUME]  	ctrl->cluster[AUDIO_CL_MUTE] == state->audio_cluster[AUDIO_CL_MUTE] +In practice using cluster arrays like this becomes very tiresome. So instead +the following equivalent method is used: + +	struct { +		/* audio cluster */ +		struct v4l2_ctrl *volume; +		struct v4l2_ctrl *mute; +	}; + +The anonymous struct is used to clearly 'cluster' these two control pointers, +but it serves no other purpose. The effect is the same as creating an +array with two control pointers. So you can just do: + +	state->volume = v4l2_ctrl_new_std(&state->ctrl_handler, ...); +	state->mute = v4l2_ctrl_new_std(&state->ctrl_handler, ...); +	v4l2_ctrl_cluster(2, &state->volume); + +And in foo_s_ctrl you can use these pointers directly: state->mute->val. +  Note that controls in a cluster may be NULL. For example, if for some  reason mute was never added (because the hardware doesn't support that  particular feature), then mute will be NULL. So in that case we have a @@ -462,6 +526,58 @@ pointer to the v4l2_ctrl_ops struct that is used for that cluster.  Obviously, all controls in the cluster array must be initialized to either  a valid control or to NULL. +In rare cases you might want to know which controls of a cluster actually +were set explicitly by the user. For this you can check the 'is_new' flag of +each control. For example, in the case of a volume/mute cluster the 'is_new' +flag of the mute control would be set if the user called VIDIOC_S_CTRL for +mute only. If the user would call VIDIOC_S_EXT_CTRLS for both mute and volume +controls, then the 'is_new' flag would be 1 for both controls. + +The 'is_new' flag is always 1 when called from v4l2_ctrl_handler_setup(). + + +Handling autogain/gain-type Controls with Auto Clusters +======================================================= + +A common type of control cluster is one that handles 'auto-foo/foo'-type +controls. Typical examples are autogain/gain, autoexposure/exposure, +autowhitebalance/red balance/blue balance. In all cases you have one control +that determines whether another control is handled automatically by the hardware, +or whether it is under manual control from the user. + +If the cluster is in automatic mode, then the manual controls should be +marked inactive and volatile. When the volatile controls are read the +g_volatile_ctrl operation should return the value that the hardware's automatic +mode set up automatically. + +If the cluster is put in manual mode, then the manual controls should become +active again and the volatile flag is cleared (so g_volatile_ctrl is no longer +called while in manual mode). In addition just before switching to manual mode +the current values as determined by the auto mode are copied as the new manual +values. + +Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since +changing that control affects the control flags of the manual controls. + +In order to simplify this a special variation of v4l2_ctrl_cluster was +introduced: + +void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls, +			u8 manual_val, bool set_volatile); + +The first two arguments are identical to v4l2_ctrl_cluster. The third argument +tells the framework which value switches the cluster into manual mode. The +last argument will optionally set V4L2_CTRL_FLAG_VOLATILE for the non-auto controls. +If it is false, then the manual controls are never volatile. You would typically +use that if the hardware does not give you the option to read back to values as +determined by the auto mode (e.g. if autogain is on, the hardware doesn't allow +you to obtain the current gain value). + +The first control of the cluster is assumed to be the 'auto' control. + +Using this function will ensure that you don't need to handle all the complex +flag and volatile handling. +  VIDIOC_LOG_STATUS Support  ========================= @@ -503,7 +619,11 @@ handler and finally add the first handler to the second. For example:  	v4l2_ctrl_new_std(&radio_ctrl_handler, &radio_ops, V4L2_CID_AUDIO_MUTE, ...);  	v4l2_ctrl_new_std(&video_ctrl_handler, &video_ops, V4L2_CID_BRIGHTNESS, ...);  	v4l2_ctrl_new_std(&video_ctrl_handler, &video_ops, V4L2_CID_CONTRAST, ...); -	v4l2_ctrl_add_handler(&video_ctrl_handler, &radio_ctrl_handler); +	v4l2_ctrl_add_handler(&video_ctrl_handler, &radio_ctrl_handler, NULL); + +The last argument to v4l2_ctrl_add_handler() is a filter function that allows +you to filter which controls will be added. Set it to NULL if you want to add +all controls.  Or you can add specific controls to a handler: @@ -596,53 +716,20 @@ a control of this type whenever the first control belonging to a new control  class is added. -Differences from the Spec -========================= - -There are a few places where the framework acts slightly differently from the -V4L2 Specification. Those differences are described in this section. We will -have to see whether we need to adjust the spec or not. - -1) It is no longer required to have all controls contained in a -v4l2_ext_control array be from the same control class. The framework will be -able to handle any type of control in the array. You need to set ctrl_class -to 0 in order to enable this. If ctrl_class is non-zero, then it will still -check that all controls belong to that control class. - -If you set ctrl_class to 0 and count to 0, then it will only return an error -if there are no controls at all. - -2) Clarified the way error_idx works. For get and set it will be equal to -count if nothing was done yet. If it is less than count then only the controls -up to error_idx-1 were successfully applied. - -3) When attempting to read a button control the framework will return -EACCES -instead of -EINVAL as stated in the spec. It seems to make more sense since -button controls are write-only controls. - -4) Attempting to write to a read-only control will return -EACCES instead of --EINVAL as the spec says. - -5) The spec does not mention what should happen when you try to set/get a -control class controls. ivtv currently returns -EINVAL (indicating that the -control ID does not exist) while the framework will return -EACCES, which -makes more sense. - - -Proposals for Extensions -======================== - -Some ideas for future extensions to the spec: +Adding Notify Callbacks +======================= -1) Add a V4L2_CTRL_FLAG_HEX to have values shown as hexadecimal instead of -decimal. Useful for e.g. video_mute_yuv. +Sometimes the platform or bridge driver needs to be notified when a control +from a sub-device driver changes. You can set a notify callback by calling +this function: -2) It is possible to mark in the controls array which controls have been -successfully written and which failed by for example adding a bit to the -control ID. Not sure if it is worth the effort, though. +void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, +	void (*notify)(struct v4l2_ctrl *ctrl, void *priv), void *priv); -3) Trying to set volatile inactive controls should result in -EACCESS. +Whenever the give control changes value the notify callback will be called +with a pointer to the control and the priv pointer that was passed with +v4l2_ctrl_notify. Note that the control's handler lock is held when the +notify function is called. -4) Add a new flag to mark volatile controls. Any application that wants -to store the state of the controls can then skip volatile inactive controls. -Currently it is not possible to detect such controls. +There can be only one notify function per control handler. Any attempt +to set another notify function will cause a WARN_ON. diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index f22f35c271f..667a4336170 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -34,6 +34,10 @@ So this framework sets up the basic building blocks that all drivers  need and this same framework should make it much easier to refactor  common code into utility functions shared by all drivers. +A good example to look at as a reference is the v4l2-pci-skeleton.c +source that is available in this directory. It is a skeleton driver for +a PCI capture card, and demonstrates how to use the V4L2 driver +framework. It can be used as a template for real PCI video capture driver.  Structure of a driver  --------------------- @@ -68,8 +72,11 @@ Structure of the framework  The framework closely resembles the driver structure: it has a v4l2_device  struct for the device instance data, a v4l2_subdev struct to refer to  sub-device instances, the video_device struct stores V4L2 device node data -and in the future a v4l2_fh struct will keep track of filehandle instances -(this is not yet implemented). +and the v4l2_fh struct keeps track of filehandle instances. + +The V4L2 framework also optionally integrates with the media framework. If a +driver sets the struct v4l2_device mdev field, sub-devices and video nodes +will automatically appear in the media framework as entities.  struct v4l2_device @@ -83,11 +90,20 @@ You must register the device instance:  	v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); -Registration will initialize the v4l2_device struct and link dev->driver_data -to v4l2_dev. If v4l2_dev->name is empty then it will be set to a value derived -from dev (driver name followed by the bus_id, to be precise). If you set it -up before calling v4l2_device_register then it will be untouched. If dev is -NULL, then you *must* setup v4l2_dev->name before calling v4l2_device_register. +Registration will initialize the v4l2_device struct. If the dev->driver_data +field is NULL, it will be linked to v4l2_dev. + +Drivers that want integration with the media device framework need to set +dev->driver_data manually to point to the driver-specific device structure +that embed the struct v4l2_device instance. This is achieved by a +dev_set_drvdata() call before registering the V4L2 device instance. They must +also set the struct v4l2_device mdev field to point to a properly initialized +and registered media_device instance. + +If v4l2_dev->name is empty then it will be set to a value derived from dev +(driver name followed by the bus_id, to be precise). If you set it up before +calling v4l2_device_register then it will be untouched. If dev is NULL, then +you *must* setup v4l2_dev->name before calling v4l2_device_register.  You can use v4l2_device_set_name() to set the name based on a driver name and  a driver-global atomic_t instance. This will generate names like ivtv0, ivtv1, @@ -108,6 +124,7 @@ You unregister with:  	v4l2_device_unregister(struct v4l2_device *v4l2_dev); +If the dev->driver_data field points to v4l2_dev, it will be reset to NULL.  Unregistering will also automatically unregister all subdevs from the device.  If you have a hotpluggable device (e.g. a USB device), then when a disconnect @@ -160,13 +177,31 @@ The recommended approach is as follows:  static atomic_t drv_instance = ATOMIC_INIT(0); -static int __devinit drv_probe(struct pci_dev *pdev, -				const struct pci_device_id *pci_id) +static int drv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)  {  	...  	state->instance = atomic_inc_return(&drv_instance) - 1;  } +If you have multiple device nodes then it can be difficult to know when it is +safe to unregister v4l2_device for hotpluggable devices. For this purpose +v4l2_device has refcounting support. The refcount is increased whenever +video_register_device is called and it is decreased whenever that device node +is released. When the refcount reaches zero, then the v4l2_device release() +callback is called. You can do your final cleanup there. + +If other device nodes (e.g. ALSA) are created, then you can increase and +decrease the refcount manually as well by calling: + +void v4l2_device_get(struct v4l2_device *v4l2_dev); + +or: + +int v4l2_device_put(struct v4l2_device *v4l2_dev); + +Since the initial refcount is 1 you also need to call v4l2_device_put in the +disconnect() callback (for USB devices) or in the remove() callback (for e.g. +PCI devices), otherwise the refcount will never reach 0.  struct v4l2_subdev  ------------------ @@ -215,7 +250,6 @@ may be NULL if the subdev driver does not support anything from that category.  It looks like this:  struct v4l2_subdev_core_ops { -	int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);  	int (*log_status)(struct v4l2_subdev *sd);  	int (*init)(struct v4l2_subdev *sd, u32 val);  	... @@ -233,11 +267,16 @@ struct v4l2_subdev_video_ops {  	...  }; +struct v4l2_subdev_pad_ops { +	... +}; +  struct v4l2_subdev_ops {  	const struct v4l2_subdev_core_ops  *core;  	const struct v4l2_subdev_tuner_ops *tuner;  	const struct v4l2_subdev_audio_ops *audio;  	const struct v4l2_subdev_video_ops *video; +	const struct v4l2_subdev_pad_ops *video;  };  The core ops are common to all subdevs, the other categories are implemented @@ -254,8 +293,63 @@ A sub-device driver initializes the v4l2_subdev struct using:  Afterwards you need to initialize subdev->name with a unique name and set the  module owner. This is done for you if you use the i2c helper functions. -A device (bridge) driver needs to register the v4l2_subdev with the -v4l2_device: +If integration with the media framework is needed, you must initialize the +media_entity struct embedded in the v4l2_subdev struct (entity field) by +calling media_entity_init(): + +	struct media_pad *pads = &my_sd->pads; +	int err; + +	err = media_entity_init(&sd->entity, npads, pads, 0); + +The pads array must have been previously initialized. There is no need to +manually set the struct media_entity type and name fields, but the revision +field must be initialized if needed. + +A reference to the entity will be automatically acquired/released when the +subdev device node (if any) is opened/closed. + +Don't forget to cleanup the media entity before the sub-device is destroyed: + +	media_entity_cleanup(&sd->entity); + +If the subdev driver intends to process video and integrate with the media +framework, it must implement format related functionality using +v4l2_subdev_pad_ops instead of v4l2_subdev_video_ops. + +In that case, the subdev driver may set the link_validate field to provide +its own link validation function. The link validation function is called for +every link in the pipeline where both of the ends of the links are V4L2 +sub-devices. The driver is still responsible for validating the correctness +of the format configuration between sub-devices and video nodes. + +If link_validate op is not set, the default function +v4l2_subdev_link_validate_default() is used instead. This function ensures +that width, height and the media bus pixel code are equal on both source and +sink of the link. Subdev drivers are also free to use this function to +perform the checks mentioned above in addition to their own checks. + +There are currently two ways to register subdevices with the V4L2 core. The +first (traditional) possibility is to have subdevices registered by bridge +drivers. This can be done when the bridge driver has the complete information +about subdevices connected to it and knows exactly when to register them. This +is typically the case for internal subdevices, like video data processing units +within SoCs or complex PCI(e) boards, camera sensors in USB cameras or connected +to SoCs, which pass information about them to bridge drivers, usually in their +platform data. + +There are however also situations where subdevices have to be registered +asynchronously to bridge devices. An example of such a configuration is a Device +Tree based system where information about subdevices is made available to the +system independently from the bridge devices, e.g. when subdevices are defined +in DT as I2C device nodes. The API used in this second case is described further +below. + +Using one or the other registration method only affects the probing process, the +run-time bridge-subdevice interaction is in both cases the same. + +In the synchronous case a device (bridge) driver needs to register the +v4l2_subdev with the v4l2_device:  	int err = v4l2_device_register_subdev(v4l2_dev, sd); @@ -263,6 +357,9 @@ This can fail if the subdev module disappeared before it could be registered.  After this function was called successfully the subdev->dev field points to  the v4l2_device. +If the v4l2_device parent device has a non-NULL mdev field, the sub-device +entity will be automatically registered with the media device. +  You can unregister a sub-device using:  	v4l2_device_unregister_subdev(sd); @@ -271,27 +368,27 @@ Afterwards the subdev module can be unloaded and sd->dev == NULL.  You can call an ops function either directly: -	err = sd->ops->core->g_chip_ident(sd, &chip); +	err = sd->ops->core->g_std(sd, &norm);  but it is better and easier to use this macro: -	err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); +	err = v4l2_subdev_call(sd, core, g_std, &norm);  The macro will to the right NULL pointer checks and returns -ENODEV if subdev -is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_chip_ident is -NULL, or the actual result of the subdev->ops->core->g_chip_ident ops. +is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_std is +NULL, or the actual result of the subdev->ops->core->g_std ops.  It is also possible to call all or a subset of the sub-devices: -	v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, &chip); +	v4l2_device_call_all(v4l2_dev, 0, core, g_std, &norm);  Any subdev that does not support this ops is skipped and error results are  ignored. If you want to check for errors use this: -	err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, &chip); +	err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_std, &norm);  Any error except -ENOIOCTLCMD will exit the loop with that error. If no -errors (except -ENOIOCTLCMD) occured, then 0 is returned. +errors (except -ENOIOCTLCMD) occurred, then 0 is returned.  The second argument to both calls is a group ID. If 0, then all subdevs are  called. If non-zero, then only those whose group ID match that value will @@ -319,6 +416,85 @@ controlled through GPIO pins. This distinction is only relevant when setting  up the device, but once the subdev is registered it is completely transparent. +In the asynchronous case subdevice probing can be invoked independently of the +bridge driver availability. The subdevice driver then has to verify whether all +the requirements for a successful probing are satisfied. This can include a +check for a master clock availability. If any of the conditions aren't satisfied +the driver might decide to return -EPROBE_DEFER to request further reprobing +attempts. Once all conditions are met the subdevice shall be registered using +the v4l2_async_register_subdev() function. Unregistration is performed using +the v4l2_async_unregister_subdev() call. Subdevices registered this way are +stored in a global list of subdevices, ready to be picked up by bridge drivers. + +Bridge drivers in turn have to register a notifier object with an array of +subdevice descriptors that the bridge device needs for its operation. This is +performed using the v4l2_async_notifier_register() call. To unregister the +notifier the driver has to call v4l2_async_notifier_unregister(). The former of +the two functions takes two arguments: a pointer to struct v4l2_device and a +pointer to struct v4l2_async_notifier. The latter contains a pointer to an array +of pointers to subdevice descriptors of type struct v4l2_async_subdev type. The +V4L2 core will then use these descriptors to match asynchronously registered +subdevices to them. If a match is detected the .bound() notifier callback is +called. After all subdevices have been located the .complete() callback is +called. When a subdevice is removed from the system the .unbind() method is +called. All three callbacks are optional. + + +V4L2 sub-device userspace API +----------------------------- + +Beside exposing a kernel API through the v4l2_subdev_ops structure, V4L2 +sub-devices can also be controlled directly by userspace applications. + +Device nodes named v4l-subdevX can be created in /dev to access sub-devices +directly. If a sub-device supports direct userspace configuration it must set +the V4L2_SUBDEV_FL_HAS_DEVNODE flag before being registered. + +After registering sub-devices, the v4l2_device driver can create device nodes +for all registered sub-devices marked with V4L2_SUBDEV_FL_HAS_DEVNODE by calling +v4l2_device_register_subdev_nodes(). Those device nodes will be automatically +removed when sub-devices are unregistered. + +The device node handles a subset of the V4L2 API. + +VIDIOC_QUERYCTRL +VIDIOC_QUERYMENU +VIDIOC_G_CTRL +VIDIOC_S_CTRL +VIDIOC_G_EXT_CTRLS +VIDIOC_S_EXT_CTRLS +VIDIOC_TRY_EXT_CTRLS + +	The controls ioctls are identical to the ones defined in V4L2. They +	behave identically, with the only exception that they deal only with +	controls implemented in the sub-device. Depending on the driver, those +	controls can be also be accessed through one (or several) V4L2 device +	nodes. + +VIDIOC_DQEVENT +VIDIOC_SUBSCRIBE_EVENT +VIDIOC_UNSUBSCRIBE_EVENT + +	The events ioctls are identical to the ones defined in V4L2. They +	behave identically, with the only exception that they deal only with +	events generated by the sub-device. Depending on the driver, those +	events can also be reported by one (or several) V4L2 device nodes. + +	Sub-device drivers that want to use events need to set the +	V4L2_SUBDEV_USES_EVENTS v4l2_subdev::flags and initialize +	v4l2_subdev::nevents to events queue depth before registering the +	sub-device. After registration events can be queued as usual on the +	v4l2_subdev::devnode device node. + +	To properly support events, the poll() file operation is also +	implemented. + +Private ioctls + +	All ioctls not in the above list are passed directly to the sub-device +	driver through the core::ioctl operation. + +  I2C sub-device drivers  ---------------------- @@ -445,50 +621,135 @@ of the video device exits.  The default video_device_release() callback just calls kfree to free the  allocated memory. +There is also a video_device_release_empty() function that does nothing +(is empty) and can be used if the struct is embedded and there is nothing +to do when it is released. +  You should also set these fields: -- v4l2_dev: set to the v4l2_device parent device. +- v4l2_dev: must be set to the v4l2_device parent device. +  - name: set to something descriptive and unique. + +- vfl_dir: set this to VFL_DIR_RX for capture devices (VFL_DIR_RX has value 0, +  so this is normally already the default), set to VFL_DIR_TX for output +  devices and VFL_DIR_M2M for mem2mem (codec) devices. +  - fops: set to the v4l2_file_operations struct. +  - ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance    (highly recommended to use this and it might become compulsory in the -  future!), then set this to your v4l2_ioctl_ops struct. +  future!), then set this to your v4l2_ioctl_ops struct. The vfl_type and +  vfl_dir fields are used to disable ops that do not match the type/dir +  combination. E.g. VBI ops are disabled for non-VBI nodes, and output ops +  are disabled for a capture device. This makes it possible to provide +  just one v4l2_ioctl_ops struct for both vbi and video nodes. +  - lock: leave to NULL if you want to do all the locking in the driver. -  Otherwise you give it a pointer to a struct mutex_lock and before any -  of the v4l2_file_operations is called this lock will be taken by the -  core and released afterwards. -- parent: you only set this if v4l2_device was registered with NULL as +  Otherwise you give it a pointer to a struct mutex_lock and before the +  unlocked_ioctl file operation is called this lock will be taken by the +  core and released afterwards. See the next section for more details. + +- queue: a pointer to the struct vb2_queue associated with this device node. +  If queue is non-NULL, and queue->lock is non-NULL, then queue->lock is +  used for the queuing ioctls (VIDIOC_REQBUFS, CREATE_BUFS, QBUF, DQBUF, +  QUERYBUF, PREPARE_BUF, STREAMON and STREAMOFF) instead of the lock above. +  That way the vb2 queuing framework does not have to wait for other ioctls. +  This queue pointer is also used by the vb2 helper functions to check for +  queuing ownership (i.e. is the filehandle calling it allowed to do the +  operation). + +- prio: keeps track of the priorities. Used to implement VIDIOC_G/S_PRIORITY. +  If left to NULL, then it will use the struct v4l2_prio_state in v4l2_device. +  If you want to have a separate priority state per (group of) device node(s), +  then you can point it to your own struct v4l2_prio_state. + +- dev_parent: you only set this if v4l2_device was registered with NULL as    the parent device struct. This only happens in cases where one hardware    device has multiple PCI devices that all share the same v4l2_device core.    The cx88 driver is an example of this: one core v4l2_device struct, but -  it is used by both an raw video PCI device (cx8800) and a MPEG PCI device -  (cx8802). Since the v4l2_device cannot be associated with a particular -  PCI device it is setup without a parent device. But when the struct -  video_device is setup you do know which parent PCI device to use. +  it is used by both a raw video PCI device (cx8800) and a MPEG PCI device +  (cx8802). Since the v4l2_device cannot be associated with two PCI devices +  at the same time it is setup without a parent device. But when the struct +  video_device is initialized you *do* know which parent PCI device to use and +  so you set dev_device to the correct PCI device. + +- flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the framework +  handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you use struct +  v4l2_fh. Eventually this flag will disappear once all drivers use the core +  priority handling. But for now it has to be set explicitly. -If you use v4l2_ioctl_ops, then you should set either .unlocked_ioctl or -.ioctl to video_ioctl2 in your v4l2_file_operations struct. +If you use v4l2_ioctl_ops, then you should set .unlocked_ioctl to video_ioctl2 +in your v4l2_file_operations struct. + +Do not use .ioctl! This is deprecated and will go away in the future. + +In some cases you want to tell the core that a function you had specified in +your v4l2_ioctl_ops should be ignored. You can mark such ioctls by calling this +function before video_device_register is called: + +void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd); + +This tends to be needed if based on external factors (e.g. which card is +being used) you want to turns off certain features in v4l2_ioctl_ops without +having to make a new struct.  The v4l2_file_operations struct is a subset of file_operations. The main  difference is that the inode argument is omitted since it is never used. -v4l2_file_operations and locking --------------------------------- +If integration with the media framework is needed, you must initialize the +media_entity struct embedded in the video_device struct (entity field) by +calling media_entity_init(): + +	struct media_pad *pad = &my_vdev->pad; +	int err; + +	err = media_entity_init(&vdev->entity, 1, pad, 0); + +The pads array must have been previously initialized. There is no need to +manually set the struct media_entity type and name fields. -You can set a pointer to a mutex_lock in struct video_device. Usually this -will be either a top-level mutex or a mutex per device node. If you want -finer-grained locking then you have to set it to NULL and do you own locking. +A reference to the entity will be automatically acquired/released when the +video device is opened/closed. -If a lock is specified then all file operations will be serialized on that -lock. If you use videobuf then you must pass the same lock to the videobuf -queue initialize function: if videobuf has to wait for a frame to arrive, then -it will temporarily unlock the lock and relock it afterwards. If your driver -also waits in the code, then you should do the same to allow other processes -to access the device node while the first process is waiting for something. +ioctls and locking +------------------ -The implementation of a hotplug disconnect should also take the lock before -calling v4l2_device_disconnect. +The V4L core provides optional locking services. The main service is the +lock field in struct video_device, which is a pointer to a mutex. If you set +this pointer, then that will be used by unlocked_ioctl to serialize all ioctls. + +If you are using the videobuf2 framework, then there is a second lock that you +can set: video_device->queue->lock. If set, then this lock will be used instead +of video_device->lock to serialize all queuing ioctls (see the previous section +for the full list of those ioctls). + +The advantage of using a different lock for the queuing ioctls is that for some +drivers (particularly USB drivers) certain commands such as setting controls +can take a long time, so you want to use a separate lock for the buffer queuing +ioctls. That way your VIDIOC_DQBUF doesn't stall because the driver is busy +changing the e.g. exposure of the webcam. + +Of course, you can always do all the locking yourself by leaving both lock +pointers at NULL. + +If you use the old videobuf then you must pass the video_device lock to the +videobuf queue initialize function: if videobuf has to wait for a frame to +arrive, then it will temporarily unlock the lock and relock it afterwards. If +your driver also waits in the code, then you should do the same to allow other +processes to access the device node while the first process is waiting for +something. + +In the case of videobuf2 you will need to implement the wait_prepare and +wait_finish callbacks to unlock/lock if applicable. If you use the queue->lock +pointer, then you can use the helper functions vb2_ops_wait_prepare/finish. + +The implementation of a hotplug disconnect should also take the lock from +video_device before calling v4l2_device_disconnect. If you are also using +video_device->queue->lock, then you have to first lock video_device->queue->lock +followed by video_device->lock. That way you can be sure no ioctl is running +when you call v4l2_device_disconnect.  video_device registration  ------------------------- @@ -502,12 +763,16 @@ for you.  		return err;  	} +If the v4l2_device parent device has a non-NULL mdev field, the video device +entity will be automatically registered with the media device. +  Which device is registered depends on the type argument. The following  types exist:  VFL_TYPE_GRABBER: videoX for video input/output devices  VFL_TYPE_VBI: vbiX for vertical blank data (i.e. closed captions, teletext)  VFL_TYPE_RADIO: radioX for radio tuners +VFL_TYPE_SDR: swradioX for Software Defined Radio tuners  The last argument gives you a certain amount of control over the device  device node number used (i.e. the X in videoX). Normally you will pass -1 @@ -577,6 +842,13 @@ release, of course) will return an error as well.  When the last user of the video device node exits, then the vdev->release()  callback is called and you can do the final cleanup there. +Don't forget to cleanup the media entity associated with the video device if +it has been initialized: + +	media_entity_cleanup(&vdev->entity); + +This can be done from the release callback. +  video_device helper functions  ----------------------------- @@ -636,39 +908,25 @@ struct v4l2_fh  --------------  struct v4l2_fh provides a way to easily keep file handle specific data -that is used by the V4L2 framework. Using v4l2_fh is optional for -drivers. +that is used by the V4L2 framework. New drivers must use struct v4l2_fh +since it is also used to implement priority handling (VIDIOC_G/S_PRIORITY) +if the video_device flag V4L2_FL_USE_FH_PRIO is also set.  The users of v4l2_fh (in the V4L2 framework, not the driver) know  whether a driver uses v4l2_fh as its file->private_data pointer by -testing the V4L2_FL_USES_V4L2_FH bit in video_device->flags. - -Useful functions: - -- v4l2_fh_init() +testing the V4L2_FL_USES_V4L2_FH bit in video_device->flags. This bit is +set whenever v4l2_fh_init() is called. -  Initialise the file handle. This *MUST* be performed in the driver's -  v4l2_file_operations->open() handler. - -- v4l2_fh_add() - -  Add a v4l2_fh to video_device file handle list. May be called after -  initialising the file handle. - -- v4l2_fh_del() - -  Unassociate the file handle from video_device(). The file handle -  exit function may now be called. - -- v4l2_fh_exit() +struct v4l2_fh is allocated as a part of the driver's own file handle +structure and file->private_data is set to it in the driver's open +function by the driver. -  Uninitialise the file handle. After uninitialisation the v4l2_fh -  memory can be freed. +In many cases the struct v4l2_fh will be embedded in a larger structure. +In that case you should call v4l2_fh_init+v4l2_fh_add in open() and +v4l2_fh_del+v4l2_fh_exit in release(). -struct v4l2_fh is allocated as a part of the driver's own file handle -structure and is set to file->private_data in the driver's open -function by the driver. Drivers can extract their own file handle -structure by using the container_of macro. Example: +Drivers can extract their own file handle structure by using the container_of +macro. Example:  struct my_fh {  	int blah; @@ -685,15 +943,17 @@ int my_open(struct file *file)  	... -	ret = v4l2_fh_init(&my_fh->fh, vfd); -	if (ret) -		return ret; +	my_fh = kzalloc(sizeof(*my_fh), GFP_KERNEL); -	v4l2_fh_add(&my_fh->fh); +	... -	file->private_data = &my_fh->fh; +	v4l2_fh_init(&my_fh->fh, vfd);  	... + +	file->private_data = &my_fh->fh; +	v4l2_fh_add(&my_fh->fh); +	return 0;  }  int my_release(struct file *file) @@ -702,36 +962,133 @@ int my_release(struct file *file)  	struct my_fh *my_fh = container_of(fh, struct my_fh, fh);  	... +	v4l2_fh_del(&my_fh->fh); +	v4l2_fh_exit(&my_fh->fh); +	kfree(my_fh); +	return 0;  } +Below is a short description of the v4l2_fh functions used: + +void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) + +  Initialise the file handle. This *MUST* be performed in the driver's +  v4l2_file_operations->open() handler. + +void v4l2_fh_add(struct v4l2_fh *fh) + +  Add a v4l2_fh to video_device file handle list. Must be called once the +  file handle is completely initialized. + +void v4l2_fh_del(struct v4l2_fh *fh) + +  Unassociate the file handle from video_device(). The file handle +  exit function may now be called. + +void v4l2_fh_exit(struct v4l2_fh *fh) + +  Uninitialise the file handle. After uninitialisation the v4l2_fh +  memory can be freed. + + +If struct v4l2_fh is not embedded, then you can use these helper functions: + +int v4l2_fh_open(struct file *filp) + +  This allocates a struct v4l2_fh, initializes it and adds it to the struct +  video_device associated with the file struct. + +int v4l2_fh_release(struct file *filp) + +  This deletes it from the struct video_device associated with the file +  struct, uninitialised the v4l2_fh and frees it. + +These two functions can be plugged into the v4l2_file_operation's open() and +release() ops. + + +Several drivers need to do something when the first file handle is opened and +when the last file handle closes. Two helper functions were added to check +whether the v4l2_fh struct is the only open filehandle of the associated +device node: + +int v4l2_fh_is_singular(struct v4l2_fh *fh) + +  Returns 1 if the file handle is the only open file handle, else 0. + +int v4l2_fh_is_singular_file(struct file *filp) + +  Same, but it calls v4l2_fh_is_singular with filp->private_data. + +  V4L2 events  -----------  The V4L2 events provide a generic way to pass events to user space.  The driver must use v4l2_fh to be able to support V4L2 events. -Useful functions: +Events are defined by a type and an optional ID. The ID may refer to a V4L2 +object such as a control ID. If unused, then the ID is 0. + +When the user subscribes to an event the driver will allocate a number of +kevent structs for that event. So every (type, ID) event tuple will have +its own set of kevent structs. This guarantees that if a driver is generating +lots of events of one type in a short time, then that will not overwrite +events of another type. + +But if you get more events of one type than the number of kevents that were +reserved, then the oldest event will be dropped and the new one added. + +Furthermore, the internal struct v4l2_subscribed_event has merge() and +replace() callbacks which drivers can set. These callbacks are called when +a new event is raised and there is no more room. The replace() callback +allows you to replace the payload of the old event with that of the new event, +merging any relevant data from the old payload into the new payload that +replaces it. It is called when this event type has only one kevent struct +allocated. The merge() callback allows you to merge the oldest event payload +into that of the second-oldest event payload. It is called when there are two +or more kevent structs allocated. + +This way no status information is lost, just the intermediate steps leading +up to that state. + +A good example of these replace/merge callbacks is in v4l2-event.c: +ctrls_replace() and ctrls_merge() callbacks for the control event. -- v4l2_event_alloc() +Note: these callbacks can be called from interrupt context, so they must be +fast. -  To use events, the driver must allocate events for the file handle. By -  calling the function more than once, the driver may assure that at least n -  events in total have been allocated. The function may not be called in -  atomic context. +Useful functions: -- v4l2_event_queue() +void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev)    Queue events to video device. The driver's only responsibility is to fill    in the type and the data fields. The other fields will be filled in by    V4L2. -- v4l2_event_subscribe() +int v4l2_event_subscribe(struct v4l2_fh *fh, +			 struct v4l2_event_subscription *sub, unsigned elems, +			 const struct v4l2_subscribed_event_ops *ops)    The video_device->ioctl_ops->vidioc_subscribe_event must check the driver    is able to produce events with specified event id. Then it calls    v4l2_event_subscribe() to subscribe the event. -- v4l2_event_unsubscribe() +  The elems argument is the size of the event queue for this event. If it is 0, +  then the framework will fill in a default value (this depends on the event +  type). + +  The ops argument allows the driver to specify a number of callbacks: +  * add:     called when a new listener gets added (subscribing to the same +             event twice will only cause this callback to get called once) +  * del:     called when a listener stops listening +  * replace: replace event 'old' with event 'new'. +  * merge:   merge event 'old' into event 'new'. +  All 4 callbacks are optional, if you don't want to specify any callbacks +  the ops argument itself maybe NULL. + +int v4l2_event_unsubscribe(struct v4l2_fh *fh, +			   struct v4l2_event_subscription *sub)    vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use    v4l2_event_unsubscribe() directly unless it wants to be involved in @@ -740,18 +1097,12 @@ Useful functions:    The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The    drivers may want to handle this in a special way. -- v4l2_event_pending() +int v4l2_event_pending(struct v4l2_fh *fh)    Returns the number of pending events. Useful when implementing poll. -Drivers do not initialise events directly. The events are initialised -through v4l2_fh_init() if video_device->ioctl_ops->vidioc_subscribe_event is -non-NULL. This *MUST* be performed in the driver's -v4l2_file_operations->open() handler. -  Events are delivered to user space through the poll system call. The driver -can use v4l2_fh->events->wait wait_queue_head_t as the argument for -poll_wait(). +can use v4l2_fh->wait (a wait_queue_head_t) as the argument for poll_wait().  There are standard and private events. New standard events must use the  smallest available event type. The drivers must allocate their events from @@ -761,5 +1112,30 @@ The first event type in the class is reserved for future use, so the first  available event type is 'class base + 1'.  An example on how the V4L2 events may be used can be found in the OMAP -3 ISP driver available at <URL:http://gitorious.org/omap3camera> as of -writing this. +3 ISP driver (drivers/media/platform/omap3isp). + + +V4L2 clocks +----------- + +Many subdevices, like camera sensors, TV decoders and encoders, need a clock +signal to be supplied by the system. Often this clock is supplied by the +respective bridge device. The Linux kernel provides a Common Clock Framework for +this purpose. However, it is not (yet) available on all architectures. Besides, +the nature of the multi-functional (clock, data + synchronisation, I2C control) +connection of subdevices to the system might impose special requirements on the +clock API usage. E.g. V4L2 has to support clock provider driver unregistration +while a subdevice driver is holding a reference to the clock. For these reasons +a V4L2 clock helper API has been developed and is provided to bridge and +subdevice drivers. + +The API consists of two parts: two functions to register and unregister a V4L2 +clock source: v4l2_clk_register() and v4l2_clk_unregister() and calls to control +a clock object, similar to the respective generic clock API calls: +v4l2_clk_get(), v4l2_clk_put(), v4l2_clk_enable(), v4l2_clk_disable(), +v4l2_clk_get_rate(), and v4l2_clk_set_rate(). Clock suppliers have to provide +clock operations that will be called when clock users invoke respective API +methods. + +It is expected that once the CCF becomes available on all relevant +architectures this API will be removed. diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c new file mode 100644 index 00000000000..46904fe4960 --- /dev/null +++ b/Documentation/video4linux/v4l2-pci-skeleton.c @@ -0,0 +1,929 @@ +/* + * This is a V4L2 PCI Skeleton Driver. It gives an initial skeleton source + * for use with other PCI drivers. + * + * This skeleton PCI driver assumes that the card has an S-Video connector as + * input 0 and an HDMI connector as input 1. + * + * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kmod.h> +#include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/interrupt.h> +#include <linux/videodev2.h> +#include <linux/v4l2-dv-timings.h> +#include <media/v4l2-device.h> +#include <media/v4l2-dev.h> +#include <media/v4l2-ioctl.h> +#include <media/v4l2-dv-timings.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-event.h> +#include <media/videobuf2-dma-contig.h> + +MODULE_DESCRIPTION("V4L2 PCI Skeleton Driver"); +MODULE_AUTHOR("Hans Verkuil"); +MODULE_LICENSE("GPL v2"); +MODULE_DEVICE_TABLE(pci, skeleton_pci_tbl); + +/** + * struct skeleton - All internal data for one instance of device + * @pdev: PCI device + * @v4l2_dev: top-level v4l2 device struct + * @vdev: video node structure + * @ctrl_handler: control handler structure + * @lock: ioctl serialization mutex + * @std: current SDTV standard + * @timings: current HDTV timings + * @format: current pix format + * @input: current video input (0 = SDTV, 1 = HDTV) + * @queue: vb2 video capture queue + * @alloc_ctx: vb2 contiguous DMA context + * @qlock: spinlock controlling access to buf_list and sequence + * @buf_list: list of buffers queued for DMA + * @sequence: frame sequence counter + */ +struct skeleton { +	struct pci_dev *pdev; +	struct v4l2_device v4l2_dev; +	struct video_device vdev; +	struct v4l2_ctrl_handler ctrl_handler; +	struct mutex lock; +	v4l2_std_id std; +	struct v4l2_dv_timings timings; +	struct v4l2_pix_format format; +	unsigned input; + +	struct vb2_queue queue; +	struct vb2_alloc_ctx *alloc_ctx; + +	spinlock_t qlock; +	struct list_head buf_list; +	unsigned field; +	unsigned sequence; +}; + +struct skel_buffer { +	struct vb2_buffer vb; +	struct list_head list; +}; + +static inline struct skel_buffer *to_skel_buffer(struct vb2_buffer *vb2) +{ +	return container_of(vb2, struct skel_buffer, vb); +} + +static const struct pci_device_id skeleton_pci_tbl[] = { +	/* { PCI_DEVICE(PCI_VENDOR_ID_, PCI_DEVICE_ID_) }, */ +	{ 0, } +}; + +/* + * HDTV: this structure has the capabilities of the HDTV receiver. + * It is used to constrain the huge list of possible formats based + * upon the hardware capabilities. + */ +static const struct v4l2_dv_timings_cap skel_timings_cap = { +	.type = V4L2_DV_BT_656_1120, +	/* keep this initialization for compatibility with GCC < 4.4.6 */ +	.reserved = { 0 }, +	V4L2_INIT_BT_TIMINGS( +		720, 1920,		/* min/max width */ +		480, 1080,		/* min/max height */ +		27000000, 74250000,	/* min/max pixelclock*/ +		V4L2_DV_BT_STD_CEA861,	/* Supported standards */ +		/* capabilities */ +		V4L2_DV_BT_CAP_INTERLACED | V4L2_DV_BT_CAP_PROGRESSIVE +	) +}; + +/* + * Supported SDTV standards. This does the same job as skel_timings_cap, but + * for standard TV formats. + */ +#define SKEL_TVNORMS V4L2_STD_ALL + +/* + * Interrupt handler: typically interrupts happen after a new frame has been + * captured. It is the job of the handler to remove the new frame from the + * internal list and give it back to the vb2 framework, updating the sequence + * counter, field and timestamp at the same time. + */ +static irqreturn_t skeleton_irq(int irq, void *dev_id) +{ +#ifdef TODO +	struct skeleton *skel = dev_id; + +	/* handle interrupt */ + +	/* Once a new frame has been captured, mark it as done like this: */ +	if (captured_new_frame) { +		... +		spin_lock(&skel->qlock); +		list_del(&new_buf->list); +		spin_unlock(&skel->qlock); +		v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp); +		new_buf->vb.v4l2_buf.sequence = skel->sequence++; +		new_buf->vb.v4l2_buf.field = skel->field; +		if (skel->format.field == V4L2_FIELD_ALTERNATE) { +			if (skel->field == V4L2_FIELD_BOTTOM) +				skel->field = V4L2_FIELD_TOP; +			else if (skel->field == V4L2_FIELD_TOP) +				skel->field = V4L2_FIELD_BOTTOM; +		} +		vb2_buffer_done(&new_buf->vb, VB2_BUF_STATE_DONE); +	} +#endif +	return IRQ_HANDLED; +} + +/* + * Setup the constraints of the queue: besides setting the number of planes + * per buffer and the size and allocation context of each plane, it also + * checks if sufficient buffers have been allocated. Usually 3 is a good + * minimum number: many DMA engines need a minimum of 2 buffers in the + * queue and you need to have another available for userspace processing. + */ +static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, +		       unsigned int *nbuffers, unsigned int *nplanes, +		       unsigned int sizes[], void *alloc_ctxs[]) +{ +	struct skeleton *skel = vb2_get_drv_priv(vq); + +	skel->field = skel->format.field; +	if (skel->field == V4L2_FIELD_ALTERNATE) { +		/* +		 * You cannot use read() with FIELD_ALTERNATE since the field +		 * information (TOP/BOTTOM) cannot be passed back to the user. +		 */ +		if (vb2_fileio_is_active(vq)) +			return -EINVAL; +		skel->field = V4L2_FIELD_TOP; +	} + +	if (vq->num_buffers + *nbuffers < 3) +		*nbuffers = 3 - vq->num_buffers; + +	if (fmt && fmt->fmt.pix.sizeimage < skel->format.sizeimage) +		return -EINVAL; +	*nplanes = 1; +	sizes[0] = fmt ? fmt->fmt.pix.sizeimage : skel->format.sizeimage; +	alloc_ctxs[0] = skel->alloc_ctx; +	return 0; +} + +/* + * Prepare the buffer for queueing to the DMA engine: check and set the + * payload size. + */ +static int buffer_prepare(struct vb2_buffer *vb) +{ +	struct skeleton *skel = vb2_get_drv_priv(vb->vb2_queue); +	unsigned long size = skel->format.sizeimage; + +	if (vb2_plane_size(vb, 0) < size) { +		dev_err(&skel->pdev->dev, "buffer too small (%lu < %lu)\n", +			 vb2_plane_size(vb, 0), size); +		return -EINVAL; +	} + +	vb2_set_plane_payload(vb, 0, size); +	return 0; +} + +/* + * Queue this buffer to the DMA engine. + */ +static void buffer_queue(struct vb2_buffer *vb) +{ +	struct skeleton *skel = vb2_get_drv_priv(vb->vb2_queue); +	struct skel_buffer *buf = to_skel_buffer(vb); +	unsigned long flags; + +	spin_lock_irqsave(&skel->qlock, flags); +	list_add_tail(&buf->list, &skel->buf_list); + +	/* TODO: Update any DMA pointers if necessary */ + +	spin_unlock_irqrestore(&skel->qlock, flags); +} + +static void return_all_buffers(struct skeleton *skel, +			       enum vb2_buffer_state state) +{ +	struct skel_buffer *buf, *node; +	unsigned long flags; + +	spin_lock_irqsave(&skel->qlock, flags); +	list_for_each_entry_safe(buf, node, &skel->buf_list, list) { +		vb2_buffer_done(&buf->vb, state); +		list_del(&buf->list); +	} +	spin_unlock_irqrestore(&skel->qlock, flags); +} + +/* + * Start streaming. First check if the minimum number of buffers have been + * queued. If not, then return -ENOBUFS and the vb2 framework will call + * this function again the next time a buffer has been queued until enough + * buffers are available to actually start the DMA engine. + */ +static int start_streaming(struct vb2_queue *vq, unsigned int count) +{ +	struct skeleton *skel = vb2_get_drv_priv(vq); +	int ret = 0; + +	skel->sequence = 0; + +	/* TODO: start DMA */ + +	if (ret) { +		/* +		 * In case of an error, return all active buffers to the +		 * QUEUED state +		 */ +		return_all_buffers(skel, VB2_BUF_STATE_QUEUED); +	} +	return ret; +} + +/* + * Stop the DMA engine. Any remaining buffers in the DMA queue are dequeued + * and passed on to the vb2 framework marked as STATE_ERROR. + */ +static void stop_streaming(struct vb2_queue *vq) +{ +	struct skeleton *skel = vb2_get_drv_priv(vq); + +	/* TODO: stop DMA */ + +	/* Release all active buffers */ +	return_all_buffers(skel, VB2_BUF_STATE_ERROR); +} + +/* + * The vb2 queue ops. Note that since q->lock is set we can use the standard + * vb2_ops_wait_prepare/finish helper functions. If q->lock would be NULL, + * then this driver would have to provide these ops. + */ +static struct vb2_ops skel_qops = { +	.queue_setup		= queue_setup, +	.buf_prepare		= buffer_prepare, +	.buf_queue		= buffer_queue, +	.start_streaming	= start_streaming, +	.stop_streaming		= stop_streaming, +	.wait_prepare		= vb2_ops_wait_prepare, +	.wait_finish		= vb2_ops_wait_finish, +}; + +/* + * Required ioctl querycap. Note that the version field is prefilled with + * the version of the kernel. + */ +static int skeleton_querycap(struct file *file, void *priv, +			     struct v4l2_capability *cap) +{ +	struct skeleton *skel = video_drvdata(file); + +	strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); +	strlcpy(cap->card, "V4L2 PCI Skeleton", sizeof(cap->card)); +	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", +		 pci_name(skel->pdev)); +	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | +			   V4L2_CAP_STREAMING; +	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; +	return 0; +} + +/* + * Helper function to check and correct struct v4l2_pix_format. It's used + * not only in VIDIOC_TRY/S_FMT, but also elsewhere if changes to the SDTV + * standard, HDTV timings or the video input would require updating the + * current format. + */ +static void skeleton_fill_pix_format(struct skeleton *skel, +				     struct v4l2_pix_format *pix) +{ +	pix->pixelformat = V4L2_PIX_FMT_YUYV; +	if (skel->input == 0) { +		/* S-Video input */ +		pix->width = 720; +		pix->height = (skel->std & V4L2_STD_525_60) ? 480 : 576; +		pix->field = V4L2_FIELD_INTERLACED; +		pix->colorspace = V4L2_COLORSPACE_SMPTE170M; +	} else { +		/* HDMI input */ +		pix->width = skel->timings.bt.width; +		pix->height = skel->timings.bt.height; +		if (skel->timings.bt.interlaced) { +			pix->field = V4L2_FIELD_ALTERNATE; +			pix->height /= 2; +		} else { +			pix->field = V4L2_FIELD_NONE; +		} +		pix->colorspace = V4L2_COLORSPACE_REC709; +	} + +	/* +	 * The YUYV format is four bytes for every two pixels, so bytesperline +	 * is width * 2. +	 */ +	pix->bytesperline = pix->width * 2; +	pix->sizeimage = pix->bytesperline * pix->height; +	pix->priv = 0; +} + +static int skeleton_try_fmt_vid_cap(struct file *file, void *priv, +				    struct v4l2_format *f) +{ +	struct skeleton *skel = video_drvdata(file); +	struct v4l2_pix_format *pix = &f->fmt.pix; + +	/* +	 * Due to historical reasons providing try_fmt with an unsupported +	 * pixelformat will return -EINVAL for video receivers. Webcam drivers, +	 * however, will silently correct the pixelformat. Some video capture +	 * applications rely on this behavior... +	 */ +	if (pix->pixelformat != V4L2_PIX_FMT_YUYV) +		return -EINVAL; +	skeleton_fill_pix_format(skel, pix); +	return 0; +} + +static int skeleton_s_fmt_vid_cap(struct file *file, void *priv, +				  struct v4l2_format *f) +{ +	struct skeleton *skel = video_drvdata(file); +	int ret; + +	ret = skeleton_try_fmt_vid_cap(file, priv, f); +	if (ret) +		return ret; + +	/* +	 * It is not allowed to change the format while buffers for use with +	 * streaming have already been allocated. +	 */ +	if (vb2_is_busy(&skel->queue)) +		return -EBUSY; + +	/* TODO: change format */ +	skel->format = f->fmt.pix; +	return 0; +} + +static int skeleton_g_fmt_vid_cap(struct file *file, void *priv, +				  struct v4l2_format *f) +{ +	struct skeleton *skel = video_drvdata(file); + +	f->fmt.pix = skel->format; +	return 0; +} + +static int skeleton_enum_fmt_vid_cap(struct file *file, void *priv, +				     struct v4l2_fmtdesc *f) +{ +	if (f->index != 0) +		return -EINVAL; + +	strlcpy(f->description, "4:2:2, packed, YUYV", sizeof(f->description)); +	f->pixelformat = V4L2_PIX_FMT_YUYV; +	f->flags = 0; +	return 0; +} + +static int skeleton_s_std(struct file *file, void *priv, v4l2_std_id std) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* S_STD is not supported on the HDMI input */ +	if (skel->input) +		return -ENODATA; + +	/* +	 * No change, so just return. Some applications call S_STD again after +	 * the buffers for streaming have been set up, so we have to allow for +	 * this behavior. +	 */ +	if (std == skel->std) +		return 0; + +	/* +	 * Changing the standard implies a format change, which is not allowed +	 * while buffers for use with streaming have already been allocated. +	 */ +	if (vb2_is_busy(&skel->queue)) +		return -EBUSY; + +	/* TODO: handle changing std */ + +	skel->std = std; + +	/* Update the internal format */ +	skeleton_fill_pix_format(skel, &skel->format); +	return 0; +} + +static int skeleton_g_std(struct file *file, void *priv, v4l2_std_id *std) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* G_STD is not supported on the HDMI input */ +	if (skel->input) +		return -ENODATA; + +	*std = skel->std; +	return 0; +} + +/* + * Query the current standard as seen by the hardware. This function shall + * never actually change the standard, it just detects and reports. + * The framework will initially set *std to tvnorms (i.e. the set of + * supported standards by this input), and this function should just AND + * this value. If there is no signal, then *std should be set to 0. + */ +static int skeleton_querystd(struct file *file, void *priv, v4l2_std_id *std) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* QUERY_STD is not supported on the HDMI input */ +	if (skel->input) +		return -ENODATA; + +#ifdef TODO +	/* +	 * Query currently seen standard. Initial value of *std is +	 * V4L2_STD_ALL. This function should look something like this: +	 */ +	get_signal_info(); +	if (no_signal) { +		*std = 0; +		return 0; +	} +	/* Use signal information to reduce the number of possible standards */ +	if (signal_has_525_lines) +		*std &= V4L2_STD_525_60; +	else +		*std &= V4L2_STD_625_50; +#endif +	return 0; +} + +static int skeleton_s_dv_timings(struct file *file, void *_fh, +				 struct v4l2_dv_timings *timings) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* S_DV_TIMINGS is not supported on the S-Video input */ +	if (skel->input == 0) +		return -ENODATA; + +	/* Quick sanity check */ +	if (!v4l2_valid_dv_timings(timings, &skel_timings_cap, NULL, NULL)) +		return -EINVAL; + +	/* Check if the timings are part of the CEA-861 timings. */ +	if (!v4l2_find_dv_timings_cap(timings, &skel_timings_cap, +				      0, NULL, NULL)) +		return -EINVAL; + +	/* Return 0 if the new timings are the same as the current timings. */ +	if (v4l2_match_dv_timings(timings, &skel->timings, 0)) +		return 0; + +	/* +	 * Changing the timings implies a format change, which is not allowed +	 * while buffers for use with streaming have already been allocated. +	 */ +	if (vb2_is_busy(&skel->queue)) +		return -EBUSY; + +	/* TODO: Configure new timings */ + +	/* Save timings */ +	skel->timings = *timings; + +	/* Update the internal format */ +	skeleton_fill_pix_format(skel, &skel->format); +	return 0; +} + +static int skeleton_g_dv_timings(struct file *file, void *_fh, +				 struct v4l2_dv_timings *timings) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* G_DV_TIMINGS is not supported on the S-Video input */ +	if (skel->input == 0) +		return -ENODATA; + +	*timings = skel->timings; +	return 0; +} + +static int skeleton_enum_dv_timings(struct file *file, void *_fh, +				    struct v4l2_enum_dv_timings *timings) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* ENUM_DV_TIMINGS is not supported on the S-Video input */ +	if (skel->input == 0) +		return -ENODATA; + +	return v4l2_enum_dv_timings_cap(timings, &skel_timings_cap, +					NULL, NULL); +} + +/* + * Query the current timings as seen by the hardware. This function shall + * never actually change the timings, it just detects and reports. + * If no signal is detected, then return -ENOLINK. If the hardware cannot + * lock to the signal, then return -ENOLCK. If the signal is out of range + * of the capabilities of the system (e.g., it is possible that the receiver + * can lock but that the DMA engine it is connected to cannot handle + * pixelclocks above a certain frequency), then -ERANGE is returned. + */ +static int skeleton_query_dv_timings(struct file *file, void *_fh, +				     struct v4l2_dv_timings *timings) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* QUERY_DV_TIMINGS is not supported on the S-Video input */ +	if (skel->input == 0) +		return -ENODATA; + +#ifdef TODO +	/* +	 * Query currently seen timings. This function should look +	 * something like this: +	 */ +	detect_timings(); +	if (no_signal) +		return -ENOLINK; +	if (cannot_lock_to_signal) +		return -ENOLCK; +	if (signal_out_of_range_of_capabilities) +		return -ERANGE; + +	/* Useful for debugging */ +	v4l2_print_dv_timings(skel->v4l2_dev.name, "query_dv_timings:", +			timings, true); +#endif +	return 0; +} + +static int skeleton_dv_timings_cap(struct file *file, void *fh, +				   struct v4l2_dv_timings_cap *cap) +{ +	struct skeleton *skel = video_drvdata(file); + +	/* DV_TIMINGS_CAP is not supported on the S-Video input */ +	if (skel->input == 0) +		return -ENODATA; +	*cap = skel_timings_cap; +	return 0; +} + +static int skeleton_enum_input(struct file *file, void *priv, +			       struct v4l2_input *i) +{ +	if (i->index > 1) +		return -EINVAL; + +	i->type = V4L2_INPUT_TYPE_CAMERA; +	if (i->index == 0) { +		i->std = SKEL_TVNORMS; +		strlcpy(i->name, "S-Video", sizeof(i->name)); +		i->capabilities = V4L2_IN_CAP_STD; +	} else { +		i->std = 0; +		strlcpy(i->name, "HDMI", sizeof(i->name)); +		i->capabilities = V4L2_IN_CAP_DV_TIMINGS; +	} +	return 0; +} + +static int skeleton_s_input(struct file *file, void *priv, unsigned int i) +{ +	struct skeleton *skel = video_drvdata(file); + +	if (i > 1) +		return -EINVAL; + +	/* +	 * Changing the input implies a format change, which is not allowed +	 * while buffers for use with streaming have already been allocated. +	 */ +	if (vb2_is_busy(&skel->queue)) +		return -EBUSY; + +	skel->input = i; +	/* +	 * Update tvnorms. The tvnorms value is used by the core to implement +	 * VIDIOC_ENUMSTD so it has to be correct. If tvnorms == 0, then +	 * ENUMSTD will return -ENODATA. +	 */ +	skel->vdev.tvnorms = i ? 0 : SKEL_TVNORMS; + +	/* Update the internal format */ +	skeleton_fill_pix_format(skel, &skel->format); +	return 0; +} + +static int skeleton_g_input(struct file *file, void *priv, unsigned int *i) +{ +	struct skeleton *skel = video_drvdata(file); + +	*i = skel->input; +	return 0; +} + +/* The control handler. */ +static int skeleton_s_ctrl(struct v4l2_ctrl *ctrl) +{ +	/*struct skeleton *skel = +		container_of(ctrl->handler, struct skeleton, ctrl_handler);*/ + +	switch (ctrl->id) { +	case V4L2_CID_BRIGHTNESS: +		/* TODO: set brightness to ctrl->val */ +		break; +	case V4L2_CID_CONTRAST: +		/* TODO: set contrast to ctrl->val */ +		break; +	case V4L2_CID_SATURATION: +		/* TODO: set saturation to ctrl->val */ +		break; +	case V4L2_CID_HUE: +		/* TODO: set hue to ctrl->val */ +		break; +	default: +		return -EINVAL; +	} +	return 0; +} + +/* ------------------------------------------------------------------ +	File operations for the device +   ------------------------------------------------------------------*/ + +static const struct v4l2_ctrl_ops skel_ctrl_ops = { +	.s_ctrl = skeleton_s_ctrl, +}; + +/* + * The set of all supported ioctls. Note that all the streaming ioctls + * use the vb2 helper functions that take care of all the locking and + * that also do ownership tracking (i.e. only the filehandle that requested + * the buffers can call the streaming ioctls, all other filehandles will + * receive -EBUSY if they attempt to call the same streaming ioctls). + * + * The last three ioctls also use standard helper functions: these implement + * standard behavior for drivers with controls. + */ +static const struct v4l2_ioctl_ops skel_ioctl_ops = { +	.vidioc_querycap = skeleton_querycap, +	.vidioc_try_fmt_vid_cap = skeleton_try_fmt_vid_cap, +	.vidioc_s_fmt_vid_cap = skeleton_s_fmt_vid_cap, +	.vidioc_g_fmt_vid_cap = skeleton_g_fmt_vid_cap, +	.vidioc_enum_fmt_vid_cap = skeleton_enum_fmt_vid_cap, + +	.vidioc_g_std = skeleton_g_std, +	.vidioc_s_std = skeleton_s_std, +	.vidioc_querystd = skeleton_querystd, + +	.vidioc_s_dv_timings = skeleton_s_dv_timings, +	.vidioc_g_dv_timings = skeleton_g_dv_timings, +	.vidioc_enum_dv_timings = skeleton_enum_dv_timings, +	.vidioc_query_dv_timings = skeleton_query_dv_timings, +	.vidioc_dv_timings_cap = skeleton_dv_timings_cap, + +	.vidioc_enum_input = skeleton_enum_input, +	.vidioc_g_input = skeleton_g_input, +	.vidioc_s_input = skeleton_s_input, + +	.vidioc_reqbufs = vb2_ioctl_reqbufs, +	.vidioc_create_bufs = vb2_ioctl_create_bufs, +	.vidioc_querybuf = vb2_ioctl_querybuf, +	.vidioc_qbuf = vb2_ioctl_qbuf, +	.vidioc_dqbuf = vb2_ioctl_dqbuf, +	.vidioc_expbuf = vb2_ioctl_expbuf, +	.vidioc_streamon = vb2_ioctl_streamon, +	.vidioc_streamoff = vb2_ioctl_streamoff, + +	.vidioc_log_status = v4l2_ctrl_log_status, +	.vidioc_subscribe_event = v4l2_ctrl_subscribe_event, +	.vidioc_unsubscribe_event = v4l2_event_unsubscribe, +}; + +/* + * The set of file operations. Note that all these ops are standard core + * helper functions. + */ +static const struct v4l2_file_operations skel_fops = { +	.owner = THIS_MODULE, +	.open = v4l2_fh_open, +	.release = vb2_fop_release, +	.unlocked_ioctl = video_ioctl2, +	.read = vb2_fop_read, +	.mmap = vb2_fop_mmap, +	.poll = vb2_fop_poll, +}; + +/* + * The initial setup of this device instance. Note that the initial state of + * the driver should be complete. So the initial format, standard, timings + * and video input should all be initialized to some reasonable value. + */ +static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +{ +	/* The initial timings are chosen to be 720p60. */ +	static const struct v4l2_dv_timings timings_def = +		V4L2_DV_BT_CEA_1280X720P60; +	struct skeleton *skel; +	struct video_device *vdev; +	struct v4l2_ctrl_handler *hdl; +	struct vb2_queue *q; +	int ret; + +	/* Enable PCI */ +	ret = pci_enable_device(pdev); +	if (ret) +		return ret; +	ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); +	if (ret) { +		dev_err(&pdev->dev, "no suitable DMA available.\n"); +		goto disable_pci; +	} + +	/* Allocate a new instance */ +	skel = devm_kzalloc(&pdev->dev, sizeof(struct skeleton), GFP_KERNEL); +	if (!skel) +		return -ENOMEM; + +	/* Allocate the interrupt */ +	ret = devm_request_irq(&pdev->dev, pdev->irq, +			       skeleton_irq, 0, KBUILD_MODNAME, skel); +	if (ret) { +		dev_err(&pdev->dev, "request_irq failed\n"); +		goto disable_pci; +	} +	skel->pdev = pdev; + +	/* Fill in the initial format-related settings */ +	skel->timings = timings_def; +	skel->std = V4L2_STD_625_50; +	skeleton_fill_pix_format(skel, &skel->format); + +	/* Initialize the top-level structure */ +	ret = v4l2_device_register(&pdev->dev, &skel->v4l2_dev); +	if (ret) +		goto disable_pci; + +	mutex_init(&skel->lock); + +	/* Add the controls */ +	hdl = &skel->ctrl_handler; +	v4l2_ctrl_handler_init(hdl, 4); +	v4l2_ctrl_new_std(hdl, &skel_ctrl_ops, +			  V4L2_CID_BRIGHTNESS, 0, 255, 1, 127); +	v4l2_ctrl_new_std(hdl, &skel_ctrl_ops, +			  V4L2_CID_CONTRAST, 0, 255, 1, 16); +	v4l2_ctrl_new_std(hdl, &skel_ctrl_ops, +			  V4L2_CID_SATURATION, 0, 255, 1, 127); +	v4l2_ctrl_new_std(hdl, &skel_ctrl_ops, +			  V4L2_CID_HUE, -128, 127, 1, 0); +	if (hdl->error) { +		ret = hdl->error; +		goto free_hdl; +	} +	skel->v4l2_dev.ctrl_handler = hdl; + +	/* Initialize the vb2 queue */ +	q = &skel->queue; +	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +	q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; +	q->drv_priv = skel; +	q->buf_struct_size = sizeof(struct skel_buffer); +	q->ops = &skel_qops; +	q->mem_ops = &vb2_dma_contig_memops; +	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; +	/* +	 * Assume that this DMA engine needs to have at least two buffers +	 * available before it can be started. The start_streaming() op +	 * won't be called until at least this many buffers are queued up. +	 */ +	q->min_buffers_needed = 2; +	/* +	 * The serialization lock for the streaming ioctls. This is the same +	 * as the main serialization lock, but if some of the non-streaming +	 * ioctls could take a long time to execute, then you might want to +	 * have a different lock here to prevent VIDIOC_DQBUF from being +	 * blocked while waiting for another action to finish. This is +	 * generally not needed for PCI devices, but USB devices usually do +	 * want a separate lock here. +	 */ +	q->lock = &skel->lock; +	/* +	 * Since this driver can only do 32-bit DMA we must make sure that +	 * the vb2 core will allocate the buffers in 32-bit DMA memory. +	 */ +	q->gfp_flags = GFP_DMA32; +	ret = vb2_queue_init(q); +	if (ret) +		goto free_hdl; + +	skel->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); +	if (IS_ERR(skel->alloc_ctx)) { +		dev_err(&pdev->dev, "Can't allocate buffer context"); +		ret = PTR_ERR(skel->alloc_ctx); +		goto free_hdl; +	} +	INIT_LIST_HEAD(&skel->buf_list); +	spin_lock_init(&skel->qlock); + +	/* Initialize the video_device structure */ +	vdev = &skel->vdev; +	strlcpy(vdev->name, KBUILD_MODNAME, sizeof(vdev->name)); +	/* +	 * There is nothing to clean up, so release is set to an empty release +	 * function. The release callback must be non-NULL. +	 */ +	vdev->release = video_device_release_empty; +	vdev->fops = &skel_fops, +	vdev->ioctl_ops = &skel_ioctl_ops, +	/* +	 * The main serialization lock. All ioctls are serialized by this +	 * lock. Exception: if q->lock is set, then the streaming ioctls +	 * are serialized by that separate lock. +	 */ +	vdev->lock = &skel->lock; +	vdev->queue = q; +	vdev->v4l2_dev = &skel->v4l2_dev; +	/* Supported SDTV standards, if any */ +	vdev->tvnorms = SKEL_TVNORMS; +	/* If this bit is set, then the v4l2 core will provide the support +	 * for the VIDIOC_G/S_PRIORITY ioctls. This flag will eventually +	 * go away once all drivers have been converted to use struct v4l2_fh. +	 */ +	set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); +	video_set_drvdata(vdev, skel); + +	ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); +	if (ret) +		goto free_ctx; + +	dev_info(&pdev->dev, "V4L2 PCI Skeleton Driver loaded\n"); +	return 0; + +free_ctx: +	vb2_dma_contig_cleanup_ctx(skel->alloc_ctx); +free_hdl: +	v4l2_ctrl_handler_free(&skel->ctrl_handler); +	v4l2_device_unregister(&skel->v4l2_dev); +disable_pci: +	pci_disable_device(pdev); +	return ret; +} + +static void skeleton_remove(struct pci_dev *pdev) +{ +	struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); +	struct skeleton *skel = container_of(v4l2_dev, struct skeleton, v4l2_dev); + +	video_unregister_device(&skel->vdev); +	v4l2_ctrl_handler_free(&skel->ctrl_handler); +	vb2_dma_contig_cleanup_ctx(skel->alloc_ctx); +	v4l2_device_unregister(&skel->v4l2_dev); +	pci_disable_device(skel->pdev); +} + +static struct pci_driver skeleton_driver = { +	.name = KBUILD_MODNAME, +	.probe = skeleton_probe, +	.remove = skeleton_remove, +	.id_table = skeleton_pci_tbl, +}; + +module_pci_driver(skeleton_driver); diff --git a/Documentation/video4linux/v4lgrab.c b/Documentation/video4linux/v4lgrab.c deleted file mode 100644 index c8ded175796..00000000000 --- a/Documentation/video4linux/v4lgrab.c +++ /dev/null @@ -1,201 +0,0 @@ -/* Simple Video4Linux image grabber. */ -/* - *	Video4Linux Driver Test/Example Framegrabbing Program - * - *	Compile with: - *		gcc -s -Wall -Wstrict-prototypes v4lgrab.c -o v4lgrab - *	Use as: - *		v4lgrab >image.ppm - * - *	Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org> - *	Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c - *	with minor modifications (Dave Forrest, drf5n@virginia.edu). - * - * - *	For some cameras you may need to pre-load libv4l to perform - *	the necessary decompression, e.g.: - * - *	export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so - *	./v4lgrab >image.ppm - * - *	see http://hansdegoede.livejournal.com/3636.html for details. - * - */ - -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdio.h> -#include <sys/ioctl.h> -#include <stdlib.h> - -#include <linux/types.h> -#include <linux/videodev.h> - -#define VIDEO_DEV "/dev/video0" - -/* Stole this from tvset.c */ - -#define READ_VIDEO_PIXEL(buf, format, depth, r, g, b)                   \ -{                                                                       \ -	switch (format)                                                 \ -	{                                                               \ -		case VIDEO_PALETTE_GREY:                                \ -			switch (depth)                                  \ -			{                                               \ -				case 4:                                 \ -				case 6:                                 \ -				case 8:                                 \ -					(r) = (g) = (b) = (*buf++ << 8);\ -					break;                          \ -									\ -				case 16:                                \ -					(r) = (g) = (b) =               \ -						*((unsigned short *) buf);      \ -					buf += 2;                       \ -					break;                          \ -			}                                               \ -			break;                                          \ -									\ -									\ -		case VIDEO_PALETTE_RGB565:                              \ -		{                                                       \ -			unsigned short tmp = *(unsigned short *)buf;    \ -			(r) = tmp&0xF800;                               \ -			(g) = (tmp<<5)&0xFC00;                          \ -			(b) = (tmp<<11)&0xF800;                         \ -			buf += 2;                                       \ -		}                                                       \ -		break;                                                  \ -									\ -		case VIDEO_PALETTE_RGB555:                              \ -			(r) = (buf[0]&0xF8)<<8;                         \ -			(g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8;    \ -			(b) = ((buf[1] << 2 ) & 0xF8)<<8;               \ -			buf += 2;                                       \ -			break;                                          \ -									\ -		case VIDEO_PALETTE_RGB24:                               \ -			(r) = buf[0] << 8; (g) = buf[1] << 8;           \ -			(b) = buf[2] << 8;                              \ -			buf += 3;                                       \ -			break;                                          \ -									\ -		default:                                                \ -			fprintf(stderr,                                 \ -				"Format %d not yet supported\n",        \ -				format);                                \ -	}                                                               \ -} - -static int get_brightness_adj(unsigned char *image, long size, int *brightness) { -  long i, tot = 0; -  for (i=0;i<size*3;i++) -    tot += image[i]; -  *brightness = (128 - tot/(size*3))/3; -  return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130); -} - -int main(int argc, char ** argv) -{ -  int fd = open(VIDEO_DEV, O_RDONLY), f; -  struct video_capability cap; -  struct video_window win; -  struct video_picture vpic; - -  unsigned char *buffer, *src; -  int bpp = 24, r = 0, g = 0, b = 0; -  unsigned int i, src_depth = 16; - -  if (fd < 0) { -    perror(VIDEO_DEV); -    exit(1); -  } - -  if (ioctl(fd, VIDIOCGCAP, &cap) < 0) { -    perror("VIDIOGCAP"); -    fprintf(stderr, "(" VIDEO_DEV " not a video4linux device?)\n"); -    close(fd); -    exit(1); -  } - -  if (ioctl(fd, VIDIOCGWIN, &win) < 0) { -    perror("VIDIOCGWIN"); -    close(fd); -    exit(1); -  } - -  if (ioctl(fd, VIDIOCGPICT, &vpic) < 0) { -    perror("VIDIOCGPICT"); -    close(fd); -    exit(1); -  } - -  if (cap.type & VID_TYPE_MONOCHROME) { -    vpic.depth=8; -    vpic.palette=VIDEO_PALETTE_GREY;    /* 8bit grey */ -    if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { -      vpic.depth=6; -      if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { -	vpic.depth=4; -	if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { -	  fprintf(stderr, "Unable to find a supported capture format.\n"); -	  close(fd); -	  exit(1); -	} -      } -    } -  } else { -    vpic.depth=24; -    vpic.palette=VIDEO_PALETTE_RGB24; - -    if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { -      vpic.palette=VIDEO_PALETTE_RGB565; -      vpic.depth=16; - -      if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { -	vpic.palette=VIDEO_PALETTE_RGB555; -	vpic.depth=15; - -	if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { -	  fprintf(stderr, "Unable to find a supported capture format.\n"); -	  return -1; -	} -      } -    } -  } - -  buffer = malloc(win.width * win.height * bpp); -  if (!buffer) { -    fprintf(stderr, "Out of memory.\n"); -    exit(1); -  } - -  do { -    int newbright; -    read(fd, buffer, win.width * win.height * bpp); -    f = get_brightness_adj(buffer, win.width * win.height, &newbright); -    if (f) { -      vpic.brightness += (newbright << 8); -      if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { -	perror("VIDIOSPICT"); -	break; -      } -    } -  } while (f); - -  fprintf(stdout, "P6\n%d %d 255\n", win.width, win.height); - -  src = buffer; - -  for (i = 0; i < win.width * win.height; i++) { -    READ_VIDEO_PIXEL(src, vpic.palette, src_depth, r, g, b); -    fputc(r>>8, stdout); -    fputc(g>>8, stdout); -    fputc(b>>8, stdout); -  } - -  close(fd); -  return 0; -} diff --git a/Documentation/video4linux/videobuf b/Documentation/video4linux/videobuf index 17a1f9abf26..3ffe9e960b6 100644 --- a/Documentation/video4linux/videobuf +++ b/Documentation/video4linux/videobuf @@ -247,8 +247,6 @@ calls.  The relevant helper functions are:  		       int nonblocking);      int videobuf_streamon(struct videobuf_queue *q);      int videobuf_streamoff(struct videobuf_queue *q); -    int videobuf_cgmbuf(struct videobuf_queue *q, struct video_mbuf *mbuf, -			int count);  So, for example, a VIDIOC_REQBUFS call turns into a call to the driver's  vidioc_reqbufs() callback which, in turn, usually only needs to locate the @@ -258,10 +256,7 @@ boilerplate in a lot of V4L2 drivers.  The vidioc_streamon() and vidioc_streamoff() functions will be a bit more  complex, of course, since they will also need to deal with starting and -stopping the capture engine.  videobuf_cgmbuf(), called from the driver's -vidiocgmbuf() function, only exists if the V4L1 compatibility module has -been selected with CONFIG_VIDEO_V4L1_COMPAT, so its use must be surrounded -with #ifdef directives. +stopping the capture engine.  Buffer allocation @@ -354,7 +349,7 @@ again.  Developers who are interested in more information can go into the relevant  header files; there are a few low-level functions declared there which have  not been talked about here.  Also worthwhile is the vivi driver -(drivers/media/video/vivi.c), which is maintained as an example of how V4L2 +(drivers/media/platform/vivi.c), which is maintained as an example of how V4L2  drivers should be written.  Vivi only uses the vmalloc() API, but it's good  enough to get started with.  Note also that all of these calls are exported  GPL-only, so they will not be available to non-GPL kernel modules. diff --git a/Documentation/video4linux/w9968cf.txt b/Documentation/video4linux/w9968cf.txt deleted file mode 100644 index 05138e8aea0..00000000000 --- a/Documentation/video4linux/w9968cf.txt +++ /dev/null @@ -1,458 +0,0 @@ - -		   W996[87]CF JPEG USB Dual Mode Camera Chip -		     Driver for Linux 2.6 (basic version) -		   ========================================= - -			       - Documentation - - - -Index -===== -1.  Copyright -2.  Disclaimer -3.  License -4.  Overview -5.  Supported devices -6.  Module dependencies -7.  Module loading -8.  Module parameters -9.  Contact information -10. Credits - - -1. Copyright -============ -Copyright (C) 2002-2004 by Luca Risolia <luca.risolia@studio.unibo.it> - - -2. Disclaimer -============= -Winbond is a trademark of Winbond Electronics Corporation. -This software is not sponsored or developed by Winbond. - - -3. License -========== -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -4. Overview -=========== -This driver supports the video streaming capabilities of the devices mounting -Winbond W9967CF and Winbond W9968CF JPEG USB Dual Mode Camera Chips. OV681 -based cameras should be supported as well. - -The driver is divided into two modules: the basic one, "w9968cf", is needed for -the supported devices to work; the second one, "w9968cf-vpp", is an optional -module, which provides some useful video post-processing functions like video -decoding, up-scaling and colour conversions. - -Note that the official kernels do neither include nor support the second -module for performance purposes. Therefore, it is always recommended to -download and install the latest and complete release of the driver, -replacing the existing one, if present. - -The latest and full-featured version of the W996[87]CF driver can be found at: -http://www.linux-projects.org. Please refer to the documentation included in -that package, if you are going to use it. - -Up to 32 cameras can be handled at the same time. They can be connected and -disconnected from the host many times without turning off the computer, if -your system supports the hotplug facility. - -To change the default settings for each camera, many parameters can be passed -through command line when the module is loaded into memory. - -The driver relies on the Video4Linux, USB and I2C core modules. It has been -designed to run properly on SMP systems as well. An additional module, -"ovcamchip", is mandatory; it provides support for some OmniVision image -sensors connected to the W996[87]CF chips; if found in the system, the module -will be automatically loaded by default (provided that the kernel has been -compiled with the automatic module loading option). - - -5. Supported devices -==================== -At the moment, known W996[87]CF and OV681 based devices are: -- Aroma Digi Pen VGA Dual Mode ADG-5000 (unknown image sensor) -- AVerMedia AVerTV USB (SAA7111A, Philips FI1216Mk2 tuner, PT2313L audio chip) -- Creative Labs Video Blaster WebCam Go (OmniVision OV7610 sensor) -- Creative Labs Video Blaster WebCam Go Plus (OmniVision OV7620 sensor) -- Lebon LDC-035A (unknown image sensor) -- Ezonics EZ-802 EZMega Cam (OmniVision OV8610C sensor) -- OmniVision OV8610-EDE (OmniVision OV8610 sensor) -- OPCOM Digi Pen VGA Dual Mode Pen Camera (unknown image sensor) -- Pretec Digi Pen-II (OmniVision OV7620 sensor) -- Pretec DigiPen-480 (OmniVision OV8610 sensor) - -If you know any other W996[87]CF or OV681 based cameras, please contact me. - -The list above does not imply that all those devices work with this driver: up -until now only webcams that have an image sensor supported by the "ovcamchip" -module work. Kernel messages will always tell you whether this is case. - -Possible external microcontrollers of those webcams are not supported: this -means that still images cannot be downloaded from the device memory. - -Furthermore, it's worth to note that I was only able to run tests on my -"Creative Labs Video Blaster WebCam Go". Donations of other models, for -additional testing and full support, would be much appreciated. - - -6. Module dependencies -====================== -For it to work properly, the driver needs kernel support for Video4Linux, USB -and I2C, and the "ovcamchip" module for the image sensor. Make sure you are not -actually using any external "ovcamchip" module, given that the W996[87]CF -driver depends on the version of the module present in the official kernels. - -The following options of the kernel configuration file must be enabled and -corresponding modules must be compiled: - -	# Multimedia devices -	# -	CONFIG_VIDEO_DEV=m - -	# I2C support -	# -	CONFIG_I2C=m - -The I2C core module can be compiled statically in the kernel as well. - -	# OmniVision Camera Chip support -	# -	CONFIG_VIDEO_OVCAMCHIP=m - -	# USB support -	# -	CONFIG_USB=m - -In addition, depending on the hardware being used, only one of the modules -below is necessary: - -	# USB Host Controller Drivers -	# -	CONFIG_USB_EHCI_HCD=m -	CONFIG_USB_UHCI_HCD=m -	CONFIG_USB_OHCI_HCD=m - -And finally: - -	# USB Multimedia devices -	# -	CONFIG_USB_W9968CF=m - - -7. Module loading -================= -To use the driver, it is necessary to load the "w9968cf" module into memory -after every other module required. - -Loading can be done this way, from root: - -	[root@localhost home]# modprobe usbcore -	[root@localhost home]# modprobe i2c-core -	[root@localhost home]# modprobe videodev -	[root@localhost home]# modprobe w9968cf - -At this point the pertinent devices should be recognized: "dmesg" can be used -to analyze kernel messages: - -	[user@localhost home]$ dmesg - -There are a lot of parameters the module can use to change the default -settings for each device. To list every possible parameter with a brief -explanation about them and which syntax to use, it is recommended to run the -"modinfo" command: - -	[root@locahost home]# modinfo w9968cf - - -8. Module parameters -==================== -Module parameters are listed below: -------------------------------------------------------------------------------- -Name:            ovmod_load -Type:            bool -Syntax:          <0|1> -Description:     Automatic 'ovcamchip' module loading: 0 disabled, 1 enabled. -		 If enabled, 'insmod' searches for the required 'ovcamchip' -		 module in the system, according to its configuration, and -		 loads that module automatically. This action is performed as -		 once soon as the 'w9968cf' module is loaded into memory. -Default:         1 -------------------------------------------------------------------------------- -Name:           simcams -Type:           int -Syntax:         <n> -Description:    Number of cameras allowed to stream simultaneously. -		n may vary from 0 to 32. -Default:        32 -------------------------------------------------------------------------------- -Name:           video_nr -Type:           int array (min = 0, max = 32) -Syntax:         <-1|n[,...]> -Description:    Specify V4L minor mode number. -		-1 = use next available -		 n = use minor number n -		You can specify up to 32 cameras this way. -		For example: -		video_nr=-1,2,-1 would assign minor number 2 to the second -		recognized camera and use auto for the first one and for every -		other camera. -Default:        -1 -------------------------------------------------------------------------------- -Name:           packet_size -Type:           int array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Specify the maximum data payload size in bytes for alternate -		settings, for each device. n is scaled between 63 and 1023. -Default:        1023 -------------------------------------------------------------------------------- -Name:           max_buffers -Type:           int array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    For advanced users. -		Specify the maximum number of video frame buffers to allocate -		for each device, from 2 to 32. -Default:        2 -------------------------------------------------------------------------------- -Name:           double_buffer -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Hardware double buffering: 0 disabled, 1 enabled. -		It should be enabled if you want smooth video output: if you -		obtain out of sync. video, disable it, or try to -		decrease the 'clockdiv' module parameter value. -Default:        1 for every device. -------------------------------------------------------------------------------- -Name:           clamping -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Video data clamping: 0 disabled, 1 enabled. -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           filter_type -Type:           int array (min = 0, max = 32) -Syntax:         <0|1|2[,...]> -Description:    Video filter type. -		0 none, 1 (1-2-1) 3-tap filter, 2 (2-3-6-3-2) 5-tap filter. -		The filter is used to reduce noise and aliasing artifacts -		produced by the CCD or CMOS image sensor. -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           largeview -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Large view: 0 disabled, 1 enabled. -Default:        1 for every device. -------------------------------------------------------------------------------- -Name:           upscaling -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Software scaling (for non-compressed video only): -		0 disabled, 1 enabled. -		Disable it if you have a slow CPU or you don't have enough -		memory. -Default:        0 for every device. -Note:           If 'w9968cf-vpp' is not present, this parameter is set to 0. -------------------------------------------------------------------------------- -Name:           decompression -Type:           int array (min = 0, max = 32) -Syntax:         <0|1|2[,...]> -Description:    Software video decompression: -		0 = disables decompression -		    (doesn't allow formats needing decompression). -		1 = forces decompression -		    (allows formats needing decompression only). -		2 = allows any permitted formats. -		Formats supporting (de)compressed video are YUV422P and -		YUV420P/YUV420 in any resolutions where width and height are -		multiples of 16. -Default:        2 for every device. -Note:           If 'w9968cf-vpp' is not present, forcing decompression is not -		allowed; in this case this parameter is set to 2. -------------------------------------------------------------------------------- -Name:           force_palette -Type:           int array (min = 0, max = 32) -Syntax:         <0|9|10|13|15|8|7|1|6|3|4|5[,...]> -Description:    Force picture palette. -		In order: -		 0 = Off - allows any of the following formats: -		 9 = UYVY    16 bpp - Original video, compression disabled -		10 = YUV420  12 bpp - Original video, compression enabled -		13 = YUV422P 16 bpp - Original video, compression enabled -		15 = YUV420P 12 bpp - Original video, compression enabled -		 8 = YUVY    16 bpp - Software conversion from UYVY -		 7 = YUV422  16 bpp - Software conversion from UYVY -		 1 = GREY     8 bpp - Software conversion from UYVY -		 6 = RGB555  16 bpp - Software conversion from UYVY -		 3 = RGB565  16 bpp - Software conversion from UYVY -		 4 = RGB24   24 bpp - Software conversion from UYVY -		 5 = RGB32   32 bpp - Software conversion from UYVY -		When not 0, this parameter will override 'decompression'. -Default:        0 for every device. Initial palette is 9 (UYVY). -Note:           If 'w9968cf-vpp' is not present, this parameter is set to 9. -------------------------------------------------------------------------------- -Name:           force_rgb -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Read RGB video data instead of BGR: -		1 = use RGB component ordering. -		0 = use BGR component ordering. -		This parameter has effect when using RGBX palettes only. -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           autobright -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Image sensor automatically changes brightness: -		0 = no, 1 = yes -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           autoexp -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Image sensor automatically changes exposure: -		0 = no, 1 = yes -Default:        1 for every device. -------------------------------------------------------------------------------- -Name:           lightfreq -Type:           int array (min = 0, max = 32) -Syntax:         <50|60[,...]> -Description:    Light frequency in Hz: -		50 for European and Asian lighting, 60 for American lighting. -Default:        50 for every device. -------------------------------------------------------------------------------- -Name:           bandingfilter -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Banding filter to reduce effects of fluorescent -		lighting: -		0 disabled, 1 enabled. -		This filter tries to reduce the pattern of horizontal -		light/dark bands caused by some (usually fluorescent) lighting. -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           clockdiv -Type:           int array (min = 0, max = 32) -Syntax:         <-1|n[,...]> -Description:    Force pixel clock divisor to a specific value (for experts): -		n may vary from 0 to 127. -		-1 for automatic value. -		See also the 'double_buffer' module parameter. -Default:        -1 for every device. -------------------------------------------------------------------------------- -Name:           backlight -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Objects are lit from behind: -		0 = no, 1 = yes -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           mirror -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    Reverse image horizontally: -		0 = no, 1 = yes -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           monochrome -Type:           bool array (min = 0, max = 32) -Syntax:         <0|1[,...]> -Description:    The image sensor is monochrome: -		0 = no, 1 = yes -Default:        0 for every device. -------------------------------------------------------------------------------- -Name:           brightness -Type:           long array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Set picture brightness (0-65535). -		This parameter has no effect if 'autobright' is enabled. -Default:        31000 for every device. -------------------------------------------------------------------------------- -Name:           hue -Type:           long array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Set picture hue (0-65535). -Default:        32768 for every device. -------------------------------------------------------------------------------- -Name:           colour -Type:           long array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Set picture saturation (0-65535). -Default:        32768 for every device. -------------------------------------------------------------------------------- -Name:           contrast -Type:           long array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Set picture contrast (0-65535). -Default:        50000 for every device. -------------------------------------------------------------------------------- -Name:           whiteness -Type:           long array (min = 0, max = 32) -Syntax:         <n[,...]> -Description:    Set picture whiteness (0-65535). -Default:        32768 for every device. -------------------------------------------------------------------------------- -Name:           debug -Type:           int -Syntax:         <n> -Description:    Debugging information level, from 0 to 6: -		0 = none (use carefully) -		1 = critical errors -		2 = significant informations -		3 = configuration or general messages -		4 = warnings -		5 = called functions -		6 = function internals -		Level 5 and 6 are useful for testing only, when only one -		device is used. -Default:        2 -------------------------------------------------------------------------------- -Name:           specific_debug -Type:           bool -Syntax:         <0|1> -Description:    Enable or disable specific debugging messages: -		0 = print messages concerning every level <= 'debug' level. -		1 = print messages concerning the level indicated by 'debug'. -Default:        0 -------------------------------------------------------------------------------- - - -9. Contact information -====================== -I may be contacted by e-mail at <luca.risolia@studio.unibo.it>. - -I can accept GPG/PGP encrypted e-mail. My GPG key ID is 'FCE635A4'. -My public 1024-bit key should be available at your keyserver; the fingerprint -is: '88E8 F32F 7244 68BA 3958  5D40 99DA 5D2A FCE6 35A4'. - - -10. Credits -========== -The development would not have proceed much further without having looked at -the source code of other drivers and without the help of several persons; in -particular: - -- the I2C interface to kernel and high-level image sensor control routines have -  been taken from the OV511 driver by Mark McClelland; - -- memory management code has been copied from the bttv driver by Ralph Metzler, -  Marcus Metzler and Gerd Knorr; - -- the low-level I2C read function has been written by Frederic Jouault; - -- the low-level I2C fast write function has been written by Piotr Czerczak. diff --git a/Documentation/video4linux/zc0301.txt b/Documentation/video4linux/zc0301.txt deleted file mode 100644 index befdfdacdc5..00000000000 --- a/Documentation/video4linux/zc0301.txt +++ /dev/null @@ -1,270 +0,0 @@ - -	      ZC0301 and ZC0301P Image Processor and Control Chip -				Driver for Linux -	      =================================================== - -			       - Documentation - - - -Index -===== -1.  Copyright -2.  Disclaimer -3.  License -4.  Overview and features -5.  Module dependencies -6.  Module loading -7.  Module parameters -8.  Supported devices -9.  Notes for V4L2 application developers -10. Contact information -11. Credits - - -1. Copyright -============ -Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> - - -2. Disclaimer -============= -This software is not developed or sponsored by Z-Star Microelectronics Corp. -Trademarks are property of their respective owner. - - -3. License -========== -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -4. Overview and features -======================== -This driver supports the video interface of the devices mounting the ZC0301 or -ZC0301P Image Processors and Control Chips. - -The driver relies on the Video4Linux2 and USB core modules. It has been -designed to run properly on SMP systems as well. - -The latest version of the ZC0301[P] driver can be found at the following URL: -http://www.linux-projects.org/ - -Some of the features of the driver are: - -- full compliance with the Video4Linux2 API (see also "Notes for V4L2 -  application developers" paragraph); -- available mmap or read/poll methods for video streaming through isochronous -  data transfers; -- automatic detection of image sensor; -- video format is standard JPEG; -- dynamic driver control thanks to various module parameters (see "Module -  parameters" paragraph); -- up to 64 cameras can be handled at the same time; they can be connected and -  disconnected from the host many times without turning off the computer, if -  the system supports hotplugging; - - -5. Module dependencies -====================== -For it to work properly, the driver needs kernel support for Video4Linux and -USB. - -The following options of the kernel configuration file must be enabled and -corresponding modules must be compiled: - -	# Multimedia devices -	# -	CONFIG_VIDEO_DEV=m - -	# USB support -	# -	CONFIG_USB=m - -In addition, depending on the hardware being used, the modules below are -necessary: - -	# USB Host Controller Drivers -	# -	CONFIG_USB_EHCI_HCD=m -	CONFIG_USB_UHCI_HCD=m -	CONFIG_USB_OHCI_HCD=m - -The ZC0301 controller also provides a built-in microphone interface. It is -supported by the USB Audio driver thanks to the ALSA API: - -	# Sound -	# -	CONFIG_SOUND=y - -	# Advanced Linux Sound Architecture -	# -	CONFIG_SND=m - -	# USB devices -	# -	CONFIG_SND_USB_AUDIO=m - -And finally: - -	# V4L USB devices -	# -	CONFIG_USB_ZC0301=m - - -6. Module loading -================= -To use the driver, it is necessary to load the "zc0301" module into memory -after every other module required: "videodev", "v4l2_common", "compat_ioctl32", -"usbcore" and, depending on the USB host controller you have, "ehci-hcd", -"uhci-hcd" or "ohci-hcd". - -Loading can be done as shown below: - -	[root@localhost home]# modprobe zc0301 - -At this point the devices should be recognized. You can invoke "dmesg" to -analyze kernel messages and verify that the loading process has gone well: - -	[user@localhost home]$ dmesg - - -7. Module parameters -==================== -Module parameters are listed below: -------------------------------------------------------------------------------- -Name:           video_nr -Type:           short array (min = 0, max = 64) -Syntax:         <-1|n[,...]> -Description:    Specify V4L2 minor mode number: -		-1 = use next available -		 n = use minor number n -		You can specify up to 64 cameras this way. -		For example: -		video_nr=-1,2,-1 would assign minor number 2 to the second -		registered camera and use auto for the first one and for every -		other camera. -Default:        -1 -------------------------------------------------------------------------------- -Name:           force_munmap -Type:           bool array (min = 0, max = 64) -Syntax:         <0|1[,...]> -Description:    Force the application to unmap previously mapped buffer memory -		before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not -		all the applications support this feature. This parameter is -		specific for each detected camera. -		0 = do not force memory unmapping -		1 = force memory unmapping (save memory) -Default:        0 -------------------------------------------------------------------------------- -Name:           frame_timeout -Type:           uint array (min = 0, max = 64) -Syntax:         <n[,...]> -Description:    Timeout for a video frame in seconds. This parameter is -		specific for each detected camera. This parameter can be -		changed at runtime thanks to the /sys filesystem interface. -Default:        2 -------------------------------------------------------------------------------- -Name:           debug -Type:           ushort -Syntax:         <n> -Description:    Debugging information level, from 0 to 3: -		0 = none (use carefully) -		1 = critical errors -		2 = significant informations -		3 = more verbose messages -		Level 3 is useful for testing only, when only one device -		is used at the same time. It also shows some more informations -		about the hardware being detected. This module parameter can be -		changed at runtime thanks to the /sys filesystem interface. -Default:        2 -------------------------------------------------------------------------------- - - -8. Supported devices -==================== -None of the names of the companies as well as their products will be mentioned -here. They have never collaborated with the author, so no advertising. - -From the point of view of a driver, what unambiguously identify a device are -its vendor and product USB identifiers. Below is a list of known identifiers of -devices mounting the ZC0301 Image Processor and Control Chips: - -Vendor ID  Product ID ----------  ---------- -0x041e     0x4017 -0x041e     0x401c -0x041e     0x401e -0x041e     0x401f -0x041e     0x4022 -0x041e     0x4034 -0x041e     0x4035 -0x041e     0x4036 -0x041e     0x403a -0x0458     0x7007 -0x0458     0x700c -0x0458     0x700f -0x046d     0x08ae -0x055f     0xd003 -0x055f     0xd004 -0x0ac8     0x0301 -0x0ac8     0x301b -0x0ac8     0x303b -0x10fd     0x0128 -0x10fd     0x8050 -0x10fd     0x804e - -The list above does not imply that all those devices work with this driver: up -until now only the ones that mount the following image sensors are supported; -kernel messages will always tell you whether this is the case: - -Model       Manufacturer ------       ------------ -PAS202BCB   PixArt Imaging, Inc. -PB-0330     Photobit Corporation - - -9. Notes for V4L2 application developers -======================================== -This driver follows the V4L2 API specifications. In particular, it enforces two -rules: - -- exactly one I/O method, either "mmap" or "read", is associated with each -file descriptor. Once it is selected, the application must close and reopen the -device to switch to the other I/O method; - -- although it is not mandatory, previously mapped buffer memory should always -be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's. -The same number of buffers as before will be allocated again to match the size -of the new video frames, so you have to map the buffers again before any I/O -attempts on them. - - -10. Contact information -======================= -The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. - -GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is -'FCE635A4'; the public 1024-bit key should be available at any keyserver; -the fingerprint is: '88E8 F32F 7244 68BA 3958  5D40 99DA 5D2A FCE6 35A4'. - - -11. Credits -=========== -- Informations about the chip internals needed to enable the I2C protocol have -  been taken from the documentation of the ZC030x Video4Linux1 driver written -  by Andrew Birkett <andy@nobugs.org>; -- The initialization values of the ZC0301 controller connected to the PAS202BCB -  and PB-0330 image sensors have been taken from the SPCA5XX driver maintained -  by Michel Xhaard <mxhaard@magic.fr>; -- Stanislav Lechev donated one camera.  | 
