]> Git Repo - linux.git/commitdiff
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
authorLinus Torvalds <[email protected]>
Sat, 30 Jul 2011 07:08:53 +0000 (00:08 -0700)
committerLinus Torvalds <[email protected]>
Sat, 30 Jul 2011 07:08:53 +0000 (00:08 -0700)
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (430 commits)
  [media] ir-mce_kbd-decoder: include module.h for its facilities
  [media] ov5642: include module.h for its facilities
  [media] em28xx: Fix DVB-C maxsize for em2884
  [media] tda18271c2dd: Fix saw filter configuration for DVB-C @6MHz
  [media] v4l: mt9v032: Fix Bayer pattern
  [media] V4L: mt9m111: rewrite set_pixfmt
  [media] V4L: mt9m111: fix missing return value check mt9m111_reg_clear
  [media] V4L: initial driver for ov5642 CMOS sensor
  [media] V4L: sh_mobile_ceu_camera: fix Oops when USERPTR mapping fails
  [media] V4L: soc-camera: remove soc-camera bus and devices on it
  [media] V4L: soc-camera: un-export the soc-camera bus
  [media] V4L: sh_mobile_csi2: switch away from using the soc-camera bus notifier
  [media] V4L: add media bus configuration subdev operations
  [media] V4L: soc-camera: group struct field initialisations together
  [media] V4L: soc-camera: remove now unused soc-camera specific PM hooks
  [media] V4L: pxa-camera: switch to using standard PM hooks
  [media] NetUP Dual DVB-T/C CI RF: force card hardware revision by module param
  [media] Don't OOPS if videobuf_dvb_get_frontend return NULL
  [media] NetUP Dual DVB-T/C CI RF: load firmware according card revision
  [media] omap3isp: Support configurable HS/VS polarities
  ...

Fix up conflicts:
 - arch/arm/mach-omap2/board-rx51-peripherals.c:
     cleanup regulator supply definitions in mach-omap2
   vs
     OMAP3: RX-51: define vdds_csib regulator supply
 - drivers/staging/tm6000/tm6000-alsa.c (trivial)

15 files changed:
1  2 
Documentation/DocBook/media/v4l/io.xml
Documentation/feature-removal-schedule.txt
arch/arm/mach-omap2/board-rx51-peripherals.c
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c
arch/sh/boards/mach-ap325rxa/setup.c
drivers/media/rc/ite-cir.c
drivers/media/video/hdpvr/hdpvr-core.c
drivers/media/video/omap24xxcam.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_v4l2.c
drivers/media/video/videobuf2-memops.c
drivers/staging/cxd2099/cxd2099.c
drivers/staging/tm6000/tm6000-alsa.c
kernel/compat.c

index 0000000000000000000000000000000000000000,227e7ac45a06c4dbf3ac91973e492c3301df983f..c57d1ec6291cf00c7a3a2f87f13c84c0b53d5468
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1265 +1,1265 @@@
 -#define FMT_NUM_PLANES = 3;
