aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-12 17:07:46 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-12 17:07:46 -0500
commit0a87a2db485a1456b7427914969c0e8195a1bbda (patch)
tree8d0186672af22c6ee76118c471881cd66a36502d /Documentation/DocBook
parent7226572d8ed48f7e1aa9de5383d919490d6e9a0c (diff)
parentfcf3aac5fc307f0cae429f5844ddc25761662858 (diff)
Merge tag 'topic/i915-hda-componentized-2015-01-12' into drm-intel-next-queued
Conflicts: drivers/gpu/drm/i915/intel_runtime_pm.c Separate branch so that Takashi can also pull just this refactoring into sound-next. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/alsa-driver-api.tmpl31
-rw-r--r--Documentation/DocBook/crypto-API.tmpl1253
-rw-r--r--Documentation/DocBook/drm.tmpl39
-rw-r--r--Documentation/DocBook/media/dvb/dvbproperty.xml4
-rw-r--r--Documentation/DocBook/media/v4l/biblio.xml85
-rw-r--r--Documentation/DocBook/media/v4l/compat.xml12
-rw-r--r--Documentation/DocBook/media/v4l/dev-subdev.xml109
-rw-r--r--Documentation/DocBook/media/v4l/io.xml5
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt.xml1310
-rw-r--r--Documentation/DocBook/media/v4l/selections-common.xml16
-rw-r--r--Documentation/DocBook/media/v4l/subdev-formats.xml326
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml11
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-enuminput.xml8
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-enumoutput.xml8
-rw-r--r--Documentation/DocBook/uio-howto.tmpl2
-rw-r--r--Documentation/DocBook/writing-an-alsa-driver.tmpl23
17 files changed, 2721 insertions, 523 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index bec06659e0eb..9c7d92d03f62 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -15,7 +15,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \
15 80211.xml debugobjects.xml sh.xml regulator.xml \ 15 80211.xml debugobjects.xml sh.xml regulator.xml \
16 alsa-driver-api.xml writing-an-alsa-driver.xml \ 16 alsa-driver-api.xml writing-an-alsa-driver.xml \
17 tracepoint.xml drm.xml media_api.xml w1.xml \ 17 tracepoint.xml drm.xml media_api.xml w1.xml \
18 writing_musb_glue_layer.xml 18 writing_musb_glue_layer.xml crypto-API.xml
19 19
20include Documentation/DocBook/media/Makefile 20include Documentation/DocBook/media/Makefile
21 21
diff --git a/Documentation/DocBook/alsa-driver-api.tmpl b/Documentation/DocBook/alsa-driver-api.tmpl
index 0230a96f0564..71f9246127ec 100644
--- a/Documentation/DocBook/alsa-driver-api.tmpl
+++ b/Documentation/DocBook/alsa-driver-api.tmpl
@@ -57,6 +57,7 @@
57!Esound/core/pcm.c 57!Esound/core/pcm.c
58!Esound/core/pcm_lib.c 58!Esound/core/pcm_lib.c
59!Esound/core/pcm_native.c 59!Esound/core/pcm_native.c
60!Iinclude/sound/pcm.h
60 </sect1> 61 </sect1>
61 <sect1><title>PCM Format Helpers</title> 62 <sect1><title>PCM Format Helpers</title>
62!Esound/core/pcm_misc.c 63!Esound/core/pcm_misc.c
@@ -64,6 +65,10 @@
64 <sect1><title>PCM Memory Management</title> 65 <sect1><title>PCM Memory Management</title>
65!Esound/core/pcm_memory.c 66!Esound/core/pcm_memory.c
66 </sect1> 67 </sect1>
68 <sect1><title>PCM DMA Engine API</title>
69!Esound/core/pcm_dmaengine.c
70!Iinclude/sound/dmaengine_pcm.h
71 </sect1>
67 </chapter> 72 </chapter>
68 <chapter><title>Control/Mixer API</title> 73 <chapter><title>Control/Mixer API</title>
69 <sect1><title>General Control Interface</title> 74 <sect1><title>General Control Interface</title>
@@ -91,12 +96,38 @@
91!Esound/core/info.c 96!Esound/core/info.c
92 </sect1> 97 </sect1>
93 </chapter> 98 </chapter>
99 <chapter><title>Compress Offload</title>
100 <sect1><title>Compress Offload API</title>
101!Esound/core/compress_offload.c
102!Iinclude/uapi/sound/compress_offload.h
103!Iinclude/uapi/sound/compress_params.h
104!Iinclude/sound/compress_driver.h
105 </sect1>
106 </chapter>
107 <chapter><title>ASoC</title>
108 <sect1><title>ASoC Core API</title>
109!Iinclude/sound/soc.h
110!Esound/soc/soc-core.c
111!Esound/soc/soc-cache.c
112!Esound/soc/soc-devres.c
113!Esound/soc/soc-io.c
114!Esound/soc/soc-pcm.c
115 </sect1>
116 <sect1><title>ASoC DAPM API</title>
117!Esound/soc/soc-dapm.c
118 </sect1>
119 <sect1><title>ASoC DMA Engine API</title>
120!Esound/soc/soc-generic-dmaengine-pcm.c
121 </sect1>
122 </chapter>
94 <chapter><title>Miscellaneous Functions</title> 123 <chapter><title>Miscellaneous Functions</title>
95 <sect1><title>Hardware-Dependent Devices API</title> 124 <sect1><title>Hardware-Dependent Devices API</title>
96!Esound/core/hwdep.c 125!Esound/core/hwdep.c
97 </sect1> 126 </sect1>
98 <sect1><title>Jack Abstraction Layer API</title> 127 <sect1><title>Jack Abstraction Layer API</title>
128!Iinclude/sound/jack.h
99!Esound/core/jack.c 129!Esound/core/jack.c
130!Esound/soc/soc-jack.c
100 </sect1> 131 </sect1>
101 <sect1><title>ISA DMA Helpers</title> 132 <sect1><title>ISA DMA Helpers</title>
102!Esound/core/isadma.c 133!Esound/core/isadma.c
diff --git a/Documentation/DocBook/crypto-API.tmpl b/Documentation/DocBook/crypto-API.tmpl
new file mode 100644
index 000000000000..c763d30f4893
--- /dev/null
+++ b/Documentation/DocBook/crypto-API.tmpl
@@ -0,0 +1,1253 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="KernelCryptoAPI">
6 <bookinfo>
7 <title>Linux Kernel Crypto API</title>
8
9 <authorgroup>
10 <author>
11 <firstname>Stephan</firstname>
12 <surname>Mueller</surname>
13 <affiliation>
14 <address>
15 <email>smueller@chronox.de</email>
16 </address>
17 </affiliation>
18 </author>
19 <author>
20 <firstname>Marek</firstname>
21 <surname>Vasut</surname>
22 <affiliation>
23 <address>
24 <email>marek@denx.de</email>
25 </address>
26 </affiliation>
27 </author>
28 </authorgroup>
29
30 <copyright>
31 <year>2014</year>
32 <holder>Stephan Mueller</holder>
33 </copyright>
34
35
36 <legalnotice>
37 <para>
38 This documentation is free software; you can redistribute
39 it and/or modify it under the terms of the GNU General Public
40 License as published by the Free Software Foundation; either
41 version 2 of the License, or (at your option) any later
42 version.
43 </para>
44
45 <para>
46 This program is distributed in the hope that it will be
47 useful, but WITHOUT ANY WARRANTY; without even the implied
48 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
49 See the GNU General Public License for more details.
50 </para>
51
52 <para>
53 You should have received a copy of the GNU General Public
54 License along with this program; if not, write to the Free
55 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
56 MA 02111-1307 USA
57 </para>
58
59 <para>
60 For more details see the file COPYING in the source
61 distribution of Linux.
62 </para>
63 </legalnotice>
64 </bookinfo>
65
66 <toc></toc>
67
68 <chapter id="Intro">
69 <title>Kernel Crypto API Interface Specification</title>
70
71 <sect1><title>Introduction</title>
72
73 <para>
74 The kernel crypto API offers a rich set of cryptographic ciphers as
75 well as other data transformation mechanisms and methods to invoke
76 these. This document contains a description of the API and provides
77 example code.
78 </para>
79
80 <para>
81 To understand and properly use the kernel crypto API a brief
82 explanation of its structure is given. Based on the architecture,
83 the API can be separated into different components. Following the
84 architecture specification, hints to developers of ciphers are
85 provided. Pointers to the API function call documentation are
86 given at the end.
87 </para>
88
89 <para>
90 The kernel crypto API refers to all algorithms as "transformations".
91 Therefore, a cipher handle variable usually has the name "tfm".
92 Besides cryptographic operations, the kernel crypto API also knows
93 compression transformations and handles them the same way as ciphers.
94 </para>
95
96 <para>
97 The kernel crypto API serves the following entity types:
98
99 <itemizedlist>
100 <listitem>
101 <para>consumers requesting cryptographic services</para>
102 </listitem>
103 <listitem>
104 <para>data transformation implementations (typically ciphers)
105 that can be called by consumers using the kernel crypto
106 API</para>
107 </listitem>
108 </itemizedlist>
109 </para>
110
111 <para>
112 This specification is intended for consumers of the kernel crypto
113 API as well as for developers implementing ciphers. This API
114 specification, however, does not discusses all API calls available
115 to data transformation implementations (i.e. implementations of
116 ciphers and other transformations (such as CRC or even compression
117 algorithms) that can register with the kernel crypto API).
118 </para>
119
120 <para>
121 Note: The terms "transformation" and cipher algorithm are used
122 interchangably.
123 </para>
124 </sect1>
125
126 <sect1><title>Terminology</title>
127 <para>
128 The transformation implementation is an actual code or interface
129 to hardware which implements a certain transformation with precisely
130 defined behavior.
131 </para>
132
133 <para>
134 The transformation object (TFM) is an instance of a transformation
135 implementation. There can be multiple transformation objects
136 associated with a single transformation implementation. Each of
137 those transformation objects is held by a crypto API consumer or
138 another transformation. Transformation object is allocated when a
139 crypto API consumer requests a transformation implementation.
140 The consumer is then provided with a structure, which contains
141 a transformation object (TFM).
142 </para>
143
144 <para>
145 The structure that contains transformation objects may also be
146 referred to as a "cipher handle". Such a cipher handle is always
147 subject to the following phases that are reflected in the API calls
148 applicable to such a cipher handle:
149 </para>
150
151 <orderedlist>
152 <listitem>
153 <para>Initialization of a cipher handle.</para>
154 </listitem>
155 <listitem>
156 <para>Execution of all intended cipher operations applicable
157 for the handle where the cipher handle must be furnished to
158 every API call.</para>
159 </listitem>
160 <listitem>
161 <para>Destruction of a cipher handle.</para>
162 </listitem>
163 </orderedlist>
164
165 <para>
166 When using the initialization API calls, a cipher handle is
167 created and returned to the consumer. Therefore, please refer
168 to all initialization API calls that refer to the data
169 structure type a consumer is expected to receive and subsequently
170 to use. The initialization API calls have all the same naming
171 conventions of crypto_alloc_*.
172 </para>
173
174 <para>
175 The transformation context is private data associated with
176 the transformation object.
177 </para>
178 </sect1>
179 </chapter>
180
181 <chapter id="Architecture"><title>Kernel Crypto API Architecture</title>
182 <sect1><title>Cipher algorithm types</title>
183 <para>
184 The kernel crypto API provides different API calls for the
185 following cipher types:
186
187 <itemizedlist>
188 <listitem><para>Symmetric ciphers</para></listitem>
189 <listitem><para>AEAD ciphers</para></listitem>
190 <listitem><para>Message digest, including keyed message digest</para></listitem>
191 <listitem><para>Random number generation</para></listitem>
192 <listitem><para>User space interface</para></listitem>
193 </itemizedlist>
194 </para>
195 </sect1>
196
197 <sect1><title>Ciphers And Templates</title>
198 <para>
199 The kernel crypto API provides implementations of single block
200 ciphers and message digests. In addition, the kernel crypto API
201 provides numerous "templates" that can be used in conjunction
202 with the single block ciphers and message digests. Templates
203 include all types of block chaining mode, the HMAC mechanism, etc.
204 </para>
205
206 <para>
207 Single block ciphers and message digests can either be directly
208 used by a caller or invoked together with a template to form
209 multi-block ciphers or keyed message digests.
210 </para>
211
212 <para>
213 A single block cipher may even be called with multiple templates.
214 However, templates cannot be used without a single cipher.
215 </para>
216
217 <para>
218 See /proc/crypto and search for "name". For example:
219
220 <itemizedlist>
221 <listitem><para>aes</para></listitem>
222 <listitem><para>ecb(aes)</para></listitem>
223 <listitem><para>cmac(aes)</para></listitem>
224 <listitem><para>ccm(aes)</para></listitem>
225 <listitem><para>rfc4106(gcm(aes))</para></listitem>
226 <listitem><para>sha1</para></listitem>
227 <listitem><para>hmac(sha1)</para></listitem>
228 <listitem><para>authenc(hmac(sha1),cbc(aes))</para></listitem>
229 </itemizedlist>
230 </para>
231
232 <para>
233 In these examples, "aes" and "sha1" are the ciphers and all
234 others are the templates.
235 </para>
236 </sect1>
237
238 <sect1><title>Synchronous And Asynchronous Operation</title>
239 <para>
240 The kernel crypto API provides synchronous and asynchronous
241 API operations.
242 </para>
243
244 <para>
245 When using the synchronous API operation, the caller invokes
246 a cipher operation which is performed synchronously by the
247 kernel crypto API. That means, the caller waits until the
248 cipher operation completes. Therefore, the kernel crypto API
249 calls work like regular function calls. For synchronous
250 operation, the set of API calls is small and conceptually
251 similar to any other crypto library.
252 </para>
253
254 <para>
255 Asynchronous operation is provided by the kernel crypto API
256 which implies that the invocation of a cipher operation will
257 complete almost instantly. That invocation triggers the
258 cipher operation but it does not signal its completion. Before
259 invoking a cipher operation, the caller must provide a callback
260 function the kernel crypto API can invoke to signal the
261 completion of the cipher operation. Furthermore, the caller
262 must ensure it can handle such asynchronous events by applying
263 appropriate locking around its data. The kernel crypto API
264 does not perform any special serialization operation to protect
265 the caller's data integrity.
266 </para>
267 </sect1>
268
269 <sect1><title>Crypto API Cipher References And Priority</title>
270 <para>
271 A cipher is referenced by the caller with a string. That string
272 has the following semantics:
273
274 <programlisting>
275 template(single block cipher)
276 </programlisting>
277
278 where "template" and "single block cipher" is the aforementioned
279 template and single block cipher, respectively. If applicable,
280 additional templates may enclose other templates, such as
281
282 <programlisting>
283 template1(template2(single block cipher)))
284 </programlisting>
285 </para>
286
287 <para>
288 The kernel crypto API may provide multiple implementations of a
289 template or a single block cipher. For example, AES on newer
290 Intel hardware has the following implementations: AES-NI,
291 assembler implementation, or straight C. Now, when using the
292 string "aes" with the kernel crypto API, which cipher
293 implementation is used? The answer to that question is the
294 priority number assigned to each cipher implementation by the
295 kernel crypto API. When a caller uses the string to refer to a
296 cipher during initialization of a cipher handle, the kernel
297 crypto API looks up all implementations providing an
298 implementation with that name and selects the implementation
299 with the highest priority.
300 </para>
301
302 <para>
303 Now, a caller may have the need to refer to a specific cipher
304 implementation and thus does not want to rely on the
305 priority-based selection. To accommodate this scenario, the
306 kernel crypto API allows the cipher implementation to register
307 a unique name in addition to common names. When using that
308 unique name, a caller is therefore always sure to refer to
309 the intended cipher implementation.
310 </para>
311
312 <para>
313 The list of available ciphers is given in /proc/crypto. However,
314 that list does not specify all possible permutations of
315 templates and ciphers. Each block listed in /proc/crypto may
316 contain the following information -- if one of the components
317 listed as follows are not applicable to a cipher, it is not
318 displayed:
319 </para>
320
321 <itemizedlist>
322 <listitem>
323 <para>name: the generic name of the cipher that is subject
324 to the priority-based selection -- this name can be used by
325 the cipher allocation API calls (all names listed above are
326 examples for such generic names)</para>
327 </listitem>
328 <listitem>
329 <para>driver: the unique name of the cipher -- this name can
330 be used by the cipher allocation API calls</para>
331 </listitem>
332 <listitem>
333 <para>module: the kernel module providing the cipher
334 implementation (or "kernel" for statically linked ciphers)</para>
335 </listitem>
336 <listitem>
337 <para>priority: the priority value of the cipher implementation</para>
338 </listitem>
339 <listitem>
340 <para>refcnt: the reference count of the respective cipher
341 (i.e. the number of current consumers of this cipher)</para>
342 </listitem>
343 <listitem>
344 <para>selftest: specification whether the self test for the
345 cipher passed</para>
346 </listitem>
347 <listitem>
348 <para>type:
349 <itemizedlist>
350 <listitem>
351 <para>blkcipher for synchronous block ciphers</para>
352 </listitem>
353 <listitem>
354 <para>ablkcipher for asynchronous block ciphers</para>
355 </listitem>
356 <listitem>
357 <para>cipher for single block ciphers that may be used with
358 an additional template</para>
359 </listitem>
360 <listitem>
361 <para>shash for synchronous message digest</para>
362 </listitem>
363 <listitem>
364 <para>ahash for asynchronous message digest</para>
365 </listitem>
366 <listitem>
367 <para>aead for AEAD cipher type</para>
368 </listitem>
369 <listitem>
370 <para>compression for compression type transformations</para>
371 </listitem>
372 <listitem>
373 <para>rng for random number generator</para>
374 </listitem>
375 <listitem>
376 <para>givcipher for cipher with associated IV generator
377 (see the geniv entry below for the specification of the
378 IV generator type used by the cipher implementation)</para>
379 </listitem>
380 </itemizedlist>
381 </para>
382 </listitem>
383 <listitem>
384 <para>blocksize: blocksize of cipher in bytes</para>
385 </listitem>
386 <listitem>
387 <para>keysize: key size in bytes</para>
388 </listitem>
389 <listitem>
390 <para>ivsize: IV size in bytes</para>
391 </listitem>
392 <listitem>
393 <para>seedsize: required size of seed data for random number
394 generator</para>
395 </listitem>
396 <listitem>
397 <para>digestsize: output size of the message digest</para>
398 </listitem>
399 <listitem>
400 <para>geniv: IV generation type:
401 <itemizedlist>
402 <listitem>
403 <para>eseqiv for encrypted sequence number based IV
404 generation</para>
405 </listitem>
406 <listitem>
407 <para>seqiv for sequence number based IV generation</para>
408 </listitem>
409 <listitem>
410 <para>chainiv for chain iv generation</para>
411 </listitem>
412 <listitem>
413 <para>&lt;builtin&gt; is a marker that the cipher implements
414 IV generation and handling as it is specific to the given
415 cipher</para>
416 </listitem>
417 </itemizedlist>
418 </para>
419 </listitem>
420 </itemizedlist>
421 </sect1>
422
423 <sect1><title>Key Sizes</title>
424 <para>
425 When allocating a cipher handle, the caller only specifies the
426 cipher type. Symmetric ciphers, however, typically support
427 multiple key sizes (e.g. AES-128 vs. AES-192 vs. AES-256).
428 These key sizes are determined with the length of the provided
429 key. Thus, the kernel crypto API does not provide a separate
430 way to select the particular symmetric cipher key size.
431 </para>
432 </sect1>
433
434 <sect1><title>Cipher Allocation Type And Masks</title>
435 <para>
436 The different cipher handle allocation functions allow the
437 specification of a type and mask flag. Both parameters have
438 the following meaning (and are therefore not covered in the
439 subsequent sections).
440 </para>
441
442 <para>
443 The type flag specifies the type of the cipher algorithm.
444 The caller usually provides a 0 when the caller wants the
445 default handling. Otherwise, the caller may provide the
446 following selections which match the the aforementioned
447 cipher types:
448 </para>
449
450 <itemizedlist>
451 <listitem>
452 <para>CRYPTO_ALG_TYPE_CIPHER Single block cipher</para>
453 </listitem>
454 <listitem>
455 <para>CRYPTO_ALG_TYPE_COMPRESS Compression</para>
456 </listitem>
457 <listitem>
458 <para>CRYPTO_ALG_TYPE_AEAD Authenticated Encryption with
459 Associated Data (MAC)</para>
460 </listitem>
461 <listitem>
462 <para>CRYPTO_ALG_TYPE_BLKCIPHER Synchronous multi-block cipher</para>
463 </listitem>
464 <listitem>
465 <para>CRYPTO_ALG_TYPE_ABLKCIPHER Asynchronous multi-block cipher</para>
466 </listitem>
467 <listitem>
468 <para>CRYPTO_ALG_TYPE_GIVCIPHER Asynchronous multi-block
469 cipher packed together with an IV generator (see geniv field
470 in the /proc/crypto listing for the known IV generators)</para>
471 </listitem>
472 <listitem>
473 <para>CRYPTO_ALG_TYPE_DIGEST Raw message digest</para>
474 </listitem>
475 <listitem>
476 <para>CRYPTO_ALG_TYPE_HASH Alias for CRYPTO_ALG_TYPE_DIGEST</para>
477 </listitem>
478 <listitem>
479 <para>CRYPTO_ALG_TYPE_SHASH Synchronous multi-block hash</para>
480 </listitem>
481 <listitem>
482 <para>CRYPTO_ALG_TYPE_AHASH Asynchronous multi-block hash</para>
483 </listitem>
484 <listitem>
485 <para>CRYPTO_ALG_TYPE_RNG Random Number Generation</para>
486 </listitem>
487 <listitem>
488 <para>CRYPTO_ALG_TYPE_PCOMPRESS Enhanced version of
489 CRYPTO_ALG_TYPE_COMPRESS allowing for segmented compression /
490 decompression instead of performing the operation on one
491 segment only. CRYPTO_ALG_TYPE_PCOMPRESS is intended to replace
492 CRYPTO_ALG_TYPE_COMPRESS once existing consumers are converted.</para>
493 </listitem>
494 </itemizedlist>
495
496 <para>
497 The mask flag restricts the type of cipher. The only allowed
498 flag is CRYPTO_ALG_ASYNC to restrict the cipher lookup function
499 to asynchronous ciphers. Usually, a caller provides a 0 for the
500 mask flag.
501 </para>
502
503 <para>
504 When the caller provides a mask and type specification, the
505 caller limits the search the kernel crypto API can perform for
506 a suitable cipher implementation for the given cipher name.
507 That means, even when a caller uses a cipher name that exists
508 during its initialization call, the kernel crypto API may not
509 select it due to the used type and mask field.
510 </para>
511 </sect1>
512 </chapter>
513
514 <chapter id="Development"><title>Developing Cipher Algorithms</title>
515 <sect1><title>Registering And Unregistering Transformation</title>
516 <para>
517 There are three distinct types of registration functions in
518 the Crypto API. One is used to register a generic cryptographic
519 transformation, while the other two are specific to HASH
520 transformations and COMPRESSion. We will discuss the latter
521 two in a separate chapter, here we will only look at the
522 generic ones.
523 </para>
524
525 <para>
526 Before discussing the register functions, the data structure
527 to be filled with each, struct crypto_alg, must be considered
528 -- see below for a description of this data structure.
529 </para>
530
531 <para>
532 The generic registration functions can be found in
533 include/linux/crypto.h and their definition can be seen below.
534 The former function registers a single transformation, while
535 the latter works on an array of transformation descriptions.
536 The latter is useful when registering transformations in bulk.
537 </para>
538
539 <programlisting>
540 int crypto_register_alg(struct crypto_alg *alg);
541 int crypto_register_algs(struct crypto_alg *algs, int count);
542 </programlisting>
543
544 <para>
545 The counterparts to those functions are listed below.
546 </para>
547
548 <programlisting>
549 int crypto_unregister_alg(struct crypto_alg *alg);
550 int crypto_unregister_algs(struct crypto_alg *algs, int count);
551 </programlisting>
552
553 <para>
554 Notice that both registration and unregistration functions
555 do return a value, so make sure to handle errors. A return
556 code of zero implies success. Any return code &lt; 0 implies
557 an error.
558 </para>
559
560 <para>
561 The bulk registration / unregistration functions require
562 that struct crypto_alg is an array of count size. These
563 functions simply loop over that array and register /
564 unregister each individual algorithm. If an error occurs,
565 the loop is terminated at the offending algorithm definition.
566 That means, the algorithms prior to the offending algorithm
567 are successfully registered. Note, the caller has no way of
568 knowing which cipher implementations have successfully
569 registered. If this is important to know, the caller should
570 loop through the different implementations using the single
571 instance *_alg functions for each individual implementation.
572 </para>
573 </sect1>
574
575 <sect1><title>Single-Block Symmetric Ciphers [CIPHER]</title>
576 <para>
577 Example of transformations: aes, arc4, ...
578 </para>
579
580 <para>
581 This section describes the simplest of all transformation
582 implementations, that being the CIPHER type used for symmetric
583 ciphers. The CIPHER type is used for transformations which
584 operate on exactly one block at a time and there are no
585 dependencies between blocks at all.
586 </para>
587
588 <sect2><title>Registration specifics</title>
589 <para>
590 The registration of [CIPHER] algorithm is specific in that
591 struct crypto_alg field .cra_type is empty. The .cra_u.cipher
592 has to be filled in with proper callbacks to implement this
593 transformation.
594 </para>
595
596 <para>
597 See struct cipher_alg below.
598 </para>
599 </sect2>
600
601 <sect2><title>Cipher Definition With struct cipher_alg</title>
602 <para>
603 Struct cipher_alg defines a single block cipher.
604 </para>
605
606 <para>
607 Here are schematics of how these functions are called when
608 operated from other part of the kernel. Note that the
609 .cia_setkey() call might happen before or after any of these
610 schematics happen, but must not happen during any of these
611 are in-flight.
612 </para>
613
614 <para>
615 <programlisting>
616 KEY ---. PLAINTEXT ---.
617 v v
618 .cia_setkey() -&gt; .cia_encrypt()
619 |
620 '-----&gt; CIPHERTEXT
621 </programlisting>
622 </para>
623
624 <para>
625 Please note that a pattern where .cia_setkey() is called
626 multiple times is also valid:
627 </para>
628
629 <para>
630 <programlisting>
631
632 KEY1 --. PLAINTEXT1 --. KEY2 --. PLAINTEXT2 --.
633 v v v v
634 .cia_setkey() -&gt; .cia_encrypt() -&gt; .cia_setkey() -&gt; .cia_encrypt()
635 | |
636 '---&gt; CIPHERTEXT1 '---&gt; CIPHERTEXT2
637 </programlisting>
638 </para>
639
640 </sect2>
641 </sect1>
642
643 <sect1><title>Multi-Block Ciphers [BLKCIPHER] [ABLKCIPHER]</title>
644 <para>
645 Example of transformations: cbc(aes), ecb(arc4), ...
646 </para>
647
648 <para>
649 This section describes the multi-block cipher transformation
650 implementations for both synchronous [BLKCIPHER] and
651 asynchronous [ABLKCIPHER] case. The multi-block ciphers are
652 used for transformations which operate on scatterlists of
653 data supplied to the transformation functions. They output
654 the result into a scatterlist of data as well.
655 </para>
656
657 <sect2><title>Registration Specifics</title>
658
659 <para>
660 The registration of [BLKCIPHER] or [ABLKCIPHER] algorithms
661 is one of the most standard procedures throughout the crypto API.
662 </para>
663
664 <para>
665 Note, if a cipher implementation requires a proper alignment
666 of data, the caller should use the functions of
667 crypto_blkcipher_alignmask() or crypto_ablkcipher_alignmask()
668 respectively to identify a memory alignment mask. The kernel
669 crypto API is able to process requests that are unaligned.
670 This implies, however, additional overhead as the kernel
671 crypto API needs to perform the realignment of the data which
672 may imply moving of data.
673 </para>
674 </sect2>
675
676 <sect2><title>Cipher Definition With struct blkcipher_alg and ablkcipher_alg</title>
677 <para>
678 Struct blkcipher_alg defines a synchronous block cipher whereas
679 struct ablkcipher_alg defines an asynchronous block cipher.
680 </para>
681
682 <para>
683 Please refer to the single block cipher description for schematics
684 of the block cipher usage. The usage patterns are exactly the same
685 for [ABLKCIPHER] and [BLKCIPHER] as they are for plain [CIPHER].
686 </para>
687 </sect2>
688
689 <sect2><title>Specifics Of Asynchronous Multi-Block Cipher</title>
690 <para>
691 There are a couple of specifics to the [ABLKCIPHER] interface.
692 </para>
693
694 <para>
695 First of all, some of the drivers will want to use the
696 Generic ScatterWalk in case the hardware needs to be fed
697 separate chunks of the scatterlist which contains the
698 plaintext and will contain the ciphertext. Please refer
699 to the ScatterWalk interface offered by the Linux kernel
700 scatter / gather list implementation.
701 </para>
702 </sect2>
703 </sect1>
704
705 <sect1><title>Hashing [HASH]</title>
706
707 <para>
708 Example of transformations: crc32, md5, sha1, sha256,...
709 </para>
710
711 <sect2><title>Registering And Unregistering The Transformation</title>
712
713 <para>
714 There are multiple ways to register a HASH transformation,
715 depending on whether the transformation is synchronous [SHASH]
716 or asynchronous [AHASH] and the amount of HASH transformations
717 we are registering. You can find the prototypes defined in
718 include/crypto/internal/hash.h:
719 </para>
720
721 <programlisting>
722 int crypto_register_ahash(struct ahash_alg *alg);
723
724 int crypto_register_shash(struct shash_alg *alg);
725 int crypto_register_shashes(struct shash_alg *algs, int count);
726 </programlisting>
727
728 <para>
729 The respective counterparts for unregistering the HASH
730 transformation are as follows:
731 </para>
732
733 <programlisting>
734 int crypto_unregister_ahash(struct ahash_alg *alg);
735
736 int crypto_unregister_shash(struct shash_alg *alg);
737 int crypto_unregister_shashes(struct shash_alg *algs, int count);
738 </programlisting>
739 </sect2>
740
741 <sect2><title>Cipher Definition With struct shash_alg and ahash_alg</title>
742 <para>
743 Here are schematics of how these functions are called when
744 operated from other part of the kernel. Note that the .setkey()
745 call might happen before or after any of these schematics happen,
746 but must not happen during any of these are in-flight. Please note
747 that calling .init() followed immediately by .finish() is also a
748 perfectly valid transformation.
749 </para>
750
751 <programlisting>
752 I) DATA -----------.
753 v
754 .init() -&gt; .update() -&gt; .final() ! .update() might not be called
755 ^ | | at all in this scenario.
756 '----' '---&gt; HASH
757
758 II) DATA -----------.-----------.
759 v v
760 .init() -&gt; .update() -&gt; .finup() ! .update() may not be called
761 ^ | | at all in this scenario.
762 '----' '---&gt; HASH
763
764 III) DATA -----------.
765 v
766 .digest() ! The entire process is handled
767 | by the .digest() call.
768 '---------------&gt; HASH
769 </programlisting>
770
771 <para>
772 Here is a schematic of how the .export()/.import() functions are
773 called when used from another part of the kernel.
774 </para>
775
776 <programlisting>
777 KEY--. DATA--.
778 v v ! .update() may not be called
779 .setkey() -&gt; .init() -&gt; .update() -&gt; .export() at all in this scenario.
780 ^ | |
781 '-----' '--&gt; PARTIAL_HASH
782
783 ----------- other transformations happen here -----------
784
785 PARTIAL_HASH--. DATA1--.
786 v v
787 .import -&gt; .update() -&gt; .final() ! .update() may not be called
788 ^ | | at all in this scenario.
789 '----' '--&gt; HASH1
790
791 PARTIAL_HASH--. DATA2-.
792 v v
793 .import -&gt; .finup()
794 |
795 '---------------&gt; HASH2
796 </programlisting>
797 </sect2>
798
799 <sect2><title>Specifics Of Asynchronous HASH Transformation</title>
800 <para>
801 Some of the drivers will want to use the Generic ScatterWalk
802 in case the implementation needs to be fed separate chunks of the
803 scatterlist which contains the input data. The buffer containing
804 the resulting hash will always be properly aligned to
805 .cra_alignmask so there is no need to worry about this.
806 </para>
807 </sect2>
808 </sect1>
809 </chapter>
810
811 <chapter id="API"><title>Programming Interface</title>
812 <sect1><title>Block Cipher Context Data Structures</title>
813!Pinclude/linux/crypto.h Block Cipher Context Data Structures
814!Finclude/linux/crypto.h aead_request
815 </sect1>
816 <sect1><title>Block Cipher Algorithm Definitions</title>
817!Pinclude/linux/crypto.h Block Cipher Algorithm Definitions
818!Finclude/linux/crypto.h crypto_alg
819!Finclude/linux/crypto.h ablkcipher_alg
820!Finclude/linux/crypto.h aead_alg
821!Finclude/linux/crypto.h blkcipher_alg
822!Finclude/linux/crypto.h cipher_alg
823!Finclude/linux/crypto.h rng_alg
824 </sect1>
825 <sect1><title>Asynchronous Block Cipher API</title>
826!Pinclude/linux/crypto.h Asynchronous Block Cipher API
827!Finclude/linux/crypto.h crypto_alloc_ablkcipher
828!Finclude/linux/crypto.h crypto_free_ablkcipher
829!Finclude/linux/crypto.h crypto_has_ablkcipher
830!Finclude/linux/crypto.h crypto_ablkcipher_ivsize
831!Finclude/linux/crypto.h crypto_ablkcipher_blocksize
832!Finclude/linux/crypto.h crypto_ablkcipher_setkey
833!Finclude/linux/crypto.h crypto_ablkcipher_reqtfm
834!Finclude/linux/crypto.h crypto_ablkcipher_encrypt
835!Finclude/linux/crypto.h crypto_ablkcipher_decrypt
836 </sect1>
837 <sect1><title>Asynchronous Cipher Request Handle</title>
838!Pinclude/linux/crypto.h Asynchronous Cipher Request Handle
839!Finclude/linux/crypto.h crypto_ablkcipher_reqsize
840!Finclude/linux/crypto.h ablkcipher_request_set_tfm
841!Finclude/linux/crypto.h ablkcipher_request_alloc
842!Finclude/linux/crypto.h ablkcipher_request_free
843!Finclude/linux/crypto.h ablkcipher_request_set_callback
844!Finclude/linux/crypto.h ablkcipher_request_set_crypt
845 </sect1>
846 <sect1><title>Authenticated Encryption With Associated Data (AEAD) Cipher API</title>
847!Pinclude/linux/crypto.h Authenticated Encryption With Associated Data (AEAD) Cipher API
848!Finclude/linux/crypto.h crypto_alloc_aead
849!Finclude/linux/crypto.h crypto_free_aead
850!Finclude/linux/crypto.h crypto_aead_ivsize
851!Finclude/linux/crypto.h crypto_aead_authsize
852!Finclude/linux/crypto.h crypto_aead_blocksize
853!Finclude/linux/crypto.h crypto_aead_setkey
854!Finclude/linux/crypto.h crypto_aead_setauthsize
855!Finclude/linux/crypto.h crypto_aead_encrypt
856!Finclude/linux/crypto.h crypto_aead_decrypt
857 </sect1>
858 <sect1><title>Asynchronous AEAD Request Handle</title>
859!Pinclude/linux/crypto.h Asynchronous AEAD Request Handle
860!Finclude/linux/crypto.h crypto_aead_reqsize
861!Finclude/linux/crypto.h aead_request_set_tfm
862!Finclude/linux/crypto.h aead_request_alloc
863!Finclude/linux/crypto.h aead_request_free
864!Finclude/linux/crypto.h aead_request_set_callback
865!Finclude/linux/crypto.h aead_request_set_crypt
866!Finclude/linux/crypto.h aead_request_set_assoc
867 </sect1>
868 <sect1><title>Synchronous Block Cipher API</title>
869!Pinclude/linux/crypto.h Synchronous Block Cipher API
870!Finclude/linux/crypto.h crypto_alloc_blkcipher
871!Finclude/linux/crypto.h crypto_free_blkcipher
872!Finclude/linux/crypto.h crypto_has_blkcipher
873!Finclude/linux/crypto.h crypto_blkcipher_name
874!Finclude/linux/crypto.h crypto_blkcipher_ivsize
875!Finclude/linux/crypto.h crypto_blkcipher_blocksize
876!Finclude/linux/crypto.h crypto_blkcipher_setkey
877!Finclude/linux/crypto.h crypto_blkcipher_encrypt
878!Finclude/linux/crypto.h crypto_blkcipher_encrypt_iv
879!Finclude/linux/crypto.h crypto_blkcipher_decrypt
880!Finclude/linux/crypto.h crypto_blkcipher_decrypt_iv
881!Finclude/linux/crypto.h crypto_blkcipher_set_iv
882!Finclude/linux/crypto.h crypto_blkcipher_get_iv
883 </sect1>
884 <sect1><title>Single Block Cipher API</title>
885!Pinclude/linux/crypto.h Single Block Cipher API
886!Finclude/linux/crypto.h crypto_alloc_cipher
887!Finclude/linux/crypto.h crypto_free_cipher
888!Finclude/linux/crypto.h crypto_has_cipher
889!Finclude/linux/crypto.h crypto_cipher_blocksize
890!Finclude/linux/crypto.h crypto_cipher_setkey
891!Finclude/linux/crypto.h crypto_cipher_encrypt_one
892!Finclude/linux/crypto.h crypto_cipher_decrypt_one
893 </sect1>
894 <sect1><title>Synchronous Message Digest API</title>
895!Pinclude/linux/crypto.h Synchronous Message Digest API
896!Finclude/linux/crypto.h crypto_alloc_hash
897!Finclude/linux/crypto.h crypto_free_hash
898!Finclude/linux/crypto.h crypto_has_hash
899!Finclude/linux/crypto.h crypto_hash_blocksize
900!Finclude/linux/crypto.h crypto_hash_digestsize
901!Finclude/linux/crypto.h crypto_hash_init
902!Finclude/linux/crypto.h crypto_hash_update
903!Finclude/linux/crypto.h crypto_hash_final
904!Finclude/linux/crypto.h crypto_hash_digest
905!Finclude/linux/crypto.h crypto_hash_setkey
906 </sect1>
907 <sect1><title>Message Digest Algorithm Definitions</title>
908!Pinclude/crypto/hash.h Message Digest Algorithm Definitions
909!Finclude/crypto/hash.h hash_alg_common
910!Finclude/crypto/hash.h ahash_alg
911!Finclude/crypto/hash.h shash_alg
912 </sect1>
913 <sect1><title>Asynchronous Message Digest API</title>
914!Pinclude/crypto/hash.h Asynchronous Message Digest API
915!Finclude/crypto/hash.h crypto_alloc_ahash
916!Finclude/crypto/hash.h crypto_free_ahash
917!Finclude/crypto/hash.h crypto_ahash_init
918!Finclude/crypto/hash.h crypto_ahash_digestsize
919!Finclude/crypto/hash.h crypto_ahash_reqtfm
920!Finclude/crypto/hash.h crypto_ahash_reqsize
921!Finclude/crypto/hash.h crypto_ahash_setkey
922!Finclude/crypto/hash.h crypto_ahash_finup
923!Finclude/crypto/hash.h crypto_ahash_final
924!Finclude/crypto/hash.h crypto_ahash_digest
925!Finclude/crypto/hash.h crypto_ahash_export
926!Finclude/crypto/hash.h crypto_ahash_import
927 </sect1>
928 <sect1><title>Asynchronous Hash Request Handle</title>
929!Pinclude/crypto/hash.h Asynchronous Hash Request Handle
930!Finclude/crypto/hash.h ahash_request_set_tfm
931!Finclude/crypto/hash.h ahash_request_alloc
932!Finclude/crypto/hash.h ahash_request_free
933!Finclude/crypto/hash.h ahash_request_set_callback
934!Finclude/crypto/hash.h ahash_request_set_crypt
935 </sect1>
936 <sect1><title>Synchronous Message Digest API</title>
937!Pinclude/crypto/hash.h Synchronous Message Digest API
938!Finclude/crypto/hash.h crypto_alloc_shash
939!Finclude/crypto/hash.h crypto_free_shash
940!Finclude/crypto/hash.h crypto_shash_blocksize
941!Finclude/crypto/hash.h crypto_shash_digestsize
942!Finclude/crypto/hash.h crypto_shash_descsize
943!Finclude/crypto/hash.h crypto_shash_setkey
944!Finclude/crypto/hash.h crypto_shash_digest
945!Finclude/crypto/hash.h crypto_shash_export
946!Finclude/crypto/hash.h crypto_shash_import
947!Finclude/crypto/hash.h crypto_shash_init
948!Finclude/crypto/hash.h crypto_shash_update
949!Finclude/crypto/hash.h crypto_shash_final
950!Finclude/crypto/hash.h crypto_shash_finup
951 </sect1>
952 <sect1><title>Crypto API Random Number API</title>
953!Pinclude/crypto/rng.h Random number generator API
954!Finclude/crypto/rng.h crypto_alloc_rng
955!Finclude/crypto/rng.h crypto_rng_alg
956!Finclude/crypto/rng.h crypto_free_rng
957!Finclude/crypto/rng.h crypto_rng_get_bytes
958!Finclude/crypto/rng.h crypto_rng_reset
959!Finclude/crypto/rng.h crypto_rng_seedsize
960!Cinclude/crypto/rng.h
961 </sect1>
962 </chapter>
963
964 <chapter id="Code"><title>Code Examples</title>
965 <sect1><title>Code Example For Asynchronous Block Cipher Operation</title>
966 <programlisting>
967
968struct tcrypt_result {
969 struct completion completion;
970 int err;
971};
972
973/* tie all data structures together */
974struct ablkcipher_def {
975 struct scatterlist sg;
976 struct crypto_ablkcipher *tfm;
977 struct ablkcipher_request *req;
978 struct tcrypt_result result;
979};
980
981/* Callback function */
982static void test_ablkcipher_cb(struct crypto_async_request *req, int error)
983{
984 struct tcrypt_result *result = req-&gt;data;
985
986 if (error == -EINPROGRESS)
987 return;
988 result-&gt;err = error;
989 complete(&amp;result-&gt;completion);
990 pr_info("Encryption finished successfully\n");
991}
992
993/* Perform cipher operation */
994static unsigned int test_ablkcipher_encdec(struct ablkcipher_def *ablk,
995 int enc)
996{
997 int rc = 0;
998
999 if (enc)
1000 rc = crypto_ablkcipher_encrypt(ablk-&gt;req);
1001 else
1002 rc = crypto_ablkcipher_decrypt(ablk-&gt;req);
1003
1004 switch (rc) {
1005 case 0:
1006 break;
1007 case -EINPROGRESS:
1008 case -EBUSY:
1009 rc = wait_for_completion_interruptible(
1010 &amp;ablk-&gt;result.completion);
1011 if (!rc &amp;&amp; !ablk-&gt;result.err) {
1012 reinit_completion(&amp;ablk-&gt;result.completion);
1013 break;
1014 }
1015 default:
1016 pr_info("ablkcipher encrypt returned with %d result %d\n",
1017 rc, ablk-&gt;result.err);
1018 break;
1019 }
1020 init_completion(&amp;ablk-&gt;result.completion);
1021
1022 return rc;
1023}
1024
1025/* Initialize and trigger cipher operation */
1026static int test_ablkcipher(void)
1027{
1028 struct ablkcipher_def ablk;
1029 struct crypto_ablkcipher *ablkcipher = NULL;
1030 struct ablkcipher_request *req = NULL;
1031 char *scratchpad = NULL;
1032 char *ivdata = NULL;
1033 unsigned char key[32];
1034 int ret = -EFAULT;
1035
1036 ablkcipher = crypto_alloc_ablkcipher("cbc-aes-aesni", 0, 0);
1037 if (IS_ERR(ablkcipher)) {
1038 pr_info("could not allocate ablkcipher handle\n");
1039 return PTR_ERR(ablkcipher);
1040 }
1041
1042 req = ablkcipher_request_alloc(ablkcipher, GFP_KERNEL);
1043 if (IS_ERR(req)) {
1044 pr_info("could not allocate request queue\n");
1045 ret = PTR_ERR(req);
1046 goto out;
1047 }
1048
1049 ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
1050 test_ablkcipher_cb,
1051 &amp;ablk.result);
1052
1053 /* AES 256 with random key */
1054 get_random_bytes(&amp;key, 32);
1055 if (crypto_ablkcipher_setkey(ablkcipher, key, 32)) {
1056 pr_info("key could not be set\n");
1057 ret = -EAGAIN;
1058 goto out;
1059 }
1060
1061 /* IV will be random */
1062 ivdata = kmalloc(16, GFP_KERNEL);
1063 if (!ivdata) {
1064 pr_info("could not allocate ivdata\n");
1065 goto out;
1066 }
1067 get_random_bytes(ivdata, 16);
1068
1069 /* Input data will be random */
1070 scratchpad = kmalloc(16, GFP_KERNEL);
1071 if (!scratchpad) {
1072 pr_info("could not allocate scratchpad\n");
1073 goto out;
1074 }
1075 get_random_bytes(scratchpad, 16);
1076
1077 ablk.tfm = ablkcipher;
1078 ablk.req = req;
1079
1080 /* We encrypt one block */
1081 sg_init_one(&amp;ablk.sg, scratchpad, 16);
1082 ablkcipher_request_set_crypt(req, &amp;ablk.sg, &amp;ablk.sg, 16, ivdata);
1083 init_completion(&amp;ablk.result.completion);
1084
1085 /* encrypt data */
1086 ret = test_ablkcipher_encdec(&amp;ablk, 1);
1087 if (ret)
1088 goto out;
1089
1090 pr_info("Encryption triggered successfully\n");
1091
1092out:
1093 if (ablkcipher)
1094 crypto_free_ablkcipher(ablkcipher);
1095 if (req)
1096 ablkcipher_request_free(req);
1097 if (ivdata)
1098 kfree(ivdata);
1099 if (scratchpad)
1100 kfree(scratchpad);
1101 return ret;
1102}
1103 </programlisting>
1104 </sect1>
1105
1106 <sect1><title>Code Example For Synchronous Block Cipher Operation</title>
1107 <programlisting>
1108
1109static int test_blkcipher(void)
1110{
1111 struct crypto_blkcipher *blkcipher = NULL;
1112 char *cipher = "cbc(aes)";
1113 // AES 128
1114 charkey =
1115"\x12\x34\x56\x78\x90\xab\xcd\xef\x12\x34\x56\x78\x90\xab\xcd\xef";
1116 chariv =
1117"\x12\x34\x56\x78\x90\xab\xcd\xef\x12\x34\x56\x78\x90\xab\xcd\xef";
1118 unsigned int ivsize = 0;
1119 char *scratchpad = NULL; // holds plaintext and ciphertext
1120 struct scatterlist sg;
1121 struct blkcipher_desc desc;
1122 int ret = -EFAULT;
1123
1124 blkcipher = crypto_alloc_blkcipher(cipher, 0, 0);
1125 if (IS_ERR(blkcipher)) {
1126 printk("could not allocate blkcipher handle for %s\n", cipher);
1127 return -PTR_ERR(blkcipher);
1128 }
1129
1130 if (crypto_blkcipher_setkey(blkcipher, key, strlen(key))) {
1131 printk("key could not be set\n");
1132 ret = -EAGAIN;
1133 goto out;
1134 }
1135
1136 ivsize = crypto_blkcipher_ivsize(blkcipher);
1137 if (ivsize) {
1138 if (ivsize != strlen(iv))
1139 printk("IV length differs from expected length\n");
1140 crypto_blkcipher_set_iv(blkcipher, iv, ivsize);
1141 }
1142
1143 scratchpad = kmalloc(crypto_blkcipher_blocksize(blkcipher), GFP_KERNEL);
1144 if (!scratchpad) {
1145 printk("could not allocate scratchpad for %s\n", cipher);
1146 goto out;
1147 }
1148 /* get some random data that we want to encrypt */
1149 get_random_bytes(scratchpad, crypto_blkcipher_blocksize(blkcipher));
1150
1151 desc.flags = 0;
1152 desc.tfm = blkcipher;
1153 sg_init_one(&amp;sg, scratchpad, crypto_blkcipher_blocksize(blkcipher));
1154
1155 /* encrypt data in place */
1156 crypto_blkcipher_encrypt(&amp;desc, &amp;sg, &amp;sg,
1157 crypto_blkcipher_blocksize(blkcipher));
1158
1159 /* decrypt data in place
1160 * crypto_blkcipher_decrypt(&amp;desc, &amp;sg, &amp;sg,
1161 */ crypto_blkcipher_blocksize(blkcipher));
1162
1163
1164 printk("Cipher operation completed\n");
1165 return 0;
1166
1167out:
1168 if (blkcipher)
1169 crypto_free_blkcipher(blkcipher);
1170 if (scratchpad)
1171 kzfree(scratchpad);
1172 return ret;
1173}
1174 </programlisting>
1175 </sect1>
1176
1177 <sect1><title>Code Example For Use of Operational State Memory With SHASH</title>
1178 <programlisting>
1179
1180struct sdesc {
1181 struct shash_desc shash;
1182 char ctx[];
1183};
1184
1185static struct sdescinit_sdesc(struct crypto_shash *alg)
1186{
1187 struct sdescsdesc;
1188 int size;
1189
1190 size = sizeof(struct shash_desc) + crypto_shash_descsize(alg);
1191 sdesc = kmalloc(size, GFP_KERNEL);
1192 if (!sdesc)
1193 return ERR_PTR(-ENOMEM);
1194 sdesc-&gt;shash.tfm = alg;
1195 sdesc-&gt;shash.flags = 0x0;
1196 return sdesc;
1197}
1198
1199static int calc_hash(struct crypto_shashalg,
1200 const unsigned chardata, unsigned int datalen,
1201 unsigned chardigest) {
1202 struct sdescsdesc;
1203 int ret;
1204
1205 sdesc = init_sdesc(alg);
1206 if (IS_ERR(sdesc)) {
1207 pr_info("trusted_key: can't alloc %s\n", hash_alg);
1208 return PTR_ERR(sdesc);
1209 }
1210
1211 ret = crypto_shash_digest(&amp;sdesc-&gt;shash, data, datalen, digest);
1212 kfree(sdesc);
1213 return ret;
1214}
1215 </programlisting>
1216 </sect1>
1217
1218 <sect1><title>Code Example For Random Number Generator Usage</title>
1219 <programlisting>
1220
1221static int get_random_numbers(u8 *buf, unsigned int len)
1222{
1223 struct crypto_rngrng = NULL;
1224 chardrbg = "drbg_nopr_sha256"; /* Hash DRBG with SHA-256, no PR */
1225 int ret;
1226
1227 if (!buf || !len) {
1228 pr_debug("No output buffer provided\n");
1229 return -EINVAL;
1230 }
1231
1232 rng = crypto_alloc_rng(drbg, 0, 0);
1233 if (IS_ERR(rng)) {
1234 pr_debug("could not allocate RNG handle for %s\n", drbg);
1235 return -PTR_ERR(rng);
1236 }
1237
1238 ret = crypto_rng_get_bytes(rng, buf, len);
1239 if (ret &lt; 0)
1240 pr_debug("generation of random numbers failed\n");
1241 else if (ret == 0)
1242 pr_debug("RNG returned no data");
1243 else
1244 pr_debug("RNG returned %d bytes of data\n", ret);
1245
1246out:
1247 crypto_free_rng(rng);
1248 return ret;
1249}
1250 </programlisting>
1251 </sect1>
1252 </chapter>
1253 </book>
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 38f7ef3933c4..0d1e70c37a33 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1947,10 +1947,16 @@ void intel_crt_init(struct drm_device *dev)
1947 and then retrieves a list of modes by calling the connector 1947 and then retrieves a list of modes by calling the connector
1948 <methodname>get_modes</methodname> helper operation. 1948 <methodname>get_modes</methodname> helper operation.
1949 </para> 1949 </para>
1950 <para>
1951 If the helper operation returns no mode, and if the connector status
1952 is connector_status_connected, standard VESA DMT modes up to
1953 1024x768 are automatically added to the modes list by a call to
1954 <function>drm_add_modes_noedid</function>.
1955 </para>
1950 <para> 1956 <para>
1951 The function filters out modes larger than 1957 The function then filters out modes larger than
1952 <parameter>max_width</parameter> and <parameter>max_height</parameter> 1958 <parameter>max_width</parameter> and <parameter>max_height</parameter>
1953 if specified. It then calls the optional connector 1959 if specified. It finally calls the optional connector
1954 <methodname>mode_valid</methodname> helper operation for each mode in 1960 <methodname>mode_valid</methodname> helper operation for each mode in
1955 the probed list to check whether the mode is valid for the connector. 1961 the probed list to check whether the mode is valid for the connector.
1956 </para> 1962 </para>
@@ -2090,12 +2096,20 @@ void intel_crt_init(struct drm_device *dev)
2090 <synopsis>int (*get_modes)(struct drm_connector *connector);</synopsis> 2096 <synopsis>int (*get_modes)(struct drm_connector *connector);</synopsis>
2091 <para> 2097 <para>
2092 Fill the connector's <structfield>probed_modes</structfield> list 2098 Fill the connector's <structfield>probed_modes</structfield> list
2093 by parsing EDID data with <function>drm_add_edid_modes</function> or 2099 by parsing EDID data with <function>drm_add_edid_modes</function>,
2094 calling <function>drm_mode_probed_add</function> directly for every 2100 adding standard VESA DMT modes with <function>drm_add_modes_noedid</function>,
2101 or calling <function>drm_mode_probed_add</function> directly for every
2095 supported mode and return the number of modes it has detected. This 2102 supported mode and return the number of modes it has detected. This
2096 operation is mandatory. 2103 operation is mandatory.
2097 </para> 2104 </para>
2098 <para> 2105 <para>
2106 Note that the caller function will automatically add standard VESA
2107 DMT modes up to 1024x768 if the <methodname>get_modes</methodname>
2108 helper operation returns no mode and if the connector status is
2109 connector_status_connected. There is no need to call
2110 <function>drm_add_edid_modes</function> manually in that case.
2111 </para>
2112 <para>
2099 When adding modes manually the driver creates each mode with a call to 2113 When adding modes manually the driver creates each mode with a call to
2100 <function>drm_mode_create</function> and must fill the following fields. 2114 <function>drm_mode_create</function> and must fill the following fields.
2101 <itemizedlist> 2115 <itemizedlist>
@@ -2292,7 +2306,7 @@ void intel_crt_init(struct drm_device *dev)
2292 <function>drm_helper_probe_single_connector_modes</function>. 2306 <function>drm_helper_probe_single_connector_modes</function>.
2293 </para> 2307 </para>
2294 <para> 2308 <para>
2295 When parsing EDID data, <function>drm_add_edid_modes</function> fill the 2309 When parsing EDID data, <function>drm_add_edid_modes</function> fills the
2296 connector <structfield>display_info</structfield> 2310 connector <structfield>display_info</structfield>
2297 <structfield>width_mm</structfield> and 2311 <structfield>width_mm</structfield> and
2298 <structfield>height_mm</structfield> fields. When creating modes 2312 <structfield>height_mm</structfield> fields. When creating modes
@@ -2412,6 +2426,10 @@ void intel_crt_init(struct drm_device *dev)
2412!Edrivers/gpu/drm/drm_plane_helper.c 2426!Edrivers/gpu/drm/drm_plane_helper.c
2413!Pdrivers/gpu/drm/drm_plane_helper.c overview 2427!Pdrivers/gpu/drm/drm_plane_helper.c overview
2414 </sect2> 2428 </sect2>
2429 <sect2>
2430 <title>Tile group</title>
2431!Pdrivers/gpu/drm/drm_crtc.c Tile group
2432 </sect2>
2415 </sect1> 2433 </sect1>
2416 2434
2417 <!-- Internals: kms properties --> 2435 <!-- Internals: kms properties -->
@@ -2546,8 +2564,8 @@ void intel_crt_init(struct drm_device *dev)
2546 <td valign="top" >Description/Restrictions</td> 2564 <td valign="top" >Description/Restrictions</td>
2547 </tr> 2565 </tr>
2548 <tr> 2566 <tr>
2549 <td rowspan="23" valign="top" >DRM</td> 2567 <td rowspan="25" valign="top" >DRM</td>
2550 <td rowspan="3" valign="top" >Generic</td> 2568 <td rowspan="4" valign="top" >Generic</td>
2551 <td valign="top" >“EDID”</td> 2569 <td valign="top" >“EDID”</td>
2552 <td valign="top" >BLOB | IMMUTABLE</td> 2570 <td valign="top" >BLOB | IMMUTABLE</td>
2553 <td valign="top" >0</td> 2571 <td valign="top" >0</td>
@@ -2569,6 +2587,13 @@ void intel_crt_init(struct drm_device *dev)
2569 <td valign="top" >Contains topology path to a connector.</td> 2587 <td valign="top" >Contains topology path to a connector.</td>
2570 </tr> 2588 </tr>
2571 <tr> 2589 <tr>
2590 <td valign="top" >“TILE”</td>
2591 <td valign="top" >BLOB | IMMUTABLE</td>
2592 <td valign="top" >0</td>
2593 <td valign="top" >Connector</td>
2594 <td valign="top" >Contains tiling information for a connector.</td>
2595 </tr>
2596 <tr>
2572 <td rowspan="1" valign="top" >Plane</td> 2597 <td rowspan="1" valign="top" >Plane</td>
2573 <td valign="top" >“type”</td> 2598 <td valign="top" >“type”</td>
2574 <td valign="top" >ENUM | IMMUTABLE</td> 2599 <td valign="top" >ENUM | IMMUTABLE</td>
diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml
index 948ddaab592e..3018564ddfd9 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -120,8 +120,8 @@ struct dtv_properties {
120</para> 120</para>
121<informaltable><tgroup cols="1"><tbody><row><entry 121<informaltable><tgroup cols="1"><tbody><row><entry
122 align="char"> 122 align="char">
123<para>This ioctl call sets one or more frontend properties. This call only 123<para>This ioctl call sets one or more frontend properties. This call
124 requires read-only access to the device.</para> 124 requires read/write access to the device.</para>
125</entry> 125</entry>
126 </row></tbody></tgroup></informaltable> 126 </row></tbody></tgroup></informaltable>
127<para>SYNOPSIS 127<para>SYNOPSIS
diff --git a/Documentation/DocBook/media/v4l/biblio.xml b/Documentation/DocBook/media/v4l/biblio.xml
index d2eb79e41a01..7ff01a23c2fe 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -178,6 +178,75 @@ Signal - NTSC for Studio Applications"</title>
1781125-Line High-Definition Production"</title> 1781125-Line High-Definition Production"</title>
179 </biblioentry> 179 </biblioentry>
180 180
181 <biblioentry id="srgb">
182 <abbrev>sRGB</abbrev>
183 <authorgroup>
184 <corpauthor>International Electrotechnical Commission
185(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
186 </authorgroup>
187 <title>IEC 61966-2-1 ed1.0 "Multimedia systems and equipment - Colour measurement
188and management - Part 2-1: Colour management - Default RGB colour space - sRGB"</title>
189 </biblioentry>
190
191 <biblioentry id="sycc">
192 <abbrev>sYCC</abbrev>
193 <authorgroup>
194 <corpauthor>International Electrotechnical Commission
195(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
196 </authorgroup>
197 <title>IEC 61966-2-1-am1 ed1.0 "Amendment 1 - Multimedia systems and equipment - Colour measurement
198and management - Part 2-1: Colour management - Default RGB colour space - sRGB"</title>
199 </biblioentry>
200
201 <biblioentry id="xvycc">
202 <abbrev>xvYCC</abbrev>
203 <authorgroup>
204 <corpauthor>International Electrotechnical Commission
205(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
206 </authorgroup>
207 <title>IEC 61966-2-4 ed1.0 "Multimedia systems and equipment - Colour measurement
208and management - Part 2-4: Colour management - Extended-gamut YCC colour space for video
209applications - xvYCC"</title>
210 </biblioentry>
211
212 <biblioentry id="adobergb">
213 <abbrev>AdobeRGB</abbrev>
214 <authorgroup>
215 <corpauthor>Adobe Systems Incorporated (<ulink url="http://www.adobe.com">http://www.adobe.com</ulink>)</corpauthor>
216 </authorgroup>
217 <title>Adobe&copy; RGB (1998) Color Image Encoding Version 2005-05</title>
218 </biblioentry>
219
220 <biblioentry id="oprgb">
221 <abbrev>opRGB</abbrev>
222 <authorgroup>
223 <corpauthor>International Electrotechnical Commission
224(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
225 </authorgroup>
226 <title>IEC 61966-2-5 "Multimedia systems and equipment - Colour measurement
227and management - Part 2-5: Colour management - Optional RGB colour space - opRGB"</title>
228 </biblioentry>
229
230 <biblioentry id="itu2020">
231 <abbrev>ITU&nbsp;BT.2020</abbrev>
232 <authorgroup>
233 <corpauthor>International Telecommunication Union (<ulink
234url="http://www.itu.ch">http://www.itu.ch</ulink>)</corpauthor>
235 </authorgroup>
236 <title>ITU-R Recommendation BT.2020 (08/2012) "Parameter values for ultra-high
237definition television systems for production and international programme exchange"
238</title>
239 </biblioentry>
240
241 <biblioentry id="tech3213">
242 <abbrev>EBU&nbsp;Tech&nbsp;3213</abbrev>
243 <authorgroup>
244 <corpauthor>European Broadcast Union (<ulink
245url="http://www.ebu.ch">http://www.ebu.ch</ulink>)</corpauthor>
246 </authorgroup>
247 <title>E.B.U. Standard for Chromaticity Tolerances for Studio Monitors"</title>
248 </biblioentry>
249
181 <biblioentry id="iec62106"> 250 <biblioentry id="iec62106">
182 <abbrev>IEC&nbsp;62106</abbrev> 251 <abbrev>IEC&nbsp;62106</abbrev>
183 <authorgroup> 252 <authorgroup>
@@ -266,4 +335,20 @@ in the frequency range from 87,5 to 108,0 MHz</title>
266 <subtitle>Version 1, Revision 2</subtitle> 335 <subtitle>Version 1, Revision 2</subtitle>
267 </biblioentry> 336 </biblioentry>
268 337
338 <biblioentry id="poynton">
339 <abbrev>poynton</abbrev>
340 <authorgroup>
341 <corpauthor>Charles Poynton</corpauthor>
342 </authorgroup>
343 <title>Digital Video and HDTV, Algorithms and Interfaces</title>
344 </biblioentry>
345
346 <biblioentry id="colimg">
347 <abbrev>colimg</abbrev>
348 <authorgroup>
349 <corpauthor>Erik Reinhard et al.</corpauthor>
350 </authorgroup>
351 <title>Color Imaging: Fundamentals and Applications</title>
352 </biblioentry>
353
269 </bibliography> 354 </bibliography>
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
index 0a2debfa68f6..350dfb3d71ea 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2579,6 +2579,18 @@ fields changed from _s32 to _u32.
2579 </orderedlist> 2579 </orderedlist>
2580 </section> 2580 </section>
2581 2581
2582 <section>
2583 <title>V4L2 in Linux 3.19</title>
2584 <orderedlist>
2585 <listitem>
2586 <para>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding;
2587and &v4l2-quantization; fields to &v4l2-pix-format;, &v4l2-pix-format-mplane;
2588and &v4l2-mbus-framefmt;.
2589 </para>
2590 </listitem>
2591 </orderedlist>
2592 </section>
2593
2582 <section id="other"> 2594 <section id="other">
2583 <title>Relation of V4L2 to other Linux multimedia APIs</title> 2595 <title>Relation of V4L2 to other Linux multimedia APIs</title>
2584 2596
diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml b/Documentation/DocBook/media/v4l/dev-subdev.xml
index d15aaf83f56f..4f0ba58c9bd9 100644
--- a/Documentation/DocBook/media/v4l/dev-subdev.xml
+++ b/Documentation/DocBook/media/v4l/dev-subdev.xml
@@ -195,53 +195,59 @@
195 <title>Sample Pipeline Configuration</title> 195 <title>Sample Pipeline Configuration</title>
196 <tgroup cols="3"> 196 <tgroup cols="3">
197 <colspec colname="what"/> 197 <colspec colname="what"/>
198 <colspec colname="sensor-0" /> 198 <colspec colname="sensor-0 format" />
199 <colspec colname="frontend-0" /> 199 <colspec colname="frontend-0 format" />
200 <colspec colname="frontend-1" /> 200 <colspec colname="frontend-1 format" />
201 <colspec colname="scaler-0" /> 201 <colspec colname="scaler-0 format" />
202 <colspec colname="scaler-1" /> 202 <colspec colname="scaler-0 compose" />
203 <colspec colname="scaler-1 format" />
203 <thead> 204 <thead>
204 <row> 205 <row>
205 <entry></entry> 206 <entry></entry>
206 <entry>Sensor/0</entry> 207 <entry>Sensor/0 format</entry>
207 <entry>Frontend/0</entry> 208 <entry>Frontend/0 format</entry>
208 <entry>Frontend/1</entry> 209 <entry>Frontend/1 format</entry>
209 <entry>Scaler/0</entry> 210 <entry>Scaler/0 format</entry>
210 <entry>Scaler/1</entry> 211 <entry>Scaler/0 compose selection rectangle</entry>
212 <entry>Scaler/1 format</entry>
211 </row> 213 </row>
212 </thead> 214 </thead>
213 <tbody valign="top"> 215 <tbody valign="top">
214 <row> 216 <row>
215 <entry>Initial state</entry> 217 <entry>Initial state</entry>
216 <entry>2048x1536</entry> 218 <entry>2048x1536/SGRBG8_1X8</entry>
217 <entry>-</entry> 219 <entry>(default)</entry>
218 <entry>-</entry> 220 <entry>(default)</entry>
219 <entry>-</entry> 221 <entry>(default)</entry>
220 <entry>-</entry> 222 <entry>(default)</entry>
223 <entry>(default)</entry>
221 </row> 224 </row>
222 <row> 225 <row>
223 <entry>Configure frontend input</entry> 226 <entry>Configure frontend sink format</entry>
224 <entry>2048x1536</entry> 227 <entry>2048x1536/SGRBG8_1X8</entry>
225 <entry><emphasis>2048x1536</emphasis></entry> 228 <entry><emphasis>2048x1536/SGRBG8_1X8</emphasis></entry>
226 <entry><emphasis>2046x1534</emphasis></entry> 229 <entry><emphasis>2046x1534/SGRBG8_1X8</emphasis></entry>
227 <entry>-</entry> 230 <entry>(default)</entry>
228 <entry>-</entry> 231 <entry>(default)</entry>
232 <entry>(default)</entry>
229 </row> 233 </row>
230 <row> 234 <row>
231 <entry>Configure scaler input</entry> 235 <entry>Configure scaler sink format</entry>
232 <entry>2048x1536</entry> 236 <entry>2048x1536/SGRBG8_1X8</entry>
233 <entry>2048x1536</entry> 237 <entry>2048x1536/SGRBG8_1X8</entry>
234 <entry>2046x1534</entry> 238 <entry>2046x1534/SGRBG8_1X8</entry>
235 <entry><emphasis>2046x1534</emphasis></entry> 239 <entry><emphasis>2046x1534/SGRBG8_1X8</emphasis></entry>
236 <entry><emphasis>2046x1534</emphasis></entry> 240 <entry><emphasis>0,0/2046x1534</emphasis></entry>
241 <entry><emphasis>2046x1534/SGRBG8_1X8</emphasis></entry>
237 </row> 242 </row>
238 <row> 243 <row>
239 <entry>Configure scaler output</entry> 244 <entry>Configure scaler sink compose selection</entry>
240 <entry>2048x1536</entry> 245 <entry>2048x1536/SGRBG8_1X8</entry>
241 <entry>2048x1536</entry> 246 <entry>2048x1536/SGRBG8_1X8</entry>
242 <entry>2046x1534</entry> 247 <entry>2046x1534/SGRBG8_1X8</entry>
243 <entry>2046x1534</entry> 248 <entry>2046x1534/SGRBG8_1X8</entry>
244 <entry><emphasis>1280x960</emphasis></entry> 249 <entry><emphasis>0,0/1280x960</emphasis></entry>
250 <entry><emphasis>1280x960/SGRBG8_1X8</emphasis></entry>
245 </row> 251 </row>
246 </tbody> 252 </tbody>
247 </tgroup> 253 </tgroup>
@@ -249,19 +255,30 @@
249 255
250 <para> 256 <para>
251 <orderedlist> 257 <orderedlist>
252 <listitem><para>Initial state. The sensor output is set to its native 3MP 258 <listitem><para>Initial state. The sensor source pad format is
253 resolution. Resolutions on the host frontend and scaler input and output 259 set to its native 3MP size and V4L2_MBUS_FMT_SGRBG8_1X8
254 pads are undefined.</para></listitem> 260 media bus code. Formats on the host frontend and scaler sink
255 <listitem><para>The application configures the frontend input pad resolution to 261 and source pads have the default values, as well as the
256 2048x1536. The driver propagates the format to the frontend output pad. 262 compose rectangle on the scaler's sink pad.</para></listitem>
257 Note that the propagated output format can be different, as in this case, 263
258 than the input format, as the hardware might need to crop pixels (for 264 <listitem><para>The application configures the frontend sink
259 instance when converting a Bayer filter pattern to RGB or YUV).</para></listitem> 265 pad format's size to 2048x1536 and its media bus code to
260 <listitem><para>The application configures the scaler input pad resolution to 266 V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the format to
261 2046x1534 to match the frontend output resolution. The driver propagates 267 the frontend source pad.</para></listitem>
262 the format to the scaler output pad.</para></listitem> 268
263 <listitem><para>The application configures the scaler output pad resolution to 269 <listitem><para>The application configures the scaler sink pad
264 1280x960.</para></listitem> 270 format's size to 2046x1534 and the media bus code to
271 V4L2_MBUS_FMT_SGRBG_1X8 to match the frontend source size and
272 media bus code. The media bus code on the sink pad is set to
273 V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the size to the
274 compose selection rectangle on the scaler's sink pad, and the
275 format to the scaler source pad.</para></listitem>
276
277 <listitem><para>The application configures the size of the compose
278 selection rectangle of the scaler's sink pad 1280x960. The driver
279 propagates the size to the scaler's source pad
280 format.</para></listitem>
281
265 </orderedlist> 282 </orderedlist>
266 </para> 283 </para>
267 284
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml
index e5e8325aa3d7..1c17f802b471 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -1422,7 +1422,10 @@ one of the <constant>V4L2_FIELD_NONE</constant>,
1422<constant>V4L2_FIELD_BOTTOM</constant>, or 1422<constant>V4L2_FIELD_BOTTOM</constant>, or
1423<constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable. 1423<constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable.
1424Drivers choose depending on hardware capabilities or e.&nbsp;g. the 1424Drivers choose depending on hardware capabilities or e.&nbsp;g. the
1425requested image size, and return the actual field order. &v4l2-buffer; 1425requested image size, and return the actual field order. Drivers must
1426never return <constant>V4L2_FIELD_ANY</constant>. If multiple
1427field orders are possible the driver must choose one of the possible
1428field orders during &VIDIOC-S-FMT; or &VIDIOC-TRY-FMT;. &v4l2-buffer;
1426<structfield>field</structfield> can never be 1429<structfield>field</structfield> can never be
1427<constant>V4L2_FIELD_ANY</constant>.</entry> 1430<constant>V4L2_FIELD_ANY</constant>.</entry>
1428 </row> 1431 </row>
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
index df5b23d46552..d5eca4b8f74b 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -138,9 +138,25 @@ applicable values.</para></entry>
138 <row> 138 <row>
139 <entry>__u32</entry> 139 <entry>__u32</entry>
140 <entry><structfield>flags</structfield></entry> 140 <entry><structfield>flags</structfield></entry>
141 <entry>Flags set by the application or driver, see <xref 141 <entry>Flags set by the application or driver, see <xref
142linkend="format-flags" />.</entry> 142linkend="format-flags" />.</entry>
143 </row> 143 </row>
144 <row>
145 <entry>&v4l2-ycbcr-encoding;</entry>
146 <entry><structfield>ycbcr_enc</structfield></entry>
147 <entry>This information supplements the
148<structfield>colorspace</structfield> and must be set by the driver for
149capture streams and by the application for output streams,
150see <xref linkend="colorspaces" />.</entry>
151 </row>
152 <row>
153 <entry>&v4l2-quantization;</entry>
154 <entry><structfield>quantization</structfield></entry>
155 <entry>This information supplements the
156<structfield>colorspace</structfield> and must be set by the driver for
157capture streams and by the application for output streams,
158see <xref linkend="colorspaces" />.</entry>
159 </row>
144 </tbody> 160 </tbody>
145 </tgroup> 161 </tgroup>
146 </table> 162 </table>
@@ -232,9 +248,25 @@ codes can be used.</entry>
232 <entry>Flags set by the application or driver, see <xref 248 <entry>Flags set by the application or driver, see <xref
233linkend="format-flags" />.</entry> 249linkend="format-flags" />.</entry>
234 </row> 250 </row>
251 <row>
252 <entry>&v4l2-ycbcr-encoding;</entry>
253 <entry><structfield>ycbcr_enc</structfield></entry>
254 <entry>This information supplements the
255<structfield>colorspace</structfield> and must be set by the driver for
256capture streams and by the application for output streams,
257see <xref linkend="colorspaces" />.</entry>
258 </row>
259 <row>
260 <entry>&v4l2-quantization;</entry>
261 <entry><structfield>quantization</structfield></entry>
262 <entry>This information supplements the
263<structfield>colorspace</structfield> and must be set by the driver for
264capture streams and by the application for output streams,
265see <xref linkend="colorspaces" />.</entry>
266 </row>
235 <row> 267 <row>
236 <entry>__u8</entry> 268 <entry>__u8</entry>
237 <entry><structfield>reserved[10]</structfield></entry> 269 <entry><structfield>reserved[8]</structfield></entry>
238 <entry>Reserved for future extensions. Should be zeroed by the 270 <entry>Reserved for future extensions. Should be zeroed by the
239 application.</entry> 271 application.</entry>
240 </row> 272 </row>
@@ -296,345 +328,1005 @@ in the 2-planar version or with each component in its own buffer in the
296 <section id="colorspaces"> 328 <section id="colorspaces">
297 <title>Colorspaces</title> 329 <title>Colorspaces</title>
298 330
299 <para>[intro]</para> 331 <para>'Color' is a very complex concept and depends on physics, chemistry and
332biology. Just because you have three numbers that describe the 'red', 'green'
333and 'blue' components of the color of a pixel does not mean that you can accurately
334display that color. A colorspace defines what it actually <emphasis>means</emphasis>
335to have an RGB value of e.g. (255,&nbsp;0,&nbsp;0). That is, which color should be
336reproduced on the screen in a perfectly calibrated environment.</para>
300 337
301 <!-- See proposal by Billy Biggs, video4linux-list@redhat.com 338 <para>In order to do that we first need to have a good definition of
302on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and 339color, i.e. some way to uniquely and unambiguously define a color so that someone
303http://vektor.theorem.ca/graphics/ycbcr/ and 340else can reproduce it. Human color vision is trichromatic since the human eye has
304http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html --> 341color receptors that are sensitive to three different wavelengths of light. Hence
342the need to use three numbers to describe color. Be glad you are not a mantis shrimp
343as those are sensitive to 12 different wavelengths, so instead of RGB we would be
344using the ABCDEFGHIJKL colorspace...</para>
305 345
306 <para> 346 <para>Color exists only in the eye and brain and is the result of how strongly
307 <variablelist> 347color receptors are stimulated. This is based on the Spectral
308 <varlistentry> 348Power Distribution (SPD) which is a graph showing the intensity (radiant power)
309 <term>Gamma Correction</term> 349of the light at wavelengths covering the visible spectrum as it enters the eye.
310 <listitem> 350The science of colorimetry is about the relationship between the SPD and color as
311 <para>[to do]</para> 351perceived by the human brain.</para>
312 <para>E'<subscript>R</subscript> = f(R)</para> 352
313 <para>E'<subscript>G</subscript> = f(G)</para> 353 <para>Since the human eye has only three color receptors it is perfectly
314 <para>E'<subscript>B</subscript> = f(B)</para> 354possible that different SPDs will result in the same stimulation of those receptors
315 </listitem> 355and are perceived as the same color, even though the SPD of the light is
316 </varlistentry> 356different.</para>
317 <varlistentry> 357
318 <term>Construction of luminance and color-difference 358 <para>In the 1920s experiments were devised to determine the relationship
319signals</term> 359between SPDs and the perceived color and that resulted in the CIE 1931 standard
320 <listitem> 360that defines spectral weighting functions that model the perception of color.
321 <para>[to do]</para> 361Specifically that standard defines functions that can take an SPD and calculate
322 <para>E'<subscript>Y</subscript> = 362the stimulus for each color receptor. After some further mathematical transforms
323Coeff<subscript>R</subscript> E'<subscript>R</subscript> 363these stimuli are known as the <emphasis>CIE XYZ tristimulus</emphasis> values
324+ Coeff<subscript>G</subscript> E'<subscript>G</subscript> 364and these X, Y and Z values describe a color as perceived by a human unambiguously.
325+ Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 365These X, Y and Z values are all in the range [0&hellip;1].</para>
326 <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript> 366
327- Coeff<subscript>R</subscript> E'<subscript>R</subscript> 367 <para>The Y value in the CIE XYZ colorspace corresponds to luminance. Often
328- Coeff<subscript>G</subscript> E'<subscript>G</subscript> 368the CIE XYZ colorspace is transformed to the normalized CIE xyY colorspace:</para>
329- Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 369
330 <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript> 370 <para>x = X / (X + Y + Z)</para>
331- Coeff<subscript>R</subscript> E'<subscript>R</subscript> 371 <para>y = Y / (X + Y + Z)</para>
332- Coeff<subscript>G</subscript> E'<subscript>G</subscript> 372
333- Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 373 <para>The x and y values are the chromaticity coordinates and can be used to
334 </listitem> 374define a color without the luminance component Y. It is very confusing to
335 </varlistentry> 375have such similar names for these colorspaces. Just be aware that if colors
336 <varlistentry> 376are specified with lower case 'x' and 'y', then the CIE xyY colorspace is
337 <term>Re-normalized color-difference signals</term> 377used. Upper case 'X' and 'Y' refer to the CIE XYZ colorspace. Also, y has nothing
338 <listitem> 378to do with luminance. Together x and y specify a color, and Y the luminance.
339 <para>The color-difference signals are scaled back to unity 379That is really all you need to remember from a practical point of view. At
340range [-0.5;+0.5]:</para> 380the end of this section you will find reading resources that go into much more
341 <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para> 381detail if you are interested.
342 <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para> 382</para>
343 <para>P<subscript>B</subscript> = 383
344K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = 384 <para>A monitor or TV will reproduce colors by emitting light at three
345 0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript> 385different wavelengths, the combination of which will stimulate the color receptors
346+ 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript> 386in the eye and thus cause the perception of color. Historically these wavelengths
347+ 0.5 E'<subscript>B</subscript></para> 387were defined by the red, green and blue phosphors used in the displays. These
348 <para>P<subscript>R</subscript> = 388<emphasis>color primaries</emphasis> are part of what defines a colorspace.</para>
349K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = 389
350 0.5 E'<subscript>R</subscript> 390 <para>Different display devices will have different primaries and some
351+ 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript> 391primaries are more suitable for some display technologies than others. This has
352+ 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para> 392resulted in a variety of colorspaces that are used for different display
353 </listitem> 393technologies or uses. To define a colorspace you need to define the three
354 </varlistentry> 394color primaries (these are typically defined as x,&nbsp;y chromaticity coordinates
355 <varlistentry> 395from the CIE xyY colorspace) but also the white reference: that is the color obtained
356 <term>Quantization</term> 396when all three primaries are at maximum power. This determines the relative power
357 <listitem> 397or energy of the primaries. This is usually chosen to be close to daylight which has
358 <para>[to do]</para> 398been defined as the CIE D65 Illuminant.</para>
359 <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para> 399
360 <para>C<subscript>B</subscript> = (Chrom. Levels - 1) 400 <para>To recapitulate: the CIE XYZ colorspace uniquely identifies colors.
361&middot; P<subscript>B</subscript> + Chrom. Offset</para> 401Other colorspaces are defined by three chromaticity coordinates defined in the
362 <para>C<subscript>R</subscript> = (Chrom. Levels - 1) 402CIE xyY colorspace. Based on those a 3x3 matrix can be constructed that
363&middot; P<subscript>R</subscript> + Chrom. Offset</para> 403transforms CIE XYZ colors to colors in the new colorspace.
364 <para>Rounding to the nearest integer and clamping to the range 404</para>
365[0;255] finally yields the digital color components Y'CbCr 405
366stored in YUV images.</para> 406 <para>Both the CIE XYZ and the RGB colorspace that are derived from the
367 </listitem> 407specific chromaticity primaries are linear colorspaces. But neither the eye,
368 </varlistentry> 408nor display technology is linear. Doubling the values of all components in
369 </variablelist> 409the linear colorspace will not be perceived as twice the intensity of the color.
370 </para> 410So each colorspace also defines a transfer function that takes a linear color
371 411component value and transforms it to the non-linear component value, which is a
372 <example> 412closer match to the non-linear performance of both the eye and displays. Linear
373 <title>ITU-R Rec. BT.601 color conversion</title> 413component values are denoted RGB, non-linear are denoted as R'G'B'. In general
374 414colors used in graphics are all R'G'B', except in openGL which uses linear RGB.
375 <para>Forward Transformation</para> 415Special care should be taken when dealing with openGL to provide linear RGB colors
376 416or to use the built-in openGL support to apply the inverse transfer function.</para>
377 <programlisting> 417
378int ER, EG, EB; /* gamma corrected RGB input [0;255] */ 418 <para>The final piece that defines a colorspace is a function that
379int Y1, Cb, Cr; /* output [0;255] */ 419transforms non-linear R'G'B' to non-linear Y'CbCr. This function is determined
380 420by the so-called luma coefficients. There may be multiple possible Y'CbCr
381double r, g, b; /* temporaries */ 421encodings allowed for the same colorspace. Many encodings of color
382double y1, pb, pr; 422prefer to use luma (Y') and chroma (CbCr) instead of R'G'B'. Since the human
383 423eye is more sensitive to differences in luminance than in color this encoding
384int 424allows one to reduce the amount of color information compared to the luma
385clamp (double x) 425data. Note that the luma (Y') is unrelated to the Y in the CIE XYZ colorspace.
386{ 426Also note that Y'CbCr is often called YCbCr or YUV even though these are
387 int r = x; /* round to nearest */ 427strictly speaking wrong.</para>
388 428
389 if (r &lt; 0) return 0; 429 <para>Sometimes people confuse Y'CbCr as being a colorspace. This is not
390 else if (r &gt; 255) return 255; 430correct, it is just an encoding of an R'G'B' color into luma and chroma
391 else return r; 431values. The underlying colorspace that is associated with the R'G'B' color
392} 432is also associated with the Y'CbCr color.</para>
393 433
394r = ER / 255.0; 434 <para>The final step is how the RGB, R'G'B' or Y'CbCr values are
395g = EG / 255.0; 435quantized. The CIE XYZ colorspace where X, Y and Z are in the range
396b = EB / 255.0; 436[0&hellip;1] describes all colors that humans can perceive, but the transform to
397 437another colorspace will produce colors that are outside the [0&hellip;1] range.
398y1 = 0.299 * r + 0.587 * g + 0.114 * b; 438Once clamped to the [0&hellip;1] range those colors can no longer be reproduced
399pb = -0.169 * r - 0.331 * g + 0.5 * b; 439in that colorspace. This clamping is what reduces the extent or gamut of the
400pr = 0.5 * r - 0.419 * g - 0.081 * b; 440colorspace. How the range of [0&hellip;1] is translated to integer values in the
401 441range of [0&hellip;255] (or higher, depending on the color depth) is called the
402Y1 = clamp (219 * y1 + 16); 442quantization. This is <emphasis>not</emphasis> part of the colorspace
403Cb = clamp (224 * pb + 128); 443definition. In practice RGB or R'G'B' values are full range, i.e. they
404Cr = clamp (224 * pr + 128); 444use the full [0&hellip;255] range. Y'CbCr values on the other hand are limited
405 445range with Y' using [16&hellip;235] and Cb and Cr using [16&hellip;240].</para>
406/* or shorter */ 446
407 447 <para>Unfortunately, in some cases limited range RGB is also used
408y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB; 448where the components use the range [16&hellip;235]. And full range Y'CbCr also exists
409 449using the [0&hellip;255] range.</para>
410Y1 = clamp ( (219 / 255.0) * y1 + 16); 450
411Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128); 451 <para>In order to correctly interpret a color you need to know the
412Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128); 452quantization range, whether it is R'G'B' or Y'CbCr, the used Y'CbCr encoding
413 </programlisting> 453and the colorspace.
414 454From that information you can calculate the corresponding CIE XYZ color
415 <para>Inverse Transformation</para> 455and map that again to whatever colorspace your display device uses.</para>
416 456
417 <programlisting> 457 <para>The colorspace definition itself consists of the three
418int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */ 458chromaticity primaries, the white reference chromaticity, a transfer
419int ER, EG, EB; /* output [0;255] */ 459function and the luma coefficients needed to transform R'G'B' to Y'CbCr. While
420 460some colorspace standards correctly define all four, quite often the colorspace
421double r, g, b; /* temporaries */ 461standard only defines some, and you have to rely on other standards for
422double y1, pb, pr; 462the missing pieces. The fact that colorspaces are often a mix of different
423 463standards also led to very confusing naming conventions where the name of
424int 464a standard was used to name a colorspace when in fact that standard was
425clamp (double x) 465part of various other colorspaces as well.</para>
426{ 466
427 int r = x; /* round to nearest */ 467 <para>If you want to read more about colors and colorspaces, then the
428 468following resources are useful: <xref linkend="poynton" /> is a good practical
429 if (r &lt; 0) return 0; 469book for video engineers, <xref linkend="colimg" /> has a much broader scope and
430 else if (r &gt; 255) return 255; 470describes many more aspects of color (physics, chemistry, biology, etc.).
431 else return r; 471The <ulink url="http://www.brucelindbloom.com">http://www.brucelindbloom.com</ulink>
432} 472website is an excellent resource, especially with respect to the mathematics behind
433 473colorspace conversions. The wikipedia <ulink url="http://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space">CIE 1931 colorspace</ulink> article
434y1 = (Y1 - 16) / 219.0; 474is also very useful.</para>
435pb = (Cb - 128) / 224.0; 475 </section>
436pr = (Cr - 128) / 224.0; 476
437 477 <section>
438r = 1.0 * y1 + 0 * pb + 1.402 * pr; 478 <title>Defining Colorspaces in V4L2</title>
439g = 1.0 * y1 - 0.344 * pb - 0.714 * pr; 479 <para>In V4L2 colorspaces are defined by three values. The first is the colorspace
440b = 1.0 * y1 + 1.772 * pb + 0 * pr; 480identifier (&v4l2-colorspace;) which defines the chromaticities, the transfer
441 481function, the default Y'CbCr encoding and the default quantization method. The second
442ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */ 482is the Y'CbCr encoding identifier (&v4l2-ycbcr-encoding;) to specify non-standard
443EG = clamp (g * 255); 483Y'CbCr encodings and the third is the quantization identifier (&v4l2-quantization;)
444EB = clamp (b * 255); 484to specify non-standard quantization methods. Most of the time only the colorspace
445 </programlisting> 485field of &v4l2-pix-format; or &v4l2-pix-format-mplane; needs to be filled in. Note
446 </example> 486that the default R'G'B' quantization is always full range for all colorspaces,
447 487so this won't be mentioned explicitly for each colorspace description.</para>
448 <table pgwide="1" id="v4l2-colorspace" orient="land"> 488
449 <title>enum v4l2_colorspace</title> 489 <table pgwide="1" frame="none" id="v4l2-colorspace">
450 <tgroup cols="11" align="center"> 490 <title>V4L2 Colorspaces</title>
451 <colspec align="left" /> 491 <tgroup cols="2" align="left">
452 <colspec align="center" /> 492 &cs-def;
453 <colspec align="left" />
454 <colspec colname="cr" />
455 <colspec colname="cg" />
456 <colspec colname="cb" />
457 <colspec colname="wp" />
458 <colspec colname="gc" />
459 <colspec colname="lum" />
460 <colspec colname="qy" />
461 <colspec colname="qc" />
462 <spanspec namest="cr" nameend="cb" spanname="chrom" />
463 <spanspec namest="qy" nameend="qc" spanname="quant" />
464 <spanspec namest="lum" nameend="qc" spanname="spam" />
465 <thead> 493 <thead>
466 <row> 494 <row>
467 <entry morerows="1">Identifier</entry> 495 <entry>Identifier</entry>
468 <entry morerows="1">Value</entry> 496 <entry>Details</entry>
469 <entry morerows="1">Description</entry>
470 <entry spanname="chrom">Chromaticities<footnote>
471 <para>The coordinates of the color primaries are
472given in the CIE system (1931)</para>
473 </footnote></entry>
474 <entry morerows="1">White Point</entry>
475 <entry morerows="1">Gamma Correction</entry>
476 <entry morerows="1">Luminance E'<subscript>Y</subscript></entry>
477 <entry spanname="quant">Quantization</entry>
478 </row>
479 <row>
480 <entry>Red</entry>
481 <entry>Green</entry>
482 <entry>Blue</entry>
483 <entry>Y'</entry>
484 <entry>Cb, Cr</entry>
485 </row> 497 </row>
486 </thead> 498 </thead>
487 <tbody valign="top"> 499 <tbody valign="top">
488 <row> 500 <row>
489 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry> 501 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry>
490 <entry>1</entry> 502 <entry>See <xref linkend="col-smpte-170m" />.</entry>
491 <entry>NTSC/PAL according to <xref linkend="smpte170m" />,
492<xref linkend="itu601" /></entry>
493 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
494 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
495 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
496 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
497 Illuminant D<subscript>65</subscript></entry>
498 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
4991.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
500 <entry>0.299&nbsp;E'<subscript>R</subscript>
501+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
502+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
503 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
504 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
505 </row> 503 </row>
506 <row> 504 <row>
507 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry> 505 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry>
508 <entry>2</entry> 506 <entry>See <xref linkend="col-rec709" />.</entry>
509 <entry>1125-Line (US) HDTV, see <xref
510linkend="smpte240m" /></entry>
511 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
512 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
513 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
514 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
515 Illuminant D<subscript>65</subscript></entry>
516 <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228,
5171.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry>
518 <entry>0.212&nbsp;E'<subscript>R</subscript>
519+&nbsp;0.701&nbsp;E'<subscript>G</subscript>
520+&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry>
521 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
522 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
523 </row> 507 </row>
524 <row> 508 <row>
525 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry> 509 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry>
526 <entry>3</entry> 510 <entry>See <xref linkend="col-srgb" />.</entry>
527 <entry>HDTV and modern devices, see <xref
528linkend="itu709" /></entry>
529 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
530 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
531 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
532 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
533 Illuminant D<subscript>65</subscript></entry>
534 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
5351.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
536 <entry>0.2125&nbsp;E'<subscript>R</subscript>
537+&nbsp;0.7154&nbsp;E'<subscript>G</subscript>
538+&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry>
539 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
540 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
541 </row> 511 </row>
542 <row> 512 <row>
543 <entry><constant>V4L2_COLORSPACE_BT878</constant></entry> 513 <entry><constant>V4L2_COLORSPACE_ADOBERGB</constant></entry>
544 <entry>4</entry> 514 <entry>See <xref linkend="col-adobergb" />.</entry>
545 <entry>Broken Bt878 extents<footnote> 515 </row>
546 <para>The ubiquitous Bt878 video capture chip 516 <row>
547quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range 517 <entry><constant>V4L2_COLORSPACE_BT2020</constant></entry>
548of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip; 518 <entry>See <xref linkend="col-bt2020" />.</entry>
549235. This is not a typo in the Bt878 documentation, it has been 519 </row>
550implemented in silicon. The chroma extents are unclear.</para> 520 <row>
551 </footnote>, <xref linkend="itu601" /></entry> 521 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
552 <entry>?</entry> 522 <entry>See <xref linkend="col-smpte-240m" />.</entry>
553 <entry>?</entry>
554 <entry>?</entry>
555 <entry>?</entry>
556 <entry>?</entry>
557 <entry>0.299&nbsp;E'<subscript>R</subscript>
558+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
559+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
560 <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
561 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry>
562 </row> 523 </row>
563 <row> 524 <row>
564 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry> 525 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry>
565 <entry>5</entry> 526 <entry>See <xref linkend="col-sysm" />.</entry>
566 <entry>M/NTSC<footnote>
567 <para>No identifier exists for M/PAL which uses
568the chromaticities of M/NTSC, the remaining parameters are equal to B and
569G/PAL.</para>
570 </footnote> according to <xref linkend="itu470" />, <xref
571 linkend="itu601" /></entry>
572 <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry>
573 <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry>
574 <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry>
575 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry>
576 <entry>?</entry>
577 <entry>0.299&nbsp;E'<subscript>R</subscript>
578+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
579+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
580 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
581 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
582 </row> 527 </row>
583 <row> 528 <row>
584 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry> 529 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry>
585 <entry>6</entry> 530 <entry>See <xref linkend="col-sysbg" />.</entry>
586 <entry>625-line PAL and SECAM systems according to <xref
587linkend="itu470" />, <xref linkend="itu601" /></entry>
588 <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry>
589 <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry>
590 <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry>
591 <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329,
592Illuminant D<subscript>65</subscript></entry>
593 <entry>?</entry>
594 <entry>0.299&nbsp;E'<subscript>R</subscript>
595+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
596+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
597 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
598 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
599 </row> 531 </row>
600 <row> 532 <row>
601 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry> 533 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry>
602 <entry>7</entry> 534 <entry>See <xref linkend="col-jpeg" />.</entry>
603 <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry>
604 <entry>?</entry>
605 <entry>?</entry>
606 <entry>?</entry>
607 <entry>?</entry>
608 <entry>?</entry>
609 <entry>0.299&nbsp;E'<subscript>R</subscript>
610+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
611+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
612 <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote>
613 <para>Note JFIF quantizes
614Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and
615[-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals
616are still clamped to [0;255].</para>
617 </footnote></entry>
618 <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
619 </row> 535 </row>
536 </tbody>
537 </tgroup>
538 </table>
539
540 <table pgwide="1" frame="none" id="v4l2-ycbcr-encoding">
541 <title>V4L2 Y'CbCr Encodings</title>
542 <tgroup cols="2" align="left">
543 &cs-def;
544 <thead>
620 <row> 545 <row>
621 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry> 546 <entry>Identifier</entry>
622 <entry>8</entry> 547 <entry>Details</entry>
623 <entry>[?]</entry> 548 </row>
624 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry> 549 </thead>
625 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry> 550 <tbody valign="top">
626 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry> 551 <row>
627 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 552 <entry><constant>V4L2_YCBCR_ENC_DEFAULT</constant></entry>
628 Illuminant D<subscript>65</subscript></entry> 553 <entry>Use the default Y'CbCr encoding as defined by the colorspace.</entry>
629 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018, 554 </row>
6301.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry> 555 <row>
631 <entry spanname="spam">n/a</entry> 556 <entry><constant>V4L2_YCBCR_ENC_601</constant></entry>
557 <entry>Use the BT.601 Y'CbCr encoding.</entry>
558 </row>
559 <row>
560 <entry><constant>V4L2_YCBCR_ENC_709</constant></entry>
561 <entry>Use the Rec. 709 Y'CbCr encoding.</entry>
562 </row>
563 <row>
564 <entry><constant>V4L2_YCBCR_ENC_XV601</constant></entry>
565 <entry>Use the extended gamut xvYCC BT.601 encoding.</entry>
566 </row>
567 <row>
568 <entry><constant>V4L2_YCBCR_ENC_XV709</constant></entry>
569 <entry>Use the extended gamut xvYCC Rec. 709 encoding.</entry>
570 </row>
571 <row>
572 <entry><constant>V4L2_YCBCR_ENC_SYCC</constant></entry>
573 <entry>Use the extended gamut sYCC encoding.</entry>
574 </row>
575 <row>
576 <entry><constant>V4L2_YCBCR_ENC_BT2020</constant></entry>
577 <entry>Use the default non-constant luminance BT.2020 Y'CbCr encoding.</entry>
578 </row>
579 <row>
580 <entry><constant>V4L2_YCBCR_ENC_BT2020_CONST_LUM</constant></entry>
581 <entry>Use the constant luminance BT.2020 Yc'CbcCrc encoding.</entry>
582 </row>
583 </tbody>
584 </tgroup>
585 </table>
586
587 <table pgwide="1" frame="none" id="v4l2-quantization">
588 <title>V4L2 Quantization Methods</title>
589 <tgroup cols="2" align="left">
590 &cs-def;
591 <thead>
592 <row>
593 <entry>Identifier</entry>
594 <entry>Details</entry>
595 </row>
596 </thead>
597 <tbody valign="top">
598 <row>
599 <entry><constant>V4L2_QUANTIZATION_DEFAULT</constant></entry>
600 <entry>Use the default quantization encoding as defined by the colorspace.
601This is always full range for R'G'B' and usually limited range for Y'CbCr.</entry>
602 </row>
603 <row>
604 <entry><constant>V4L2_QUANTIZATION_FULL_RANGE</constant></entry>
605 <entry>Use the full range quantization encoding. I.e. the range [0&hellip;1]
606is mapped to [0&hellip;255] (with possible clipping to [1&hellip;254] to avoid the
6070x00 and 0xff values). Cb and Cr are mapped from [-0.5&hellip;0.5] to [0&hellip;255]
608(with possible clipping to [1&hellip;254] to avoid the 0x00 and 0xff values).</entry>
609 </row>
610 <row>
611 <entry><constant>V4L2_QUANTIZATION_LIM_RANGE</constant></entry>
612 <entry>Use the limited range quantization encoding. I.e. the range [0&hellip;1]
613is mapped to [16&hellip;235]. Cb and Cr are mapped from [-0.5&hellip;0.5] to [16&hellip;240].
614</entry>
632 </row> 615 </row>
633 </tbody> 616 </tbody>
634 </tgroup> 617 </tgroup>
635 </table> 618 </table>
636 </section> 619 </section>
637 620
621 <section>
622 <title>Detailed Colorspace Descriptions</title>
623 <section>
624 <title id="col-smpte-170m">Colorspace SMPTE 170M (<constant>V4L2_COLORSPACE_SMPTE170M</constant>)</title>
625 <para>The <xref linkend="smpte170m" /> standard defines the colorspace used by NTSC and PAL and by SDTV
626in general. The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_601</constant>.
627The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and
628the white reference are:</para>
629 <table frame="none">
630 <title>SMPTE 170M Chromaticities</title>
631 <tgroup cols="3" align="left">
632 &cs-str;
633 <thead>
634 <row>
635 <entry>Color</entry>
636 <entry>x</entry>
637 <entry>y</entry>
638 </row>
639 </thead>
640 <tbody valign="top">
641 <row>
642 <entry>Red</entry>
643 <entry>0.630</entry>
644 <entry>0.340</entry>
645 </row>
646 <row>
647 <entry>Green</entry>
648 <entry>0.310</entry>
649 <entry>0.595</entry>
650 </row>
651 <row>
652 <entry>Blue</entry>
653 <entry>0.155</entry>
654 <entry>0.070</entry>
655 </row>
656 <row>
657 <entry>White Reference (D65)</entry>
658 <entry>0.3127</entry>
659 <entry>0.3290</entry>
660 </row>
661 </tbody>
662 </tgroup>
663 </table>
664 <para>The red, green and blue chromaticities are also often referred to
665as the SMPTE C set, so this colorspace is sometimes called SMPTE C as well.</para>
666 <variablelist>
667 <varlistentry>
668 <term>The transfer function defined for SMPTE 170M is the same as the
669one defined in Rec. 709. Normally L is in the range [0&hellip;1], but for the extended
670gamut xvYCC encoding values outside that range are allowed.</term>
671 <listitem>
672 <para>L' = -1.099(-L)<superscript>0.45</superscript>&nbsp;+&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&le;&nbsp;-0.018</para>
673 <para>L' = 4.5L&nbsp;for&nbsp;-0.018&nbsp;&lt;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
674 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&ge;&nbsp;0.018</para>
675 </listitem>
676 </varlistentry>
677 </variablelist>
678 <variablelist>
679 <varlistentry>
680 <term>Inverse Transfer function:</term>
681 <listitem>
682 <para>L = -((L'&nbsp;-&nbsp;0.099)&nbsp;/&nbsp;-1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&le;&nbsp;-0.081</para>
683 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;-0.081&nbsp;&lt;&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
684 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
685 </listitem>
686 </varlistentry>
687 </variablelist>
688 <variablelist>
689 <varlistentry>
690 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with
691the following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
692 <listitem>
693 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
694 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
695 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
696 </listitem>
697 </varlistentry>
698 </variablelist>
699 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
700clamped to the range [-0.5&hellip;0.5]. This conversion to Y'CbCr is identical to the one
701defined in the <xref linkend="itu601" /> standard and this colorspace is sometimes called BT.601 as well, even
702though BT.601 does not mention any color primaries.</para>
703 <para>The default quantization is limited range, but full range is possible although
704rarely seen.</para>
705 <para>The <constant>V4L2_YCBCR_ENC_601</constant> encoding as described above is the
706default for this colorspace, but it can be overridden with <constant>V4L2_YCBCR_ENC_709</constant>,
707in which case the Rec. 709 Y'CbCr encoding is used.</para>
708 <variablelist>
709 <varlistentry>
710 <term>The xvYCC 601 encoding (<constant>V4L2_YCBCR_ENC_XV601</constant>, <xref linkend="xvycc" />) is similar
711to the BT.601 encoding, but it allows for R', G' and B' values that are outside the range
712[0&hellip;1]. The resulting Y', Cb and Cr values are scaled and offset:</term>
713 <listitem>
714 <para>Y'&nbsp;=&nbsp;(219&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B')&nbsp;+&nbsp;(16&nbsp;/&nbsp;255)</para>
715 <para>Cb&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B')</para>
716 <para>Cr&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B')</para>
717 </listitem>
718 </varlistentry>
719 </variablelist>
720 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
721to the range [-0.5&hellip;0.5]. The non-standard xvYCC 709 encoding can also be used by selecting
722<constant>V4L2_YCBCR_ENC_XV709</constant>. The xvYCC encodings always use full range
723quantization.</para>
724 </section>
725
726 <section>
727 <title id="col-rec709">Colorspace Rec. 709 (<constant>V4L2_COLORSPACE_REC709</constant>)</title>
728 <para>The <xref linkend="itu709" /> standard defines the colorspace used by HDTV in general. The default
729Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_709</constant>. The default Y'CbCr quantization is
730limited range. The chromaticities of the primary colors and the white reference are:</para>
731 <table frame="none">
732 <title>Rec. 709 Chromaticities</title>
733 <tgroup cols="3" align="left">
734 &cs-str;
735 <thead>
736 <row>
737 <entry>Color</entry>
738 <entry>x</entry>
739 <entry>y</entry>
740 </row>
741 </thead>
742 <tbody valign="top">
743 <row>
744 <entry>Red</entry>
745 <entry>0.640</entry>
746 <entry>0.330</entry>
747 </row>
748 <row>
749 <entry>Green</entry>
750 <entry>0.300</entry>
751 <entry>0.600</entry>
752 </row>
753 <row>
754 <entry>Blue</entry>
755 <entry>0.150</entry>
756 <entry>0.060</entry>
757 </row>
758 <row>
759 <entry>White Reference (D65)</entry>
760 <entry>0.3127</entry>
761 <entry>0.3290</entry>
762 </row>
763 </tbody>
764 </tgroup>
765 </table>
766 <para>The full name of this standard is Rec. ITU-R BT.709-5.</para>
767 <variablelist>
768 <varlistentry>
769 <term>Transfer function. Normally L is in the range [0&hellip;1], but for the extended
770gamut xvYCC encoding values outside that range are allowed.</term>
771 <listitem>
772 <para>L' = -1.099(-L)<superscript>0.45</superscript>&nbsp;+&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&le;&nbsp;-0.018</para>
773 <para>L' = 4.5L&nbsp;for&nbsp;-0.018&nbsp;&lt;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
774 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&ge;&nbsp;0.018</para>
775 </listitem>
776 </varlistentry>
777 </variablelist>
778 <variablelist>
779 <varlistentry>
780 <term>Inverse Transfer function:</term>
781 <listitem>
782 <para>L = -((L'&nbsp;-&nbsp;0.099)&nbsp;/&nbsp;-1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&le;&nbsp;-0.081</para>
783 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;-0.081&nbsp;&lt;&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
784 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
785 </listitem>
786 </varlistentry>
787 </variablelist>
788 <variablelist>
789 <varlistentry>
790 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the following
791<constant>V4L2_YCBCR_ENC_709</constant> encoding:</term>
792 <listitem>
793 <para>Y'&nbsp;=&nbsp;0.2126R'&nbsp;+&nbsp;0.7152G'&nbsp;+&nbsp;0.0722B'</para>
794 <para>Cb&nbsp;=&nbsp;-0.1146R'&nbsp;-&nbsp;0.3854G'&nbsp;+&nbsp;0.5B'</para>
795 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4542G'&nbsp;-&nbsp;0.0458B'</para>
796 </listitem>
797 </varlistentry>
798 </variablelist>
799 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
800clamped to the range [-0.5&hellip;0.5].</para>
801 <para>The default quantization is limited range, but full range is possible although
802rarely seen.</para>
803 <para>The <constant>V4L2_YCBCR_ENC_709</constant> encoding described above is the default
804for this colorspace, but it can be overridden with <constant>V4L2_YCBCR_ENC_601</constant>, in which
805case the BT.601 Y'CbCr encoding is used.</para>
806 <variablelist>
807 <varlistentry>
808 <term>The xvYCC 709 encoding (<constant>V4L2_YCBCR_ENC_XV709</constant>, <xref linkend="xvycc" />)
809is similar to the Rec. 709 encoding, but it allows for R', G' and B' values that are outside the range
810[0&hellip;1]. The resulting Y', Cb and Cr values are scaled and offset:</term>
811 <listitem>
812 <para>Y'&nbsp;=&nbsp;(219&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.2126R'&nbsp;+&nbsp;0.7152G'&nbsp;+&nbsp;0.0722B')&nbsp;+&nbsp;(16&nbsp;/&nbsp;255)</para>
813 <para>Cb&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(-0.1146R'&nbsp;-&nbsp;0.3854G'&nbsp;+&nbsp;0.5B')</para>
814 <para>Cr&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.5R'&nbsp;-&nbsp;0.4542G'&nbsp;-&nbsp;0.0458B')</para>
815 </listitem>
816 </varlistentry>
817 </variablelist>
818 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
819to the range [-0.5&hellip;0.5]. The non-standard xvYCC 601 encoding can also be used by
820selecting <constant>V4L2_YCBCR_ENC_XV601</constant>. The xvYCC encodings always use full
821range quantization.</para>
822 </section>
823
824 <section>
825 <title id="col-srgb">Colorspace sRGB (<constant>V4L2_COLORSPACE_SRGB</constant>)</title>
826 <para>The <xref linkend="srgb" /> standard defines the colorspace used by most webcams and computer graphics. The
827default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_SYCC</constant>. The default Y'CbCr quantization
828is full range. The chromaticities of the primary colors and the white reference are:</para>
829 <table frame="none">
830 <title>sRGB Chromaticities</title>
831 <tgroup cols="3" align="left">
832 &cs-str;
833 <thead>
834 <row>
835 <entry>Color</entry>
836 <entry>x</entry>
837 <entry>y</entry>
838 </row>
839 </thead>
840 <tbody valign="top">
841 <row>
842 <entry>Red</entry>
843 <entry>0.640</entry>
844 <entry>0.330</entry>
845 </row>
846 <row>
847 <entry>Green</entry>
848 <entry>0.300</entry>
849 <entry>0.600</entry>
850 </row>
851 <row>
852 <entry>Blue</entry>
853 <entry>0.150</entry>
854 <entry>0.060</entry>
855 </row>
856 <row>
857 <entry>White Reference (D65)</entry>
858 <entry>0.3127</entry>
859 <entry>0.3290</entry>
860 </row>
861 </tbody>
862 </tgroup>
863 </table>
864 <para>These chromaticities are identical to the Rec. 709 colorspace.</para>
865 <variablelist>
866 <varlistentry>
867 <term>Transfer function. Note that negative values for L are only used by the Y'CbCr conversion.</term>
868 <listitem>
869 <para>L' = -1.055(-L)<superscript>1/2.4</superscript>&nbsp;+&nbsp;0.055&nbsp;for&nbsp;L&nbsp;&lt;&nbsp;-0.0031308</para>
870 <para>L' = 12.92L&nbsp;for&nbsp;-0.0031308&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;0.0031308</para>
871 <para>L' = 1.055L<superscript>1/2.4</superscript>&nbsp;-&nbsp;0.055&nbsp;for&nbsp;0.0031308&nbsp;&lt;&nbsp;L&nbsp;&le;&nbsp;1</para>
872 </listitem>
873 </varlistentry>
874 <varlistentry>
875 <term>Inverse Transfer function:</term>
876 <listitem>
877 <para>L = -((-L'&nbsp;+&nbsp;0.055)&nbsp;/&nbsp;1.055)<superscript>2.4</superscript>&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;-0.04045</para>
878 <para>L = L'&nbsp;/&nbsp;12.92&nbsp;for&nbsp;-0.04045&nbsp;&le;&nbsp;L'&nbsp;&le;&nbsp;0.04045</para>
879 <para>L = ((L'&nbsp;+&nbsp;0.055)&nbsp;/&nbsp;1.055)<superscript>2.4</superscript>&nbsp;for&nbsp;L'&nbsp;&gt;&nbsp;0.04045</para>
880 </listitem>
881 </varlistentry>
882 </variablelist>
883 <variablelist>
884 <varlistentry>
885 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the following
886<constant>V4L2_YCBCR_ENC_SYCC</constant> encoding as defined by <xref linkend="sycc" />:</term>
887 <listitem>
888 <para>Y'&nbsp;=&nbsp;0.2990R'&nbsp;+&nbsp;0.5870G'&nbsp;+&nbsp;0.1140B'</para>
889 <para>Cb&nbsp;=&nbsp;-0.1687R'&nbsp;-&nbsp;0.3313G'&nbsp;+&nbsp;0.5B'</para>
890 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4187G'&nbsp;-&nbsp;0.0813B'</para>
891 </listitem>
892 </varlistentry>
893 </variablelist>
894 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
895to the range [-0.5&hellip;0.5]. The <constant>V4L2_YCBCR_ENC_SYCC</constant> quantization is always
896full range. Although this Y'CbCr encoding looks very similar to the <constant>V4L2_YCBCR_ENC_XV601</constant>
897encoding, it is not. The <constant>V4L2_YCBCR_ENC_XV601</constant> scales and offsets the Y'CbCr
898values before quantization, but this encoding does not do that.</para>
899 </section>
900
901 <section>
902 <title id="col-adobergb">Colorspace Adobe RGB (<constant>V4L2_COLORSPACE_ADOBERGB</constant>)</title>
903 <para>The <xref linkend="adobergb" /> standard defines the colorspace used by computer graphics
904that use the AdobeRGB colorspace. This is also known as the <xref linkend="oprgb" /> standard.
905The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr
906quantization is limited range. The chromaticities of the primary colors and the white reference
907are:</para>
908 <table frame="none">
909 <title>Adobe RGB Chromaticities</title>
910 <tgroup cols="3" align="left">
911 &cs-str;
912 <thead>
913 <row>
914 <entry>Color</entry>
915 <entry>x</entry>
916 <entry>y</entry>
917 </row>
918 </thead>
919 <tbody valign="top">
920 <row>
921 <entry>Red</entry>
922 <entry>0.6400</entry>
923 <entry>0.3300</entry>
924 </row>
925 <row>
926 <entry>Green</entry>
927 <entry>0.2100</entry>
928 <entry>0.7100</entry>
929 </row>
930 <row>
931 <entry>Blue</entry>
932 <entry>0.1500</entry>
933 <entry>0.0600</entry>
934 </row>
935 <row>
936 <entry>White Reference (D65)</entry>
937 <entry>0.3127</entry>
938 <entry>0.3290</entry>
939 </row>
940 </tbody>
941 </tgroup>
942 </table>
943 <variablelist>
944 <varlistentry>
945 <term>Transfer function:</term>
946 <listitem>
947 <para>L' = L<superscript>1/2.19921875</superscript></para>
948 </listitem>
949 </varlistentry>
950 <varlistentry>
951 <term>Inverse Transfer function:</term>
952 <listitem>
953 <para>L = L'<superscript>2.19921875</superscript></para>
954 </listitem>
955 </varlistentry>
956 </variablelist>
957 <variablelist>
958 <varlistentry>
959 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
960following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
961 <listitem>
962 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
963 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
964 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
965 </listitem>
966 </varlistentry>
967 </variablelist>
968 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
969clamped to the range [-0.5&hellip;0.5]. This transform is identical to one defined in
970SMPTE 170M/BT.601. The Y'CbCr quantization is limited range.</para>
971 </section>
972
973 <section>
974 <title id="col-bt2020">Colorspace BT.2020 (<constant>V4L2_COLORSPACE_BT2020</constant>)</title>
975 <para>The <xref linkend="itu2020" /> standard defines the colorspace used by Ultra-high definition
976television (UHDTV). The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_BT2020</constant>.
977The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and
978the white reference are:</para>
979 <table frame="none">
980 <title>BT.2020 Chromaticities</title>
981 <tgroup cols="3" align="left">
982 &cs-str;
983 <thead>
984 <row>
985 <entry>Color</entry>
986 <entry>x</entry>
987 <entry>y</entry>
988 </row>
989 </thead>
990 <tbody valign="top">
991 <row>
992 <entry>Red</entry>
993 <entry>0.708</entry>
994 <entry>0.292</entry>
995 </row>
996 <row>
997 <entry>Green</entry>
998 <entry>0.170</entry>
999 <entry>0.797</entry>
1000 </row>
1001 <row>
1002 <entry>Blue</entry>
1003 <entry>0.131</entry>
1004 <entry>0.046</entry>
1005 </row>
1006 <row>
1007 <entry>White Reference (D65)</entry>
1008 <entry>0.3127</entry>
1009 <entry>0.3290</entry>
1010 </row>
1011 </tbody>
1012 </tgroup>
1013 </table>
1014 <variablelist>
1015 <varlistentry>
1016 <term>Transfer function (same as Rec. 709):</term>
1017 <listitem>
1018 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
1019 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1020 </listitem>
1021 </varlistentry>
1022 <varlistentry>
1023 <term>Inverse Transfer function:</term>
1024 <listitem>
1025 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
1026 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
1027 </listitem>
1028 </varlistentry>
1029 </variablelist>
1030 <variablelist>
1031 <varlistentry>
1032 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1033following <constant>V4L2_YCBCR_ENC_BT2020</constant> encoding:</term>
1034 <listitem>
1035 <para>Y'&nbsp;=&nbsp;0.2627R'&nbsp;+&nbsp;0.6789G'&nbsp;+&nbsp;0.0593B'</para>
1036 <para>Cb&nbsp;=&nbsp;-0.1396R'&nbsp;-&nbsp;0.3604G'&nbsp;+&nbsp;0.5B'</para>
1037 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4598G'&nbsp;-&nbsp;0.0402B'</para>
1038 </listitem>
1039 </varlistentry>
1040 </variablelist>
1041 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1042clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.</para>
1043 <para>There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
1044(<constant>V4L2_YCBCR_ENC_BT2020_CONST_LUM</constant>) encoding:</para>
1045 <variablelist>
1046 <varlistentry>
1047 <term>Luma:</term>
1048 <listitem>
1049 <para>Yc'&nbsp;=&nbsp;(0.2627R&nbsp;+&nbsp;0.6789G&nbsp;+&nbsp;0.0593B)'</para>
1050 </listitem>
1051 </varlistentry>
1052 </variablelist>
1053 <variablelist>
1054 <varlistentry>
1055 <term>B'&nbsp;-&nbsp;Yc'&nbsp;&le;&nbsp;0:</term>
1056 <listitem>
1057 <para>Cbc&nbsp;=&nbsp;(B'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.9404</para>
1058 </listitem>
1059 </varlistentry>
1060 </variablelist>
1061 <variablelist>
1062 <varlistentry>
1063 <term>B'&nbsp;-&nbsp;Yc'&nbsp;&gt;&nbsp;0:</term>
1064 <listitem>
1065 <para>Cbc&nbsp;=&nbsp;(B'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.5816</para>
1066 </listitem>
1067 </varlistentry>
1068 </variablelist>
1069 <variablelist>
1070 <varlistentry>
1071 <term>R'&nbsp;-&nbsp;Yc'&nbsp;&le;&nbsp;0:</term>
1072 <listitem>
1073 <para>Crc&nbsp;=&nbsp;(R'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.7184</para>
1074 </listitem>
1075 </varlistentry>
1076 </variablelist>
1077 <variablelist>
1078 <varlistentry>
1079 <term>R'&nbsp;-&nbsp;Yc'&nbsp;&gt;&nbsp;0:</term>
1080 <listitem>
1081 <para>Crc&nbsp;=&nbsp;(R'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;0.9936</para>
1082 </listitem>
1083 </varlistentry>
1084 </variablelist>
1085 <para>Yc' is clamped to the range [0&hellip;1] and Cbc and Crc are
1086clamped to the range [-0.5&hellip;0.5]. The Yc'CbcCrc quantization is limited range.</para>
1087 </section>
1088
1089 <section>
1090 <title id="col-smpte-240m">Colorspace SMPTE 240M (<constant>V4L2_COLORSPACE_SMPTE240M</constant>)</title>
1091 <para>The <xref linkend="smpte240m" /> standard was an interim standard used during the early days of HDTV (1988-1998).
1092It has been superseded by Rec. 709. The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_SMPTE240M</constant>.
1093The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and the
1094white reference are:</para>
1095 <table frame="none">
1096 <title>SMPTE 240M Chromaticities</title>
1097 <tgroup cols="3" align="left">
1098 &cs-str;
1099 <thead>
1100 <row>
1101 <entry>Color</entry>
1102 <entry>x</entry>
1103 <entry>y</entry>
1104 </row>
1105 </thead>
1106 <tbody valign="top">
1107 <row>
1108 <entry>Red</entry>
1109 <entry>0.630</entry>
1110 <entry>0.340</entry>
1111 </row>
1112 <row>
1113 <entry>Green</entry>
1114 <entry>0.310</entry>
1115 <entry>0.595</entry>
1116 </row>
1117 <row>
1118 <entry>Blue</entry>
1119 <entry>0.155</entry>
1120 <entry>0.070</entry>
1121 </row>
1122 <row>
1123 <entry>White Reference (D65)</entry>
1124 <entry>0.3127</entry>
1125 <entry>0.3290</entry>
1126 </row>
1127 </tbody>
1128 </tgroup>
1129 </table>
1130 <para>These chromaticities are identical to the SMPTE 170M colorspace.</para>
1131 <variablelist>
1132 <varlistentry>
1133 <term>Transfer function:</term>
1134 <listitem>
1135 <para>L' = 4L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.0228</para>
1136 <para>L' = 1.1115L<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1137 </listitem>
1138 </varlistentry>
1139 <varlistentry>
1140 <term>Inverse Transfer function:</term>
1141 <listitem>
1142 <para>L = L'&nbsp;/&nbsp;4&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L'&nbsp;&lt;&nbsp;0.0913</para>
1143 <para>L = ((L'&nbsp;+&nbsp;0.1115)&nbsp;/&nbsp;1.1115)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.0913</para>
1144 </listitem>
1145 </varlistentry>
1146 </variablelist>
1147 <variablelist>
1148 <varlistentry>
1149 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1150following <constant>V4L2_YCBCR_ENC_SMPTE240M</constant> encoding:</term>
1151 <listitem>
1152 <para>Y'&nbsp;=&nbsp;0.2122R'&nbsp;+&nbsp;0.7013G'&nbsp;+&nbsp;0.0865B'</para>
1153 <para>Cb&nbsp;=&nbsp;-0.1161R'&nbsp;-&nbsp;0.3839G'&nbsp;+&nbsp;0.5B'</para>
1154 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4451G'&nbsp;-&nbsp;0.0549B'</para>
1155 </listitem>
1156 </varlistentry>
1157 </variablelist>
1158 <para>Yc' is clamped to the range [0&hellip;1] and Cbc and Crc are
1159clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.</para>
1160 </section>
1161
1162 <section>
1163 <title id="col-sysm">Colorspace NTSC 1953 (<constant>V4L2_COLORSPACE_470_SYSTEM_M</constant>)</title>
1164 <para>This standard defines the colorspace used by NTSC in 1953. In practice this
1165colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
1166is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr quantization is limited range.
1167The chromaticities of the primary colors and the white reference are:</para>
1168 <table frame="none">
1169 <title>NTSC 1953 Chromaticities</title>
1170 <tgroup cols="3" align="left">
1171 &cs-str;
1172 <thead>
1173 <row>
1174 <entry>Color</entry>
1175 <entry>x</entry>
1176 <entry>y</entry>
1177 </row>
1178 </thead>
1179 <tbody valign="top">
1180 <row>
1181 <entry>Red</entry>
1182 <entry>0.67</entry>
1183 <entry>0.33</entry>
1184 </row>
1185 <row>
1186 <entry>Green</entry>
1187 <entry>0.21</entry>
1188 <entry>0.71</entry>
1189 </row>
1190 <row>
1191 <entry>Blue</entry>
1192 <entry>0.14</entry>
1193 <entry>0.08</entry>
1194 </row>
1195 <row>
1196 <entry>White Reference (C)</entry>
1197 <entry>0.310</entry>
1198 <entry>0.316</entry>
1199 </row>
1200 </tbody>
1201 </tgroup>
1202 </table>
1203 <para>Note that this colorspace uses Illuminant C instead of D65 as the
1204white reference. To correctly convert an image in this colorspace to another
1205that uses D65 you need to apply a chromatic adaptation algorithm such as the
1206Bradford method.</para>
1207 <variablelist>
1208 <varlistentry>
1209 <term>The transfer function was never properly defined for NTSC 1953. The
1210Rec. 709 transfer function is recommended in the literature:</term>
1211 <listitem>
1212 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
1213 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1214 </listitem>
1215 </varlistentry>
1216 <varlistentry>
1217 <term>Inverse Transfer function:</term>
1218 <listitem>
1219 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
1220 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
1221 </listitem>
1222 </varlistentry>
1223 </variablelist>
1224 <variablelist>
1225 <varlistentry>
1226 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1227following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
1228 <listitem>
1229 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
1230 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
1231 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
1232 </listitem>
1233 </varlistentry>
1234 </variablelist>
1235 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1236clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.
1237This transform is identical to one defined in SMPTE 170M/BT.601.</para>
1238 </section>
1239
1240 <section>
1241 <title id="col-sysbg">Colorspace EBU Tech. 3213 (<constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant>)</title>
1242 <para>The <xref linkend="tech3213" /> standard defines the colorspace used by PAL/SECAM in 1975. In practice this
1243colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
1244is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr quantization is limited range.
1245The chromaticities of the primary colors and the white reference are:</para>
1246 <table frame="none">
1247 <title>EBU Tech. 3213 Chromaticities</title>
1248 <tgroup cols="3" align="left">
1249 &cs-str;
1250 <thead>
1251 <row>
1252 <entry>Color</entry>
1253 <entry>x</entry>
1254 <entry>y</entry>
1255 </row>
1256 </thead>
1257 <tbody valign="top">
1258 <row>
1259 <entry>Red</entry>
1260 <entry>0.64</entry>
1261 <entry>0.33</entry>
1262 </row>
1263 <row>
1264 <entry>Green</entry>
1265 <entry>0.29</entry>
1266 <entry>0.60</entry>
1267 </row>
1268 <row>
1269 <entry>Blue</entry>
1270 <entry>0.15</entry>
1271 <entry>0.06</entry>
1272 </row>
1273 <row>
1274 <entry>White Reference (D65)</entry>
1275 <entry>0.3127</entry>
1276 <entry>0.3290</entry>
1277 </row>
1278 </tbody>
1279 </tgroup>
1280 </table>
1281 <variablelist>
1282 <varlistentry>
1283 <term>The transfer function was never properly defined for this colorspace.
1284The Rec. 709 transfer function is recommended in the literature:</term>
1285 <listitem>
1286 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
1287 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1288 </listitem>
1289 </varlistentry>
1290 <varlistentry>
1291 <term>Inverse Transfer function:</term>
1292 <listitem>
1293 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
1294 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
1295 </listitem>
1296 </varlistentry>
1297 </variablelist>
1298 <variablelist>
1299 <varlistentry>
1300 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1301following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
1302 <listitem>
1303 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
1304 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
1305 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
1306 </listitem>
1307 </varlistentry>
1308 </variablelist>
1309 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1310clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.
1311This transform is identical to one defined in SMPTE 170M/BT.601.</para>
1312 </section>
1313
1314 <section>
1315 <title id="col-jpeg">Colorspace JPEG (<constant>V4L2_COLORSPACE_JPEG</constant>)</title>
1316 <para>This colorspace defines the colorspace used by most (Motion-)JPEG formats. The chromaticities
1317of the primary colors and the white reference are identical to sRGB. The Y'CbCr encoding is
1318<constant>V4L2_YCBCR_ENC_601</constant> with full range quantization where
1319Y' is scaled to [0&hellip;255] and Cb/Cr are scaled to [-128&hellip;128] and
1320then clipped to [-128&hellip;127].</para>
1321 <para>Note that the JPEG standard does not actually store colorspace information.
1322So if something other than sRGB is used, then the driver will have to set that information
1323explicitly. Effectively <constant>V4L2_COLORSPACE_JPEG</constant> can be considered to be
1324an abbreviation for <constant>V4L2_COLORSPACE_SRGB</constant>, <constant>V4L2_YCBCR_ENC_601</constant>
1325and <constant>V4L2_QUANTIZATION_FULL_RANGE</constant>.</para>
1326 </section>
1327
1328 </section>
1329
638 <section id="pixfmt-indexed"> 1330 <section id="pixfmt-indexed">
639 <title>Indexed Format</title> 1331 <title>Indexed Format</title>
640 1332
diff --git a/Documentation/DocBook/media/v4l/selections-common.xml b/Documentation/DocBook/media/v4l/selections-common.xml
index 7502f784b8cc..d6d56fb6f9c0 100644
--- a/Documentation/DocBook/media/v4l/selections-common.xml
+++ b/Documentation/DocBook/media/v4l/selections-common.xml
@@ -63,6 +63,22 @@
63 <entry>Yes</entry> 63 <entry>Yes</entry>
64 </row> 64 </row>
65 <row> 65 <row>
66 <entry><constant>V4L2_SEL_TGT_NATIVE_SIZE</constant></entry>
67 <entry>0x0003</entry>
68 <entry>The native size of the device, e.g. a sensor's
69 pixel array. <structfield>left</structfield> and
70 <structfield>top</structfield> fields are zero for this
71 target. Setting the native size will generally only make
72 sense for memory to memory devices where the software can
73 create a canvas of a given size in which for example a
74 video frame can be composed. In that case
75 V4L2_SEL_TGT_NATIVE_SIZE can be used to configure the size
76 of that canvas.
77 </entry>
78 <entry>Yes</entry>
79 <entry>Yes</entry>
80 </row>
81 <row>
66 <entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry> 82 <entry><constant>V4L2_SEL_TGT_COMPOSE</constant></entry>
67 <entry>0x0100</entry> 83 <entry>0x0100</entry>
68 <entry>Compose rectangle. Used to configure scaling 84 <entry>Compose rectangle. Used to configure scaling
diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml
index b2d5a0363cba..c5ea868e3909 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -34,8 +34,24 @@
34 <xref linkend="colorspaces" /> for details.</entry> 34 <xref linkend="colorspaces" /> for details.</entry>
35 </row> 35 </row>
36 <row> 36 <row>
37 <entry>&v4l2-ycbcr-encoding;</entry>
38 <entry><structfield>ycbcr_enc</structfield></entry>
39 <entry>This information supplements the
40<structfield>colorspace</structfield> and must be set by the driver for
41capture streams and by the application for output streams,
42see <xref linkend="colorspaces" />.</entry>
43 </row>
44 <row>
45 <entry>&v4l2-quantization;</entry>
46 <entry><structfield>quantization</structfield></entry>
47 <entry>This information supplements the
48<structfield>colorspace</structfield> and must be set by the driver for
49capture streams and by the application for output streams,
50see <xref linkend="colorspaces" />.</entry>
51 </row>
52 <row>
37 <entry>__u32</entry> 53 <entry>__u32</entry>
38 <entry><structfield>reserved</structfield>[7]</entry> 54 <entry><structfield>reserved</structfield>[6]</entry>
39 <entry>Reserved for future extensions. Applications and drivers must 55 <entry>Reserved for future extensions. Applications and drivers must
40 set the array to zero.</entry> 56 set the array to zero.</entry>
41 </row> 57 </row>
@@ -86,7 +102,7 @@
86 green and 5-bit blue values padded on the high bit, transferred as 2 8-bit 102 green and 5-bit blue values padded on the high bit, transferred as 2 8-bit
87 samples per pixel with the most significant bits (padding, red and half of 103 samples per pixel with the most significant bits (padding, red and half of
88 the green value) transferred first will be named 104 the green value) transferred first will be named
89 <constant>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</constant>. 105 <constant>MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE</constant>.
90 </para> 106 </para>
91 107
92 <para>The following tables list existing packed RGB formats.</para> 108 <para>The following tables list existing packed RGB formats.</para>
@@ -176,8 +192,8 @@
176 </row> 192 </row>
177 </thead> 193 </thead>
178 <tbody valign="top"> 194 <tbody valign="top">
179 <row id="V4L2-MBUS-FMT-RGB444-2X8-PADHI-BE"> 195 <row id="MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE">
180 <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE</entry> 196 <entry>MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE</entry>
181 <entry>0x1001</entry> 197 <entry>0x1001</entry>
182 <entry></entry> 198 <entry></entry>
183 &dash-ent-24; 199 &dash-ent-24;
@@ -204,8 +220,8 @@
204 <entry>b<subscript>1</subscript></entry> 220 <entry>b<subscript>1</subscript></entry>
205 <entry>b<subscript>0</subscript></entry> 221 <entry>b<subscript>0</subscript></entry>
206 </row> 222 </row>
207 <row id="V4L2-MBUS-FMT-RGB444-2X8-PADHI-LE"> 223 <row id="MEDIA-BUS-FMT-RGB444-2X8-PADHI-LE">
208 <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE</entry> 224 <entry>MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE</entry>
209 <entry>0x1002</entry> 225 <entry>0x1002</entry>
210 <entry></entry> 226 <entry></entry>
211 &dash-ent-24; 227 &dash-ent-24;
@@ -232,8 +248,8 @@
232 <entry>r<subscript>1</subscript></entry> 248 <entry>r<subscript>1</subscript></entry>
233 <entry>r<subscript>0</subscript></entry> 249 <entry>r<subscript>0</subscript></entry>
234 </row> 250 </row>
235 <row id="V4L2-MBUS-FMT-RGB555-2X8-PADHI-BE"> 251 <row id="MEDIA-BUS-FMT-RGB555-2X8-PADHI-BE">
236 <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</entry> 252 <entry>MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE</entry>
237 <entry>0x1003</entry> 253 <entry>0x1003</entry>
238 <entry></entry> 254 <entry></entry>
239 &dash-ent-24; 255 &dash-ent-24;
@@ -260,8 +276,8 @@
260 <entry>b<subscript>1</subscript></entry> 276 <entry>b<subscript>1</subscript></entry>
261 <entry>b<subscript>0</subscript></entry> 277 <entry>b<subscript>0</subscript></entry>
262 </row> 278 </row>
263 <row id="V4L2-MBUS-FMT-RGB555-2X8-PADHI-LE"> 279 <row id="MEDIA-BUS-FMT-RGB555-2X8-PADHI-LE">
264 <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE</entry> 280 <entry>MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE</entry>
265 <entry>0x1004</entry> 281 <entry>0x1004</entry>
266 <entry></entry> 282 <entry></entry>
267 &dash-ent-24; 283 &dash-ent-24;
@@ -288,8 +304,8 @@
288 <entry>g<subscript>4</subscript></entry> 304 <entry>g<subscript>4</subscript></entry>
289 <entry>g<subscript>3</subscript></entry> 305 <entry>g<subscript>3</subscript></entry>
290 </row> 306 </row>
291 <row id="V4L2-MBUS-FMT-BGR565-2X8-BE"> 307 <row id="MEDIA-BUS-FMT-BGR565-2X8-BE">
292 <entry>V4L2_MBUS_FMT_BGR565_2X8_BE</entry> 308 <entry>MEDIA_BUS_FMT_BGR565_2X8_BE</entry>
293 <entry>0x1005</entry> 309 <entry>0x1005</entry>
294 <entry></entry> 310 <entry></entry>
295 &dash-ent-24; 311 &dash-ent-24;
@@ -316,8 +332,8 @@
316 <entry>r<subscript>1</subscript></entry> 332 <entry>r<subscript>1</subscript></entry>
317 <entry>r<subscript>0</subscript></entry> 333 <entry>r<subscript>0</subscript></entry>
318 </row> 334 </row>
319 <row id="V4L2-MBUS-FMT-BGR565-2X8-LE"> 335 <row id="MEDIA-BUS-FMT-BGR565-2X8-LE">
320 <entry>V4L2_MBUS_FMT_BGR565_2X8_LE</entry> 336 <entry>MEDIA_BUS_FMT_BGR565_2X8_LE</entry>
321 <entry>0x1006</entry> 337 <entry>0x1006</entry>
322 <entry></entry> 338 <entry></entry>
323 &dash-ent-24; 339 &dash-ent-24;
@@ -344,8 +360,8 @@
344 <entry>g<subscript>4</subscript></entry> 360 <entry>g<subscript>4</subscript></entry>
345 <entry>g<subscript>3</subscript></entry> 361 <entry>g<subscript>3</subscript></entry>
346 </row> 362 </row>
347 <row id="V4L2-MBUS-FMT-RGB565-2X8-BE"> 363 <row id="MEDIA-BUS-FMT-RGB565-2X8-BE">
348 <entry>V4L2_MBUS_FMT_RGB565_2X8_BE</entry> 364 <entry>MEDIA_BUS_FMT_RGB565_2X8_BE</entry>
349 <entry>0x1007</entry> 365 <entry>0x1007</entry>
350 <entry></entry> 366 <entry></entry>
351 &dash-ent-24; 367 &dash-ent-24;
@@ -372,8 +388,8 @@
372 <entry>b<subscript>1</subscript></entry> 388 <entry>b<subscript>1</subscript></entry>
373 <entry>b<subscript>0</subscript></entry> 389 <entry>b<subscript>0</subscript></entry>
374 </row> 390 </row>
375 <row id="V4L2-MBUS-FMT-RGB565-2X8-LE"> 391 <row id="MEDIA-BUS-FMT-RGB565-2X8-LE">
376 <entry>V4L2_MBUS_FMT_RGB565_2X8_LE</entry> 392 <entry>MEDIA_BUS_FMT_RGB565_2X8_LE</entry>
377 <entry>0x1008</entry> 393 <entry>0x1008</entry>
378 <entry></entry> 394 <entry></entry>
379 &dash-ent-24; 395 &dash-ent-24;
@@ -400,8 +416,8 @@
400 <entry>g<subscript>4</subscript></entry> 416 <entry>g<subscript>4</subscript></entry>
401 <entry>g<subscript>3</subscript></entry> 417 <entry>g<subscript>3</subscript></entry>
402 </row> 418 </row>
403 <row id="V4L2-MBUS-FMT-RGB666-1X18"> 419 <row id="MEDIA-BUS-FMT-RGB666-1X18">
404 <entry>V4L2_MBUS_FMT_RGB666_1X18</entry> 420 <entry>MEDIA_BUS_FMT_RGB666_1X18</entry>
405 <entry>0x1009</entry> 421 <entry>0x1009</entry>
406 <entry></entry> 422 <entry></entry>
407 &dash-ent-14; 423 &dash-ent-14;
@@ -424,8 +440,8 @@
424 <entry>b<subscript>1</subscript></entry> 440 <entry>b<subscript>1</subscript></entry>
425 <entry>b<subscript>0</subscript></entry> 441 <entry>b<subscript>0</subscript></entry>
426 </row> 442 </row>
427 <row id="V4L2-MBUS-FMT-RGB888-1X24"> 443 <row id="MEDIA-BUS-FMT-RGB888-1X24">
428 <entry>V4L2_MBUS_FMT_RGB888_1X24</entry> 444 <entry>MEDIA_BUS_FMT_RGB888_1X24</entry>
429 <entry>0x100a</entry> 445 <entry>0x100a</entry>
430 <entry></entry> 446 <entry></entry>
431 &dash-ent-8; 447 &dash-ent-8;
@@ -454,8 +470,8 @@
454 <entry>b<subscript>1</subscript></entry> 470 <entry>b<subscript>1</subscript></entry>
455 <entry>b<subscript>0</subscript></entry> 471 <entry>b<subscript>0</subscript></entry>
456 </row> 472 </row>
457 <row id="V4L2-MBUS-FMT-RGB888-2X12-BE"> 473 <row id="MEDIA-BUS-FMT-RGB888-2X12-BE">
458 <entry>V4L2_MBUS_FMT_RGB888_2X12_BE</entry> 474 <entry>MEDIA_BUS_FMT_RGB888_2X12_BE</entry>
459 <entry>0x100b</entry> 475 <entry>0x100b</entry>
460 <entry></entry> 476 <entry></entry>
461 &dash-ent-20; 477 &dash-ent-20;
@@ -490,8 +506,8 @@
490 <entry>b<subscript>1</subscript></entry> 506 <entry>b<subscript>1</subscript></entry>
491 <entry>b<subscript>0</subscript></entry> 507 <entry>b<subscript>0</subscript></entry>
492 </row> 508 </row>
493 <row id="V4L2-MBUS-FMT-RGB888-2X12-LE"> 509 <row id="MEDIA-BUS-FMT-RGB888-2X12-LE">
494 <entry>V4L2_MBUS_FMT_RGB888_2X12_LE</entry> 510 <entry>MEDIA_BUS_FMT_RGB888_2X12_LE</entry>
495 <entry>0x100c</entry> 511 <entry>0x100c</entry>
496 <entry></entry> 512 <entry></entry>
497 &dash-ent-20; 513 &dash-ent-20;
@@ -526,8 +542,8 @@
526 <entry>g<subscript>5</subscript></entry> 542 <entry>g<subscript>5</subscript></entry>
527 <entry>g<subscript>4</subscript></entry> 543 <entry>g<subscript>4</subscript></entry>
528 </row> 544 </row>
529 <row id="V4L2-MBUS-FMT-ARGB888-1X32"> 545 <row id="MEDIA-BUS-FMT-ARGB888-1X32">
530 <entry>V4L2_MBUS_FMT_ARGB888_1X32</entry> 546 <entry>MEDIA_BUS_FMT_ARGB888_1X32</entry>
531 <entry>0x100d</entry> 547 <entry>0x100d</entry>
532 <entry></entry> 548 <entry></entry>
533 <entry>a<subscript>7</subscript></entry> 549 <entry>a<subscript>7</subscript></entry>
@@ -600,7 +616,7 @@
600 <para>For instance, a format with uncompressed 10-bit Bayer components 616 <para>For instance, a format with uncompressed 10-bit Bayer components
601 arranged in a red, green, green, blue pattern transferred as 2 8-bit 617 arranged in a red, green, green, blue pattern transferred as 2 8-bit
602 samples per pixel with the least significant bits transferred first will 618 samples per pixel with the least significant bits transferred first will
603 be named <constant>V4L2_MBUS_FMT_SRGGB10_2X8_PADHI_LE</constant>. 619 be named <constant>MEDIA_BUS_FMT_SRGGB10_2X8_PADHI_LE</constant>.
604 </para> 620 </para>
605 621
606 <figure id="bayer-patterns"> 622 <figure id="bayer-patterns">
@@ -663,8 +679,8 @@
663 </row> 679 </row>
664 </thead> 680 </thead>
665 <tbody valign="top"> 681 <tbody valign="top">
666 <row id="V4L2-MBUS-FMT-SBGGR8-1X8"> 682 <row id="MEDIA-BUS-FMT-SBGGR8-1X8">
667 <entry>V4L2_MBUS_FMT_SBGGR8_1X8</entry> 683 <entry>MEDIA_BUS_FMT_SBGGR8_1X8</entry>
668 <entry>0x3001</entry> 684 <entry>0x3001</entry>
669 <entry></entry> 685 <entry></entry>
670 <entry>-</entry> 686 <entry>-</entry>
@@ -680,8 +696,8 @@
680 <entry>b<subscript>1</subscript></entry> 696 <entry>b<subscript>1</subscript></entry>
681 <entry>b<subscript>0</subscript></entry> 697 <entry>b<subscript>0</subscript></entry>
682 </row> 698 </row>
683 <row id="V4L2-MBUS-FMT-SGBRG8-1X8"> 699 <row id="MEDIA-BUS-FMT-SGBRG8-1X8">
684 <entry>V4L2_MBUS_FMT_SGBRG8_1X8</entry> 700 <entry>MEDIA_BUS_FMT_SGBRG8_1X8</entry>
685 <entry>0x3013</entry> 701 <entry>0x3013</entry>
686 <entry></entry> 702 <entry></entry>
687 <entry>-</entry> 703 <entry>-</entry>
@@ -697,8 +713,8 @@
697 <entry>g<subscript>1</subscript></entry> 713 <entry>g<subscript>1</subscript></entry>
698 <entry>g<subscript>0</subscript></entry> 714 <entry>g<subscript>0</subscript></entry>
699 </row> 715 </row>
700 <row id="V4L2-MBUS-FMT-SGRBG8-1X8"> 716 <row id="MEDIA-BUS-FMT-SGRBG8-1X8">
701 <entry>V4L2_MBUS_FMT_SGRBG8_1X8</entry> 717 <entry>MEDIA_BUS_FMT_SGRBG8_1X8</entry>
702 <entry>0x3002</entry> 718 <entry>0x3002</entry>
703 <entry></entry> 719 <entry></entry>
704 <entry>-</entry> 720 <entry>-</entry>
@@ -714,8 +730,8 @@
714 <entry>g<subscript>1</subscript></entry> 730 <entry>g<subscript>1</subscript></entry>
715 <entry>g<subscript>0</subscript></entry> 731 <entry>g<subscript>0</subscript></entry>
716 </row> 732 </row>
717 <row id="V4L2-MBUS-FMT-SRGGB8-1X8"> 733 <row id="MEDIA-BUS-FMT-SRGGB8-1X8">
718 <entry>V4L2_MBUS_FMT_SRGGB8_1X8</entry> 734 <entry>MEDIA_BUS_FMT_SRGGB8_1X8</entry>
719 <entry>0x3014</entry> 735 <entry>0x3014</entry>
720 <entry></entry> 736 <entry></entry>
721 <entry>-</entry> 737 <entry>-</entry>
@@ -731,8 +747,8 @@
731 <entry>r<subscript>1</subscript></entry> 747 <entry>r<subscript>1</subscript></entry>
732 <entry>r<subscript>0</subscript></entry> 748 <entry>r<subscript>0</subscript></entry>
733 </row> 749 </row>
734 <row id="V4L2-MBUS-FMT-SBGGR10-ALAW8-1X8"> 750 <row id="MEDIA-BUS-FMT-SBGGR10-ALAW8-1X8">
735 <entry>V4L2_MBUS_FMT_SBGGR10_ALAW8_1X8</entry> 751 <entry>MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8</entry>
736 <entry>0x3015</entry> 752 <entry>0x3015</entry>
737 <entry></entry> 753 <entry></entry>
738 <entry>-</entry> 754 <entry>-</entry>
@@ -748,8 +764,8 @@
748 <entry>b<subscript>1</subscript></entry> 764 <entry>b<subscript>1</subscript></entry>
749 <entry>b<subscript>0</subscript></entry> 765 <entry>b<subscript>0</subscript></entry>
750 </row> 766 </row>
751 <row id="V4L2-MBUS-FMT-SGBRG10-ALAW8-1X8"> 767 <row id="MEDIA-BUS-FMT-SGBRG10-ALAW8-1X8">
752 <entry>V4L2_MBUS_FMT_SGBRG10_ALAW8_1X8</entry> 768 <entry>MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8</entry>
753 <entry>0x3016</entry> 769 <entry>0x3016</entry>
754 <entry></entry> 770 <entry></entry>
755 <entry>-</entry> 771 <entry>-</entry>
@@ -765,8 +781,8 @@
765 <entry>g<subscript>1</subscript></entry> 781 <entry>g<subscript>1</subscript></entry>
766 <entry>g<subscript>0</subscript></entry> 782 <entry>g<subscript>0</subscript></entry>
767 </row> 783 </row>
768 <row id="V4L2-MBUS-FMT-SGRBG10-ALAW8-1X8"> 784 <row id="MEDIA-BUS-FMT-SGRBG10-ALAW8-1X8">
769 <entry>V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8</entry> 785 <entry>MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8</entry>
770 <entry>0x3017</entry> 786 <entry>0x3017</entry>
771 <entry></entry> 787 <entry></entry>
772 <entry>-</entry> 788 <entry>-</entry>
@@ -782,8 +798,8 @@
782 <entry>g<subscript>1</subscript></entry> 798 <entry>g<subscript>1</subscript></entry>
783 <entry>g<subscript>0</subscript></entry> 799 <entry>g<subscript>0</subscript></entry>
784 </row> 800 </row>
785 <row id="V4L2-MBUS-FMT-SRGGB10-ALAW8-1X8"> 801 <row id="MEDIA-BUS-FMT-SRGGB10-ALAW8-1X8">
786 <entry>V4L2_MBUS_FMT_SRGGB10_ALAW8_1X8</entry> 802 <entry>MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8</entry>
787 <entry>0x3018</entry> 803 <entry>0x3018</entry>
788 <entry></entry> 804 <entry></entry>
789 <entry>-</entry> 805 <entry>-</entry>
@@ -799,8 +815,8 @@
799 <entry>r<subscript>1</subscript></entry> 815 <entry>r<subscript>1</subscript></entry>
800 <entry>r<subscript>0</subscript></entry> 816 <entry>r<subscript>0</subscript></entry>
801 </row> 817 </row>
802 <row id="V4L2-MBUS-FMT-SBGGR10-DPCM8-1X8"> 818 <row id="MEDIA-BUS-FMT-SBGGR10-DPCM8-1X8">
803 <entry>V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8</entry> 819 <entry>MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8</entry>
804 <entry>0x300b</entry> 820 <entry>0x300b</entry>
805 <entry></entry> 821 <entry></entry>
806 <entry>-</entry> 822 <entry>-</entry>
@@ -816,8 +832,8 @@
816 <entry>b<subscript>1</subscript></entry> 832 <entry>b<subscript>1</subscript></entry>
817 <entry>b<subscript>0</subscript></entry> 833 <entry>b<subscript>0</subscript></entry>
818 </row> 834 </row>
819 <row id="V4L2-MBUS-FMT-SGBRG10-DPCM8-1X8"> 835 <row id="MEDIA-BUS-FMT-SGBRG10-DPCM8-1X8">
820 <entry>V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8</entry> 836 <entry>MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8</entry>
821 <entry>0x300c</entry> 837 <entry>0x300c</entry>
822 <entry></entry> 838 <entry></entry>
823 <entry>-</entry> 839 <entry>-</entry>
@@ -833,8 +849,8 @@
833 <entry>g<subscript>1</subscript></entry> 849 <entry>g<subscript>1</subscript></entry>
834 <entry>g<subscript>0</subscript></entry> 850 <entry>g<subscript>0</subscript></entry>
835 </row> 851 </row>
836 <row id="V4L2-MBUS-FMT-SGRBG10-DPCM8-1X8"> 852 <row id="MEDIA-BUS-FMT-SGRBG10-DPCM8-1X8">
837 <entry>V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8</entry> 853 <entry>MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8</entry>
838 <entry>0x3009</entry> 854 <entry>0x3009</entry>
839 <entry></entry> 855 <entry></entry>
840 <entry>-</entry> 856 <entry>-</entry>
@@ -850,8 +866,8 @@
850 <entry>g<subscript>1</subscript></entry> 866 <entry>g<subscript>1</subscript></entry>
851 <entry>g<subscript>0</subscript></entry> 867 <entry>g<subscript>0</subscript></entry>
852 </row> 868 </row>
853 <row id="V4L2-MBUS-FMT-SRGGB10-DPCM8-1X8"> 869 <row id="MEDIA-BUS-FMT-SRGGB10-DPCM8-1X8">
854 <entry>V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8</entry> 870 <entry>MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8</entry>
855 <entry>0x300d</entry> 871 <entry>0x300d</entry>
856 <entry></entry> 872 <entry></entry>
857 <entry>-</entry> 873 <entry>-</entry>
@@ -867,8 +883,8 @@
867 <entry>r<subscript>1</subscript></entry> 883 <entry>r<subscript>1</subscript></entry>
868 <entry>r<subscript>0</subscript></entry> 884 <entry>r<subscript>0</subscript></entry>
869 </row> 885 </row>
870 <row id="V4L2-MBUS-FMT-SBGGR10-2X8-PADHI-BE"> 886 <row id="MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-BE">
871 <entry>V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE</entry> 887 <entry>MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE</entry>
872 <entry>0x3003</entry> 888 <entry>0x3003</entry>
873 <entry></entry> 889 <entry></entry>
874 <entry>-</entry> 890 <entry>-</entry>
@@ -901,8 +917,8 @@
901 <entry>b<subscript>1</subscript></entry> 917 <entry>b<subscript>1</subscript></entry>
902 <entry>b<subscript>0</subscript></entry> 918 <entry>b<subscript>0</subscript></entry>
903 </row> 919 </row>
904 <row id="V4L2-MBUS-FMT-SBGGR10-2X8-PADHI-LE"> 920 <row id="MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-LE">
905 <entry>V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE</entry> 921 <entry>MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE</entry>
906 <entry>0x3004</entry> 922 <entry>0x3004</entry>
907 <entry></entry> 923 <entry></entry>
908 <entry>-</entry> 924 <entry>-</entry>
@@ -935,8 +951,8 @@
935 <entry>b<subscript>9</subscript></entry> 951 <entry>b<subscript>9</subscript></entry>
936 <entry>b<subscript>8</subscript></entry> 952 <entry>b<subscript>8</subscript></entry>
937 </row> 953 </row>
938 <row id="V4L2-MBUS-FMT-SBGGR10-2X8-PADLO-BE"> 954 <row id="MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-BE">
939 <entry>V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE</entry> 955 <entry>MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE</entry>
940 <entry>0x3005</entry> 956 <entry>0x3005</entry>
941 <entry></entry> 957 <entry></entry>
942 <entry>-</entry> 958 <entry>-</entry>
@@ -969,8 +985,8 @@
969 <entry>0</entry> 985 <entry>0</entry>
970 <entry>0</entry> 986 <entry>0</entry>
971 </row> 987 </row>
972 <row id="V4L2-MBUS-FMT-SBGGR10-2X8-PADLO-LE"> 988 <row id="MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-LE">
973 <entry>V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE</entry> 989 <entry>MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE</entry>
974 <entry>0x3006</entry> 990 <entry>0x3006</entry>
975 <entry></entry> 991 <entry></entry>
976 <entry>-</entry> 992 <entry>-</entry>
@@ -1003,8 +1019,8 @@
1003 <entry>b<subscript>3</subscript></entry> 1019 <entry>b<subscript>3</subscript></entry>
1004 <entry>b<subscript>2</subscript></entry> 1020 <entry>b<subscript>2</subscript></entry>
1005 </row> 1021 </row>
1006 <row id="V4L2-MBUS-FMT-SBGGR10-1X10"> 1022 <row id="MEDIA-BUS-FMT-SBGGR10-1X10">
1007 <entry>V4L2_MBUS_FMT_SBGGR10_1X10</entry> 1023 <entry>MEDIA_BUS_FMT_SBGGR10_1X10</entry>
1008 <entry>0x3007</entry> 1024 <entry>0x3007</entry>
1009 <entry></entry> 1025 <entry></entry>
1010 <entry>-</entry> 1026 <entry>-</entry>
@@ -1020,8 +1036,8 @@
1020 <entry>b<subscript>1</subscript></entry> 1036 <entry>b<subscript>1</subscript></entry>
1021 <entry>b<subscript>0</subscript></entry> 1037 <entry>b<subscript>0</subscript></entry>
1022 </row> 1038 </row>
1023 <row id="V4L2-MBUS-FMT-SGBRG10-1X10"> 1039 <row id="MEDIA-BUS-FMT-SGBRG10-1X10">
1024 <entry>V4L2_MBUS_FMT_SGBRG10_1X10</entry> 1040 <entry>MEDIA_BUS_FMT_SGBRG10_1X10</entry>
1025 <entry>0x300e</entry> 1041 <entry>0x300e</entry>
1026 <entry></entry> 1042 <entry></entry>
1027 <entry>-</entry> 1043 <entry>-</entry>
@@ -1037,8 +1053,8 @@
1037 <entry>g<subscript>1</subscript></entry> 1053 <entry>g<subscript>1</subscript></entry>
1038 <entry>g<subscript>0</subscript></entry> 1054 <entry>g<subscript>0</subscript></entry>
1039 </row> 1055 </row>
1040 <row id="V4L2-MBUS-FMT-SGRBG10-1X10"> 1056 <row id="MEDIA-BUS-FMT-SGRBG10-1X10">
1041 <entry>V4L2_MBUS_FMT_SGRBG10_1X10</entry> 1057 <entry>MEDIA_BUS_FMT_SGRBG10_1X10</entry>
1042 <entry>0x300a</entry> 1058 <entry>0x300a</entry>
1043 <entry></entry> 1059 <entry></entry>
1044 <entry>-</entry> 1060 <entry>-</entry>
@@ -1054,8 +1070,8 @@
1054 <entry>g<subscript>1</subscript></entry> 1070 <entry>g<subscript>1</subscript></entry>
1055 <entry>g<subscript>0</subscript></entry> 1071 <entry>g<subscript>0</subscript></entry>
1056 </row> 1072 </row>
1057 <row id="V4L2-MBUS-FMT-SRGGB10-1X10"> 1073 <row id="MEDIA-BUS-FMT-SRGGB10-1X10">
1058 <entry>V4L2_MBUS_FMT_SRGGB10_1X10</entry> 1074 <entry>MEDIA_BUS_FMT_SRGGB10_1X10</entry>
1059 <entry>0x300f</entry> 1075 <entry>0x300f</entry>
1060 <entry></entry> 1076 <entry></entry>
1061 <entry>-</entry> 1077 <entry>-</entry>
@@ -1071,8 +1087,8 @@
1071 <entry>r<subscript>1</subscript></entry> 1087 <entry>r<subscript>1</subscript></entry>
1072 <entry>r<subscript>0</subscript></entry> 1088 <entry>r<subscript>0</subscript></entry>
1073 </row> 1089 </row>
1074 <row id="V4L2-MBUS-FMT-SBGGR12-1X12"> 1090 <row id="MEDIA-BUS-FMT-SBGGR12-1X12">
1075 <entry>V4L2_MBUS_FMT_SBGGR12_1X12</entry> 1091 <entry>MEDIA_BUS_FMT_SBGGR12_1X12</entry>
1076 <entry>0x3008</entry> 1092 <entry>0x3008</entry>
1077 <entry></entry> 1093 <entry></entry>
1078 <entry>b<subscript>11</subscript></entry> 1094 <entry>b<subscript>11</subscript></entry>
@@ -1088,8 +1104,8 @@
1088 <entry>b<subscript>1</subscript></entry> 1104 <entry>b<subscript>1</subscript></entry>
1089 <entry>b<subscript>0</subscript></entry> 1105 <entry>b<subscript>0</subscript></entry>
1090 </row> 1106 </row>
1091 <row id="V4L2-MBUS-FMT-SGBRG12-1X12"> 1107 <row id="MEDIA-BUS-FMT-SGBRG12-1X12">
1092 <entry>V4L2_MBUS_FMT_SGBRG12_1X12</entry> 1108 <entry>MEDIA_BUS_FMT_SGBRG12_1X12</entry>
1093 <entry>0x3010</entry> 1109 <entry>0x3010</entry>
1094 <entry></entry> 1110 <entry></entry>
1095 <entry>g<subscript>11</subscript></entry> 1111 <entry>g<subscript>11</subscript></entry>
@@ -1105,8 +1121,8 @@
1105 <entry>g<subscript>1</subscript></entry> 1121 <entry>g<subscript>1</subscript></entry>
1106 <entry>g<subscript>0</subscript></entry> 1122 <entry>g<subscript>0</subscript></entry>
1107 </row> 1123 </row>
1108 <row id="V4L2-MBUS-FMT-SGRBG12-1X12"> 1124 <row id="MEDIA-BUS-FMT-SGRBG12-1X12">
1109 <entry>V4L2_MBUS_FMT_SGRBG12_1X12</entry> 1125 <entry>MEDIA_BUS_FMT_SGRBG12_1X12</entry>
1110 <entry>0x3011</entry> 1126 <entry>0x3011</entry>
1111 <entry></entry> 1127 <entry></entry>
1112 <entry>g<subscript>11</subscript></entry> 1128 <entry>g<subscript>11</subscript></entry>
@@ -1122,8 +1138,8 @@
1122 <entry>g<subscript>1</subscript></entry> 1138 <entry>g<subscript>1</subscript></entry>
1123 <entry>g<subscript>0</subscript></entry> 1139 <entry>g<subscript>0</subscript></entry>
1124 </row> 1140 </row>
1125 <row id="V4L2-MBUS-FMT-SRGGB12-1X12"> 1141 <row id="MEDIA-BUS-FMT-SRGGB12-1X12">
1126 <entry>V4L2_MBUS_FMT_SRGGB12_1X12</entry> 1142 <entry>MEDIA_BUS_FMT_SRGGB12_1X12</entry>
1127 <entry>0x3012</entry> 1143 <entry>0x3012</entry>
1128 <entry></entry> 1144 <entry></entry>
1129 <entry>r<subscript>11</subscript></entry> 1145 <entry>r<subscript>11</subscript></entry>
@@ -1175,7 +1191,7 @@
1175 1191
1176 <para>For instance, a format where pixels are encoded as 8-bit YUV values 1192 <para>For instance, a format where pixels are encoded as 8-bit YUV values
1177 downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in the 1193 downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in the
1178 U, Y, V, Y order will be named <constant>V4L2_MBUS_FMT_UYVY8_2X8</constant>. 1194 U, Y, V, Y order will be named <constant>MEDIA_BUS_FMT_UYVY8_2X8</constant>.
1179 </para> 1195 </para>
1180 1196
1181 <para><xref linkend="v4l2-mbus-pixelcode-yuv8"/> lists existing packed YUV 1197 <para><xref linkend="v4l2-mbus-pixelcode-yuv8"/> lists existing packed YUV
@@ -1280,8 +1296,8 @@
1280 </row> 1296 </row>
1281 </thead> 1297 </thead>
1282 <tbody valign="top"> 1298 <tbody valign="top">
1283 <row id="V4L2-MBUS-FMT-Y8-1X8"> 1299 <row id="MEDIA-BUS-FMT-Y8-1X8">
1284 <entry>V4L2_MBUS_FMT_Y8_1X8</entry> 1300 <entry>MEDIA_BUS_FMT_Y8_1X8</entry>
1285 <entry>0x2001</entry> 1301 <entry>0x2001</entry>
1286 <entry></entry> 1302 <entry></entry>
1287 &dash-ent-24; 1303 &dash-ent-24;
@@ -1294,8 +1310,8 @@
1294 <entry>y<subscript>1</subscript></entry> 1310 <entry>y<subscript>1</subscript></entry>
1295 <entry>y<subscript>0</subscript></entry> 1311 <entry>y<subscript>0</subscript></entry>
1296 </row> 1312 </row>
1297 <row id="V4L2-MBUS-FMT-UV8-1X8"> 1313 <row id="MEDIA-BUS-FMT-UV8-1X8">
1298 <entry>V4L2_MBUS_FMT_UV8_1X8</entry> 1314 <entry>MEDIA_BUS_FMT_UV8_1X8</entry>
1299 <entry>0x2015</entry> 1315 <entry>0x2015</entry>
1300 <entry></entry> 1316 <entry></entry>
1301 &dash-ent-24; 1317 &dash-ent-24;
@@ -1322,8 +1338,8 @@
1322 <entry>v<subscript>1</subscript></entry> 1338 <entry>v<subscript>1</subscript></entry>
1323 <entry>v<subscript>0</subscript></entry> 1339 <entry>v<subscript>0</subscript></entry>
1324 </row> 1340 </row>
1325 <row id="V4L2-MBUS-FMT-UYVY8-1_5X8"> 1341 <row id="MEDIA-BUS-FMT-UYVY8-1_5X8">
1326 <entry>V4L2_MBUS_FMT_UYVY8_1_5X8</entry> 1342 <entry>MEDIA_BUS_FMT_UYVY8_1_5X8</entry>
1327 <entry>0x2002</entry> 1343 <entry>0x2002</entry>
1328 <entry></entry> 1344 <entry></entry>
1329 &dash-ent-24; 1345 &dash-ent-24;
@@ -1406,8 +1422,8 @@
1406 <entry>y<subscript>1</subscript></entry> 1422 <entry>y<subscript>1</subscript></entry>
1407 <entry>y<subscript>0</subscript></entry> 1423 <entry>y<subscript>0</subscript></entry>
1408 </row> 1424 </row>
1409 <row id="V4L2-MBUS-FMT-VYUY8-1_5X8"> 1425 <row id="MEDIA-BUS-FMT-VYUY8-1_5X8">
1410 <entry>V4L2_MBUS_FMT_VYUY8_1_5X8</entry> 1426 <entry>MEDIA_BUS_FMT_VYUY8_1_5X8</entry>
1411 <entry>0x2003</entry> 1427 <entry>0x2003</entry>
1412 <entry></entry> 1428 <entry></entry>
1413 &dash-ent-24; 1429 &dash-ent-24;
@@ -1490,8 +1506,8 @@
1490 <entry>y<subscript>1</subscript></entry> 1506 <entry>y<subscript>1</subscript></entry>
1491 <entry>y<subscript>0</subscript></entry> 1507 <entry>y<subscript>0</subscript></entry>
1492 </row> 1508 </row>
1493 <row id="V4L2-MBUS-FMT-YUYV8-1_5X8"> 1509 <row id="MEDIA-BUS-FMT-YUYV8-1_5X8">
1494 <entry>V4L2_MBUS_FMT_YUYV8_1_5X8</entry> 1510 <entry>MEDIA_BUS_FMT_YUYV8_1_5X8</entry>
1495 <entry>0x2004</entry> 1511 <entry>0x2004</entry>
1496 <entry></entry> 1512 <entry></entry>
1497 &dash-ent-24; 1513 &dash-ent-24;
@@ -1574,8 +1590,8 @@
1574 <entry>v<subscript>1</subscript></entry> 1590 <entry>v<subscript>1</subscript></entry>
1575 <entry>v<subscript>0</subscript></entry> 1591 <entry>v<subscript>0</subscript></entry>
1576 </row> 1592 </row>
1577 <row id="V4L2-MBUS-FMT-YVYU8-1_5X8"> 1593 <row id="MEDIA-BUS-FMT-YVYU8-1_5X8">
1578 <entry>V4L2_MBUS_FMT_YVYU8_1_5X8</entry> 1594 <entry>MEDIA_BUS_FMT_YVYU8_1_5X8</entry>
1579 <entry>0x2005</entry> 1595 <entry>0x2005</entry>
1580 <entry></entry> 1596 <entry></entry>
1581 &dash-ent-24; 1597 &dash-ent-24;
@@ -1658,8 +1674,8 @@
1658 <entry>u<subscript>1</subscript></entry> 1674 <entry>u<subscript>1</subscript></entry>
1659 <entry>u<subscript>0</subscript></entry> 1675 <entry>u<subscript>0</subscript></entry>
1660 </row> 1676 </row>
1661 <row id="V4L2-MBUS-FMT-UYVY8-2X8"> 1677 <row id="MEDIA-BUS-FMT-UYVY8-2X8">
1662 <entry>V4L2_MBUS_FMT_UYVY8_2X8</entry> 1678 <entry>MEDIA_BUS_FMT_UYVY8_2X8</entry>
1663 <entry>0x2006</entry> 1679 <entry>0x2006</entry>
1664 <entry></entry> 1680 <entry></entry>
1665 &dash-ent-24; 1681 &dash-ent-24;
@@ -1714,8 +1730,8 @@
1714 <entry>y<subscript>1</subscript></entry> 1730 <entry>y<subscript>1</subscript></entry>
1715 <entry>y<subscript>0</subscript></entry> 1731 <entry>y<subscript>0</subscript></entry>
1716 </row> 1732 </row>
1717 <row id="V4L2-MBUS-FMT-VYUY8-2X8"> 1733 <row id="MEDIA-BUS-FMT-VYUY8-2X8">
1718 <entry>V4L2_MBUS_FMT_VYUY8_2X8</entry> 1734 <entry>MEDIA_BUS_FMT_VYUY8_2X8</entry>
1719 <entry>0x2007</entry> 1735 <entry>0x2007</entry>
1720 <entry></entry> 1736 <entry></entry>
1721 &dash-ent-24; 1737 &dash-ent-24;
@@ -1770,8 +1786,8 @@
1770 <entry>y<subscript>1</subscript></entry> 1786 <entry>y<subscript>1</subscript></entry>
1771 <entry>y<subscript>0</subscript></entry> 1787 <entry>y<subscript>0</subscript></entry>
1772 </row> 1788 </row>
1773 <row id="V4L2-MBUS-FMT-YUYV8-2X8"> 1789 <row id="MEDIA-BUS-FMT-YUYV8-2X8">
1774 <entry>V4L2_MBUS_FMT_YUYV8_2X8</entry> 1790 <entry>MEDIA_BUS_FMT_YUYV8_2X8</entry>
1775 <entry>0x2008</entry> 1791 <entry>0x2008</entry>
1776 <entry></entry> 1792 <entry></entry>
1777 &dash-ent-24; 1793 &dash-ent-24;
@@ -1826,8 +1842,8 @@
1826 <entry>v<subscript>1</subscript></entry> 1842 <entry>v<subscript>1</subscript></entry>
1827 <entry>v<subscript>0</subscript></entry> 1843 <entry>v<subscript>0</subscript></entry>
1828 </row> 1844 </row>
1829 <row id="V4L2-MBUS-FMT-YVYU8-2X8"> 1845 <row id="MEDIA-BUS-FMT-YVYU8-2X8">
1830 <entry>V4L2_MBUS_FMT_YVYU8_2X8</entry> 1846 <entry>MEDIA_BUS_FMT_YVYU8_2X8</entry>
1831 <entry>0x2009</entry> 1847 <entry>0x2009</entry>
1832 <entry></entry> 1848 <entry></entry>
1833 &dash-ent-24; 1849 &dash-ent-24;
@@ -1882,8 +1898,8 @@
1882 <entry>u<subscript>1</subscript></entry> 1898 <entry>u<subscript>1</subscript></entry>
1883 <entry>u<subscript>0</subscript></entry> 1899 <entry>u<subscript>0</subscript></entry>
1884 </row> 1900 </row>
1885 <row id="V4L2-MBUS-FMT-Y10-1X10"> 1901 <row id="MEDIA-BUS-FMT-Y10-1X10">
1886 <entry>V4L2_MBUS_FMT_Y10_1X10</entry> 1902 <entry>MEDIA_BUS_FMT_Y10_1X10</entry>
1887 <entry>0x200a</entry> 1903 <entry>0x200a</entry>
1888 <entry></entry> 1904 <entry></entry>
1889 &dash-ent-22; 1905 &dash-ent-22;
@@ -1898,8 +1914,8 @@
1898 <entry>y<subscript>1</subscript></entry> 1914 <entry>y<subscript>1</subscript></entry>
1899 <entry>y<subscript>0</subscript></entry> 1915 <entry>y<subscript>0</subscript></entry>
1900 </row> 1916 </row>
1901 <row id="V4L2-MBUS-FMT-UYVY10-2X10"> 1917 <row id="MEDIA-BUS-FMT-UYVY10-2X10">
1902 <entry>V4L2_MBUS_FMT_UYVY10_2X10</entry> 1918 <entry>MEDIA_BUS_FMT_UYVY10_2X10</entry>
1903 <entry>0x2018</entry> 1919 <entry>0x2018</entry>
1904 <entry></entry> 1920 <entry></entry>
1905 &dash-ent-22; 1921 &dash-ent-22;
@@ -1962,8 +1978,8 @@
1962 <entry>y<subscript>1</subscript></entry> 1978 <entry>y<subscript>1</subscript></entry>
1963 <entry>y<subscript>0</subscript></entry> 1979 <entry>y<subscript>0</subscript></entry>
1964 </row> 1980 </row>
1965 <row id="V4L2-MBUS-FMT-VYUY10-2X10"> 1981 <row id="MEDIA-BUS-FMT-VYUY10-2X10">
1966 <entry>V4L2_MBUS_FMT_VYUY10_2X10</entry> 1982 <entry>MEDIA_BUS_FMT_VYUY10_2X10</entry>
1967 <entry>0x2019</entry> 1983 <entry>0x2019</entry>
1968 <entry></entry> 1984 <entry></entry>
1969 &dash-ent-22; 1985 &dash-ent-22;
@@ -2026,8 +2042,8 @@
2026 <entry>y<subscript>1</subscript></entry> 2042 <entry>y<subscript>1</subscript></entry>
2027 <entry>y<subscript>0</subscript></entry> 2043 <entry>y<subscript>0</subscript></entry>
2028 </row> 2044 </row>
2029 <row id="V4L2-MBUS-FMT-YUYV10-2X10"> 2045 <row id="MEDIA-BUS-FMT-YUYV10-2X10">
2030 <entry>V4L2_MBUS_FMT_YUYV10_2X10</entry> 2046 <entry>MEDIA_BUS_FMT_YUYV10_2X10</entry>
2031 <entry>0x200b</entry> 2047 <entry>0x200b</entry>
2032 <entry></entry> 2048 <entry></entry>
2033 &dash-ent-22; 2049 &dash-ent-22;
@@ -2090,8 +2106,8 @@
2090 <entry>v<subscript>1</subscript></entry> 2106 <entry>v<subscript>1</subscript></entry>
2091 <entry>v<subscript>0</subscript></entry> 2107 <entry>v<subscript>0</subscript></entry>
2092 </row> 2108 </row>
2093 <row id="V4L2-MBUS-FMT-YVYU10-2X10"> 2109 <row id="MEDIA-BUS-FMT-YVYU10-2X10">
2094 <entry>V4L2_MBUS_FMT_YVYU10_2X10</entry> 2110 <entry>MEDIA_BUS_FMT_YVYU10_2X10</entry>
2095 <entry>0x200c</entry> 2111 <entry>0x200c</entry>
2096 <entry></entry> 2112 <entry></entry>
2097 &dash-ent-22; 2113 &dash-ent-22;
@@ -2154,8 +2170,8 @@
2154 <entry>u<subscript>1</subscript></entry> 2170 <entry>u<subscript>1</subscript></entry>
2155 <entry>u<subscript>0</subscript></entry> 2171 <entry>u<subscript>0</subscript></entry>
2156 </row> 2172 </row>
2157 <row id="V4L2-MBUS-FMT-Y12-1X12"> 2173 <row id="MEDIA-BUS-FMT-Y12-1X12">
2158 <entry>V4L2_MBUS_FMT_Y12_1X12</entry> 2174 <entry>MEDIA_BUS_FMT_Y12_1X12</entry>
2159 <entry>0x2013</entry> 2175 <entry>0x2013</entry>
2160 <entry></entry> 2176 <entry></entry>
2161 &dash-ent-20; 2177 &dash-ent-20;
@@ -2172,8 +2188,8 @@
2172 <entry>y<subscript>1</subscript></entry> 2188 <entry>y<subscript>1</subscript></entry>
2173 <entry>y<subscript>0</subscript></entry> 2189 <entry>y<subscript>0</subscript></entry>
2174 </row> 2190 </row>
2175 <row id="V4L2-MBUS-FMT-UYVY8-1X16"> 2191 <row id="MEDIA-BUS-FMT-UYVY8-1X16">
2176 <entry>V4L2_MBUS_FMT_UYVY8_1X16</entry> 2192 <entry>MEDIA_BUS_FMT_UYVY8_1X16</entry>
2177 <entry>0x200f</entry> 2193 <entry>0x200f</entry>
2178 <entry></entry> 2194 <entry></entry>
2179 &dash-ent-16; 2195 &dash-ent-16;
@@ -2216,8 +2232,8 @@
2216 <entry>y<subscript>1</subscript></entry> 2232 <entry>y<subscript>1</subscript></entry>
2217 <entry>y<subscript>0</subscript></entry> 2233 <entry>y<subscript>0</subscript></entry>
2218 </row> 2234 </row>
2219 <row id="V4L2-MBUS-FMT-VYUY8-1X16"> 2235 <row id="MEDIA-BUS-FMT-VYUY8-1X16">
2220 <entry>V4L2_MBUS_FMT_VYUY8_1X16</entry> 2236 <entry>MEDIA_BUS_FMT_VYUY8_1X16</entry>
2221 <entry>0x2010</entry> 2237 <entry>0x2010</entry>
2222 <entry></entry> 2238 <entry></entry>
2223 &dash-ent-16; 2239 &dash-ent-16;
@@ -2260,8 +2276,8 @@
2260 <entry>y<subscript>1</subscript></entry> 2276 <entry>y<subscript>1</subscript></entry>
2261 <entry>y<subscript>0</subscript></entry> 2277 <entry>y<subscript>0</subscript></entry>
2262 </row> 2278 </row>
2263 <row id="V4L2-MBUS-FMT-YUYV8-1X16"> 2279 <row id="MEDIA-BUS-FMT-YUYV8-1X16">
2264 <entry>V4L2_MBUS_FMT_YUYV8_1X16</entry> 2280 <entry>MEDIA_BUS_FMT_YUYV8_1X16</entry>
2265 <entry>0x2011</entry> 2281 <entry>0x2011</entry>
2266 <entry></entry> 2282 <entry></entry>
2267 &dash-ent-16; 2283 &dash-ent-16;
@@ -2304,8 +2320,8 @@
2304 <entry>v<subscript>1</subscript></entry> 2320 <entry>v<subscript>1</subscript></entry>
2305 <entry>v<subscript>0</subscript></entry> 2321 <entry>v<subscript>0</subscript></entry>
2306 </row> 2322 </row>
2307 <row id="V4L2-MBUS-FMT-YVYU8-1X16"> 2323 <row id="MEDIA-BUS-FMT-YVYU8-1X16">
2308 <entry>V4L2_MBUS_FMT_YVYU8_1X16</entry> 2324 <entry>MEDIA_BUS_FMT_YVYU8_1X16</entry>
2309 <entry>0x2012</entry> 2325 <entry>0x2012</entry>
2310 <entry></entry> 2326 <entry></entry>
2311 &dash-ent-16; 2327 &dash-ent-16;
@@ -2348,8 +2364,8 @@
2348 <entry>u<subscript>1</subscript></entry> 2364 <entry>u<subscript>1</subscript></entry>
2349 <entry>u<subscript>0</subscript></entry> 2365 <entry>u<subscript>0</subscript></entry>
2350 </row> 2366 </row>
2351 <row id="V4L2-MBUS-FMT-YDYUYDYV8-1X16"> 2367 <row id="MEDIA-BUS-FMT-YDYUYDYV8-1X16">
2352 <entry>V4L2_MBUS_FMT_YDYUYDYV8_1X16</entry> 2368 <entry>MEDIA_BUS_FMT_YDYUYDYV8_1X16</entry>
2353 <entry>0x2014</entry> 2369 <entry>0x2014</entry>
2354 <entry></entry> 2370 <entry></entry>
2355 &dash-ent-16; 2371 &dash-ent-16;
@@ -2436,8 +2452,8 @@
2436 <entry>v<subscript>1</subscript></entry> 2452 <entry>v<subscript>1</subscript></entry>
2437 <entry>v<subscript>0</subscript></entry> 2453 <entry>v<subscript>0</subscript></entry>
2438 </row> 2454 </row>
2439 <row id="V4L2-MBUS-FMT-UYVY10-1X20"> 2455 <row id="MEDIA-BUS-FMT-UYVY10-1X20">
2440 <entry>V4L2_MBUS_FMT_UYVY10_1X20</entry> 2456 <entry>MEDIA_BUS_FMT_UYVY10_1X20</entry>
2441 <entry>0x201a</entry> 2457 <entry>0x201a</entry>
2442 <entry></entry> 2458 <entry></entry>
2443 &dash-ent-12; 2459 &dash-ent-12;
@@ -2488,8 +2504,8 @@
2488 <entry>y<subscript>1</subscript></entry> 2504 <entry>y<subscript>1</subscript></entry>
2489 <entry>y<subscript>0</subscript></entry> 2505 <entry>y<subscript>0</subscript></entry>
2490 </row> 2506 </row>
2491 <row id="V4L2-MBUS-FMT-VYUY10-1X20"> 2507 <row id="MEDIA-BUS-FMT-VYUY10-1X20">
2492 <entry>V4L2_MBUS_FMT_VYUY10_1X20</entry> 2508 <entry>MEDIA_BUS_FMT_VYUY10_1X20</entry>
2493 <entry>0x201b</entry> 2509 <entry>0x201b</entry>
2494 <entry></entry> 2510 <entry></entry>
2495 &dash-ent-12; 2511 &dash-ent-12;
@@ -2540,8 +2556,8 @@
2540 <entry>y<subscript>1</subscript></entry> 2556 <entry>y<subscript>1</subscript></entry>
2541 <entry>y<subscript>0</subscript></entry> 2557 <entry>y<subscript>0</subscript></entry>
2542 </row> 2558 </row>
2543 <row id="V4L2-MBUS-FMT-YUYV10-1X20"> 2559 <row id="MEDIA-BUS-FMT-YUYV10-1X20">
2544 <entry>V4L2_MBUS_FMT_YUYV10_1X20</entry> 2560 <entry>MEDIA_BUS_FMT_YUYV10_1X20</entry>
2545 <entry>0x200d</entry> 2561 <entry>0x200d</entry>
2546 <entry></entry> 2562 <entry></entry>
2547 &dash-ent-12; 2563 &dash-ent-12;
@@ -2592,8 +2608,8 @@
2592 <entry>v<subscript>1</subscript></entry> 2608 <entry>v<subscript>1</subscript></entry>
2593 <entry>v<subscript>0</subscript></entry> 2609 <entry>v<subscript>0</subscript></entry>
2594 </row> 2610 </row>
2595 <row id="V4L2-MBUS-FMT-YVYU10-1X20"> 2611 <row id="MEDIA-BUS-FMT-YVYU10-1X20">
2596 <entry>V4L2_MBUS_FMT_YVYU10_1X20</entry> 2612 <entry>MEDIA_BUS_FMT_YVYU10_1X20</entry>
2597 <entry>0x200e</entry> 2613 <entry>0x200e</entry>
2598 <entry></entry> 2614 <entry></entry>
2599 &dash-ent-12; 2615 &dash-ent-12;
@@ -2644,8 +2660,8 @@
2644 <entry>u<subscript>1</subscript></entry> 2660 <entry>u<subscript>1</subscript></entry>
2645 <entry>u<subscript>0</subscript></entry> 2661 <entry>u<subscript>0</subscript></entry>
2646 </row> 2662 </row>
2647 <row id="V4L2-MBUS-FMT-YUV10-1X30"> 2663 <row id="MEDIA-BUS-FMT-YUV10-1X30">
2648 <entry>V4L2_MBUS_FMT_YUV10_1X30</entry> 2664 <entry>MEDIA_BUS_FMT_YUV10_1X30</entry>
2649 <entry>0x2016</entry> 2665 <entry>0x2016</entry>
2650 <entry></entry> 2666 <entry></entry>
2651 <entry>-</entry> 2667 <entry>-</entry>
@@ -2681,8 +2697,8 @@
2681 <entry>v<subscript>1</subscript></entry> 2697 <entry>v<subscript>1</subscript></entry>
2682 <entry>v<subscript>0</subscript></entry> 2698 <entry>v<subscript>0</subscript></entry>
2683 </row> 2699 </row>
2684 <row id="V4L2-MBUS-FMT-AYUV8-1X32"> 2700 <row id="MEDIA-BUS-FMT-AYUV8-1X32">
2685 <entry>V4L2_MBUS_FMT_AYUV8_1X32</entry> 2701 <entry>MEDIA_BUS_FMT_AYUV8_1X32</entry>
2686 <entry>0x2017</entry> 2702 <entry>0x2017</entry>
2687 <entry></entry> 2703 <entry></entry>
2688 <entry>a<subscript>7</subscript></entry> 2704 <entry>a<subscript>7</subscript></entry>
@@ -2718,8 +2734,8 @@
2718 <entry>v<subscript>1</subscript></entry> 2734 <entry>v<subscript>1</subscript></entry>
2719 <entry>v<subscript>0</subscript></entry> 2735 <entry>v<subscript>0</subscript></entry>
2720 </row> 2736 </row>
2721 <row id="V4L2-MBUS-FMT-UYVY12-2X12"> 2737 <row id="MEDIA-BUS-FMT-UYVY12-2X12">
2722 <entry>V4L2_MBUS_FMT_UYVY12_2X12</entry> 2738 <entry>MEDIA_BUS_FMT_UYVY12_2X12</entry>
2723 <entry>0x201c</entry> 2739 <entry>0x201c</entry>
2724 <entry></entry> 2740 <entry></entry>
2725 &dash-ent-20; 2741 &dash-ent-20;
@@ -2790,8 +2806,8 @@
2790 <entry>y<subscript>1</subscript></entry> 2806 <entry>y<subscript>1</subscript></entry>
2791 <entry>y<subscript>0</subscript></entry> 2807 <entry>y<subscript>0</subscript></entry>
2792 </row> 2808 </row>
2793 <row id="V4L2-MBUS-FMT-VYUY12-2X12"> 2809 <row id="MEDIA-BUS-FMT-VYUY12-2X12">
2794 <entry>V4L2_MBUS_FMT_VYUY12_2X12</entry> 2810 <entry>MEDIA_BUS_FMT_VYUY12_2X12</entry>
2795 <entry>0x201d</entry> 2811 <entry>0x201d</entry>
2796 <entry></entry> 2812 <entry></entry>
2797 &dash-ent-20; 2813 &dash-ent-20;
@@ -2862,8 +2878,8 @@
2862 <entry>y<subscript>1</subscript></entry> 2878 <entry>y<subscript>1</subscript></entry>
2863 <entry>y<subscript>0</subscript></entry> 2879 <entry>y<subscript>0</subscript></entry>
2864 </row> 2880 </row>
2865 <row id="V4L2-MBUS-FMT-YUYV12-2X12"> 2881 <row id="MEDIA-BUS-FMT-YUYV12-2X12">
2866 <entry>V4L2_MBUS_FMT_YUYV12_2X12</entry> 2882 <entry>MEDIA_BUS_FMT_YUYV12_2X12</entry>
2867 <entry>0x201e</entry> 2883 <entry>0x201e</entry>
2868 <entry></entry> 2884 <entry></entry>
2869 &dash-ent-20; 2885 &dash-ent-20;
@@ -2934,8 +2950,8 @@
2934 <entry>v<subscript>1</subscript></entry> 2950 <entry>v<subscript>1</subscript></entry>
2935 <entry>v<subscript>0</subscript></entry> 2951 <entry>v<subscript>0</subscript></entry>
2936 </row> 2952 </row>
2937 <row id="V4L2-MBUS-FMT-YVYU12-2X12"> 2953 <row id="MEDIA-BUS-FMT-YVYU12-2X12">
2938 <entry>V4L2_MBUS_FMT_YVYU12_2X12</entry> 2954 <entry>MEDIA_BUS_FMT_YVYU12_2X12</entry>
2939 <entry>0x201f</entry> 2955 <entry>0x201f</entry>
2940 <entry></entry> 2956 <entry></entry>
2941 &dash-ent-20; 2957 &dash-ent-20;
@@ -3006,8 +3022,8 @@
3006 <entry>u<subscript>1</subscript></entry> 3022 <entry>u<subscript>1</subscript></entry>
3007 <entry>u<subscript>0</subscript></entry> 3023 <entry>u<subscript>0</subscript></entry>
3008 </row> 3024 </row>
3009 <row id="V4L2-MBUS-FMT-UYVY12-1X24"> 3025 <row id="MEDIA-BUS-FMT-UYVY12-1X24">
3010 <entry>V4L2_MBUS_FMT_UYVY12_1X24</entry> 3026 <entry>MEDIA_BUS_FMT_UYVY12_1X24</entry>
3011 <entry>0x2020</entry> 3027 <entry>0x2020</entry>
3012 <entry></entry> 3028 <entry></entry>
3013 &dash-ent-8; 3029 &dash-ent-8;
@@ -3066,8 +3082,8 @@
3066 <entry>y<subscript>1</subscript></entry> 3082 <entry>y<subscript>1</subscript></entry>
3067 <entry>y<subscript>0</subscript></entry> 3083 <entry>y<subscript>0</subscript></entry>
3068 </row> 3084 </row>
3069 <row id="V4L2-MBUS-FMT-VYUY12-1X24"> 3085 <row id="MEDIA-BUS-FMT-VYUY12-1X24">
3070 <entry>V4L2_MBUS_FMT_VYUY12_1X24</entry> 3086 <entry>MEDIA_BUS_FMT_VYUY12_1X24</entry>
3071 <entry>0x2021</entry> 3087 <entry>0x2021</entry>
3072 <entry></entry> 3088 <entry></entry>
3073 &dash-ent-8; 3089 &dash-ent-8;
@@ -3126,8 +3142,8 @@
3126 <entry>y<subscript>1</subscript></entry> 3142 <entry>y<subscript>1</subscript></entry>
3127 <entry>y<subscript>0</subscript></entry> 3143 <entry>y<subscript>0</subscript></entry>
3128 </row> 3144 </row>
3129 <row id="V4L2-MBUS-FMT-YUYV12-1X24"> 3145 <row id="MEDIA-BUS-FMT-YUYV12-1X24">
3130 <entry>V4L2_MBUS_FMT_YUYV12_1X24</entry> 3146 <entry>MEDIA_BUS_FMT_YUYV12_1X24</entry>
3131 <entry>0x2022</entry> 3147 <entry>0x2022</entry>
3132 <entry></entry> 3148 <entry></entry>
3133 &dash-ent-8; 3149 &dash-ent-8;
@@ -3186,8 +3202,8 @@
3186 <entry>v<subscript>1</subscript></entry> 3202 <entry>v<subscript>1</subscript></entry>
3187 <entry>v<subscript>0</subscript></entry> 3203 <entry>v<subscript>0</subscript></entry>
3188 </row> 3204 </row>
3189 <row id="V4L2-MBUS-FMT-YVYU12-1X24"> 3205 <row id="MEDIA-BUS-FMT-YVYU12-1X24">
3190 <entry>V4L2_MBUS_FMT_YVYU12_1X24</entry> 3206 <entry>MEDIA_BUS_FMT_YVYU12_1X24</entry>
3191 <entry>0x2023</entry> 3207 <entry>0x2023</entry>
3192 <entry></entry> 3208 <entry></entry>
3193 &dash-ent-8; 3209 &dash-ent-8;
@@ -3366,8 +3382,8 @@
3366 </row> 3382 </row>
3367 </thead> 3383 </thead>
3368 <tbody valign="top"> 3384 <tbody valign="top">
3369 <row id="V4L2-MBUS-FMT-AHSV8888-1X32"> 3385 <row id="MEDIA-BUS-FMT-AHSV8888-1X32">
3370 <entry>V4L2_MBUS_FMT_AHSV8888_1X32</entry> 3386 <entry>MEDIA_BUS_FMT_AHSV8888_1X32</entry>
3371 <entry>0x6001</entry> 3387 <entry>0x6001</entry>
3372 <entry></entry> 3388 <entry></entry>
3373 <entry>a<subscript>7</subscript></entry> 3389 <entry>a<subscript>7</subscript></entry>
@@ -3422,7 +3438,7 @@
3422 </para> 3438 </para>
3423 3439
3424 <para>For instance, for a JPEG baseline process and an 8-bit bus width 3440 <para>For instance, for a JPEG baseline process and an 8-bit bus width
3425 the format will be named <constant>V4L2_MBUS_FMT_JPEG_1X8</constant>. 3441 the format will be named <constant>MEDIA_BUS_FMT_JPEG_1X8</constant>.
3426 </para> 3442 </para>
3427 3443
3428 <para>The following table lists existing JPEG compressed formats.</para> 3444 <para>The following table lists existing JPEG compressed formats.</para>
@@ -3441,8 +3457,8 @@
3441 </row> 3457 </row>
3442 </thead> 3458 </thead>
3443 <tbody valign="top"> 3459 <tbody valign="top">
3444 <row id="V4L2-MBUS-FMT-JPEG-1X8"> 3460 <row id="MEDIA-BUS-FMT-JPEG-1X8">
3445 <entry>V4L2_MBUS_FMT_JPEG_1X8</entry> 3461 <entry>MEDIA_BUS_FMT_JPEG_1X8</entry>
3446 <entry>0x4001</entry> 3462 <entry>0x4001</entry>
3447 <entry>Besides of its usage for the parallel bus this format is 3463 <entry>Besides of its usage for the parallel bus this format is
3448 recommended for transmission of JPEG data over MIPI CSI bus 3464 recommended for transmission of JPEG data over MIPI CSI bus
@@ -3484,8 +3500,8 @@ interface and may change in the future.</para>
3484 </row> 3500 </row>
3485 </thead> 3501 </thead>
3486 <tbody valign="top"> 3502 <tbody valign="top">
3487 <row id="V4L2-MBUS-FMT-S5C-UYVY-JPEG-1X8"> 3503 <row id="MEDIA-BUS-FMT-S5C-UYVY-JPEG-1X8">
3488 <entry>V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8</entry> 3504 <entry>MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8</entry>
3489 <entry>0x5001</entry> 3505 <entry>0x5001</entry>
3490 <entry> 3506 <entry>
3491 Interleaved raw UYVY and JPEG image format with embedded 3507 Interleaved raw UYVY and JPEG image format with embedded
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index 7cfe618f754d..ac0f8d9d2a49 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -152,6 +152,15 @@ structs, ioctls) must be noted in more detail in the history chapter
152applications. --> 152applications. -->
153 153
154 <revision> 154 <revision>
155 <revnumber>3.19</revnumber>
156 <date>2014-12-05</date>
157 <authorinitials>hv</authorinitials>
158 <revremark>Rewrote Colorspace chapter, added new &v4l2-ycbcr-encoding; and &v4l2-quantization; fields
159to &v4l2-pix-format;, &v4l2-pix-format-mplane; and &v4l2-mbus-framefmt;.
160 </revremark>
161 </revision>
162
163 <revision>
155 <revnumber>3.17</revnumber> 164 <revnumber>3.17</revnumber>
156 <date>2014-08-04</date> 165 <date>2014-08-04</date>
157 <authorinitials>lp, hv</authorinitials> 166 <authorinitials>lp, hv</authorinitials>
@@ -539,7 +548,7 @@ and discussions on the V4L mailing list.</revremark>
539</partinfo> 548</partinfo>
540 549
541<title>Video for Linux Two API Specification</title> 550<title>Video for Linux Two API Specification</title>
542 <subtitle>Revision 3.17</subtitle> 551 <subtitle>Revision 3.19</subtitle>
543 552
544 <chapter id="common"> 553 <chapter id="common">
545 &sub-common; 554 &sub-common;
diff --git a/Documentation/DocBook/media/v4l/vidioc-enuminput.xml b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
index 493a39a8ef21..603fecef9083 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
@@ -287,6 +287,14 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009.
287 <entry>0x00000004</entry> 287 <entry>0x00000004</entry>
288 <entry>This input supports setting the TV standard by using VIDIOC_S_STD.</entry> 288 <entry>This input supports setting the TV standard by using VIDIOC_S_STD.</entry>
289 </row> 289 </row>
290 <row>
291 <entry><constant>V4L2_IN_CAP_NATIVE_SIZE</constant></entry>
292 <entry>0x00000008</entry>
293 <entry>This input supports setting the native size using
294 the <constant>V4L2_SEL_TGT_NATIVE_SIZE</constant>
295 selection target, see <xref
296 linkend="v4l2-selections-common"/>.</entry>
297 </row>
290 </tbody> 298 </tbody>
291 </tgroup> 299 </tgroup>
292 </table> 300 </table>
diff --git a/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
index 2654e097df39..773fb1258c24 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
@@ -172,6 +172,14 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009.
172 <entry>0x00000004</entry> 172 <entry>0x00000004</entry>
173 <entry>This output supports setting the TV standard by using VIDIOC_S_STD.</entry> 173 <entry>This output supports setting the TV standard by using VIDIOC_S_STD.</entry>
174 </row> 174 </row>
175 <row>
176 <entry><constant>V4L2_OUT_CAP_NATIVE_SIZE</constant></entry>
177 <entry>0x00000008</entry>
178 <entry>This output supports setting the native size using
179 the <constant>V4L2_SEL_TGT_NATIVE_SIZE</constant>
180 selection target, see <xref
181 linkend="v4l2-selections-common"/>.</entry>
182 </row>
175 </tbody> 183 </tbody>
176 </tgroup> 184 </tgroup>
177 </table> 185 </table>
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index bbe9c1fd5cef..1fdc246e4256 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -540,7 +540,7 @@ appears in sysfs.
540</para></listitem> 540</para></listitem>
541 541
542<listitem><para> 542<listitem><para>
543<varname>unsigned long size</varname>: Fill in the size of the 543<varname>resource_size_t size</varname>: Fill in the size of the
544memory block that <varname>addr</varname> points to. If <varname>size</varname> 544memory block that <varname>addr</varname> points to. If <varname>size</varname>
545is zero, the mapping is considered unused. Note that you 545is zero, the mapping is considered unused. Note that you
546<emphasis>must</emphasis> initialize <varname>size</varname> with zero for 546<emphasis>must</emphasis> initialize <varname>size</varname> with zero for
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl
index 784793df81ed..84ef6a90131c 100644
--- a/Documentation/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl
@@ -3658,6 +3658,29 @@ struct _snd_pcm_runtime {
3658 </para> 3658 </para>
3659 3659
3660 <para> 3660 <para>
3661 The above callback can be simplified with a helper function,
3662 <function>snd_ctl_enum_info</function>. The final code
3663 looks like below.
3664 (You can pass ARRAY_SIZE(texts) instead of 4 in the third
3665 argument; it's a matter of taste.)
3666
3667 <informalexample>
3668 <programlisting>
3669<![CDATA[
3670 static int snd_myctl_enum_info(struct snd_kcontrol *kcontrol,
3671 struct snd_ctl_elem_info *uinfo)
3672 {
3673 static char *texts[4] = {
3674 "First", "Second", "Third", "Fourth"
3675 };
3676 return snd_ctl_enum_info(uinfo, 1, 4, texts);
3677 }
3678]]>
3679 </programlisting>
3680 </informalexample>
3681 </para>
3682
3683 <para>
3661 Some common info callbacks are available for your convenience: 3684 Some common info callbacks are available for your convenience:
3662 <function>snd_ctl_boolean_mono_info()</function> and 3685 <function>snd_ctl_boolean_mono_info()</function> and
3663 <function>snd_ctl_boolean_stereo_info()</function>. 3686 <function>snd_ctl_boolean_stereo_info()</function>.