From d41592a2a2b9a27425ade3fc2c8526e9e997acd6 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 13 Dec 2009 14:11:07 -0300 Subject: V4L/DVB (13815): gspca - sunplus: Add webcam 052b:1507. Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 1800a62..98ee599 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -142,6 +142,7 @@ sunplus 04fc:5360 Sunplus Generic spca500 04fc:7333 PalmPixDC85 sunplus 04fc:ffff Pure DigitalDakota spca501 0506:00df 3Com HomeConnect Lite +sunplus 052b:1507 Megapixel 5 Pretec DC-1007 sunplus 052b:1513 Megapix V4 sunplus 052b:1803 MegaImage VI tv8532 0545:808b Veo Stingray -- cgit v1.1 From 0a71d9cec238dd953e1e31df6ad28f69dee16fcc Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 20 Dec 2009 09:09:22 -0300 Subject: V4L/DVB (13871): gspca - benq: New subdriver for camera 04a5:3035. Tested-by: Francesco Lavra Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 98ee599..d389619 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -109,6 +109,7 @@ sunplus 04a5:3003 Benq DC 1300 sunplus 04a5:3008 Benq DC 1500 sunplus 04a5:300a Benq DC 3410 spca500 04a5:300c Benq DC 1016 +benq 04a5:3035 Benq DC E300 finepix 04cb:0104 Fujifilm FinePix 4800 finepix 04cb:0109 Fujifilm FinePix A202 finepix 04cb:010b Fujifilm FinePix A203 -- cgit v1.1 From 64677573a28c354828343741bc177e5543f5077e Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 20 Dec 2009 12:31:28 -0300 Subject: V4L/DVB (13872): gspca - sonixj: Add sensor adcm1700 and webcam 0c45:614a. Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index d389619..7b60343 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -304,6 +304,7 @@ sonixj 0c45:613b Surfer SN-206 sonixj 0c45:613c Sonix Pccam168 sonixj 0c45:6143 Sonix Pccam168 sonixj 0c45:6148 Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia +sonixj 0c45:614a Frontech E-Ccam (JIL-2225) sn9c20x 0c45:6240 PC Camera (SN9C201 + MT9M001) sn9c20x 0c45:6242 PC Camera (SN9C201 + MT9M111) sn9c20x 0c45:6248 PC Camera (SN9C201 + OV9655) -- cgit v1.1 From 9c6f97a02358c78ed1db69cde702db263bc62cf6 Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Mon, 21 Dec 2009 02:00:38 -0300 Subject: V4L/DVB (13945): Add lost config and PCI ID for card of Beholder Add lost configuration for our TV card. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.saa7134 | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index fce1e7e..b4a7670 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -174,3 +174,4 @@ 173 -> Zolid Hybrid TV Tuner PCI [1131:2004] 174 -> Asus Europa Hybrid OEM [1043:4847] 175 -> Leadtek Winfast DTV1000S [107d:6655] +176 -> Beholder BeholdTV 505 RDS [0000:5051] -- cgit v1.1 From c52af79916028f9d15638519b54a80ed1c10bce5 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Thu, 7 Jan 2010 05:18:16 -0300 Subject: V4L/DVB (13916): gspca - ov534/ov534_9: Split the ov534 subdriver. The two sensors ov772x and ov965x have too much differences. Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 7b60343..c6364fa 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -190,8 +190,7 @@ spca500 06bd:0404 Agfa CL20 spca500 06be:0800 Optimedia sunplus 06d6:0031 Trust 610 LCD PowerC@m Zoom spca506 06e1:a190 ADS Instant VCD -ov534 06f8:3002 Hercules Blog Webcam -ov534 06f8:3003 Hercules Dualpix HD Weblog +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 -- cgit v1.1 From 9336960d075839b41bef89a0c68899c4025e8289 Mon Sep 17 00:00:00 2001 From: Theodore Kilgore Date: Fri, 25 Dec 2009 05:19:24 -0300 Subject: V4L/DVB (13993): gspca.txt: add cams supported by mr97310a, sq905(c) and sn9c2028 drivers gspca.txt: add cams supported by mr97310a, sq905(c) and sn9c2028 drivers Signed-off-by: Theodore Kilgore Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index c6364fa..9de9db0 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -42,6 +42,7 @@ ov519 041e:4064 Creative Live! VISTA VF0420 ov519 041e:4067 Creative Live! Cam Video IM (VF0350) ov519 041e:4068 Creative Live! VISTA VF0470 spca561 0458:7004 Genius VideoCAM Express V2 +sn9c2028 0458:7005 Genius Smart 300, version 2 sunplus 0458:7006 Genius Dsc 1.3 Smart zc3xx 0458:7007 Genius VideoCam V2 zc3xx 0458:700c Genius VideoCam V3 @@ -226,7 +227,8 @@ sunplus 08ca:2050 Medion MD 41437 sunplus 08ca:2060 Aiptek PocketDV5300 tv8532 0923:010f ICM532 cams mars 093a:050f Mars-Semi Pc-Camera -mr97310a 093a:010f Sakar Digital no. 77379 +mr97310a 093a:010e All four known CIF cams with this ID +mr97310a 093a:010f All four known VGA cams with this ID pac207 093a:2460 Qtec Webcam 100 pac207 093a:2461 HP Webcam pac207 093a:2463 Philips SPC 220 NC @@ -326,6 +328,10 @@ sn9c20x 0c45:62b0 PC Camera (SN9C202 + MT9V011/MT9V111/MT9V112) sn9c20x 0c45:62b3 PC Camera (SN9C202 + OV9655) sn9c20x 0c45:62bb PC Camera (SN9C202 + OV7660) sn9c20x 0c45:62bc PC Camera (SN9C202 + HV7131R) +sn9c2028 0c45:8001 Wild Planet Digital Spy Camera +sn9c2028 0c45:8003 Sakar #11199, #6637x, #67480 keychain cams +sn9c2028 0c45:8008 Mini-Shotz ms-350 +sn9c2028 0c45:800a Vivitar Vivicam 3350B sunplus 0d64:0303 Sunplus FashionCam DXG ov519 0e96:c001 TRUST 380 USB2 SPACEC@M etoms 102c:6151 Qcam Sangha CIF @@ -343,10 +349,11 @@ spca501 1776:501c Arowana 300K CMOS Camera 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 sq905c -sq905c 2770:905c DualCamera -sq905 2770:9120 Argus Digital Camera DC1512 -sq905c 2770:913d sq905c +sq905c 2770:9050 Disney pix micro (CIF) +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 +sq905c 2770:913d All 4 known cameras with this ID spca500 2899:012c Toptro Industrial ov519 8020:ef04 ov519 spca508 8086:0110 Intel Easy PC Camera -- cgit v1.1 From 0b32d65cd7938d31eebd9c62aab6a59a3c4cf0f8 Mon Sep 17 00:00:00 2001 From: Kusanagi Kouichi Date: Fri, 22 Jan 2010 04:55:28 -0300 Subject: V4L/DVB: cx23885: Add support for LEADTEK WinFast PxTV1200 I tested only tv and composite. Video works fine but no audio. Signed-off-by: Kusanagi Kouichi Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.cx23885 | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 7539e8f..16ca030 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 @@ -26,3 +26,4 @@ 25 -> Compro VideoMate E800 [1858:e800] 26 -> Hauppauge WinTV-HVR1290 [0070:8551] 27 -> Mygica X8558 PRO DMB-TH [14f1:8578] + 28 -> LEADTEK WinFast PxTV1200 [107d:6f22] -- cgit v1.1 From e7e41d3b59877475e4c19ddd0d33cb3ef5298f87 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Fri, 5 Feb 2010 07:52:44 -0300 Subject: V4L/DVB: get_dvb_firmware: Add function to retrieve nGene firmwares Commiter: Oliver Endriss Use 'get_dvb_firmware ngene' to download 'ngene_15.fw' and 'ngene_17.fw'. Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- Documentation/dvb/get_dvb_firmware | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index 14b7b5a..f550fda 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware @@ -26,7 +26,7 @@ use IO::Handle; "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", "or51211", "or51132_qam", "or51132_vsb", "bluebird", "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718", - "af9015"); + "af9015", "ngene"); # Check args syntax() if (scalar(@ARGV) != 1); @@ -549,6 +549,24 @@ sub af9015 { close INFILE; } +sub ngene { + my $url = "http://www.digitaldevices.de/download/"; + my $file1 = "ngene_15.fw"; + my $hash1 = "d798d5a757121174f0dbc5f2833c0c85"; + my $file2 = "ngene_17.fw"; + my $hash2 = "26b687136e127b8ac24b81e0eeafc20b"; + + checkstandard(); + + wgetfile($file1, $url . $file1); + verify($file1, $hash1); + + wgetfile($file2, $url . $file2); + verify($file2, $hash2); + + "$file1, $file2"; +} + # --------------------------------------------------------------- # Utilities -- cgit v1.1 From 87147ff03a8aa27b9cc94872b195e6f8bb922feb Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Fri, 5 Feb 2010 07:57:58 -0300 Subject: V4L/DVB: get_dvb_firmware: Fix typo, sort list of components Commiter: Oliver Endriss Fix typo. Sort list of components for better readability. Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- Documentation/dvb/get_dvb_firmware | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index f550fda..239cbdb 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware @@ -39,7 +39,7 @@ for ($i=0; $i < scalar(@components); $i++) { die $@ if $@; print STDERR <\n"; print STDERR "Supported components:\n"; + @components = sort @components; for($i=0; $i < scalar(@components); $i++) { print STDERR "\t" . $components[$i] . "\n"; } -- cgit v1.1 From 5b3f03f044ad6dffc8cd8c9c50bc5d7769cbd89f Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Tue, 2 Feb 2010 04:07:47 -0300 Subject: V4L/DVB: Add driver for Telegent tlg2300 pd-common.h contains the common data structures, while vendorcmds.h contains the vendor commands for firmware. [mchehab@redhat.com: Folded the 10 patches with the driver] Signed-off-by: Huang Shijie Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/README.tlg2300 | 231 +++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 Documentation/video4linux/README.tlg2300 (limited to 'Documentation') diff --git a/Documentation/video4linux/README.tlg2300 b/Documentation/video4linux/README.tlg2300 new file mode 100644 index 0000000..82417db --- /dev/null +++ b/Documentation/video4linux/README.tlg2300 @@ -0,0 +1,231 @@ +tlg2300 release notes +==================== + +This is a v4l2/dvb device driver for the tlg2300 chip. + + +current status +============== + +video + - support mmap and read().(no overlay) + +audio + - The driver will register a ALSA card for the audio input. + +vbi + - Works for almost TV norms. + +dvb-t + - works for DVB-T + +FM + - Works for radio. + +--------------------------------------------------------------------------- +TESTED APPLICATIONS: + +-VLC1.0.4 test the video and dvb. The GUI is friendly to use. + +-Mplayer test the video. + +-Mplayer test the FM. The mplayer should be compiled with --enable-radio and + --enable-radio-capture. + The command runs as this(The alsa audio registers to card 1): + #mplayer radio://103.7/capture/ -radio adevice=hw=1,0:arate=48000 \ + -rawaudio rate=48000:channels=2 + +--------------------------------------------------------------------------- +KNOWN PROBLEMS: + +country code + - The firmware of the chip needs the country code to determine + the stardards of video and audio when it runs for analog TV or radio. + The DVB-T does not need the country code. + + So you must set the country-code correctly. The V4L2 does not have + the interface,the driver has to provide a parameter `country_code'. + + You could set the coutry code in two ways, take USA as example + (The USA's country code is 1): + + [1] add the following line in /etc/modprobe.conf before you insert the + card into USB hub's port : + poseidon country_code=1 + + [2] You can also modify the parameter at runtime (before you run the + application such as VLC) + #echo 1 > /sys/module/poseidon/parameter/country_code + + The known country codes show below: + country code : country + 93 "Afghanistan" + 355 "Albania" + 213 "Algeria" + 684 "American Samoa" + 376 "Andorra" + 244 "Angola" + 54 "Argentina" + 374 "Armenia" + 61 "Australia" + 43 "Austria" + 994 "Azerbaijan" + 973 "Bahrain" + 880 "Bangladesh" + 375 "Belarus" + 32 "Belgium" + 501 "Belize" + 229 "Benin" + 591 "Bolivia" + 387 "Bosnia and Herzegovina" + 267 "Botswana" + 55 "Brazil" + 673 "Brunei Darussalam" + 359 "Bulgalia" + 226 "Burkina Faso" + 257 "Burundi" + 237 "Cameroon" + 1 "Canada" + 236 "Central African Republic" + 235 "Chad" + 56 "Chile" + 86 "China" + 57 "Colombia" + 242 "Congo" + 243 "Congo, Dem. Rep. of " + 506 "Costa Rica" + 385 "Croatia" + 53 "Cuba or Guantanamo Bay" + 357 "Cyprus" + 420 "Czech Republic" + 45 "Denmark" + 246 "Diego Garcia" + 253 "Djibouti" + 593 "Ecuador" + 20 "Egypt" + 503 "El Salvador" + 240 "Equatorial Guinea" + 372 "Estonia" + 251 "Ethiopia" + 358 "Finland" + 33 "France" + 594 "French Guiana" + 689 "French Polynesia" + 241 "Gabonese Republic" + 220 "Gambia" + 995 "Georgia" + 49 "Germany" + 233 "Ghana" + 350 "Gibraltar" + 30 "Greece" + 299 "Greenland" + 671 "Guam" + 502 "Guatemala" + 592 "Guyana" + 509 "Haiti" + 504 "Honduras" + 852 "Hong Kong SAR, China" + 36 "Hungary" + 354 "Iceland" + 91 "India" + 98 "Iran" + 964 "Iraq" + 353 "Ireland" + 972 "Israel" + 39 "Italy or Vatican City" + 225 "Ivory Coast" + 81 "Japan" + 962 "Jordan" + 7 "Kazakhstan or Kyrgyzstan" + 254 "Kenya" + 686 "Kiribati" + 965 "Kuwait" + 856 "Laos" + 371 "Latvia" + 961 "Lebanon" + 266 "Lesotho" + 231 "Liberia" + 218 "Libya" + 41 "Liechtenstein or Switzerland" + 370 "Lithuania" + 352 "Luxembourg" + 853 "Macau SAR, China" + 261 "Madagascar" + 60 "Malaysia" + 960 "Maldives" + 223 "Mali Republic" + 356 "Malta" + 692 "Marshall Islands" + 596 "Martinique" + 222 "Mauritania" + 230 "Mauritus" + 52 "Mexico" + 691 "Micronesia" + 373 "Moldova" + 377 "Monaco" + 976 "Mongolia" + 212 "Morocco" + 258 "Mozambique" + 95 "Myanmar" + 264 "Namibia" + 674 "Nauru" + 31 "Netherlands" + 687 "New Caledonia" + 64 "New Zealand" + 505 "Nicaragua" + 227 "Niger" + 234 "Nigeria" + 850 "North Korea" + 47 "Norway" + 968 "Oman" + 92 "Pakistan" + 680 "Palau" + 507 "Panama" + 675 "Papua New Guinea" + 595 "Paraguay" + 51 "Peru" + 63 "Philippines" + 48 "Poland" + 351 "Portugal" + 974 "Qatar" + 262 "Reunion Island" + 40 "Romania" + 7 "Russia" + 378 "San Marino" + 239 "Sao Tome and Principe" + 966 "Saudi Arabia" + 221 "Senegal" + 248 "Seychelles Republic" + 232 "Sierra Leone" + 65 "Singapore" + 421 "Slovak Republic" + 386 "Slovenia" + 27 "South Africa" + 82 "South Korea " + 34 "Spain" + 94 "Sri Lanka" + 508 "St. Pierre and Miquelon" + 249 "Sudan" + 597 "Suriname" + 268 "Swaziland" + 46 "Sweden" + 963 "Syria" + 886 "Taiwan Region" + 255 "Tanzania" + 66 "Thailand" + 228 "Togolese Republic" + 216 "Tunisia" + 90 "Turkey" + 993 "Turkmenistan" + 256 "Uganda" + 380 "Ukraine" + 971 "United Arab Emirates" + 44 "United Kingdom" + 1 "United States of America" + 598 "Uruguay" + 58 "Venezuela" + 84 "Vietnam" + 967 "Yemen" + 260 "Zambia" + 255 "Zanzibar" + 263 "Zimbabwe" -- cgit v1.1 From 007ad830364e795316d2825f1ab68b3a53a3d56c Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Thu, 11 Feb 2010 03:53:51 -0300 Subject: V4L/DVB: tlg2300: remove the country code for analog tv and radio video : use the V4L2_STD macros to select the proper audio setting. radio : add preemphasis ctr. test it by the command: v4l2-ctl -d /dev/radio0 --set-ctrl=pre_emphasis_settings=1 [mchehab@redhat.com: folded documentation patch] Signed-off-by: Huang Shijie Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/README.tlg2300 | 198 ++----------------------------- 1 file changed, 7 insertions(+), 191 deletions(-) (limited to 'Documentation') diff --git a/Documentation/video4linux/README.tlg2300 b/Documentation/video4linux/README.tlg2300 index 82417db..416ccb9 100644 --- a/Documentation/video4linux/README.tlg2300 +++ b/Documentation/video4linux/README.tlg2300 @@ -37,195 +37,11 @@ TESTED APPLICATIONS: --------------------------------------------------------------------------- KNOWN PROBLEMS: +about preemphasis: + You can set the preemphasis for radio by the following command: + #v4l2-ctl -d /dev/radio0 --set-ctrl=pre_emphasis_settings=1 + + "pre_emphasis_settings=1" means that you select the 50us. If you want + to select the 75us, please use "pre_emphasis_settings=2" + -country code - - The firmware of the chip needs the country code to determine - the stardards of video and audio when it runs for analog TV or radio. - The DVB-T does not need the country code. - - So you must set the country-code correctly. The V4L2 does not have - the interface,the driver has to provide a parameter `country_code'. - - You could set the coutry code in two ways, take USA as example - (The USA's country code is 1): - - [1] add the following line in /etc/modprobe.conf before you insert the - card into USB hub's port : - poseidon country_code=1 - - [2] You can also modify the parameter at runtime (before you run the - application such as VLC) - #echo 1 > /sys/module/poseidon/parameter/country_code - - The known country codes show below: - country code : country - 93 "Afghanistan" - 355 "Albania" - 213 "Algeria" - 684 "American Samoa" - 376 "Andorra" - 244 "Angola" - 54 "Argentina" - 374 "Armenia" - 61 "Australia" - 43 "Austria" - 994 "Azerbaijan" - 973 "Bahrain" - 880 "Bangladesh" - 375 "Belarus" - 32 "Belgium" - 501 "Belize" - 229 "Benin" - 591 "Bolivia" - 387 "Bosnia and Herzegovina" - 267 "Botswana" - 55 "Brazil" - 673 "Brunei Darussalam" - 359 "Bulgalia" - 226 "Burkina Faso" - 257 "Burundi" - 237 "Cameroon" - 1 "Canada" - 236 "Central African Republic" - 235 "Chad" - 56 "Chile" - 86 "China" - 57 "Colombia" - 242 "Congo" - 243 "Congo, Dem. Rep. of " - 506 "Costa Rica" - 385 "Croatia" - 53 "Cuba or Guantanamo Bay" - 357 "Cyprus" - 420 "Czech Republic" - 45 "Denmark" - 246 "Diego Garcia" - 253 "Djibouti" - 593 "Ecuador" - 20 "Egypt" - 503 "El Salvador" - 240 "Equatorial Guinea" - 372 "Estonia" - 251 "Ethiopia" - 358 "Finland" - 33 "France" - 594 "French Guiana" - 689 "French Polynesia" - 241 "Gabonese Republic" - 220 "Gambia" - 995 "Georgia" - 49 "Germany" - 233 "Ghana" - 350 "Gibraltar" - 30 "Greece" - 299 "Greenland" - 671 "Guam" - 502 "Guatemala" - 592 "Guyana" - 509 "Haiti" - 504 "Honduras" - 852 "Hong Kong SAR, China" - 36 "Hungary" - 354 "Iceland" - 91 "India" - 98 "Iran" - 964 "Iraq" - 353 "Ireland" - 972 "Israel" - 39 "Italy or Vatican City" - 225 "Ivory Coast" - 81 "Japan" - 962 "Jordan" - 7 "Kazakhstan or Kyrgyzstan" - 254 "Kenya" - 686 "Kiribati" - 965 "Kuwait" - 856 "Laos" - 371 "Latvia" - 961 "Lebanon" - 266 "Lesotho" - 231 "Liberia" - 218 "Libya" - 41 "Liechtenstein or Switzerland" - 370 "Lithuania" - 352 "Luxembourg" - 853 "Macau SAR, China" - 261 "Madagascar" - 60 "Malaysia" - 960 "Maldives" - 223 "Mali Republic" - 356 "Malta" - 692 "Marshall Islands" - 596 "Martinique" - 222 "Mauritania" - 230 "Mauritus" - 52 "Mexico" - 691 "Micronesia" - 373 "Moldova" - 377 "Monaco" - 976 "Mongolia" - 212 "Morocco" - 258 "Mozambique" - 95 "Myanmar" - 264 "Namibia" - 674 "Nauru" - 31 "Netherlands" - 687 "New Caledonia" - 64 "New Zealand" - 505 "Nicaragua" - 227 "Niger" - 234 "Nigeria" - 850 "North Korea" - 47 "Norway" - 968 "Oman" - 92 "Pakistan" - 680 "Palau" - 507 "Panama" - 675 "Papua New Guinea" - 595 "Paraguay" - 51 "Peru" - 63 "Philippines" - 48 "Poland" - 351 "Portugal" - 974 "Qatar" - 262 "Reunion Island" - 40 "Romania" - 7 "Russia" - 378 "San Marino" - 239 "Sao Tome and Principe" - 966 "Saudi Arabia" - 221 "Senegal" - 248 "Seychelles Republic" - 232 "Sierra Leone" - 65 "Singapore" - 421 "Slovak Republic" - 386 "Slovenia" - 27 "South Africa" - 82 "South Korea " - 34 "Spain" - 94 "Sri Lanka" - 508 "St. Pierre and Miquelon" - 249 "Sudan" - 597 "Suriname" - 268 "Swaziland" - 46 "Sweden" - 963 "Syria" - 886 "Taiwan Region" - 255 "Tanzania" - 66 "Thailand" - 228 "Togolese Republic" - 216 "Tunisia" - 90 "Turkey" - 993 "Turkmenistan" - 256 "Uganda" - 380 "Ukraine" - 971 "United Arab Emirates" - 44 "United Kingdom" - 1 "United States of America" - 598 "Uruguay" - 58 "Venezuela" - 84 "Vietnam" - 967 "Yemen" - 260 "Zambia" - 255 "Zanzibar" - 263 "Zimbabwe" -- cgit v1.1 From 995f5fefb0c6abba3688b3aadf40e422b64b814a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 20 Feb 2010 09:41:03 -0300 Subject: V4L/DVB: media-spec: Fix documentation mistakes regarding I/O streaming The media spec contains several errors in the description of the I/O streaming ioctls, in particular with respect to the userptr I/O method. The most important change is that you really need to set count and index in v4l2_requestbuffer and v4l2_buffer when dealing with user pointer streaming. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/io.xml | 3 +- Documentation/DocBook/v4l/vidioc-qbuf.xml | 40 +++++++++++++++------------ Documentation/DocBook/v4l/vidioc-querybuf.xml | 7 +++-- Documentation/DocBook/v4l/vidioc-reqbufs.xml | 36 +++++++++--------------- 4 files changed, 42 insertions(+), 44 deletions(-) (limited to 'Documentation') diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml index f92f243..e870330 100644 --- a/Documentation/DocBook/v4l/io.xml +++ b/Documentation/DocBook/v4l/io.xml @@ -589,7 +589,8 @@ number of a video input as in &v4l2-input; field A place holder for future extensions and custom (driver defined) buffer types -V4L2_BUF_TYPE_PRIVATE and higher. +V4L2_BUF_TYPE_PRIVATE and higher. Applications +should set this to 0. diff --git a/Documentation/DocBook/v4l/vidioc-qbuf.xml b/Documentation/DocBook/v4l/vidioc-qbuf.xml index 1870817..b843bd7 100644 --- a/Documentation/DocBook/v4l/vidioc-qbuf.xml +++ b/Documentation/DocBook/v4l/vidioc-qbuf.xml @@ -54,12 +54,10 @@ to enqueue an empty (capturing) or filled (output) buffer in the driver's incoming queue. The semantics depend on the selected I/O method. - To enqueue a memory mapped -buffer applications set the type field of a -&v4l2-buffer; to the same buffer type as previously &v4l2-format; -type and &v4l2-requestbuffers; -type, the memory -field to V4L2_MEMORY_MMAP and the + To enqueue a buffer applications set the type +field of a &v4l2-buffer; to the same buffer type as was previously used +with &v4l2-format; type and &v4l2-requestbuffers; +type. Applications must also set the index field. Valid index numbers range from zero to the number of buffers allocated with &VIDIOC-REQBUFS; (&v4l2-requestbuffers; count) minus one. The @@ -70,8 +68,19 @@ intended for output (type is V4L2_BUF_TYPE_VBI_OUTPUT) applications must also initialize the bytesused, field and -timestamp fields. See for details. When +timestamp fields, see for details. +Applications must also set flags to 0. If a driver +supports capturing from specific video inputs and you want to specify a video +input, then flags should be set to +V4L2_BUF_FLAG_INPUT and the field +input must be initialized to the desired input. +The reserved field must be set to 0. + + + To enqueue a memory mapped +buffer applications set the memory +field to V4L2_MEMORY_MMAP. When VIDIOC_QBUF is called with a pointer to this structure the driver sets the V4L2_BUF_FLAG_MAPPED and @@ -81,14 +90,10 @@ structure the driver sets the &EINVAL;. To enqueue a user pointer -buffer applications set the type field of a -&v4l2-buffer; to the same buffer type as previously &v4l2-format; -type and &v4l2-requestbuffers; -type, the memory -field to V4L2_MEMORY_USERPTR and the +buffer applications set the memory +field to V4L2_MEMORY_USERPTR, the m.userptr field to the address of the -buffer and length to its size. When the -buffer is intended for output additional fields must be set as above. +buffer and length to its size. When VIDIOC_QBUF is called with a pointer to this structure the driver sets the V4L2_BUF_FLAG_QUEUED flag and clears the V4L2_BUF_FLAG_MAPPED and @@ -96,13 +101,14 @@ flag and clears the V4L2_BUF_FLAG_MAPPED and flags field, or it returns an error code. This ioctl locks the memory pages of the buffer in physical memory, they cannot be swapped out to disk. Buffers remain locked until -dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl are +dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is called, or until the device is closed. Applications call the VIDIOC_DQBUF ioctl to dequeue a filled (capturing) or displayed (output) buffer from the driver's outgoing queue. They just set the -type and memory +type, memory +and reserved fields of a &v4l2-buffer; as above, when VIDIOC_DQBUF is called with a pointer to this structure the driver fills the remaining fields or returns an error code. diff --git a/Documentation/DocBook/v4l/vidioc-querybuf.xml b/Documentation/DocBook/v4l/vidioc-querybuf.xml index d834993..e649805 100644 --- a/Documentation/DocBook/v4l/vidioc-querybuf.xml +++ b/Documentation/DocBook/v4l/vidioc-querybuf.xml @@ -54,12 +54,13 @@ buffer at any time after buffers have been allocated with the &VIDIOC-REQBUFS; ioctl. Applications set the type field - of a &v4l2-buffer; to the same buffer type as previously + of a &v4l2-buffer; to the same buffer type as was previously used with &v4l2-format; type and &v4l2-requestbuffers; type, and the index field. Valid index numbers range from zero to the number of buffers allocated with &VIDIOC-REQBUFS; (&v4l2-requestbuffers; count) minus one. +The reserved field should to set to 0. After calling VIDIOC_QUERYBUF with a pointer to this structure drivers return an error code or fill the rest of the structure. @@ -68,8 +69,8 @@ the structure. V4L2_BUF_FLAG_MAPPED, V4L2_BUF_FLAG_QUEUED and V4L2_BUF_FLAG_DONE flags will be valid. The -memory field will be set to -V4L2_MEMORY_MMAP, the m.offset +memory field will be set to the current +I/O method, the m.offset contains the offset of the buffer from the start of the device memory, the length field its size. The driver may or may not set the remaining fields and flags, they are meaningless in diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml index bab3808..1c08163 100644 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/v4l/vidioc-reqbufs.xml @@ -54,23 +54,23 @@ I/O. Memory mapped buffers are located in device memory and must be allocated with this ioctl before they can be mapped into the application's address space. User buffers are allocated by applications themselves, and this ioctl is merely used to switch the -driver into user pointer I/O mode. +driver into user pointer I/O mode and to setup some internal structures. - To allocate device buffers applications initialize three -fields of a v4l2_requestbuffers structure. + To allocate device buffers applications initialize all +fields of the v4l2_requestbuffers structure. They set the type field to the respective stream or buffer type, the count field to -the desired number of buffers, and memory -must be set to V4L2_MEMORY_MMAP. When the ioctl -is called with a pointer to this structure the driver attempts to -allocate the requested number of buffers and stores the actual number +the desired number of buffers, memory +must be set to the requested I/O method and the reserved array +must be zeroed. When the ioctl +is called with a pointer to this structure the driver will attempt to allocate +the requested number of buffers and it stores the actual number allocated in the count field. It can be smaller than the number requested, even zero, when the driver runs out -of free memory. A larger number is possible when the driver requires -more buffers to function correctly. - For example video output requires at least two buffers, +of free memory. A larger number is also possible when the driver requires +more buffers to function correctly. For example video output requires at least two buffers, one displayed and one filled by the application. - When memory mapping I/O is not supported the ioctl + When the I/O method is not supported the ioctl returns an &EINVAL;. Applications can call VIDIOC_REQBUFS @@ -81,14 +81,6 @@ in progress, an implicit &VIDIOC-STREAMOFF;. - To negotiate user pointer I/O, applications initialize only -the type field and set -memory to -V4L2_MEMORY_USERPTR. When the ioctl is called -with a pointer to this structure the driver prepares for user pointer -I/O, when this I/O method is not supported the ioctl returns an -&EINVAL;. - struct <structname>v4l2_requestbuffers</structname> @@ -97,9 +89,7 @@ I/O, when this I/O method is not supported the ioctl returns an __u32 count - The number of buffers requested or granted. This -field is only used when memory is set to -V4L2_MEMORY_MMAP. + The number of buffers requested or granted. &v4l2-buf-type; @@ -120,7 +110,7 @@ as the &v4l2-format; type field. See reserved[2] A place holder for future extensions and custom (driver defined) buffer types V4L2_BUF_TYPE_PRIVATE and -higher. +higher. This array should be zeroed by applications. -- cgit v1.1 From 4b586a38b048b0d78874721e5b26cb6476fafb60 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 22 Feb 2010 17:47:46 -0300 Subject: V4L/DVB: V4L2: Add a document describing the videobuf layer Videobuf is a moderately complex API which most V4L2 drivers should use, but its documentation is...sparse. This document attempts to improve the situation. Signed-off-by: Jonathan Corbet Reviewed-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/v4l2-framework.txt | 107 +------- Documentation/video4linux/videobuf | 360 +++++++++++++++++++++++++++ 2 files changed, 371 insertions(+), 96 deletions(-) create mode 100644 Documentation/video4linux/videobuf (limited to 'Documentation') diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 74d677c..90b0a08 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -599,99 +599,14 @@ video_device::minor fields. video buffer helper functions ----------------------------- -The v4l2 core API provides a standard method for dealing with video -buffers. Those methods allow a driver to implement read(), mmap() and -overlay() on a consistent way. - -There are currently methods for using video buffers on devices that -supports DMA with scatter/gather method (videobuf-dma-sg), DMA with -linear access (videobuf-dma-contig), and vmalloced buffers, mostly -used on USB drivers (videobuf-vmalloc). - -Any driver using videobuf should provide operations (callbacks) for -four handlers: - -ops->buf_setup - calculates the size of the video buffers and avoid they - to waste more than some maximum limit of RAM; -ops->buf_prepare - fills the video buffer structs and calls - videobuf_iolock() to alloc and prepare mmaped memory; -ops->buf_queue - advices the driver that another buffer were - requested (by read() or by QBUF); -ops->buf_release - frees any buffer that were allocated. - -In order to use it, the driver need to have a code (generally called at -interrupt context) that will properly handle the buffer request lists, -announcing that a new buffer were filled. - -The irq handling code should handle the videobuf task lists, in order -to advice videobuf that a new frame were filled, in order to honor to a -request. The code is generally like this one: - if (list_empty(&dma_q->active)) - return; - - buf = list_entry(dma_q->active.next, struct vbuffer, vb.queue); - - if (!waitqueue_active(&buf->vb.done)) - return; - - /* Some logic to handle the buf may be needed here */ - - list_del(&buf->vb.queue); - do_gettimeofday(&buf->vb.ts); - wake_up(&buf->vb.done); - -Those are the videobuffer functions used on drivers, implemented on -videobuf-core: - -- Videobuf init functions - videobuf_queue_sg_init() - Initializes the videobuf infrastructure. This function should be - called before any other videobuf function on drivers that uses DMA - Scatter/Gather buffers. - - videobuf_queue_dma_contig_init - Initializes the videobuf infrastructure. This function should be - called before any other videobuf function on drivers that need DMA - contiguous buffers. - - videobuf_queue_vmalloc_init() - Initializes the videobuf infrastructure. This function should be - called before any other videobuf function on USB (and other drivers) - that need a vmalloced type of videobuf. - -- videobuf_iolock() - Prepares the videobuf memory for the proper method (read, mmap, overlay). - -- videobuf_queue_is_busy() - Checks if a videobuf is streaming. - -- videobuf_queue_cancel() - Stops video handling. - -- videobuf_mmap_free() - frees mmap buffers. - -- videobuf_stop() - Stops video handling, ends mmap and frees mmap and other buffers. - -- V4L2 api functions. Those functions correspond to VIDIOC_foo ioctls: - videobuf_reqbufs(), videobuf_querybuf(), videobuf_qbuf(), - videobuf_dqbuf(), videobuf_streamon(), videobuf_streamoff(). - -- V4L1 api function (corresponds to VIDIOCMBUF ioctl): - videobuf_cgmbuf() - This function is used to provide backward compatibility with V4L1 - API. - -- Some help functions for read()/poll() operations: - videobuf_read_stream() - For continuous stream read() - videobuf_read_one() - For snapshot read() - videobuf_poll_stream() - polling help function - -The better way to understand it is to take a look at vivi driver. One -of the main reasons for vivi is to be a videobuf usage example. the -vivi_thread_tick() does the task that the IRQ callback would do on PCI -drivers (or the irq callback on USB). +The v4l2 core API provides a set of standard methods (called "videobuf") +for dealing with video buffers. Those methods allow a driver to implement +read(), mmap() and overlay() in a consistent way. There are currently +methods for using video buffers on devices that supports DMA with +scatter/gather method (videobuf-dma-sg), DMA with linear access +(videobuf-dma-contig), and vmalloced buffers, mostly used on USB drivers +(videobuf-vmalloc). + +Please see Documentation/video4linux/videobuf for more information on how +to use the videobuf layer. + diff --git a/Documentation/video4linux/videobuf b/Documentation/video4linux/videobuf new file mode 100644 index 0000000..ba4ca99 --- /dev/null +++ b/Documentation/video4linux/videobuf @@ -0,0 +1,360 @@ +An introduction to the videobuf layer +Jonathan Corbet +Current as of 2.6.33 + +The videobuf layer functions as a sort of glue layer between a V4L2 driver +and user space. It handles the allocation and management of buffers for +the storage of video frames. There is a set of functions which can be used +to implement many of the standard POSIX I/O system calls, including read(), +poll(), and, happily, mmap(). Another set of functions can be used to +implement the bulk of the V4L2 ioctl() calls related to streaming I/O, +including buffer allocation, queueing and dequeueing, and streaming +control. Using videobuf imposes a few design decisions on the driver +author, but the payback comes in the form of reduced code in the driver and +a consistent implementation of the V4L2 user-space API. + +Buffer types + +Not all video devices use the same kind of buffers. In fact, there are (at +least) three common variations: + + - Buffers which are scattered in both the physical and (kernel) virtual + address spaces. (Almost) all user-space buffers are like this, but it + makes great sense to allocate kernel-space buffers this way as well when + it is possible. Unfortunately, it is not always possible; working with + this kind of buffer normally requires hardware which can do + scatter/gather DMA operations. + + - Buffers which are physically scattered, but which are virtually + contiguous; buffers allocated with vmalloc(), in other words. These + buffers are just as hard to use for DMA operations, but they can be + useful in situations where DMA is not available but virtually-contiguous + buffers are convenient. + + - Buffers which are physically contiguous. Allocation of this kind of + buffer can be unreliable on fragmented systems, but simpler DMA + controllers cannot deal with anything else. + +Videobuf can work with all three types of buffers, but the driver author +must pick one at the outset and design the driver around that decision. + +[It's worth noting that there's a fourth kind of buffer: "overlay" buffers +which are located within the system's video memory. The overlay +functionality is considered to be deprecated for most use, but it still +shows up occasionally in system-on-chip drivers where the performance +benefits merit the use of this technique. Overlay buffers can be handled +as a form of scattered buffer, but there are very few implementations in +the kernel and a description of this technique is currently beyond the +scope of this document.] + +Data structures, callbacks, and initialization + +Depending on which type of buffers are being used, the driver should +include one of the following files: + + /* Physically scattered */ + /* vmalloc() buffers */ + /* Physically contiguous */ + +The driver's data structure describing a V4L2 device should include a +struct videobuf_queue instance for the management of the buffer queue, +along with a list_head for the queue of available buffers. There will also +need to be an interrupt-safe spinlock which is used to protect (at least) +the queue. + +The next step is to write four simple callbacks to help videobuf deal with +the management of buffers: + + struct videobuf_queue_ops { + int (*buf_setup)(struct videobuf_queue *q, + unsigned int *count, unsigned int *size); + int (*buf_prepare)(struct videobuf_queue *q, + struct videobuf_buffer *vb, + enum v4l2_field field); + void (*buf_queue)(struct videobuf_queue *q, + struct videobuf_buffer *vb); + void (*buf_release)(struct videobuf_queue *q, + struct videobuf_buffer *vb); + }; + +buf_setup() is called early in the I/O process, when streaming is being +initiated; its purpose is to tell videobuf about the I/O stream. The count +parameter will be a suggested number of buffers to use; the driver should +check it for rationality and adjust it if need be. As a practical rule, a +minimum of two buffers are needed for proper streaming, and there is +usually a maximum (which cannot exceed 32) which makes sense for each +device. The size parameter should be set to the expected (maximum) size +for each frame of data. + +Each buffer (in the form of a struct videobuf_buffer pointer) will be +passed to buf_prepare(), which should set the buffer's size, width, height, +and field fields properly. If the buffer's state field is +VIDEOBUF_NEEDS_INIT, the driver should pass it to: + + int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf); + +Among other things, this call will usually allocate memory for the buffer. +Finally, the buf_prepare() function should set the buffer's state to +VIDEOBUF_PREPARED. + +When a buffer is queued for I/O, it is passed to buf_queue(), which should +put it onto the driver's list of available buffers and set its state to +VIDEOBUF_QUEUED. Note that this function is called with the queue spinlock +held; if it tries to acquire it as well things will come to a screeching +halt. Yes, this is the voice of experience. Note also that videobuf may +wait on the first buffer in the queue; placing other buffers in front of it +could again gum up the works. So use list_add_tail() to enqueue buffers. + +Finally, buf_release() is called when a buffer is no longer intended to be +used. The driver should ensure that there is no I/O active on the buffer, +then pass it to the appropriate free routine(s): + + /* Scatter/gather drivers */ + int videobuf_dma_unmap(struct videobuf_queue *q, + struct videobuf_dmabuf *dma); + int videobuf_dma_free(struct videobuf_dmabuf *dma); + + /* vmalloc drivers */ + void videobuf_vmalloc_free (struct videobuf_buffer *buf); + + /* Contiguous drivers */ + void videobuf_dma_contig_free(struct videobuf_queue *q, + struct videobuf_buffer *buf); + +One way to ensure that a buffer is no longer under I/O is to pass it to: + + int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); + +Here, vb is the buffer, non_blocking indicates whether non-blocking I/O +should be used (it should be zero in the buf_release() case), and intr +controls whether an interruptible wait is used. + +File operations + +At this point, much of the work is done; much of the rest is slipping +videobuf calls into the implementation of the other driver callbacks. The +first step is in the open() function, which must initialize the +videobuf queue. The function to use depends on the type of buffer used: + + void videobuf_queue_sg_init(struct videobuf_queue *q, + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, + void *priv); + + void videobuf_queue_vmalloc_init(struct videobuf_queue *q, + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, + void *priv); + + void videobuf_queue_dma_contig_init(struct videobuf_queue *q, + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, + void *priv); + +In each case, the parameters are the same: q is the queue structure for the +device, ops is the set of callbacks as described above, dev is the device +structure for this video device, irqlock is an interrupt-safe spinlock to +protect access to the data structures, type is the buffer type used by the +device (cameras will use V4L2_BUF_TYPE_VIDEO_CAPTURE, for example), field +describes which field is being captured (often V4L2_FIELD_NONE for +progressive devices), msize is the size of any containing structure used +around struct videobuf_buffer, and priv is a private data pointer which +shows up in the priv_data field of struct videobuf_queue. Note that these +are void functions which, evidently, are immune to failure. + +V4L2 capture drivers can be written to support either of two APIs: the +read() system call and the rather more complicated streaming mechanism. As +a general rule, it is necessary to support both to ensure that all +applications have a chance of working with the device. Videobuf makes it +easy to do that with the same code. To implement read(), the driver need +only make a call to one of: + + ssize_t videobuf_read_one(struct videobuf_queue *q, + char __user *data, size_t count, + loff_t *ppos, int nonblocking); + + ssize_t videobuf_read_stream(struct videobuf_queue *q, + char __user *data, size_t count, + loff_t *ppos, int vbihack, int nonblocking); + +Either one of these functions will read frame data into data, returning the +amount actually read; the difference is that videobuf_read_one() will only +read a single frame, while videobuf_read_stream() will read multiple frames +if they are needed to satisfy the count requested by the application. A +typical driver read() implementation will start the capture engine, call +one of the above functions, then stop the engine before returning (though a +smarter implementation might leave the engine running for a little while in +anticipation of another read() call happening in the near future). + +The poll() function can usually be implemented with a direct call to: + + unsigned int videobuf_poll_stream(struct file *file, + struct videobuf_queue *q, + poll_table *wait); + +Note that the actual wait queue eventually used will be the one associated +with the first available buffer. + +When streaming I/O is done to kernel-space buffers, the driver must support +the mmap() system call to enable user space to access the data. In many +V4L2 drivers, the often-complex mmap() implementation simplifies to a +single call to: + + int videobuf_mmap_mapper(struct videobuf_queue *q, + struct vm_area_struct *vma); + +Everything else is handled by the videobuf code. + +The release() function requires two separate videobuf calls: + + void videobuf_stop(struct videobuf_queue *q); + int videobuf_mmap_free(struct videobuf_queue *q); + +The call to videobuf_stop() terminates any I/O in progress - though it is +still up to the driver to stop the capture engine. The call to +videobuf_mmap_free() will ensure that all buffers have been unmapped; if +so, they will all be passed to the buf_release() callback. If buffers +remain mapped, videobuf_mmap_free() returns an error code instead. The +purpose is clearly to cause the closing of the file descriptor to fail if +buffers are still mapped, but every driver in the 2.6.32 kernel cheerfully +ignores its return value. + +ioctl() operations + +The V4L2 API includes a very long list of driver callbacks to respond to +the many ioctl() commands made available to user space. A number of these +- those associated with streaming I/O - turn almost directly into videobuf +calls. The relevant helper functions are: + + int videobuf_reqbufs(struct videobuf_queue *q, + struct v4l2_requestbuffers *req); + int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); + int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b); + int videobuf_dqbuf(struct videobuf_queue *q, struct v4l2_buffer *b, + 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 +proper struct videobuf_queue pointer and pass it to videobuf_reqbufs(). +These support functions can replace a great deal of buffer management +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. + +Buffer allocation + +Thus far, we have talked about buffers, but have not looked at how they are +allocated. The scatter/gather case is the most complex on this front. For +allocation, the driver can leave buffer allocation entirely up to the +videobuf layer; in this case, buffers will be allocated as anonymous +user-space pages and will be very scattered indeed. If the application is +using user-space buffers, no allocation is needed; the videobuf layer will +take care of calling get_user_pages() and filling in the scatterlist array. + +If the driver needs to do its own memory allocation, it should be done in +the vidioc_reqbufs() function, *after* calling videobuf_reqbufs(). The +first step is a call to: + + struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); + +The returned videobuf_dmabuf structure (defined in +) includes a couple of relevant fields: + + struct scatterlist *sglist; + int sglen; + +The driver must allocate an appropriately-sized scatterlist array and +populate it with pointers to the pieces of the allocated buffer; sglen +should be set to the length of the array. + +Drivers using the vmalloc() method need not (and cannot) concern themselves +with buffer allocation at all; videobuf will handle those details. The +same is normally true of contiguous-DMA drivers as well; videobuf will +allocate the buffers (with dma_alloc_coherent()) when it sees fit. That +means that these drivers may be trying to do high-order allocations at any +time, an operation which is not always guaranteed to work. Some drivers +play tricks by allocating DMA space at system boot time; videobuf does not +currently play well with those drivers. + +As of 2.6.31, contiguous-DMA drivers can work with a user-supplied buffer, +as long as that buffer is physically contiguous. Normal user-space +allocations will not meet that criterion, but buffers obtained from other +kernel drivers, or those contained within huge pages, will work with these +drivers. + +Filling the buffers + +The final part of a videobuf implementation has no direct callback - it's +the portion of the code which actually puts frame data into the buffers, +usually in response to interrupts from the device. For all types of +drivers, this process works approximately as follows: + + - Obtain the next available buffer and make sure that somebody is actually + waiting for it. + + - Get a pointer to the memory and put video data there. + + - Mark the buffer as done and wake up the process waiting for it. + +Step (1) above is done by looking at the driver-managed list_head structure +- the one which is filled in the buf_queue() callback. Because starting +the engine and enqueueing buffers are done in separate steps, it's possible +for the engine to be running without any buffers available - in the +vmalloc() case especially. So the driver should be prepared for the list +to be empty. It is equally possible that nobody is yet interested in the +buffer; the driver should not remove it from the list or fill it until a +process is waiting on it. That test can be done by examining the buffer's +done field (a wait_queue_head_t structure) with waitqueue_active(). + +A buffer's state should be set to VIDEOBUF_ACTIVE before being mapped for +DMA; that ensures that the videobuf layer will not try to do anything with +it while the device is transferring data. + +For scatter/gather drivers, the needed memory pointers will be found in the +scatterlist structure described above. Drivers using the vmalloc() method +can get a memory pointer with: + + void *videobuf_to_vmalloc(struct videobuf_buffer *buf); + +For contiguous DMA drivers, the function to use is: + + dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf); + +The contiguous DMA API goes out of its way to hide the kernel-space address +of the DMA buffer from drivers. + +The final step is to set the size field of the relevant videobuf_buffer +structure to the actual size of the captured image, set state to +VIDEOBUF_DONE, then call wake_up() on the done queue. At this point, the +buffer is owned by the videobuf layer and the driver should not touch it +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 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. -- cgit v1.1 From 7cae112ebe10e186c3bdae1f20865941717e37a2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Feb 2010 18:55:00 -0300 Subject: V4L/DVB: V4L2 docs: replace spaces by tabs CC: Jonathan Corbet CC: Reviewed-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/v4l2-framework.txt | 1 - Documentation/video4linux/videobuf | 44 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 23 deletions(-) (limited to 'Documentation') diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 90b0a08..5155700 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -609,4 +609,3 @@ scatter/gather method (videobuf-dma-sg), DMA with linear access Please see Documentation/video4linux/videobuf for more information on how to use the videobuf layer. - diff --git a/Documentation/video4linux/videobuf b/Documentation/video4linux/videobuf index ba4ca99..17a1f9a 100644 --- a/Documentation/video4linux/videobuf +++ b/Documentation/video4linux/videobuf @@ -112,7 +112,7 @@ then pass it to the appropriate free routine(s): /* Scatter/gather drivers */ int videobuf_dma_unmap(struct videobuf_queue *q, - struct videobuf_dmabuf *dma); + struct videobuf_dmabuf *dma); int videobuf_dma_free(struct videobuf_dmabuf *dma); /* vmalloc drivers */ @@ -120,7 +120,7 @@ then pass it to the appropriate free routine(s): /* Contiguous drivers */ void videobuf_dma_contig_free(struct videobuf_queue *q, - struct videobuf_buffer *buf); + struct videobuf_buffer *buf); One way to ensure that a buffer is no longer under I/O is to pass it to: @@ -138,21 +138,21 @@ first step is in the open() function, which must initialize the videobuf queue. The function to use depends on the type of buffer used: void videobuf_queue_sg_init(struct videobuf_queue *q, - struct videobuf_queue_ops *ops, - struct device *dev, - spinlock_t *irqlock, - enum v4l2_buf_type type, - enum v4l2_field field, - unsigned int msize, - void *priv); + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, + void *priv); void videobuf_queue_vmalloc_init(struct videobuf_queue *q, - struct videobuf_queue_ops *ops, - struct device *dev, - spinlock_t *irqlock, - enum v4l2_buf_type type, - enum v4l2_field field, - unsigned int msize, + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, void *priv); void videobuf_queue_dma_contig_init(struct videobuf_queue *q, @@ -183,11 +183,11 @@ easy to do that with the same code. To implement read(), the driver need only make a call to one of: ssize_t videobuf_read_one(struct videobuf_queue *q, - char __user *data, size_t count, + char __user *data, size_t count, loff_t *ppos, int nonblocking); ssize_t videobuf_read_stream(struct videobuf_queue *q, - char __user *data, size_t count, + char __user *data, size_t count, loff_t *ppos, int vbihack, int nonblocking); Either one of these functions will read frame data into data, returning the @@ -240,15 +240,15 @@ the many ioctl() commands made available to user space. A number of these calls. The relevant helper functions are: int videobuf_reqbufs(struct videobuf_queue *q, - struct v4l2_requestbuffers *req); + struct v4l2_requestbuffers *req); int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b); - int videobuf_dqbuf(struct videobuf_queue *q, struct v4l2_buffer *b, - int nonblocking); + int videobuf_dqbuf(struct videobuf_queue *q, struct v4l2_buffer *b, + 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); + 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 -- cgit v1.1 From dbb9de9bc137e08dc47db960d5730e3251932e2b Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Wed, 10 Feb 2010 19:02:58 -0300 Subject: V4L/DVB: tuner-types: Add Sony BTF-Pxn01Z tuner type used on GigaPocket cards Sony makes custome tuners for its GigaPocket line of ivtv based capture cards. This adds an entry to the tuner-types list for such tuners. Parameters are based on experiments by Eric Anderson . Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.tuner | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index e0d298f..9b2e0dd 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -81,3 +81,4 @@ tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough tuner=81 - Partsnic (Daewoo) PTI-5NF05 tuner=82 - Philips CU1216L tuner=83 - NXP TDA18271 +tuner=84 - Sony BTF-Pxn01Z -- cgit v1.1 From 4f3a89e48a9975ab3f777ea15ac161267e4b8794 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 17 Jan 2010 10:45:13 -0300 Subject: V4L/DVB: gscpa Documentation: add cpia1 cameras gscpa Documentation: add cpia1 cameras Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 9de9db0..939dda9 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -154,6 +154,7 @@ sunplus 0546:3191 Polaroid Ion 80 sunplus 0546:3273 Polaroid PDC2030 ov519 054c:0154 Sonny toy4 ov519 054c:0155 Sonny toy5 +cpia1 0553:0002 CPIA CPiA (version1) based cameras zc3xx 055f:c005 Mustek Wcam300A spca500 055f:c200 Mustek Gsmart 300 sunplus 055f:c211 Kowa Bs888e Microcamera @@ -206,6 +207,7 @@ sunplus 0733:2221 Mercury Digital Pro 3.1p sunplus 0733:3261 Concord 3045 spca536a sunplus 0733:3281 Cyberpix S550V spca506 0734:043b 3DeMon USB Capture aka +cpia1 0813:0001 QX3 camera ov519 0813:0002 Dual Mode USB Camera Plus spca500 084d:0003 D-Link DSC-350 spca500 08ca:0103 Aiptek PocketDV -- cgit v1.1 From 606f8428ca1c2fbc665f726b4f810b8d50b87954 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 10 Feb 2010 06:49:23 -0300 Subject: V4L/DVB: Documentation: gspca.txt: update known mr97310a cams Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 939dda9..181b9e6 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -229,8 +229,8 @@ sunplus 08ca:2050 Medion MD 41437 sunplus 08ca:2060 Aiptek PocketDV5300 tv8532 0923:010f ICM532 cams mars 093a:050f Mars-Semi Pc-Camera -mr97310a 093a:010e All four known CIF cams with this ID -mr97310a 093a:010f All four known VGA cams with this ID +mr97310a 093a:010e All known CIF cams with this ID +mr97310a 093a:010f All known VGA cams with this ID pac207 093a:2460 Qtec Webcam 100 pac207 093a:2461 HP Webcam pac207 093a:2463 Philips SPC 220 NC -- cgit v1.1