+   <title>Input/Output</title>
+   <para>The V4L2 API defines several different methods to read from or
+ write to a device. All drivers exchanging data with applications must
+ support at least one of them.</para>
+   <para>The classic I/O method using the <function>read()</function>
+ and <function>write()</function> function is automatically selected
+ after opening a V4L2 device. When the driver does not support this
+ method attempts to read or write will fail at any time.</para>
+   <para>Other methods must be negotiated. To select the streaming I/O
+ method with memory mapped or user buffers applications call the
+ &VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined
+ yet.</para>
+   <para>Video overlay can be considered another I/O method, although
+ the application does not directly receive the image data. It is
+ selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl.
+ For more information see <xref linkend="overlay" />.</para>
+   <para>Generally exactly one I/O method, including overlay, is
+ associated with each file descriptor. The only exceptions are
+ applications not exchanging data with a driver ("panel applications",
+ see <xref linkend="open" />) and drivers permitting simultaneous video capturing
+ and overlay using the same file descriptor, for compatibility with V4L
+ and earlier versions of V4L2.</para>
+   <para><constant>VIDIOC_S_FMT</constant> and
+ <constant>VIDIOC_REQBUFS</constant> would permit this to some degree,
+ but for simplicity drivers need not support switching the I/O method
+ (after first switching away from read/write) other than by closing
+ and reopening the device.</para>
+   <para>The following sections describe the various I/O methods in
+ more detail.</para>
+   <section id="rw">
+     <title>Read/Write</title>
+     <para>Input and output devices support the
+ <function>read()</function> and <function>write()</function> function,
+ respectively, when the <constant>V4L2_CAP_READWRITE</constant> flag in
+ the <structfield>capabilities</structfield> field of &v4l2-capability;
+ returned by the &VIDIOC-QUERYCAP; ioctl is set.</para>
+     <para>Drivers may need the CPU to copy the data, but they may also
+ support DMA to or from user memory, so this I/O method is not
+ necessarily less efficient than other methods merely exchanging buffer
+ pointers. It is considered inferior though because no meta-information
+ like frame counters or timestamps are passed. This information is
+ necessary to recognize frame dropping and to synchronize with other
+ data streams. However this is also the simplest I/O method, requiring
+ little or no setup to exchange data. It permits command line stunts
+ like this (the <application>vidctrl</application> tool is
+ fictitious):</para>
+     <informalexample>
+       <screen>
+ &gt; vidctrl /dev/video --input=0 --format=YUYV --size=352x288
+ &gt; dd if=/dev/video of=myimage.422 bs=202752 count=1
+ </screen>
+     </informalexample>
+     <para>To read from the device applications use the
+ &func-read; function, to write the &func-write; function.
+ Drivers must implement one I/O method if they
+ exchange data with applications, but it need not be this.<footnote>
+       <para>It would be desirable if applications could depend on
+ drivers supporting all I/O interfaces, but as much as the complex
+ memory mapping I/O can be inadequate for some devices we have no
+ reason to require this interface, which is most useful for simple
+ applications capturing still images.</para>
+       </footnote> When reading or writing is supported, the driver
+ must also support the &func-select; and &func-poll;
+ function.<footnote>
+       <para>At the driver level <function>select()</function> and
+ <function>poll()</function> are the same, and
+ <function>select()</function> is too important to be optional.</para>
+       </footnote></para>
+   </section>
+   <section id="mmap">
+     <title>Streaming I/O (Memory Mapping)</title>
+     <para>Input and output devices support this I/O method when the
+ <constant>V4L2_CAP_STREAMING</constant> flag in the
+ <structfield>capabilities</structfield> field of &v4l2-capability;
+ returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two
+ streaming methods, to determine if the memory mapping flavor is
+ supported applications must call the &VIDIOC-REQBUFS; ioctl.</para>
+     <para>Streaming is an I/O method where only pointers to buffers
+ are exchanged between application and driver, the data itself is not
+ copied. Memory mapping is primarily intended to map buffers in device
+ memory into the application's address space. Device memory can be for
+ example the video memory on a graphics card with a video capture
+ add-on. However, being the most efficient I/O method available for a
+ long time, many other drivers support streaming as well, allocating
+ buffers in DMA-able main memory.</para>
+     <para>A driver can support many sets of buffers. Each set is
+ identified by a unique buffer type value. The sets are independent and
+ each set can hold a different type of data. To access different sets
+ at the same time different file descriptors must be used.<footnote>
+       <para>One could use one file descriptor and set the buffer
+ type field accordingly when calling &VIDIOC-QBUF; etc., but it makes
+ the <function>select()</function> function ambiguous. We also like the
+ clean approach of one file descriptor per logical stream. Video
+ overlay for example is also a logical stream, although the CPU is not
+ needed for continuous operation.</para>
+       </footnote></para>
+     <para>To allocate device buffers applications call the
+ &VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer
+ type, for example <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>.
+ This ioctl can also be used to change the number of buffers or to free
+ the allocated memory, provided none of the buffers are still
+ mapped.</para>
+     <para>Before applications can access the buffers they must map
+ them into their address space with the &func-mmap; function. The
+ location of the buffers in device memory can be determined with the
+ &VIDIOC-QUERYBUF; ioctl. In the single-planar API case, the
+ <structfield>m.offset</structfield> and <structfield>length</structfield>
+ returned in a &v4l2-buffer; are passed as sixth and second parameter to the
+ <function>mmap()</function> function. When using the multi-planar API,
+ struct &v4l2-buffer; contains an array of &v4l2-plane; structures, each
+ containing its own <structfield>m.offset</structfield> and
+ <structfield>length</structfield>. When using the multi-planar API, every
+ plane of every buffer has to be mapped separately, so the number of
+ calls to &func-mmap; should be equal to number of buffers times number of
+ planes in each buffer. The offset and length values must not be modified.
+ Remember, the buffers are allocated in physical memory, as opposed to virtual
+ memory, which can be swapped out to disk. Applications should free the buffers
+ as soon as possible with the &func-munmap; function.</para>
+     <example>
+       <title>Mapping buffers in the single-planar API</title>
+       <programlisting>
+ &v4l2-requestbuffers; reqbuf;
+ struct {
+       void *start;
+       size_t length;
+ } *buffers;
+ unsigned int i;
+ memset(&amp;reqbuf, 0, sizeof(reqbuf));
+ reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ reqbuf.memory = V4L2_MEMORY_MMAP;
+ reqbuf.count = 20;
+ if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf)) {
+       if (errno == EINVAL)
+               printf("Video capturing or mmap-streaming is not supported\n");
+       else
+               perror("VIDIOC_REQBUFS");
+       exit(EXIT_FAILURE);
+ }
+ /* We want at least five buffers. */
+ if (reqbuf.count &lt; 5) {
+       /* You may need to free the buffers here. */
+       printf("Not enough buffer memory\n");
+       exit(EXIT_FAILURE);
+ }
+ buffers = calloc(reqbuf.count, sizeof(*buffers));
+ assert(buffers != NULL);
+ for (i = 0; i &lt; reqbuf.count; i++) {
+       &v4l2-buffer; buffer;
+       memset(&amp;buffer, 0, sizeof(buffer));
+       buffer.type = reqbuf.type;
+       buffer.memory = V4L2_MEMORY_MMAP;
+       buffer.index = i;
+       if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &amp;buffer)) {
+               perror("VIDIOC_QUERYBUF");
+               exit(EXIT_FAILURE);
+       }
+       buffers[i].length = buffer.length; /* remember for munmap() */
+       buffers[i].start = mmap(NULL, buffer.length,
+                               PROT_READ | PROT_WRITE, /* recommended */
+                               MAP_SHARED,             /* recommended */
+                               fd, buffer.m.offset);
+       if (MAP_FAILED == buffers[i].start) {
+               /* If you do not exit here you should unmap() and free()
+                  the buffers mapped so far. */
+               perror("mmap");
+               exit(EXIT_FAILURE);
+       }
+ }
+ /* Cleanup. */
+ for (i = 0; i &lt; reqbuf.count; i++)
+       munmap(buffers[i].start, buffers[i].length);
+       </programlisting>
+     </example>
+     <example>
+       <title>Mapping buffers in the multi-planar API</title>
+       <programlisting>
+ &v4l2-requestbuffers; reqbuf;
+ /* Our current format uses 3 planes per buffer */
++#define FMT_NUM_PLANES = 3
+ struct {
+       void *start[FMT_NUM_PLANES];
+       size_t length[FMT_NUM_PLANES];
+ } *buffers;
+ unsigned int i, j;
+ memset(&amp;reqbuf, 0, sizeof(reqbuf));
+ reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ reqbuf.memory = V4L2_MEMORY_MMAP;
+ reqbuf.count = 20;
+ if (ioctl(fd, &VIDIOC-REQBUFS;, &amp;reqbuf) &lt; 0) {
+       if (errno == EINVAL)
+               printf("Video capturing or mmap-streaming is not supported\n");
+       else
+               perror("VIDIOC_REQBUFS");
+       exit(EXIT_FAILURE);
+ }
+ /* We want at least five buffers. */
+ if (reqbuf.count &lt; 5) {
+       /* You may need to free the buffers here. */
+       printf("Not enough buffer memory\n");
+       exit(EXIT_FAILURE);
+ }
+ buffers = calloc(reqbuf.count, sizeof(*buffers));
+ assert(buffers != NULL);
+ for (i = 0; i &lt; reqbuf.count; i++) {
+       &v4l2-buffer; buffer;
+       &v4l2-plane; planes[FMT_NUM_PLANES];
+       memset(&amp;buffer, 0, sizeof(buffer));
+       buffer.type = reqbuf.type;
+       buffer.memory = V4L2_MEMORY_MMAP;
+       buffer.index = i;
+       /* length in struct v4l2_buffer in multi-planar API stores the size
+        * of planes array. */
+       buffer.length = FMT_NUM_PLANES;
+       buffer.m.planes = planes;
+       if (ioctl(fd, &VIDIOC-QUERYBUF;, &amp;buffer) &lt; 0) {
+               perror("VIDIOC_QUERYBUF");
+               exit(EXIT_FAILURE);
+       }
+       /* Every plane has to be mapped separately */
+       for (j = 0; j &lt; FMT_NUM_PLANES; j++) {
+               buffers[i].length[j] = buffer.m.planes[j].length; /* remember for munmap() */
+               buffers[i].start[j] = mmap(NULL, buffer.m.planes[j].length,
+                                PROT_READ | PROT_WRITE, /* recommended */
+                                MAP_SHARED,             /* recommended */
+                                fd, buffer.m.planes[j].m.offset);
+               if (MAP_FAILED == buffers[i].start[j]) {
+                       /* If you do not exit here you should unmap() and free()
+                          the buffers and planes mapped so far. */
+                       perror("mmap");
+                       exit(EXIT_FAILURE);
+               }
+       }
+ }
+ /* Cleanup. */
+ for (i = 0; i &lt; reqbuf.count; i++)
+       for (j = 0; j &lt; FMT_NUM_PLANES; j++)
+               munmap(buffers[i].start[j], buffers[i].length[j]);
+       </programlisting>
+     </example>
+     <para>Conceptually streaming drivers maintain two buffer queues, an incoming
+ and an outgoing queue. They separate the synchronous capture or output
+ operation locked to a video clock from the application which is
+ subject to random disk or network delays and preemption by
+ other processes, thereby reducing the probability of data loss.
+ The queues are organized as FIFOs, buffers will be
+ output in the order enqueued in the incoming FIFO, and were
+ captured in the order dequeued from the outgoing FIFO.</para>
+     <para>The driver may require a minimum number of buffers enqueued
+ at all times to function, apart of this no limit exists on the number
+ of buffers applications can enqueue in advance, or dequeue and
+ process. They can also enqueue in a different order than buffers have
+ been dequeued, and the driver can <emphasis>fill</emphasis> enqueued
+ <emphasis>empty</emphasis> buffers in any order. <footnote>
+       <para>Random enqueue order permits applications processing
+ images out of order (such as video codecs) to return buffers earlier,
+ reducing the probability of data loss. Random fill order allows
+ drivers to reuse buffers on a LIFO-basis, taking advantage of caches
+ holding scatter-gather lists and the like.</para>
+       </footnote> The index number of a buffer (&v4l2-buffer;
+ <structfield>index</structfield>) plays no role here, it only
+ identifies the buffer.</para>
+     <para>Initially all mapped buffers are in dequeued state,
+ inaccessible by the driver. For capturing applications it is customary
+ to first enqueue all mapped buffers, then to start capturing and enter
+ the read loop. Here the application waits until a filled buffer can be
+ dequeued, and re-enqueues the buffer when the data is no longer
+ needed. Output applications fill and enqueue buffers, when enough
+ buffers are stacked up the output is started with
+ <constant>VIDIOC_STREAMON</constant>. In the write loop, when
+ the application runs out of free buffers, it must wait until an empty
+ buffer can be dequeued and reused.</para>
+     <para>To enqueue and dequeue a buffer applications use the
+ &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being
+ mapped, enqueued, full or empty can be determined at any time using the
+ &VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the
+ application until one or more buffers can be dequeued. By default
+ <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
+ outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
+ given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
+ returns immediately with an &EAGAIN; when no buffer is available. The
+ &func-select; or &func-poll; function are always available.</para>
+     <para>To start and stop capturing or output applications call the
+ &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
+ <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
+ queues as a side effect. Since there is no notion of doing anything
+ "now" on a multitasking system, if an application needs to synchronize
+ with another event it should examine the &v4l2-buffer;
+ <structfield>timestamp</structfield> of captured buffers, or set the
+ field before enqueuing buffers for output.</para>
+     <para>Drivers implementing memory mapping I/O must
+ support the <constant>VIDIOC_REQBUFS</constant>,
+ <constant>VIDIOC_QUERYBUF</constant>,
+ <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
+ <constant>VIDIOC_STREAMON</constant> and
+ <constant>VIDIOC_STREAMOFF</constant> ioctl, the
+ <function>mmap()</function>, <function>munmap()</function>,
+ <function>select()</function> and <function>poll()</function>
+ function.<footnote>
+       <para>At the driver level <function>select()</function> and
+ <function>poll()</function> are the same, and
+ <function>select()</function> is too important to be optional. The
+ rest should be evident.</para>
+       </footnote></para>
+     <para>[capture example]</para>
+   </section>
+   <section id="userp">
+     <title>Streaming I/O (User Pointers)</title>
+     <para>Input and output devices support this I/O method when the
+ <constant>V4L2_CAP_STREAMING</constant> flag in the
+ <structfield>capabilities</structfield> field of &v4l2-capability;
+ returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user
+ pointer method (not only memory mapping) is supported must be
+ determined by calling the &VIDIOC-REQBUFS; ioctl.</para>
+     <para>This I/O method combines advantages of the read/write and
+ memory mapping methods. Buffers (planes) are allocated by the application
+ itself, and can reside for example in virtual or shared memory. Only
+ pointers to data are exchanged, these pointers and meta-information
+ are passed in &v4l2-buffer; (or in &v4l2-plane; in the multi-planar API case).
+ The driver must be switched into user pointer I/O mode by calling the
+ &VIDIOC-REQBUFS; with the desired buffer type. No buffers (planes) are allocated
+ beforehand, consequently they are not indexed and cannot be queried like mapped
+ buffers with the <constant>VIDIOC_QUERYBUF</constant> ioctl.</para>
+     <example>
+       <title>Initiating streaming I/O with user pointers</title>
+       <programlisting>
+ &v4l2-requestbuffers; reqbuf;
+ memset (&amp;reqbuf, 0, sizeof (reqbuf));
+ reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ reqbuf.memory = V4L2_MEMORY_USERPTR;
+ if (ioctl (fd, &VIDIOC-REQBUFS;, &amp;reqbuf) == -1) {
+       if (errno == EINVAL)
+               printf ("Video capturing or user pointer streaming is not supported\n");
+       else
+               perror ("VIDIOC_REQBUFS");
+       exit (EXIT_FAILURE);
+ }
+       </programlisting>
+     </example>
+     <para>Buffer (plane) addresses and sizes are passed on the fly with the
+ &VIDIOC-QBUF; ioctl. Although buffers are commonly cycled,
+ applications can pass different addresses and sizes at each
+ <constant>VIDIOC_QBUF</constant> call. If required by the hardware the
+ driver swaps memory pages within physical memory to create a
+ continuous area of memory. This happens transparently to the
+ application in the virtual memory subsystem of the kernel. When buffer
+ pages have been swapped out to disk they are brought back and finally
+ locked in physical memory for DMA.<footnote>
+       <para>We expect that frequently used buffers are typically not
+ swapped out. Anyway, the process of swapping, locking or generating
+ scatter-gather lists may be time consuming. The delay can be masked by
+ the depth of the incoming buffer queue, and perhaps by maintaining
+ caches assuming a buffer will be soon enqueued again. On the other
+ hand, to optimize memory usage drivers can limit the number of buffers
+ locked in advance and recycle the most recently used buffers first. Of
+ course, the pages of empty buffers in the incoming queue need not be
+ saved to disk. Output buffers must be saved on the incoming and
+ outgoing queue because an application may share them with other
+ processes.</para>
+       </footnote></para>
+     <para>Filled or displayed buffers are dequeued with the
+ &VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any
+ time between the completion of the DMA and this ioctl. The memory is
+ also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or
+ when the device is closed. Applications must take care not to free
+ buffers without dequeuing. For once, the buffers remain locked until
+ further, wasting physical memory. Second the driver will not be
+ notified when the memory is returned to the application's free list
+ and subsequently reused for other purposes, possibly completing the
+ requested DMA and overwriting valuable data.</para>
+     <para>For capturing applications it is customary to enqueue a
+ number of empty buffers, to start capturing and enter the read loop.
+ Here the application waits until a filled buffer can be dequeued, and
+ re-enqueues the buffer when the data is no longer needed. Output
+ applications fill and enqueue buffers, when enough buffers are stacked
+ up output is started. In the write loop, when the application
+ runs out of free buffers it must wait until an empty buffer can be
+ dequeued and reused. Two methods exist to suspend execution of the
+ application until one or more buffers can be dequeued. By default
+ <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the
+ outgoing queue. When the <constant>O_NONBLOCK</constant> flag was
+ given to the &func-open; function, <constant>VIDIOC_DQBUF</constant>
+ returns immediately with an &EAGAIN; when no buffer is available. The
+ &func-select; or &func-poll; function are always available.</para>
+     <para>To start and stop capturing or output applications call the
+ &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note
+ <constant>VIDIOC_STREAMOFF</constant> removes all buffers from both
+ queues and unlocks all buffers as a side effect. Since there is no
+ notion of doing anything "now" on a multitasking system, if an
+ application needs to synchronize with another event it should examine
+ the &v4l2-buffer; <structfield>timestamp</structfield> of captured
+ buffers, or set the field before enqueuing buffers for output.</para>
+     <para>Drivers implementing user pointer I/O must
+ support the <constant>VIDIOC_REQBUFS</constant>,
+ <constant>VIDIOC_QBUF</constant>, <constant>VIDIOC_DQBUF</constant>,
+ <constant>VIDIOC_STREAMON</constant> and
+ <constant>VIDIOC_STREAMOFF</constant> ioctl, the
+ <function>select()</function> and <function>poll()</function> function.<footnote>
+       <para>At the driver level <function>select()</function> and
+ <function>poll()</function> are the same, and
+ <function>select()</function> is too important to be optional. The
+ rest should be evident.</para>
+       </footnote></para>
+   </section>
+   <section id="async">
+     <title>Asynchronous I/O</title>
+     <para>This method is not defined yet.</para>
+   </section>
+   <section id="buffer">
+     <title>Buffers</title>
+     <para>A buffer contains data exchanged by application and
+ driver using one of the Streaming I/O methods. In the multi-planar API, the
+ data is held in planes, while the buffer structure acts as a container
+ for the planes. Only pointers to buffers (planes) are exchanged, the data
+ itself is not copied. These pointers, together with meta-information like
+ timestamps or field parity, are stored in a struct
+ <structname>v4l2_buffer</structname>, argument to
+ the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl.
+ In the multi-planar API, some plane-specific members of struct
+ <structname>v4l2_buffer</structname>, such as pointers and sizes for each
+ plane, are stored in struct <structname>v4l2_plane</structname> instead.
+ In that case, struct <structname>v4l2_buffer</structname> contains an array of
+ plane structures.</para>
+       <para>Nominally timestamps refer to the first data byte transmitted.
+ In practice however the wide range of hardware covered by the V4L2 API
+ limits timestamp accuracy. Often an interrupt routine will
+ sample the system clock shortly after the field or frame was stored
+ completely in memory. So applications must expect a constant
+ difference up to one field or frame period plus a small (few scan
+ lines) random error. The delay and error can be much
+ larger due to compression or transmission over an external bus when
+ the frames are not properly stamped by the sender. This is frequently
+ the case with USB cameras. Here timestamps refer to the instant the
+ field or frame was received by the driver, not the capture time. These
+ devices identify by not enumerating any video standards, see <xref
+ linkend="standard" />.</para>
+       <para>Similar limitations apply to output timestamps. Typically
+ the video hardware locks to a clock controlling the video timing, the
+ horizontal and vertical synchronization pulses. At some point in the
+ line sequence, possibly the vertical blanking, an interrupt routine
+ samples the system clock, compares against the timestamp and programs
+ the hardware to repeat the previous field or frame, or to display the
+ buffer contents.</para>
+       <para>Apart of limitations of the video device and natural
+ inaccuracies of all clocks, it should be noted system time itself is
+ not perfectly stable. It can be affected by power saving cycles,
+ warped to insert leap seconds, or even turned back or forth by the
+ system administrator affecting long term measurements. <footnote>
+         <para>Since no other Linux multimedia
+ API supports unadjusted time it would be foolish to introduce here. We
+ must use a universally supported clock to synchronize different media,
+ hence time of day.</para>
+       </footnote></para>
+     <table frame="none" pgwide="1" id="v4l2-buffer">
+       <title>struct <structname>v4l2_buffer</structname></title>
+       <tgroup cols="4">
+       &cs-ustr;
+       <tbody valign="top">
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>index</structfield></entry>
+           <entry></entry>
+           <entry>Number of the buffer, set by the application. This
+ field is only used for <link linkend="mmap">memory mapping</link> I/O
+ and can range from zero to the number of buffers allocated
+ with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry>
+         </row>
+         <row>
+           <entry>&v4l2-buf-type;</entry>
+           <entry><structfield>type</structfield></entry>
+           <entry></entry>
+           <entry>Type of the buffer, same as &v4l2-format;
+ <structfield>type</structfield> or &v4l2-requestbuffers;
+ <structfield>type</structfield>, set by the application.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>bytesused</structfield></entry>
+           <entry></entry>
+           <entry>The number of bytes occupied by the data in the
+ buffer. It depends on the negotiated data format and may change with
+ each buffer for compressed variable size data like JPEG images.
+ Drivers must set this field when <structfield>type</structfield>
+ refers to an input stream, applications when an output stream.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>flags</structfield></entry>
+           <entry></entry>
+           <entry>Flags set by the application or driver, see <xref
+ linkend="buffer-flags" />.</entry>
+         </row>
+         <row>
+           <entry>&v4l2-field;</entry>
+           <entry><structfield>field</structfield></entry>
+           <entry></entry>
+           <entry>Indicates the field order of the image in the
+ buffer, see <xref linkend="v4l2-field" />. This field is not used when
+ the buffer contains VBI data. Drivers must set it when
+ <structfield>type</structfield> refers to an input stream,
+ applications when an output stream.</entry>
+         </row>
+         <row>
+           <entry>struct timeval</entry>
+           <entry><structfield>timestamp</structfield></entry>
+           <entry></entry>
+           <entry><para>For input streams this is the
+ system time (as returned by the <function>gettimeofday()</function>
+ function) when the first data byte was captured. For output streams
+ the data will not be displayed before this time, secondary to the
+ nominal frame rate determined by the current video standard in
+ enqueued order. Applications can for example zero this field to
+ display frames as soon as possible. The driver stores the time at
+ which the first data byte was actually sent out in the
+ <structfield>timestamp</structfield> field. This permits
+ applications to monitor the drift between the video and system
+ clock.</para></entry>
+         </row>
+         <row>
+           <entry>&v4l2-timecode;</entry>
+           <entry><structfield>timecode</structfield></entry>
+           <entry></entry>
+           <entry>When <structfield>type</structfield> is
+ <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> and the
+ <constant>V4L2_BUF_FLAG_TIMECODE</constant> flag is set in
+ <structfield>flags</structfield>, this structure contains a frame
+ timecode. In <link linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link>
+ mode the top and bottom field contain the same timecode.
+ Timecodes are intended to help video editing and are typically recorded on
+ video tapes, but also embedded in compressed formats like MPEG. This
+ field is independent of the <structfield>timestamp</structfield> and
+ <structfield>sequence</structfield> fields.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>sequence</structfield></entry>
+           <entry></entry>
+           <entry>Set by the driver, counting the frames in the
+ sequence.</entry>
+         </row>
+         <row>
+           <entry spanname="hspan"><para>In <link
+ linkend="v4l2-field">V4L2_FIELD_ALTERNATE</link> mode the top and
+ bottom field have the same sequence number. The count starts at zero
+ and includes dropped or repeated frames. A dropped frame was received
+ by an input device but could not be stored due to lack of free buffer
+ space. A repeated frame was displayed again by an output device
+ because the application did not pass new data in
+ time.</para><para>Note this may count the frames received
+ e.g. over USB, without taking into account the frames dropped by the
+ remote hardware due to limited compression throughput or bus
+ bandwidth. These devices identify by not enumerating any video
+ standards, see <xref linkend="standard" />.</para></entry>
+         </row>
+         <row>
+           <entry>&v4l2-memory;</entry>
+           <entry><structfield>memory</structfield></entry>
+           <entry></entry>
+           <entry>This field must be set by applications and/or drivers
+ in accordance with the selected I/O method.</entry>
+         </row>
+         <row>
+           <entry>union</entry>
+           <entry><structfield>m</structfield></entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>__u32</entry>
+           <entry><structfield>offset</structfield></entry>
+           <entry>For the single-planar API and when
+ <structfield>memory</structfield> is <constant>V4L2_MEMORY_MMAP</constant> this
+ is the offset of the buffer from the start of the device memory. The value is
+ returned by the driver and apart of serving as parameter to the &func-mmap;
+ function not useful for applications. See <xref linkend="mmap" /> for details
+         </entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>unsigned long</entry>
+           <entry><structfield>userptr</structfield></entry>
+           <entry>For the single-planar API and when
+ <structfield>memory</structfield> is <constant>V4L2_MEMORY_USERPTR</constant>
+ this is a pointer to the buffer (casted to unsigned long type) in virtual
+ memory, set by the application. See <xref linkend="userp" /> for details.
+           </entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>struct v4l2_plane</entry>
+           <entry><structfield>*planes</structfield></entry>
+           <entry>When using the multi-planar API, contains a userspace pointer
+           to an array of &v4l2-plane;. The size of the array should be put
+           in the <structfield>length</structfield> field of this
+           <structname>v4l2_buffer</structname> structure.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>length</structfield></entry>
+           <entry></entry>
+           <entry>Size of the buffer (not the payload) in bytes for the
+           single-planar API. For the multi-planar API should contain the
+           number of elements in the <structfield>planes</structfield> array.
+           </entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>input</structfield></entry>
+           <entry></entry>
+           <entry>Some video capture drivers support rapid and
+ synchronous video input changes, a function useful for example in
+ video surveillance applications. For this purpose applications set the
+ <constant>V4L2_BUF_FLAG_INPUT</constant> flag, and this field to the
+ number of a video input as in &v4l2-input; field
+ <structfield>index</structfield>.</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>reserved</structfield></entry>
+           <entry></entry>
+           <entry>A place holder for future extensions and custom
+ (driver defined) buffer types
+ <constant>V4L2_BUF_TYPE_PRIVATE</constant> and higher. Applications
+ should set this to 0.</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <table frame="none" pgwide="1" id="v4l2-plane">
+       <title>struct <structname>v4l2_plane</structname></title>
+       <tgroup cols="4">
+         &cs-ustr;
+       <tbody valign="top">
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>bytesused</structfield></entry>
+           <entry></entry>
+           <entry>The number of bytes occupied by data in the plane
+           (its payload).</entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>length</structfield></entry>
+           <entry></entry>
+           <entry>Size in bytes of the plane (not its payload).</entry>
+         </row>
+         <row>
+           <entry>union</entry>
+           <entry><structfield>m</structfield></entry>
+           <entry></entry>
+           <entry></entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>__u32</entry>
+           <entry><structfield>mem_offset</structfield></entry>
+           <entry>When the memory type in the containing &v4l2-buffer; is
+             <constant>V4L2_MEMORY_MMAP</constant>, this is the value that
+             should be passed to &func-mmap;, similar to the
+             <structfield>offset</structfield> field in &v4l2-buffer;.</entry>
+         </row>
+         <row>
+           <entry></entry>
+           <entry>__unsigned long</entry>
+           <entry><structfield>userptr</structfield></entry>
+           <entry>When the memory type in the containing &v4l2-buffer; is
+             <constant>V4L2_MEMORY_USERPTR</constant>, this is a userspace
+             pointer to the memory allocated for this plane by an application.
+             </entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>data_offset</structfield></entry>
+           <entry></entry>
+           <entry>Offset in bytes to video data in the plane, if applicable.
+           </entry>
+         </row>
+         <row>
+           <entry>__u32</entry>
+           <entry><structfield>reserved[11]</structfield></entry>
+           <entry></entry>
+           <entry>Reserved for future use. Should be zeroed by an
+           application.</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <table frame="none" pgwide="1" id="v4l2-buf-type">
+       <title>enum v4l2_buf_type</title>
+       <tgroup cols="3">
+       &cs-def;
+       <tbody valign="top">
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant></entry>
+           <entry>1</entry>
+           <entry>Buffer of a single-planar video capture stream, see <xref
+               linkend="capture" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>
+           </entry>
+           <entry>9</entry>
+           <entry>Buffer of a multi-planar video capture stream, see <xref
+               linkend="capture" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant></entry>
+           <entry>2</entry>
+           <entry>Buffer of a single-planar video output stream, see <xref
+               linkend="output" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>
+           </entry>
+           <entry>10</entry>
+           <entry>Buffer of a multi-planar video output stream, see <xref
+               linkend="output" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant></entry>
+           <entry>3</entry>
+           <entry>Buffer for video overlay, see <xref linkend="overlay" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VBI_CAPTURE</constant></entry>
+           <entry>4</entry>
+           <entry>Buffer of a raw VBI capture stream, see <xref
+               linkend="raw-vbi" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VBI_OUTPUT</constant></entry>
+           <entry>5</entry>
+           <entry>Buffer of a raw VBI output stream, see <xref
+               linkend="raw-vbi" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant></entry>
+           <entry>6</entry>
+           <entry>Buffer of a sliced VBI capture stream, see <xref
+               linkend="sliced" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant></entry>
+           <entry>7</entry>
+           <entry>Buffer of a sliced VBI output stream, see <xref
+               linkend="sliced" />.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant></entry>
+           <entry>8</entry>
+           <entry>Buffer for video output overlay (OSD), see <xref
+               linkend="osd" />. Status: <link
+ linkend="experimental">Experimental</link>.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_TYPE_PRIVATE</constant></entry>
+           <entry>0x80</entry>
+         <entry>This and higher values are reserved for custom
+ (driver defined) buffer types.</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <table frame="none" pgwide="1" id="buffer-flags">
+       <title>Buffer Flags</title>
+       <tgroup cols="3">
+       &cs-def;
+       <tbody valign="top">
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_MAPPED</constant></entry>
+           <entry>0x0001</entry>
+           <entry>The buffer resides in device memory and has been mapped
+ into the application's address space, see <xref linkend="mmap" /> for details.
+ Drivers set or clear this flag when the
+ <link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link
+         linkend="vidioc-qbuf">VIDIOC_QBUF</link> or <link
+         linkend="vidioc-qbuf">VIDIOC_DQBUF</link> ioctl is called. Set by the driver.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_QUEUED</constant></entry>
+           <entry>0x0002</entry>
+         <entry>Internally drivers maintain two buffer queues, an
+ incoming and outgoing queue. When this flag is set, the buffer is
+ currently on the incoming queue. It automatically moves to the
+ outgoing queue after the buffer has been filled (capture devices) or
+ displayed (output devices). Drivers set or clear this flag when the
+ <constant>VIDIOC_QUERYBUF</constant> ioctl is called. After
+ (successful) calling the <constant>VIDIOC_QBUF </constant>ioctl it is
+ always set and after <constant>VIDIOC_DQBUF</constant> always
+ cleared.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_DONE</constant></entry>
+           <entry>0x0004</entry>
+           <entry>When this flag is set, the buffer is currently on
+ the outgoing queue, ready to be dequeued from the driver. Drivers set
+ or clear this flag when the <constant>VIDIOC_QUERYBUF</constant> ioctl
+ is called. After calling the <constant>VIDIOC_QBUF</constant> or
+ <constant>VIDIOC_DQBUF</constant> it is always cleared. Of course a
+ buffer cannot be on both queues at the same time, the
+ <constant>V4L2_BUF_FLAG_QUEUED</constant> and
+ <constant>V4L2_BUF_FLAG_DONE</constant> flag are mutually exclusive.
+ They can be both cleared however, then the buffer is in "dequeued"
+ state, in the application domain to say so.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry>
+           <entry>0x0040</entry>
+           <entry>When this flag is set, the buffer has been dequeued
+           successfully, although the data might have been corrupted.
+           This is recoverable, streaming may continue as normal and
+           the buffer may be reused normally.
+           Drivers set this flag when the <constant>VIDIOC_DQBUF</constant>
+           ioctl is called.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry>
+           <entry>0x0008</entry>
+         <entry>Drivers set or clear this flag when calling the
+ <constant>VIDIOC_DQBUF</constant> ioctl. It may be set by video
+ capture devices when the buffer contains a compressed image which is a
+ key frame (or field), &ie; can be decompressed on its own.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_PFRAME</constant></entry>
+           <entry>0x0010</entry>
+           <entry>Similar to <constant>V4L2_BUF_FLAG_KEYFRAME</constant>
+ this flags predicted frames or fields which contain only differences to a
+ previous key frame.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_BFRAME</constant></entry>
+           <entry>0x0020</entry>
+           <entry>Similar to <constant>V4L2_BUF_FLAG_PFRAME</constant>
+       this is a bidirectional predicted frame or field. [ooc tbd]</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_TIMECODE</constant></entry>
+           <entry>0x0100</entry>
+           <entry>The <structfield>timecode</structfield> field is valid.
+ Drivers set or clear this flag when the <constant>VIDIOC_DQBUF</constant>
+ ioctl is called.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_BUF_FLAG_INPUT</constant></entry>
+           <entry>0x0200</entry>
+           <entry>The <structfield>input</structfield> field is valid.
+ Applications set or clear this flag before calling the
+ <constant>VIDIOC_QBUF</constant> ioctl.</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <table pgwide="1" frame="none" id="v4l2-memory">
+       <title>enum v4l2_memory</title>
+       <tgroup cols="3">
+       &cs-def;
+       <tbody valign="top">
+         <row>
+           <entry><constant>V4L2_MEMORY_MMAP</constant></entry>
+           <entry>1</entry>
+           <entry>The buffer is used for <link linkend="mmap">memory
+ mapping</link> I/O.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_MEMORY_USERPTR</constant></entry>
+           <entry>2</entry>
+           <entry>The buffer is used for <link linkend="userp">user
+ pointer</link> I/O.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_MEMORY_OVERLAY</constant></entry>
+           <entry>3</entry>
+           <entry>[to do]</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <section>
+       <title>Timecodes</title>
+       <para>The <structname>v4l2_timecode</structname> structure is
+ designed to hold a <xref linkend="smpte12m" /> or similar timecode.
+ (struct <structname>timeval</structname> timestamps are stored in
+ &v4l2-buffer; field <structfield>timestamp</structfield>.)</para>
+       <table frame="none" pgwide="1" id="v4l2-timecode">
+       <title>struct <structname>v4l2_timecode</structname></title>
+       <tgroup cols="3">
+         &cs-str;
+         <tbody valign="top">
+           <row>
+             <entry>__u32</entry>
+             <entry><structfield>type</structfield></entry>
+             <entry>Frame rate the timecodes are based on, see <xref
+                 linkend="timecode-type" />.</entry>
+           </row>
+           <row>
+             <entry>__u32</entry>
+             <entry><structfield>flags</structfield></entry>
+             <entry>Timecode flags, see <xref linkend="timecode-flags" />.</entry>
+           </row>
+           <row>
+             <entry>__u8</entry>
+             <entry><structfield>frames</structfield></entry>
+             <entry>Frame count, 0 ... 23/24/29/49/59, depending on the
+           type of timecode.</entry>
+           </row>
+           <row>
+             <entry>__u8</entry>
+             <entry><structfield>seconds</structfield></entry>
+             <entry>Seconds count, 0 ... 59. This is a binary, not BCD number.</entry>
+           </row>
+           <row>
+             <entry>__u8</entry>
+             <entry><structfield>minutes</structfield></entry>
+             <entry>Minutes count, 0 ... 59. This is a binary, not BCD number.</entry>
+           </row>
+           <row>
+             <entry>__u8</entry>
+             <entry><structfield>hours</structfield></entry>
+             <entry>Hours count, 0 ... 29. This is a binary, not BCD number.</entry>
+           </row>
+           <row>
+             <entry>__u8</entry>
+             <entry><structfield>userbits</structfield>[4]</entry>
+             <entry>The "user group" bits from the timecode.</entry>
+           </row>
+         </tbody>
+       </tgroup>
+       </table>
+       <table frame="none" pgwide="1" id="timecode-type">
+       <title>Timecode Types</title>
+       <tgroup cols="3">
+       &cs-def;
+         <tbody valign="top">
+           <row>
+             <entry><constant>V4L2_TC_TYPE_24FPS</constant></entry>
+             <entry>1</entry>
+             <entry>24 frames per second, i.&nbsp;e. film.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_TYPE_25FPS</constant></entry>
+             <entry>2</entry>
+             <entry>25 frames per second, &ie; PAL or SECAM video.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_TYPE_30FPS</constant></entry>
+             <entry>3</entry>
+             <entry>30 frames per second, &ie; NTSC video.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_TYPE_50FPS</constant></entry>
+             <entry>4</entry>
+             <entry></entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_TYPE_60FPS</constant></entry>
+             <entry>5</entry>
+             <entry></entry>
+           </row>
+         </tbody>
+       </tgroup>
+       </table>
+       <table frame="none" pgwide="1" id="timecode-flags">
+       <title>Timecode Flags</title>
+       <tgroup cols="3">
+       &cs-def;
+         <tbody valign="top">
+           <row>
+             <entry><constant>V4L2_TC_FLAG_DROPFRAME</constant></entry>
+             <entry>0x0001</entry>
+             <entry>Indicates "drop frame" semantics for counting frames
+ in 29.97 fps material. When set, frame numbers 0 and 1 at the start of
+ each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the
+ count.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_FLAG_COLORFRAME</constant></entry>
+             <entry>0x0002</entry>
+             <entry>The "color frame" flag.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_USERBITS_field</constant></entry>
+             <entry>0x000C</entry>
+             <entry>Field mask for the "binary group flags".</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_USERBITS_USERDEFINED</constant></entry>
+             <entry>0x0000</entry>
+             <entry>Unspecified format.</entry>
+           </row>
+           <row>
+             <entry><constant>V4L2_TC_USERBITS_8BITCHARS</constant></entry>
+             <entry>0x0008</entry>
+             <entry>8-bit ISO characters.</entry>
+           </row>
+         </tbody>
+       </tgroup>
+       </table>
+     </section>
+   </section>
+   <section id="field-order">
+     <title>Field Order</title>
+     <para>We have to distinguish between progressive and interlaced
+ video. Progressive video transmits all lines of a video image
+ sequentially. Interlaced video divides an image into two fields,
+ containing only the odd and even lines of the image, respectively.
+ Alternating the so called odd and even field are transmitted, and due
+ to a small delay between fields a cathode ray TV displays the lines
+ interleaved, yielding the original frame. This curious technique was
+ invented because at refresh rates similar to film the image would
+ fade out too quickly. Transmitting fields reduces the flicker without
+ the necessity of doubling the frame rate and with it the bandwidth
+ required for each channel.</para>
+     <para>It is important to understand a video camera does not expose
+ one frame at a time, merely transmitting the frames separated into
+ fields. The fields are in fact captured at two different instances in
+ time. An object on screen may well move between one field and the
+ next. For applications analysing motion it is of paramount importance
+ to recognize which field of a frame is older, the <emphasis>temporal
+ order</emphasis>.</para>
+     <para>When the driver provides or accepts images field by field
+ rather than interleaved, it is also important applications understand
+ how the fields combine to frames. We distinguish between top (aka odd) and
+ bottom (aka even) fields, the <emphasis>spatial order</emphasis>: The first line
+ of the top field is the first line of an interlaced frame, the first
+ line of the bottom field is the second line of that frame.</para>
+     <para>However because fields were captured one after the other,
+ arguing whether a frame commences with the top or bottom field is
+ pointless. Any two successive top and bottom, or bottom and top fields
+ yield a valid frame. Only when the source was progressive to begin
+ with, &eg; when transferring film to video, two fields may come from
+ the same frame, creating a natural order.</para>
+     <para>Counter to intuition the top field is not necessarily the
+ older field. Whether the older field contains the top or bottom lines
+ is a convention determined by the video standard. Hence the
+ distinction between temporal and spatial order of fields. The diagrams
+ below should make this clearer.</para>
+     <para>All video capture and output devices must report the current
+ field order. Some drivers may permit the selection of a different
+ order, to this end applications initialize the
+ <structfield>field</structfield> field of &v4l2-pix-format; before
+ calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should
+ have the value <constant>V4L2_FIELD_ANY</constant> (0).</para>
+     <table frame="none" pgwide="1" id="v4l2-field">
+       <title>enum v4l2_field</title>
+       <tgroup cols="3">
+       &cs-def;
+       <tbody valign="top">
+         <row>
+           <entry><constant>V4L2_FIELD_ANY</constant></entry>
+           <entry>0</entry>
+           <entry>Applications request this field order when any
+ one of the <constant>V4L2_FIELD_NONE</constant>,
+ <constant>V4L2_FIELD_TOP</constant>,
+ <constant>V4L2_FIELD_BOTTOM</constant>, or
+ <constant>V4L2_FIELD_INTERLACED</constant> formats is acceptable.
+ Drivers choose depending on hardware capabilities or e.&nbsp;g. the
+ requested image size, and return the actual field order. &v4l2-buffer;
+ <structfield>field</structfield> can never be
+ <constant>V4L2_FIELD_ANY</constant>.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_NONE</constant></entry>
+           <entry>1</entry>
+           <entry>Images are in progressive format, not interlaced.
+ The driver may also indicate this order when it cannot distinguish
+ between <constant>V4L2_FIELD_TOP</constant> and
+ <constant>V4L2_FIELD_BOTTOM</constant>.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_TOP</constant></entry>
+           <entry>2</entry>
+           <entry>Images consist of the top (aka odd) field only.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_BOTTOM</constant></entry>
+           <entry>3</entry>
+           <entry>Images consist of the bottom (aka even) field only.
+ Applications may wish to prevent a device from capturing interlaced
+ images because they will have "comb" or "feathering" artefacts around
+ moving objects.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_INTERLACED</constant></entry>
+           <entry>4</entry>
+           <entry>Images contain both fields, interleaved line by
+ line. The temporal order of the fields (whether the top or bottom
+ field is first transmitted) depends on the current video standard.
+ M/NTSC transmits the bottom field first, all other standards the top
+ field first.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_SEQ_TB</constant></entry>
+           <entry>5</entry>
+           <entry>Images contain both fields, the top field lines
+ are stored first in memory, immediately followed by the bottom field
+ lines. Fields are always stored in temporal order, the older one first
+ in memory. Image sizes refer to the frame, not fields.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_SEQ_BT</constant></entry>
+           <entry>6</entry>
+           <entry>Images contain both fields, the bottom field
+ lines are stored first in memory, immediately followed by the top
+ field lines. Fields are always stored in temporal order, the older one
+ first in memory. Image sizes refer to the frame, not fields.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_ALTERNATE</constant></entry>
+           <entry>7</entry>
+           <entry>The two fields of a frame are passed in separate
+ buffers, in temporal order, &ie; the older one first. To indicate the field
+ parity (whether the current field is a top or bottom field) the driver
+ or application, depending on data direction, must set &v4l2-buffer;
+ <structfield>field</structfield> to
+ <constant>V4L2_FIELD_TOP</constant> or
+ <constant>V4L2_FIELD_BOTTOM</constant>. Any two successive fields pair
+ to build a frame. If fields are successive, without any dropped fields
+ between them (fields can drop individually), can be determined from
+ the &v4l2-buffer; <structfield>sequence</structfield> field. Image
+ sizes refer to the frame, not fields. This format cannot be selected
+ when using the read/write I/O method.<!-- Where it's indistinguishable
+ from V4L2_FIELD_SEQ_*. --></entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_INTERLACED_TB</constant></entry>
+           <entry>8</entry>
+           <entry>Images contain both fields, interleaved line by
+ line, top field first. The top field is transmitted first.</entry>
+         </row>
+         <row>
+           <entry><constant>V4L2_FIELD_INTERLACED_BT</constant></entry>
+           <entry>9</entry>
+           <entry>Images contain both fields, interleaved line by
+ line, top field first. The bottom field is transmitted first.</entry>
+         </row>
+       </tbody>
+       </tgroup>
+     </table>
+     <figure id="fieldseq-tb">
+       <title>Field Order, Top Field First Transmitted</title>
+       <mediaobject>
+         <imageobject>
+           <imagedata fileref="fieldseq_tb.pdf" format="PS" />
+         </imageobject>
+         <imageobject>
+           <imagedata fileref="fieldseq_tb.gif" format="GIF" />
+         </imageobject>
+       </mediaobject>
+     </figure>
+     <figure id="fieldseq-bt">
+       <title>Field Order, Bottom Field First Transmitted</title>
+       <mediaobject>
+         <imageobject>
+           <imagedata fileref="fieldseq_bt.pdf" format="PS" />
+         </imageobject>
+         <imageobject>
+           <imagedata fileref="fieldseq_bt.gif" format="GIF" />
+         </imageobject>
+       </mediaobject>
+     </figure>
+   </section>
+   <!--
+ Local Variables:
+ mode: sgml
+ sgml-parent-document: "v4l2.sgml"
+ indent-tabs-mode: nil
+ End:
+   -->
index dfd6a9f4a58338ea5cc5d42fede7b826382685dc,8a988e5708bac75feead9e53731a6cb2fb83c5d6..ea0bace0124ad7db95b43f3e8f30c872584bc66b
@@@ -184,7 -184,7 +184,7 @@@ Why:       /proc/<pid>/oom_adj allows userspa
  
        A much more powerful interface, /proc/<pid>/oom_score_adj, was
        introduced with the oom killer rewrite that allows users to increase or
 -      decrease the badness() score linearly.  This interface will replace
 +      decrease the badness score linearly.  This interface will replace
        /proc/<pid>/oom_adj.
  
        A warning will be emitted to the kernel log if an application uses this
  
  ---------------------------
  
 -What: CS5535/CS5536 obsolete GPIO driver
 -When: June 2011
 -Files:        drivers/staging/cs5535_gpio/*
 -Check:        drivers/staging/cs5535_gpio/cs5535_gpio.c
 -Why:  A newer driver replaces this; it is drivers/gpio/cs5535-gpio.c, and
 -      integrates with the Linux GPIO subsystem.  The old driver has been
 -      moved to staging, and will be removed altogether around 2.6.40.
 -      Please test the new driver, and ensure that the functionality you
 -      need and any bugfixes from the old driver are available in the new
 -      one.
 -Who:  Andres Salomon <[email protected]>
 -
 ---------------------------
 -
  What: remove EXPORT_SYMBOL(kernel_thread)
  When: August 2006
  Files:        arch/*/kernel/*_ksyms.c
@@@ -280,7 -294,7 +280,7 @@@ When:      The schedule was July 2008, but i
  Why:  The support code for the old firmware hurts code readability/maintainability
        and slightly hurts runtime performance. Bugfixes for the old firmware
        are not provided by Broadcom anymore.
 -Who:  Michael Buesch <m[email protected]>
 +Who:  Michael Buesch <m@bues.ch>
  
  ---------------------------
  
@@@ -416,7 -430,7 +416,7 @@@ Who:       Avi Kivity <[email protected]
  ----------------------------
  
  What: iwlwifi 50XX module parameters
 -When: 2.6.40
 +When: 3.0
  Why:  The "..50" modules parameters were used to configure 5000 series and
        up devices; different set of module parameters also available for 4965
        with same functionalities. Consolidate both set into single place
@@@ -427,7 -441,7 +427,7 @@@ Who:       Wey-Yi Guy <[email protected]
  ----------------------------
  
  What: iwl4965 alias support
 -When: 2.6.40
 +When: 3.0
  Why:  Internal alias support has been present in module-init-tools for some
        time, the MODULE_ALIAS("iwl4965") boilerplate aliases can be removed
        with no impact.
@@@ -460,8 -474,15 +460,8 @@@ Who:      FUJITA Tomonori <fujita.tomonori@l
  
  ----------------------------
  
 -What:         DMA_xxBIT_MASK macros
 -When: Jun 2011
 -Why:  DMA_xxBIT_MASK macros were replaced with DMA_BIT_MASK() macros.
 -Who:  FUJITA Tomonori <[email protected]>
 -
 -----------------------------
 -
  What: iwlwifi disable_hw_scan module parameters
 -When: 2.6.40
 +When: 3.0
  Why:  Hareware scan is the prefer method for iwlwifi devices for
        scanning operation. Remove software scan support for all the
        iwlwifi devices.
@@@ -470,6 -491,26 +470,6 @@@ Who:      Wey-Yi Guy <[email protected]
  
  ----------------------------
  
 -What:   access to nfsd auth cache through sys_nfsservctl or '.' files
 -        in the 'nfsd' filesystem.
 -When:   2.6.40
 -Why:    This is a legacy interface which have been replaced by a more
 -        dynamic cache.  Continuing to maintain this interface is an
 -        unnecessary burden.
 -Who:    NeilBrown <[email protected]>
 -
 -----------------------------
 -
 -What: cancel_rearming_delayed_work[queue]()
 -When: 2.6.39
 -
 -Why:  The functions have been superceded by cancel_delayed_work_sync()
 -      quite some time ago.  The conversion is trivial and there is no
 -      in-kernel user left.
 -Who:  Tejun Heo <[email protected]>
 -
 -----------------------------
 -
  What: Legacy, non-standard chassis intrusion detection interface.
  When: June 2011
  Why:  The adm9240, w83792d and w83793 hardware monitoring drivers have
@@@ -487,6 -528,22 +487,6 @@@ Files:    net/netfilter/xt_connlimit.
  
  ----------------------------
  
 -What: noswapaccount kernel command line parameter
 -When: 2.6.40
 -Why:  The original implementation of memsw feature enabled by
 -      CONFIG_CGROUP_MEM_RES_CTLR_SWAP could be disabled by the noswapaccount
 -      kernel parameter (introduced in 2.6.29-rc1). Later on, this decision
 -      turned out to be not ideal because we cannot have the feature compiled
 -      in and disabled by default and let only interested to enable it
 -      (e.g. general distribution kernels might need it). Therefore we have
 -      added swapaccount[=0|1] parameter (introduced in 2.6.37) which provides
 -      the both possibilities. If we remove noswapaccount we will have
 -      less command line parameters with the same functionality and we
 -      can also cleanup the parameter handling a bit ().
 -Who:  Michal Hocko <[email protected]>
 -
 -----------------------------
 -
  What: ipt_addrtype match include file
  When: 2012
  Why:  superseded by xt_addrtype
@@@ -505,7 -562,7 +505,7 @@@ Who:       Jean Delvare <[email protected]
  ----------------------------
  
  What: Support for UVCIOC_CTRL_ADD in the uvcvideo driver
 -When: 2.6.42
 +When: 3.2
  Why:  The information passed to the driver by this ioctl is now queried
        dynamically from the device.
  Who:  Laurent Pinchart <[email protected]>
  ----------------------------
  
  What: Support for UVCIOC_CTRL_MAP_OLD in the uvcvideo driver
 -When: 2.6.42
 +When: 3.2
  Why:  Used only by applications compiled against older driver versions.
        Superseded by UVCIOC_CTRL_MAP which supports V4L2 menu controls.
  Who:  Laurent Pinchart <[email protected]>
  ----------------------------
  
  What: Support for UVCIOC_CTRL_GET and UVCIOC_CTRL_SET in the uvcvideo driver
 -When: 2.6.42
 +When: 3.2
  Why:  Superseded by the UVCIOC_CTRL_QUERY ioctl.
  Who:  Laurent Pinchart <[email protected]>
  
  ----------------------------
  
+ What: Support for driver specific ioctls in the pwc driver (everything
+       defined in media/pwc-ioctl.h)
+ When: 3.3
+ Why:  This stems from the v4l1 era, with v4l2 everything can be done with
+       standardized v4l2 API calls
+ Who:  Hans de Goede <[email protected]>
+ ----------------------------
+ What: Driver specific sysfs API in the pwc driver
+ When: 3.3
+ Why:  Setting pan/tilt should be done with v4l2 controls, like with other
+       cams. The button is available as a standard input device
+ Who:  Hans de Goede <[email protected]>
+ ----------------------------
+ What: Driver specific use of pixfmt.priv in the pwc driver
+ When: 3.3
+ Why:  The .priv field never was intended for this, setting a framerate is
+       support using the standardized S_PARM ioctl
+ Who:  Hans de Goede <[email protected]>
+ ----------------------------
+ What: Software emulation of arbritary resolutions in the pwc driver
+ When: 3.3
+ Why:  The pwc driver claims to support any resolution between 160x120
+       and 640x480, but emulates this by simply drawing a black border
+       around the image. Userspace can draw its own black border if it
+       really wants one.
+ Who:  Hans de Goede <[email protected]>
+ ----------------------------
  What: For VIDIOC_S_FREQUENCY the type field must match the device node's type.
        If not, return -EINVAL.
  When: 3.2
@@@ -548,10 -640,3 +583,10 @@@ Why:     Just opening a V4L device should n
  Who:  Hans Verkuil <[email protected]>
  
  ----------------------------
 +
 +What: g_file_storage driver
 +When: 3.8
 +Why:  This driver has been superseded by g_mass_storage.
 +Who:  Alan Stern <[email protected]>
 +
 +----------------------------
index cc503aa89c5e3685b6cc5901a2329a67c6926d99,17e5685ae0cd1bd6720bd2307b058f589a4e92d6..5a886cd2c598c408f3e007e01a5f5e2b0ae9ca94
@@@ -39,7 -39,6 +39,7 @@@
  #include <sound/tpa6130a2-plat.h>
  #include <media/radio-si4713.h>
  #include <media/si4713.h>
 +#include <linux/leds-lp5523.h>
  
  #include <../drivers/staging/iio/light/tsl2563.h>
  
@@@ -54,7 -53,6 +54,7 @@@
  #define RX51_WL1251_IRQ_GPIO          42
  #define RX51_FMTX_RESET_GPIO          163
  #define RX51_FMTX_IRQ                 53
 +#define RX51_LP5523_CHIP_EN_GPIO      41
  
  #define RX51_USB_TRANSCEIVER_RST_GPIO 67
  
@@@ -73,64 -71,6 +73,64 @@@ static struct tsl2563_platform_data rx5
  };
  #endif
  
 +#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
 +static struct lp5523_led_config rx51_lp5523_led_config[] = {
 +      {
 +              .chan_nr        = 0,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 1,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 2,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 3,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 4,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 5,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 6,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 7,
 +              .led_current    = 50,
 +      }, {
 +              .chan_nr        = 8,
 +              .led_current    = 50,
 +      }
 +};
 +
 +static int rx51_lp5523_setup(void)
 +{
 +      return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
 +                      "lp5523_enable");
 +}
 +
 +static void rx51_lp5523_release(void)
 +{
 +      gpio_free(RX51_LP5523_CHIP_EN_GPIO);
 +}
 +
 +static void rx51_lp5523_enable(bool state)
 +{
 +      gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
 +}
 +
 +static struct lp5523_platform_data rx51_lp5523_platform_data = {
 +      .led_config             = rx51_lp5523_led_config,
 +      .num_channels           = ARRAY_SIZE(rx51_lp5523_led_config),
 +      .clock_mode             = LP5523_CLOCK_AUTO,
 +      .setup_resources        = rx51_lp5523_setup,
 +      .release_resources      = rx51_lp5523_release,
 +      .enable                 = rx51_lp5523_enable,
 +};
 +#endif
 +
  static struct omap2_mcspi_device_config wl1251_mcspi_config = {
        .turbo_mode     = 0,
        .single_channel = 1,
@@@ -348,6 -288,10 +348,6 @@@ static struct twl4030_keypad_data rx51_
        .rep            = 1,
  };
  
 -static struct twl4030_madc_platform_data rx51_madc_data = {
 -      .irq_line               = 1,
 -};
 -
  /* Enable input logic and pull all lines up when eMMC is on. */
  static struct omap_board_mux rx51_mmc2_on_mux[] = {
        OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
@@@ -414,17 -358,17 +414,21 @@@ static struct omap2_hsmmc_info mmc[] __
        {}      /* Terminator */
  };
  
 -static struct regulator_consumer_supply rx51_vmmc1_supply =
 -      REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
 +static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
 +      REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
 +};
  
 -static struct regulator_consumer_supply rx51_vaux2_supply =
 -      REGULATOR_SUPPLY("vdds_csib", "omap3isp");
++static struct regulator_consumer_supply rx51_vaux2_supply[] = {
++      REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
++};
 -static struct regulator_consumer_supply rx51_vaux3_supply =
 -      REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
 +static struct regulator_consumer_supply rx51_vaux3_supply[] = {
 +      REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
 +};
  
 -static struct regulator_consumer_supply rx51_vsim_supply =
 -      REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
 +static struct regulator_consumer_supply rx51_vsim_supply[] = {
 +      REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
 +};
  
  static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
        /* tlv320aic3x analog supplies */
@@@ -454,6 -398,10 +458,6 @@@ static struct regulator_consumer_suppl
        REGULATOR_SUPPLY("vdd", "2-0063"),
  };
  
 -static struct regulator_consumer_supply rx51_vdac_supply[] = {
 -      REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
 -};
 -
  static struct regulator_init_data rx51_vaux1 = {
        .constraints = {
                .name                   = "V28",
@@@ -479,6 -427,8 +483,8 @@@ static struct regulator_init_data rx51_
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
 -      .num_consumer_supplies  = 1,
 -      .consumer_supplies      = &rx51_vaux2_supply,
++      .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux2_supply),
++      .consumer_supplies      = rx51_vaux2_supply,
  };
  
  /* VAUX3 - adds more power to VIO_18 rail */
@@@ -507,8 -457,8 +513,8 @@@ static struct regulator_init_data rx51_
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
 -      .num_consumer_supplies  = 1,
 -      .consumer_supplies      = &rx51_vaux3_supply,
 +      .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux3_supply),
 +      .consumer_supplies      = rx51_vaux3_supply,
  };
  
  static struct regulator_init_data rx51_vaux4 = {
@@@ -534,8 -484,8 +540,8 @@@ static struct regulator_init_data rx51_
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
 -      .num_consumer_supplies  = 1,
 -      .consumer_supplies      = &rx51_vmmc1_supply,
 +      .num_consumer_supplies  = ARRAY_SIZE(rx51_vmmc1_supply),
 +      .consumer_supplies      = rx51_vmmc1_supply,
  };
  
  static struct regulator_init_data rx51_vmmc2 = {
        .consumer_supplies      = rx51_vmmc2_supplies,
  };
  
 -static struct regulator_init_data rx51_vsim = {
 +static struct regulator_init_data rx51_vpll1 = {
        .constraints = {
 -              .name                   = "VMMC2_IO_18",
 +              .name                   = "VPLL",
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
                .apply_uV               = true,
 +              .always_on              = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
 -              .valid_ops_mask         = REGULATOR_CHANGE_MODE
 -                                      | REGULATOR_CHANGE_STATUS,
 +              .valid_ops_mask         = REGULATOR_CHANGE_MODE,
        },
 -      .num_consumer_supplies  = 1,
 -      .consumer_supplies      = &rx51_vsim_supply,
  };
  
 -static struct regulator_init_data rx51_vdac = {
 +static struct regulator_init_data rx51_vpll2 = {
        .constraints = {
 -              .name                   = "VDAC",
 +              .name                   = "VSDI_CSI",
 +              .min_uV                 = 1800000,
 +              .max_uV                 = 1800000,
 +              .apply_uV               = true,
 +              .always_on              = true,
 +              .valid_modes_mask       = REGULATOR_MODE_NORMAL
 +                                      | REGULATOR_MODE_STANDBY,
 +              .valid_ops_mask         = REGULATOR_CHANGE_MODE,
 +      },
 +};
 +
 +static struct regulator_init_data rx51_vsim = {
 +      .constraints = {
 +              .name                   = "VMMC2_IO_18",
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
                .apply_uV               = true,
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
 -      .num_consumer_supplies  = 1,
 -      .consumer_supplies      = rx51_vdac_supply,
 +      .num_consumer_supplies  = ARRAY_SIZE(rx51_vsim_supply),
 +      .consumer_supplies      = rx51_vsim_supply,
  };
  
  static struct regulator_init_data rx51_vio = {
        .consumer_supplies      = rx51_vio_supplies,
  };
  
 +static struct regulator_init_data rx51_vintana1 = {
 +      .constraints = {
 +              .name                   = "VINTANA1",
 +              .min_uV                 = 1500000,
 +              .max_uV                 = 1500000,
 +              .always_on              = true,
 +              .valid_modes_mask       = REGULATOR_MODE_NORMAL
 +                                      | REGULATOR_MODE_STANDBY,
 +              .valid_ops_mask         = REGULATOR_CHANGE_MODE,
 +      },
 +};
 +
 +static struct regulator_init_data rx51_vintana2 = {
 +      .constraints = {
 +              .name                   = "VINTANA2",
 +              .min_uV                 = 2750000,
 +              .max_uV                 = 2750000,
 +              .apply_uV               = true,
 +              .always_on              = true,
 +              .valid_modes_mask       = REGULATOR_MODE_NORMAL
 +                                      | REGULATOR_MODE_STANDBY,
 +              .valid_ops_mask         = REGULATOR_CHANGE_MODE,
 +      },
 +};
 +
 +static struct regulator_init_data rx51_vintdig = {
 +      .constraints = {
 +              .name                   = "VINTDIG",
 +              .min_uV                 = 1500000,
 +              .max_uV                 = 1500000,
 +              .always_on              = true,
 +              .valid_modes_mask       = REGULATOR_MODE_NORMAL
 +                                      | REGULATOR_MODE_STANDBY,
 +              .valid_ops_mask         = REGULATOR_CHANGE_MODE,
 +      },
 +};
 +
  static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
        .gpio_reset     = RX51_FMTX_RESET_GPIO,
  };
@@@ -703,6 -605,10 +709,6 @@@ static struct twl4030_gpio_platform_dat
        .setup                  = rx51_twlgpio_setup,
  };
  
 -static struct twl4030_usb_data rx51_usb_data = {
 -      .usb_mode               = T2_USB_MODE_ULPI,
 -};
 -
  static struct twl4030_ins sleep_on_seq[] __initdata = {
  /*
   * Turn off everything
@@@ -864,32 -770,33 +870,32 @@@ static struct twl4030_power_data rx51_t
        .resource_config = twl4030_rconfig,
  };
  
 -struct twl4030_codec_vibra_data rx51_vibra_data __initdata = {
 +struct twl4030_vibra_data rx51_vibra_data __initdata = {
        .coexist        = 0,
  };
  
 -struct twl4030_codec_data rx51_codec_data __initdata = {
 +struct twl4030_audio_data rx51_audio_data __initdata = {
        .audio_mclk     = 26000000,
        .vibra          = &rx51_vibra_data,
  };
  
  static struct twl4030_platform_data rx51_twldata __initdata = {
 -      .irq_base               = TWL4030_IRQ_BASE,
 -      .irq_end                = TWL4030_IRQ_END,
 -
        /* platform_data for children goes here */
        .gpio                   = &rx51_gpio_data,
        .keypad                 = &rx51_kp_data,
 -      .madc                   = &rx51_madc_data,
 -      .usb                    = &rx51_usb_data,
        .power                  = &rx51_t2scripts_data,
 -      .codec                  = &rx51_codec_data,
 +      .audio                  = &rx51_audio_data,
  
        .vaux1                  = &rx51_vaux1,
        .vaux2                  = &rx51_vaux2,
        .vaux4                  = &rx51_vaux4,
        .vmmc1                  = &rx51_vmmc1,
 +      .vpll1                  = &rx51_vpll1,
 +      .vpll2                  = &rx51_vpll2,
        .vsim                   = &rx51_vsim,
 -      .vdac                   = &rx51_vdac,
 +      .vintana1               = &rx51_vintana1,
 +      .vintana2               = &rx51_vintana2,
 +      .vintdig                = &rx51_vintdig,
        .vio                    = &rx51_vio,
  };
  
@@@ -927,12 -834,6 +933,12 @@@ static struct i2c_board_info __initdat
                I2C_BOARD_INFO("tsl2563", 0x29),
                .platform_data = &rx51_tsl2563_platform_data,
        },
 +#endif
 +#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
 +      {
 +              I2C_BOARD_INFO("lp5523", 0x32),
 +              .platform_data  = &rx51_lp5523_platform_data,
 +      },
  #endif
        {
                I2C_BOARD_INFO("tpa6130a2", 0x60),
@@@ -951,13 -852,6 +957,13 @@@ static int __init rx51_i2c_init(void
                rx51_twldata.vaux3 = &rx51_vaux3_cam;
        }
        rx51_twldata.vmmc2 = &rx51_vmmc2;
 +      omap3_pmic_get_config(&rx51_twldata,
 +                      TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
 +                      TWL_COMMON_REGULATOR_VDAC);
 +
 +      rx51_twldata.vdac->constraints.apply_uV = true;
 +      rx51_twldata.vdac->constraints.name = "VDAC";
 +
        omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
        omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
                              ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
@@@ -1084,7 -978,6 +1090,7 @@@ error
  void __init rx51_peripherals_init(void)
  {
        rx51_i2c_init();
 +      regulator_has_full_constraints();
        gpmc_onenand_init(board_onenand_data);
        board_smc91x_init();
        rx51_add_gpio_keys();
index 837138e369bc162ca46e94327bfbe0e2fde84ea6,67b3d0b752b776129fe3166412d3ad764c98b0b3..9e0856b2f9e9fcc8adb4455267e0ec4964efa56d
@@@ -443,7 -443,7 +443,7 @@@ static struct platform_device usb1_host
        .resource       = usb1_host_resources,
  };
  
 -const static struct fb_videomode ap4evb_lcdc_modes[] = {
 +static const struct fb_videomode ap4evb_lcdc_modes[] = {
        {
  #ifdef CONFIG_AP4EVB_QHD
                .name           = "R63302(QHD)",
@@@ -957,19 -957,16 +957,16 @@@ static struct resource csi2_resources[
        },
  };
  
- static struct platform_device csi2_device = {
-       .name   = "sh-mobile-csi2",
-       .id     = 0,
+ static struct sh_mobile_ceu_companion csi2 = {
+       .id             = 0,
        .num_resources  = ARRAY_SIZE(csi2_resources),
        .resource       = csi2_resources,
-       .dev    = {
-               .platform_data = &csi2_info,
-       },
+       .platform_data  = &csi2_info,
  };
  
  static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
        .flags = SH_CEU_FLAG_USE_8BIT_BUS,
-       .csi2_dev = &csi2_device.dev,
+       .csi2 = &csi2,
  };
  
  static struct resource ceu_resources[] = {
@@@ -1013,7 -1010,6 +1010,6 @@@ static struct platform_device *ap4evb_d
        &lcdc1_device,
        &lcdc_device,
        &hdmi_device,
-       &csi2_device,
        &ceu_device,
        &ap4evb_camera,
        &meram_device,
@@@ -1408,14 -1404,9 +1404,14 @@@ static void __init ap4evb_init(void
  
        platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
  
 +      sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc1_device);
 +      sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
 +      sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
 +
        hdmi_init_pm_clock();
        fsi_init_pm_clock();
        sh7372_pm_init();
 +      pm_clk_add(&fsi_device.dev, "spu2");
  }
  
  static void __init ap4evb_timer_init(void)
index 5b36b6c5b448714d044fe1eb7fd8c9c2827cd95b,1610fbf1a764039a7d104c58ebc2368b88f89f3d..d41c01f83f152f75589cc228a186a6f98da59a5e
@@@ -1192,8 -1192,8 +1192,8 @@@ static struct platform_device sh_mmcif_
  };
  
  
- static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev);
- static void mackerel_camera_del(struct soc_camera_link *icl);
+ static int mackerel_camera_add(struct soc_camera_device *icd);
+ static void mackerel_camera_del(struct soc_camera_device *icd);
  
  static int camera_set_capture(struct soc_camera_platform_info *info,
                              int enable)
@@@ -1232,16 -1232,15 +1232,15 @@@ static void mackerel_camera_release(str
        soc_camera_platform_release(&camera_device);
  }
  
- static int mackerel_camera_add(struct soc_camera_link *icl,
-                              struct device *dev)
+ static int mackerel_camera_add(struct soc_camera_device *icd)
  {
-       return soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
+       return soc_camera_platform_add(icd, &camera_device, &camera_link,
                                       mackerel_camera_release, 0);
  }
  
- static void mackerel_camera_del(struct soc_camera_link *icl)
+ static void mackerel_camera_del(struct soc_camera_device *icd)
  {
-       soc_camera_platform_del(icl, camera_device, &camera_link);
+       soc_camera_platform_del(icd, camera_device, &camera_link);
  }
  
  static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
@@@ -1582,13 -1581,8 +1581,13 @@@ static void __init mackerel_init(void
  
        platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
  
 +      sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
 +      sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device);
 +      sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
 +
        hdmi_init_pm_clock();
        sh7372_pm_init();
 +      pm_clk_add(&fsi_device.dev, "spu2");
  }
  
  static void __init mackerel_timer_init(void)
index 1dc924b2f5087ffa9b1bf8ff212644752fe23fd7,e57b1df6da6a3b92a167cd3d14d7cbc61d9c4126..d36265758911faced2e4df8f2d13fa1ab30c816b
@@@ -188,7 -188,7 +188,7 @@@ static void ap320_wvga_power_off(void *
        __raw_writew(0, FPGA_LCDREG);
  }
  
 -const static struct fb_videomode ap325rxa_lcdc_modes[] = {
 +static const struct fb_videomode ap325rxa_lcdc_modes[] = {
        {
                .name = "LB070WV1",
                .xres = 800,
@@@ -332,8 -332,8 +332,8 @@@ static int camera_set_capture(struct so
        return ret;
  }
  
- static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev);
- static void ap325rxa_camera_del(struct soc_camera_link *icl);
+ static int ap325rxa_camera_add(struct soc_camera_device *icd);
+ static void ap325rxa_camera_del(struct soc_camera_device *icd);
  
  static struct soc_camera_platform_info camera_info = {
        .format_name = "UYVY",
@@@ -366,24 -366,23 +366,23 @@@ static void ap325rxa_camera_release(str
        soc_camera_platform_release(&camera_device);
  }
  
- static int ap325rxa_camera_add(struct soc_camera_link *icl,
-                              struct device *dev)
+ static int ap325rxa_camera_add(struct soc_camera_device *icd)
  {
-       int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
+       int ret = soc_camera_platform_add(icd, &camera_device, &camera_link,
                                          ap325rxa_camera_release, 0);
        if (ret < 0)
                return ret;
  
        ret = camera_probe();
        if (ret < 0)
-               soc_camera_platform_del(icl, camera_device, &camera_link);
+               soc_camera_platform_del(icd, camera_device, &camera_link);
  
        return ret;
  }
  
- static void ap325rxa_camera_del(struct soc_camera_link *icl)
+ static void ap325rxa_camera_del(struct soc_camera_device *icd)
  {
-       soc_camera_platform_del(icl, camera_device, &camera_link);
+       soc_camera_platform_del(icd, camera_device, &camera_link);
  }
  #endif /* CONFIG_I2C */
  
index d20168fe4c40a673301af4ea985c9c1f18e4ce72,1cee20761a3f76390afe2e826645e44bcb458f32..682009d76cdfe487ffe950c17235075808893795
@@@ -42,6 -42,7 +42,6 @@@
  #include <linux/bitops.h>
  #include <media/rc-core.h>
  #include <linux/pci_ids.h>
 -#include <linux/delay.h>
  
  #include "ite-cir.h"
  
@@@ -382,7 -383,7 +382,7 @@@ static int ite_set_tx_duty_cycle(struc
  /* transmit out IR pulses; what you get here is a batch of alternating
   * pulse/space/pulse/space lengths that we should write out completely through
   * the FIFO, blocking on a full FIFO */
- static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n)
+ static int ite_tx_ir(struct rc_dev *rcdev, unsigned *txbuf, unsigned n)
  {
        unsigned long flags;
        struct ite_dev *dev = rcdev->priv;
        /* clear the array just in case */
        memset(last_sent, 0, ARRAY_SIZE(last_sent));
  
-       /* n comes in bytes; convert to ints */
-       n /= sizeof(int);
        spin_lock_irqsave(&dev->lock, flags);
  
        /* let everybody know we're now transmitting */
index 5f1db46beb4e18031a0342f9f6e48cc241106303,5442a1732260a75b8a2e2014376de3b02a878d98..441dacf642bb090fc270676403868f778d3b34e3
@@@ -17,7 -17,7 +17,7 @@@
  #include <linux/slab.h>
  #include <linux/module.h>
  #include <linux/uaccess.h>
 -#include <asm/atomic.h>
 +#include <linux/atomic.h>
  #include <linux/usb.h>
  #include <linux/mutex.h>
  #include <linux/i2c.h>
@@@ -474,5 -474,6 +474,6 @@@ module_init(hdpvr_init)
  module_exit(hdpvr_exit);
  
  MODULE_LICENSE("GPL");
+ MODULE_VERSION("0.2.1");
  MODULE_AUTHOR("Janne Grunau");
  MODULE_DESCRIPTION("Hauppauge HD PVR driver");
index 69b60ba5dd7a90830ad175b9b4f4dfde60a2dd3d,2a598576357f4dce66dd33183ba075e196c42b94..eb97bff7116f644bbe66c5bd570d6a059f1a852b
@@@ -31,7 -31,6 +31,6 @@@
  #include <linux/interrupt.h>
  #include <linux/videodev2.h>
  #include <linux/pci.h>                /* needed for videobufs */
- #include <linux/version.h>
  #include <linux/platform_device.h>
  #include <linux/clk.h>
  #include <linux/io.h>
@@@ -43,7 -42,7 +42,7 @@@
  
  #include "omap24xxcam.h"
  
- #define OMAP24XXCAM_VERSION KERNEL_VERSION(0, 0, 0)
+ #define OMAP24XXCAM_VERSION "0.0.1"
  
  #define RESET_TIMEOUT_NS 10000
  
@@@ -309,11 -308,11 +308,11 @@@ static int omap24xxcam_vbq_alloc_mmap_b
                        order--;
  
                /* try to allocate as many contiguous pages as possible */
-               page = alloc_pages(GFP_KERNEL | GFP_DMA, order);
+               page = alloc_pages(GFP_KERNEL, order);
                /* if allocation fails, try to allocate smaller amount */
                while (page == NULL) {
                        order--;
-                       page = alloc_pages(GFP_KERNEL | GFP_DMA, order);
+                       page = alloc_pages(GFP_KERNEL, order);
                        if (page == NULL && !order) {
                                err = -ENOMEM;
                                goto out;
@@@ -993,7 -992,6 +992,6 @@@ static int vidioc_querycap(struct file 
  
        strlcpy(cap->driver, CAM_NAME, sizeof(cap->driver));
        strlcpy(cap->card, cam->vfd->name, sizeof(cap->card));
-       cap->version = OMAP24XXCAM_VERSION;
        cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
  
        return 0;
@@@ -1768,13 -1766,14 +1766,13 @@@ static int __devinit omap24xxcam_probe(
                dev_err(cam->dev, "no mem resource?\n");
                goto err;
        }
 -      if (!request_mem_region(mem->start, (mem->end - mem->start) + 1,
 -                              pdev->name)) {
 +      if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
                dev_err(cam->dev,
                        "cannot reserve camera register I/O region\n");
                goto err;
        }
        cam->mmio_base_phys = mem->start;
 -      cam->mmio_size = (mem->end - mem->start) + 1;
 +      cam->mmio_size = resource_size(mem);
  
        /* map the region */
        cam->mmio_base = (unsigned long)
@@@ -1888,6 -1887,7 +1886,7 @@@ static void __exit omap24xxcam_cleanup(
  MODULE_AUTHOR("Sakari Ailus <[email protected]>");
  MODULE_DESCRIPTION("OMAP24xx Video for Linux camera driver");
  MODULE_LICENSE("GPL");
+ MODULE_VERSION(OMAP24XXCAM_VERSION);
  module_param(video_nr, int, 0);
  MODULE_PARM_DESC(video_nr,
                 "Minor number for video device (-1 ==> auto assign)");
index 2c8954ec685950bc0552f403dea77ce046fec7b2,53e82753cbcacda1189b21a45d100c53ddc74eaa..10c2364f3e8a56624babb71ac2f1d59f2c4c37f1
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/videodev2.h>
  #include <linux/vmalloc.h>
  #include <linux/wait.h>
 -#include <asm/atomic.h>
 +#include <linux/atomic.h>
  
  #include "uvcvideo.h"
  
@@@ -1664,8 -1664,8 +1664,8 @@@ int uvc_ctrl_add_mapping(struct uvc_vid
                return -EINVAL;
        }
  
-       /* Search for the matching (GUID/CS) control in the given device */
-       list_for_each_entry(entity, &dev->entities, list) {
+       /* Search for the matching (GUID/CS) control on the current chain */
+       list_for_each_entry(entity, &chain->entities, chain) {
                unsigned int i;
  
                if (UVC_ENTITY_TYPE(entity) != UVC_VC_EXTENSION_UNIT ||
index dde6533e8e6dce16984c4db5eafb4c8ac25dba41,7afb97b2d7b2efbef5b489740ea52c37dd5400cd..ea71d5f1f6db93d285eada76f87f68b2692cfd36
@@@ -21,7 -21,7 +21,7 @@@
  #include <linux/vmalloc.h>
  #include <linux/mm.h>
  #include <linux/wait.h>
 -#include <asm/atomic.h>
 +#include <linux/atomic.h>
  
  #include <media/v4l2-common.h>
  #include <media/v4l2-ioctl.h>
@@@ -83,7 -83,7 +83,7 @@@ static int uvc_ioctl_ctrl_map(struct uv
        default:
                uvc_trace(UVC_TRACE_CONTROL, "Unsupported V4L2 control type "
                          "%u.\n", xmap->v4l2_type);
-               ret = -EINVAL;
+               ret = -ENOTTY;
                goto done;
        }
  
@@@ -571,7 -571,7 +571,7 @@@ static long uvc_v4l2_do_ioctl(struct fi
                strlcpy(cap->card, vdev->name, sizeof cap->card);
                usb_make_path(stream->dev->udev,
                              cap->bus_info, sizeof(cap->bus_info));
-               cap->version = DRIVER_VERSION_NUMBER;
+               cap->version = LINUX_VERSION_CODE;
                if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        cap->capabilities = V4L2_CAP_VIDEO_CAPTURE
                                          | V4L2_CAP_STREAMING;
index b03c3aea5beaf08ac1c51296240dfa573b3b7481,1987e1b13b9594f840a099ffc1f132c88665c787..569eeb3dfd506d4647ca9dae2e54db7213e816ec
@@@ -18,6 -18,7 +18,6 @@@
  #include <linux/mm.h>
  #include <linux/sched.h>
  #include <linux/file.h>
 -#include <linux/slab.h>
  
  #include <media/videobuf2-core.h>
  #include <media/videobuf2-memops.h>
@@@ -176,7 -177,7 +176,7 @@@ int vb2_mmap_pfn_range(struct vm_area_s
  
        vma->vm_ops->open(vma);
  
-       printk(KERN_DEBUG "%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
+       pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
                        __func__, paddr, vma->vm_start, size);
  
        return 0;
@@@ -194,7 -195,7 +194,7 @@@ static void vb2_common_vm_open(struct v
  {
        struct vb2_vmarea_handler *h = vma->vm_private_data;
  
-       printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n",
+       pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n",
               __func__, h, atomic_read(h->refcount), vma->vm_start,
               vma->vm_end);
  
@@@ -212,7 -213,7 +212,7 @@@ static void vb2_common_vm_close(struct 
  {
        struct vb2_vmarea_handler *h = vma->vm_private_data;
  
-       printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n",
+       pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n",
               __func__, h, atomic_read(h->refcount), vma->vm_start,
               vma->vm_end);
  
index 55b1c4a59035ac9943db9079713100f3fbbf47fc,39d21157a9b8538903d46e9aa76728b9425cb34c..1c04185bcfd72d95bfe08a2b426fb9e1c1aaef6e
@@@ -1,7 -1,7 +1,7 @@@
  /*
   * cxd2099.c: Driver for the CXD2099AR Common Interface Controller
   *
-  * Copyright (C) 2010 DigitalDevices UG
+  * Copyright (C) 2010-2011 Digital Devices GmbH
   *
   *
   * This program is free software; you can redistribute it and/or
@@@ -22,6 -22,7 +22,6 @@@
   * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
   */
  
 -#include <linux/version.h>
  #include <linux/slab.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
@@@ -41,13 -42,13 +41,13 @@@ struct cxd 
        struct dvb_ca_en50221 en;
  
        struct i2c_adapter *i2c;
-       u8     adr;
+       struct cxd2099_cfg cfg;
        u8     regs[0x23];
        u8     lastaddress;
        u8     clk_reg_f;
        u8     clk_reg_b;
        int    mode;
-       u32    bitrate;
        int    ready;
        int    dr;
        int    slot_stat;
@@@ -89,9 -90,9 +89,9 @@@ static int i2c_read_reg(struct i2c_adap
                        u8 reg, u8 *val)
  {
        struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
-                                  .buf = &reg, .len = 1 },
+                                  .buf = &reg, .len = 1},
                                  {.addr = adr, .flags = I2C_M_RD,
-                                  .buf = val, .len = 1 } };
+                                  .buf = val, .len = 1} };
  
        if (i2c_transfer(adapter, msgs, 2) != 2) {
                printk(KERN_ERR "error in i2c_read_reg\n");
@@@ -104,9 -105,9 +104,9 @@@ static int i2c_read(struct i2c_adapter 
                    u8 reg, u8 *data, u8 n)
  {
        struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
-                                  .buf = &reg, .len = 1 },
-                                 {.addr = adr, .flags = I2C_M_RD,
-                                  .buf = data, .len = n } };
+                                .buf = &reg, .len = 1},
+                               {.addr = adr, .flags = I2C_M_RD,
+                                .buf = data, .len = n} };
  
        if (i2c_transfer(adapter, msgs, 2) != 2) {
                printk(KERN_ERR "error in i2c_read\n");
@@@ -119,10 -120,10 +119,10 @@@ static int read_block(struct cxd *ci, u
  {
        int status;
  
-       status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
+       status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, adr);
        if (!status) {
                ci->lastaddress = adr;
-               status = i2c_read(ci->i2c, ci->adr, 1, data, n);
+               status = i2c_read(ci->i2c, ci->cfg.adr, 1, data, n);
        }
        return status;
  }
@@@ -136,24 -137,24 +136,24 @@@ static int read_reg(struct cxd *ci, u8 
  static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
  {
        int status;
-       u8 addr[3] = { 2, address&0xff, address>>8 };
+       u8 addr[3] = {2, address & 0xff, address >> 8};
  
-       status = i2c_write(ci->i2c, ci->adr, addr, 3);
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
        if (!status)
-               status = i2c_read(ci->i2c, ci->adr, 3, data, n);
+               status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n);
        return status;
  }
  
  static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
  {
        int status;
-       u8 addr[3] = { 2, address&0xff, address>>8 };
+       u8 addr[3] = {2, address & 0xff, address >> 8};
  
-       status = i2c_write(ci->i2c, ci->adr, addr, 3);
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
        if (!status) {
                u8 buf[256] = {3};
                memcpy(buf+1, data, n);
-               status = i2c_write(ci->i2c, ci->adr, buf, n+1);
+               status = i2c_write(ci->i2c, ci->cfg.adr, buf, n+1);
        }
        return status;
  }
  static int read_io(struct cxd *ci, u16 address, u8 *val)
  {
        int status;
-       u8 addr[3] = { 2, address&0xff, address>>8 };
+       u8 addr[3] = {2, address & 0xff, address >> 8};
  
-       status = i2c_write(ci->i2c, ci->adr, addr, 3);
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
        if (!status)
-               status = i2c_read(ci->i2c, ci->adr, 3, val, 1);
+               status = i2c_read(ci->i2c, ci->cfg.adr, 3, val, 1);
        return status;
  }
  
  static int write_io(struct cxd *ci, u16 address, u8 val)
  {
        int status;
-       u8 addr[3] = { 2, address&0xff, address>>8 };
-       u8 buf[2] = { 3, val };
+       u8 addr[3] = {2, address & 0xff, address >> 8};
+       u8 buf[2] = {3, val};
  
-       status = i2c_write(ci->i2c, ci->adr, addr, 3);
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
        if (!status)
-               status = i2c_write(ci->i2c, ci->adr, buf, 2);
+               status = i2c_write(ci->i2c, ci->cfg.adr, buf, 2);
        return status;
  }
  
+ #if 0
+ static int read_io_data(struct cxd *ci, u8 *data, u8 n)
+ {
+       int status;
+       u8 addr[3] = { 2, 0, 0 };
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
+       if (!status)
+               status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n);
+       return 0;
+ }
+ static int write_io_data(struct cxd *ci, u8 *data, u8 n)
+ {
+       int status;
+       u8 addr[3] = {2, 0, 0};
+       status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
+       if (!status) {
+               u8 buf[256] = {3};
+               memcpy(buf+1, data, n);
+               status = i2c_write(ci->i2c, ci->cfg.adr, buf, n + 1);
+       }
+       return 0;
+ }
+ #endif
  
  static int write_regm(struct cxd *ci, u8 reg, u8 val, u8 mask)
  {
        int status;
  
-       status = i2c_write_reg(ci->i2c, ci->adr, 0, reg);
+       status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, reg);
        if (!status && reg >= 6 && reg <= 8 && mask != 0xff)
-               status = i2c_read_reg(ci->i2c, ci->adr, 1, &ci->regs[reg]);
-       ci->regs[reg] = (ci->regs[reg]&(~mask))|val;
+               status = i2c_read_reg(ci->i2c, ci->cfg.adr, 1, &ci->regs[reg]);
+       ci->regs[reg] = (ci->regs[reg] & (~mask)) | val;
        if (!status) {
                ci->lastaddress = reg;
-               status = i2c_write_reg(ci->i2c, ci->adr, 1, ci->regs[reg]);
+               status = i2c_write_reg(ci->i2c, ci->cfg.adr, 1, ci->regs[reg]);
        }
        if (reg == 0x20)
                ci->regs[reg] &= 0x7f;
@@@ -211,11 -237,11 +236,11 @@@ static int write_block(struct cxd *ci, 
        int status;
        u8 buf[256] = {1};
  
-       status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
+       status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, adr);
        if (!status) {
                ci->lastaddress = adr;
-               memcpy(buf+1, data, n);
-               status = i2c_write(ci->i2c, ci->adr, buf, n+1);
+               memcpy(buf + 1, data, n);
+               status = i2c_write(ci->i2c, ci->cfg.adr, buf, n + 1);
        }
        return status;
  }
@@@ -249,12 -275,16 +274,16 @@@ static void cam_mode(struct cxd *ci, in
                write_regm(ci, 0x20, 0x80, 0x80);
                break;
        case 0x01:
+ #ifdef BUFFER_MODE
+               if (!ci->en.read_data)
+                       return;
                printk(KERN_INFO "enable cam buffer mode\n");
                /* write_reg(ci, 0x0d, 0x00); */
                /* write_reg(ci, 0x0e, 0x01); */
                write_regm(ci, 0x08, 0x40, 0x40);
                /* read_reg(ci, 0x12, &dummy); */
                write_regm(ci, 0x08, 0x80, 0x80);
+ #endif
                break;
        default:
                break;
  
  
  
- #define CHK_ERROR(s) if ((status = s)) break
  static int init(struct cxd *ci)
  {
        int status;
        mutex_lock(&ci->lock);
        ci->mode = -1;
        do {
-               CHK_ERROR(write_reg(ci, 0x00, 0x00));
-               CHK_ERROR(write_reg(ci, 0x01, 0x00));
-               CHK_ERROR(write_reg(ci, 0x02, 0x10));
-               CHK_ERROR(write_reg(ci, 0x03, 0x00));
-               CHK_ERROR(write_reg(ci, 0x05, 0xFF));
-               CHK_ERROR(write_reg(ci, 0x06, 0x1F));
-               CHK_ERROR(write_reg(ci, 0x07, 0x1F));
-               CHK_ERROR(write_reg(ci, 0x08, 0x28));
-               CHK_ERROR(write_reg(ci, 0x14, 0x20));
-               CHK_ERROR(write_reg(ci, 0x09, 0x4D)); /* Input Mode C, BYPass Serial, TIVAL = low, MSB */
-               CHK_ERROR(write_reg(ci, 0x0A, 0xA7)); /* TOSTRT = 8, Mode B (gated clock), falling Edge, Serial, POL=HIGH, MSB */
-               /* Sync detector */
-               CHK_ERROR(write_reg(ci, 0x0B, 0x33));
-               CHK_ERROR(write_reg(ci, 0x0C, 0x33));
-               CHK_ERROR(write_regm(ci, 0x14, 0x00, 0x0F));
-               CHK_ERROR(write_reg(ci, 0x15, ci->clk_reg_b));
-               CHK_ERROR(write_regm(ci, 0x16, 0x00, 0x0F));
-               CHK_ERROR(write_reg(ci, 0x17, ci->clk_reg_f));
-               CHK_ERROR(write_reg(ci, 0x20, 0x28)); /* Integer Divider, Falling Edge, Internal Sync, */
-               CHK_ERROR(write_reg(ci, 0x21, 0x00)); /* MCLKI = TICLK/8 */
-               CHK_ERROR(write_reg(ci, 0x22, 0x07)); /* MCLKI = TICLK/8 */
-               CHK_ERROR(write_regm(ci, 0x20, 0x80, 0x80)); /* Reset CAM state machine */
-               CHK_ERROR(write_regm(ci, 0x03, 0x02, 02));  /* Enable IREQA Interrupt */
-               CHK_ERROR(write_reg(ci, 0x01, 0x04));  /* Enable CD Interrupt */
-               CHK_ERROR(write_reg(ci, 0x00, 0x31));  /* Enable TS1,Hot Swap,Slot A */
-               CHK_ERROR(write_regm(ci, 0x09, 0x08, 0x08));  /* Put TS in bypass */
+               status = write_reg(ci, 0x00, 0x00);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x01, 0x00);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x02, 0x10);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x03, 0x00);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x05, 0xFF);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x06, 0x1F);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x07, 0x1F);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x08, 0x28);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x14, 0x20);
+               if (status < 0)
+                       break;
+ #if 0
+               status = write_reg(ci, 0x09, 0x4D); /* Input Mode C, BYPass Serial, TIVAL = low, MSB */
+               if (status < 0)
+                       break;
+ #endif
+               status = write_reg(ci, 0x0A, 0xA7); /* TOSTRT = 8, Mode B (gated clock), falling Edge, Serial, POL=HIGH, MSB */
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x0B, 0x33);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x0C, 0x33);
+               if (status < 0)
+                       break;
+               status = write_regm(ci, 0x14, 0x00, 0x0F);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x15, ci->clk_reg_b);
+               if (status < 0)
+                       break;
+               status = write_regm(ci, 0x16, 0x00, 0x0F);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x17, ci->clk_reg_f);
+               if (status < 0)
+                       break;
+               if (ci->cfg.clock_mode) {
+                       if (ci->cfg.polarity) {
+                               status = write_reg(ci, 0x09, 0x6f);
+                               if (status < 0)
+                                       break;
+                       } else {
+                               status = write_reg(ci, 0x09, 0x6d);
+                               if (status < 0)
+                                       break;
+                       }
+                       status = write_reg(ci, 0x20, 0x68);
+                       if (status < 0)
+                               break;
+                       status = write_reg(ci, 0x21, 0x00);
+                       if (status < 0)
+                               break;
+                       status = write_reg(ci, 0x22, 0x02);
+                       if (status < 0)
+                               break;
+               } else {
+                       if (ci->cfg.polarity) {
+                               status = write_reg(ci, 0x09, 0x4f);
+                               if (status < 0)
+                                       break;
+                       } else {
+                               status = write_reg(ci, 0x09, 0x4d);
+                               if (status < 0)
+                                       break;
+                       }
+                       status = write_reg(ci, 0x20, 0x28);
+                       if (status < 0)
+                               break;
+                       status = write_reg(ci, 0x21, 0x00);
+                       if (status < 0)
+                               break;
+                       status = write_reg(ci, 0x22, 0x07);
+                       if (status < 0)
+                               break;
+               }
+               status = write_regm(ci, 0x20, 0x80, 0x80);
+               if (status < 0)
+                       break;
+               status = write_regm(ci, 0x03, 0x02, 0x02);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x01, 0x04);
+               if (status < 0)
+                       break;
+               status = write_reg(ci, 0x00, 0x31);
+               if (status < 0)
+                       break;
+               /* Put TS in bypass */
+               status = write_regm(ci, 0x09, 0x08, 0x08);
+               if (status < 0)
+                       break;
                ci->cammode = -1;
- #ifdef BUFFER_MODE
                cam_mode(ci, 0);
- #endif
        } while (0);
        mutex_unlock(&ci->lock);
  
        return 0;
  }
  
  static int read_attribute_mem(struct dvb_ca_en50221 *ca,
                              int slot, int address)
  {
        struct cxd *ci = ca->data;
+ #if 0
+       if (ci->amem_read) {
+               if (address <= 0 || address > 1024)
+                       return -EIO;
+               return ci->amem[address];
+       }
+       mutex_lock(&ci->lock);
+       write_regm(ci, 0x06, 0x00, 0x05);
+       read_pccard(ci, 0, &ci->amem[0], 128);
+       read_pccard(ci, 128, &ci->amem[0], 128);
+       read_pccard(ci, 256, &ci->amem[0], 128);
+       read_pccard(ci, 384, &ci->amem[0], 128);
+       write_regm(ci, 0x06, 0x05, 0x05);
+       mutex_unlock(&ci->lock);
+       return ci->amem[address];
+ #else
        u8 val;
        mutex_lock(&ci->lock);
        set_mode(ci, 1);
        read_pccard(ci, address, &val, 1);
        mutex_unlock(&ci->lock);
+       /* printk(KERN_INFO "%02x:%02x\n", address,val); */
        return val;
+ #endif
  }
  
  static int write_attribute_mem(struct dvb_ca_en50221 *ca, int slot,
                               int address, u8 value)
  {
@@@ -372,6 -497,15 +496,15 @@@ static int slot_reset(struct dvb_ca_en5
        struct cxd *ci = ca->data;
  
        mutex_lock(&ci->lock);
+ #if 0
+       write_reg(ci, 0x00, 0x21);
+       write_reg(ci, 0x06, 0x1F);
+       write_reg(ci, 0x00, 0x31);
+ #else
+ #if 0
+       write_reg(ci, 0x06, 0x1F);
+       write_reg(ci, 0x06, 0x2F);
+ #else
        cam_mode(ci, 0);
        write_reg(ci, 0x00, 0x21);
        write_reg(ci, 0x06, 0x1F);
        write_regm(ci, 0x20, 0x80, 0x80);
        write_reg(ci, 0x03, 0x02);
        ci->ready = 0;
+ #endif
+ #endif
        ci->mode = -1;
        {
                int i;
+ #if 0
+               u8 val;
+ #endif
                for (i = 0; i < 100; i++) {
                        msleep(10);
+ #if 0
+                       read_reg(ci, 0x06, &val);
+                       printk(KERN_INFO "%d:%02x\n", i, val);
+                       if (!(val&0x10))
+                               break;
+ #else
                        if (ci->ready)
                                break;
+ #endif
                }
        }
        mutex_unlock(&ci->lock);
@@@ -399,12 -545,12 +544,12 @@@ static int slot_shutdown(struct dvb_ca_
  
        printk(KERN_INFO "slot_shutdown\n");
        mutex_lock(&ci->lock);
-       /* write_regm(ci, 0x09, 0x08, 0x08); */
-       write_regm(ci, 0x20, 0x80, 0x80);
-       write_regm(ci, 0x06, 0x07, 0x07);
+       write_regm(ci, 0x09, 0x08, 0x08);
+       write_regm(ci, 0x20, 0x80, 0x80); /* Reset CAM Mode */
+       write_regm(ci, 0x06, 0x07, 0x07); /* Clear IO Mode */
        ci->mode = -1;
        mutex_unlock(&ci->lock);
-       return 0; /* shutdown(ci); */
+       return 0;
  }
  
  static int slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
@@@ -459,7 -605,6 +604,6 @@@ static int campoll(struct cxd *ci
                if (istat&8 && ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) {
                        ci->ready = 1;
                        ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY;
-                       printk(KERN_INFO "READY\n");
                }
        }
        return 0;
@@@ -510,7 -655,7 +654,7 @@@ static int write_data(struct dvb_ca_en5
        struct cxd *ci = ca->data;
  
        mutex_lock(&ci->lock);
-       printk(KERN_INFO "write_data %d\n", ecount);
+       printk(kern_INFO "write_data %d\n", ecount);
        write_reg(ci, 0x0d, ecount>>8);
        write_reg(ci, 0x0e, ecount&0xff);
        write_block(ci, 0x11, ebuf, ecount);
@@@ -535,15 -680,15 +679,15 @@@ static struct dvb_ca_en50221 en_templ 
  
  };
  
- struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv,
+ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg,
+                                     void *priv,
                                      struct i2c_adapter *i2c)
  {
        struct cxd *ci = 0;
-       u32 bitrate = 62000000;
        u8 val;
  
-       if (i2c_read_reg(i2c, adr, 0, &val) < 0) {
-               printk(KERN_ERR "No CXD2099 detected at %02x\n", adr);
+       if (i2c_read_reg(i2c, cfg->adr, 0, &val) < 0) {
+               printk(KERN_INFO "No CXD2099 detected at %02x\n", cfg->adr);
                return 0;
        }
  
        memset(ci, 0, sizeof(*ci));
  
        mutex_init(&ci->lock);
+       memcpy(&ci->cfg, cfg, sizeof(struct cxd2099_cfg));
        ci->i2c = i2c;
-       ci->adr = adr;
        ci->lastaddress = 0xff;
        ci->clk_reg_b = 0x4a;
        ci->clk_reg_f = 0x1b;
-       ci->bitrate = bitrate;
  
        memcpy(&ci->en, &en_templ, sizeof(en_templ));
        ci->en.data = ci;
        init(ci);
-       printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->adr);
+       printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->cfg.adr);
        return &ci->en;
  }
  EXPORT_SYMBOL(cxd2099_attach);
  
  MODULE_DESCRIPTION("cxd2099");
- MODULE_AUTHOR("Ralph Metzler <[email protected]>");
+ MODULE_AUTHOR("Ralph Metzler");
  MODULE_LICENSE("GPL");
index ddfd7c33361ba31ba64fb1a4ef3a4a79b5b1c260,018ff73ab71d70b93908c9d095f1c01707a111d3..bd5fa89af07c32814ea55f28c0075dad7747cdad
@@@ -84,7 -84,6 +84,6 @@@ static int _tm6000_start_audio_dma(stru
  
        tm6000_set_audio_bitrate(core, 48000);
  
        return 0;
  }
  
@@@ -123,6 -122,7 +122,7 @@@ static int dsp_buffer_alloc(struct snd_
        if (substream->runtime->dma_area) {
                if (substream->runtime->dma_bytes > size)
                        return 0;
                dsp_buffer_free(substream);
        }
  
@@@ -152,9 -152,9 +152,9 @@@ static struct snd_pcm_hardware snd_tm60
                SNDRV_PCM_INFO_MMAP_VALID,
        .formats = SNDRV_PCM_FMTBIT_S16_LE,
  
-       .rates =                SNDRV_PCM_RATE_CONTINUOUS,
-       .rate_min =             48000,
-       .rate_max =             48000,
+       .rates = SNDRV_PCM_RATE_CONTINUOUS,
+       .rate_min = 48000,
+       .rate_max = 48000,
        .channels_min = 2,
        .channels_max = 2,
        .period_bytes_min = 64,
@@@ -254,9 -254,7 +254,7 @@@ static int tm6000_fillbuf(struct tm6000
                memcpy(runtime->dma_area + buf_pos * stride, buf,
                        length * stride);
  
- #ifndef NO_PCM_LOCK
 -       snd_pcm_stream_lock(substream);
 +      snd_pcm_stream_lock(substream);
- #endif
  
        chip->buf_pos += length;
        if (chip->buf_pos >= runtime->buffer_size)
                period_elapsed = 1;
        }
  
- #ifndef NO_PCM_LOCK
 -       snd_pcm_stream_unlock(substream);
 +      snd_pcm_stream_unlock(substream);
- #endif
  
        if (period_elapsed)
                snd_pcm_period_elapsed(substream);
diff --combined kernel/compat.c
index 616c78197ccaceecc670b9a2f250c7018ada63d8,d4abc5bcc27cf8e97358560a117ce02558986bfb..e2435ee9993a329bee48252a38af4ca69e6c4742
@@@ -158,6 -158,7 +158,7 @@@ int put_compat_timespec(const struct ti
                        __put_user(ts->tv_sec, &cts->tv_sec) ||
                        __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
  }
+ EXPORT_SYMBOL_GPL(put_compat_timespec);
  
  static long compat_nanosleep_restart(struct restart_block *restart)
  {
@@@ -890,7 -891,6 +891,7 @@@ sigset_from_compat (sigset_t *set, comp
        case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );
        }
  }
 +EXPORT_SYMBOL_GPL(sigset_from_compat);
  
  asmlinkage long
  compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
@@@ -992,8 -992,11 +993,8 @@@ asmlinkage long compat_sys_rt_sigsuspen
        sigset_from_compat(&newset, &newset32);
        sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP));
  
 -      spin_lock_irq(&current->sighand->siglock);
        current->saved_sigmask = current->blocked;
 -      current->blocked = newset;
 -      recalc_sigpending();
 -      spin_unlock_irq(&current->sighand->siglock);
 +      set_current_blocked(&newset);
  
        current->state = TASK_INTERRUPTIBLE;
        schedule();
This page took 0.222759 seconds and 4 git commands to generate.