diff options
Diffstat (limited to 'Documentation/DocBook')
57 files changed, 4655 insertions, 1330 deletions
diff --git a/Documentation/DocBook/.gitignore b/Documentation/DocBook/.gitignore index 720f245ceb1..7ebd5465d92 100644 --- a/Documentation/DocBook/.gitignore +++ b/Documentation/DocBook/.gitignore @@ -10,5 +10,6 @@  *.out  *.png  *.gif +*.svg  media-indices.tmpl  media-entities.tmpl diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl index f403ec3c5c9..d9b9416c989 100644 --- a/Documentation/DocBook/80211.tmpl +++ b/Documentation/DocBook/80211.tmpl @@ -98,6 +98,9 @@  !Finclude/net/cfg80211.h priv_to_wiphy  !Finclude/net/cfg80211.h set_wiphy_dev  !Finclude/net/cfg80211.h wdev_priv +!Finclude/net/cfg80211.h ieee80211_iface_limit +!Finclude/net/cfg80211.h ieee80211_iface_combination +!Finclude/net/cfg80211.h cfg80211_check_combinations        </chapter>        <chapter>        <title>Actions and configuration</title> @@ -152,8 +155,8 @@  !Finclude/net/cfg80211.h cfg80211_scan_request  !Finclude/net/cfg80211.h cfg80211_scan_done  !Finclude/net/cfg80211.h cfg80211_bss -!Finclude/net/cfg80211.h cfg80211_inform_bss_frame -!Finclude/net/cfg80211.h cfg80211_inform_bss +!Finclude/net/cfg80211.h cfg80211_inform_bss_width_frame +!Finclude/net/cfg80211.h cfg80211_inform_bss_width  !Finclude/net/cfg80211.h cfg80211_unlink_bss  !Finclude/net/cfg80211.h cfg80211_find_ie  !Finclude/net/cfg80211.h ieee80211_bss_get_ie diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index bc3d9f8c0a9..bec06659e0e 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -14,9 +14,10 @@ DOCBOOKS := z8530book.xml device-drivers.xml \  	    genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \  	    80211.xml debugobjects.xml sh.xml regulator.xml \  	    alsa-driver-api.xml writing-an-alsa-driver.xml \ -	    tracepoint.xml drm.xml media_api.xml +	    tracepoint.xml drm.xml media_api.xml w1.xml \ +	    writing_musb_glue_layer.xml -include $(srctree)/Documentation/DocBook/media/Makefile +include Documentation/DocBook/media/Makefile  ###  # The build process is as follows (targets): @@ -36,6 +37,7 @@ PS_METHOD	= $(prefer-db2x)  # The targets that may be used.  PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs +targets += $(DOCBOOKS)  BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))  xmldocs: $(BOOKS)  sgmldocs: xmldocs @@ -54,17 +56,18 @@ htmldocs: $(HTML)  MAN := $(patsubst %.xml, %.9, $(BOOKS))  mandocs: $(MAN) +	$(if $(wildcard $(obj)/man/*.9),gzip -f $(obj)/man/*.9)  installmandocs: mandocs  	mkdir -p /usr/local/man/man9/ -	install Documentation/DocBook/man/*.9.gz /usr/local/man/man9/ +	install $(obj)/man/*.9.gz /usr/local/man/man9/  ###  #External programs used  KERNELDOC = $(srctree)/scripts/kernel-doc  DOCPROC   = $(objtree)/scripts/docproc -XMLTOFLAGS = -m $(srctree)/Documentation/DocBook/stylesheet.xsl +XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl  XMLTOFLAGS += --skip-validation  ### @@ -86,21 +89,9 @@ define rule_docproc          ) > $(dir $@).$(notdir $@).cmd  endef -%.xml: %.tmpl FORCE +%.xml: %.tmpl $(KERNELDOC) $(DOCPROC) FORCE  	$(call if_changed_rule,docproc) -### -#Read in all saved dependency files -cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd)) - -ifneq ($(cmd_files),) -  include $(cmd_files) -endif - -### -# Changes in kernel-doc force a rebuild of all documentation -$(BOOKS): $(KERNELDOC) -  # Tell kbuild to always build the programs  always := $(hostprogs-y) @@ -138,16 +129,16 @@ quiet_cmd_db2pdf = PDF     $@  index = index.html -main_idx = Documentation/DocBook/$(index) +main_idx = $(obj)/$(index)  build_main_index = rm -rf $(main_idx); \  		   echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \  		   echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \  		   cat $(HTML) >> $(main_idx)  quiet_cmd_db2html = HTML    $@ -      cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \ +      cmd_db2html = xmlto html $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \  		echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ -        $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ +		$(patsubst %.html,%,$(notdir $@))</a><p>' > $@  %.html:	%.xml  	@(which xmlto > /dev/null 2>&1) || \ @@ -159,7 +150,7 @@ quiet_cmd_db2html = HTML    $@              cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi  quiet_cmd_db2man = MAN     $@ -      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; gzip -f $(obj)/man/*.9; fi +      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; fi  %.9 : %.xml  	@(which xmlto > /dev/null 2>&1) || \  	 (echo "*** You need to install xmlto ***"; \ diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index fe397f90a34..cc63f30de16 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl @@ -58,7 +58,7 @@       </sect1>       <sect1><title>Wait queues and Wake events</title>  !Iinclude/linux/wait.h -!Ekernel/wait.c +!Ekernel/sched/wait.c       </sect1>       <sect1><title>High-resolution timers</title>  !Iinclude/linux/ktime.h @@ -87,7 +87,10 @@ X!Iinclude/linux/kobject.h  !Ekernel/printk/printk.c  !Ekernel/panic.c  !Ekernel/sys.c -!Ekernel/rcupdate.c +!Ekernel/rcu/srcu.c +!Ekernel/rcu/tree.c +!Ekernel/rcu/tree_plugin.h +!Ekernel/rcu/update.c       </sect1>       <sect1><title>Device Resource Management</title> @@ -273,7 +276,7 @@ X!Isound/sound_firmware.c       </para>       <sect1><title>Frame Buffer Memory</title> -!Edrivers/video/fbmem.c +!Edrivers/video/fbdev/core/fbmem.c       </sect1>  <!--       <sect1><title>Frame Buffer Console</title> @@ -281,7 +284,7 @@ X!Edrivers/video/console/fbcon.c       </sect1>  -->       <sect1><title>Frame Buffer Colormap</title> -!Edrivers/video/fbcmap.c +!Edrivers/video/fbdev/core/fbcmap.c       </sect1>  <!-- FIXME:    drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment @@ -291,11 +294,11 @@ X!Idrivers/video/fbgen.c       </sect1>  KAO -->       <sect1><title>Frame Buffer Video Mode Database</title> -!Idrivers/video/modedb.c -!Edrivers/video/modedb.c +!Idrivers/video/fbdev/core/modedb.c +!Edrivers/video/fbdev/core/modedb.c       </sect1>       <sect1><title>Frame Buffer Macintosh Video Mode Database</title> -!Edrivers/video/macmodes.c +!Edrivers/video/fbdev/macmodes.c       </sect1>       <sect1><title>Frame Buffer Fonts</title>          <para> diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index ed1d6d28902..7df3134ebc0 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -29,12 +29,26 @@  	  </address>  	</affiliation>        </author> +      <author> +	<firstname>Daniel</firstname> +	<surname>Vetter</surname> +	<contrib>Contributions all over the place</contrib> +	<affiliation> +	  <orgname>Intel Corporation</orgname> +	  <address> +	    <email>daniel.vetter@ffwll.ch</email> +	  </address> +	</affiliation> +      </author>      </authorgroup>      <copyright>        <year>2008-2009</year> -      <year>2012</year> +      <year>2013-2014</year>        <holder>Intel Corporation</holder> +    </copyright> +    <copyright> +      <year>2012</year>        <holder>Laurent Pinchart</holder>      </copyright> @@ -60,7 +74,15 @@  <toc></toc> -  <!-- Introduction --> +<part id="drmCore"> +  <title>DRM Core</title> +  <partintro> +    <para> +      This first part of the DRM Developer's Guide documents core DRM code, +      helper libraries for writing drivers and generic userspace interfaces +      exposed by DRM drivers. +    </para> +  </partintro>    <chapter id="drmIntroduction">      <title>Introduction</title> @@ -120,6 +142,12 @@        to register it with the DRM subsystem.      </para>      <para> +      Newer drivers that no longer require a <structname>drm_bus</structname> +      structure can alternatively use the low-level device initialization and +      registration functions such as <function>drm_dev_alloc()</function> and +      <function>drm_dev_register()</function> directly. +    </para> +    <para>        The <structname>drm_driver</structname> structure contains static        information that describes the driver and features it supports, and        pointers to methods that the DRM core will call to implement the DRM API. @@ -260,12 +288,42 @@ char *date;</synopsis>        </sect3>      </sect2>      <sect2> +      <title>Device Registration</title> +      <para> +        A number of functions are provided to help with device registration. +        The functions deal with PCI, USB and platform devices, respectively. +      </para> +!Edrivers/gpu/drm/drm_pci.c +!Edrivers/gpu/drm/drm_usb.c +!Edrivers/gpu/drm/drm_platform.c +      <para> +        New drivers that no longer rely on the services provided by the +        <structname>drm_bus</structname> structure can call the low-level +        device registration functions directly. The +        <function>drm_dev_alloc()</function> function can be used to allocate +        and initialize a new <structname>drm_device</structname> structure. +        Drivers will typically want to perform some additional setup on this +        structure, such as allocating driver-specific data and storing a +        pointer to it in the DRM device's <structfield>dev_private</structfield> +        field. Drivers should also set the device's unique name using the +        <function>drm_dev_set_unique()</function> function. After it has been +        set up a device can be registered with the DRM subsystem by calling +        <function>drm_dev_register()</function>. This will cause the device to +        be exposed to userspace and will call the driver's +        <structfield>.load()</structfield> implementation. When a device is +        removed, the DRM device can safely be unregistered and freed by calling +        <function>drm_dev_unregister()</function> followed by a call to +        <function>drm_dev_unref()</function>. +      </para> +!Edrivers/gpu/drm/drm_stub.c +    </sect2> +    <sect2>        <title>Driver Load</title>        <para>          The <methodname>load</methodname> method is the driver and device          initialization entry point. The method is responsible for allocating and -        initializing driver private data, specifying supported performance -        counters, performing resource allocation and mapping (e.g. acquiring +	initializing driver private data, performing resource allocation and +	mapping (e.g. acquiring          clocks, mapping registers or allocating command buffers), initializing          the memory manager (<xref linkend="drm-memory-management"/>), installing          the IRQ handler (<xref linkend="drm-irq-registration"/>), setting up @@ -295,7 +353,7 @@ char *date;</synopsis>  	their <methodname>load</methodname> method called with flags to 0.        </para>        <sect3> -        <title>Driver Private & Performance Counters</title> +        <title>Driver Private Data</title>          <para>            The driver private hangs off the main            <structname>drm_device</structname> structure and can be used for @@ -307,14 +365,6 @@ char *date;</synopsis>            <structname>drm_device</structname>.<structfield>dev_priv</structfield>            set to NULL when the driver is unloaded.          </para> -        <para> -          DRM supports several counters which were used for rough performance -          characterization. This stat counter system is deprecated and should not -          be used. If performance monitoring is desired, the developer should -          investigate and potentially enhance the kernel perf and tracing -          infrastructure to export GPU related performance information for -          consumption by performance monitoring tools and applications. -        </para>        </sect3>        <sect3 id="drm-irq-registration">          <title>IRQ Registration</title> @@ -328,21 +378,13 @@ char *date;</synopsis>          <sect4>            <title>Managed IRQ Registration</title>            <para> -            Both the <function>drm_irq_install</function> and -	    <function>drm_irq_uninstall</function> functions get the device IRQ by -	    calling <function>drm_dev_to_irq</function>. This inline function will -	    call a bus-specific operation to retrieve the IRQ number. For platform -	    devices, <function>platform_get_irq</function>(..., 0) is used to -	    retrieve the IRQ number. -          </para> -          <para>              <function>drm_irq_install</function> starts by calling the              <methodname>irq_preinstall</methodname> driver operation. The operation              is optional and must make sure that the interrupt will not get fired by              clearing all pending interrupt flags or disabling the interrupt.            </para>            <para> -            The IRQ will then be requested by a call to +            The passed-in IRQ will then be requested by a call to              <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver              feature flag is set, a shared (IRQF_SHARED) IRQ handler will be              requested. @@ -445,7 +487,7 @@ char *date;</synopsis>        providing a solution to every graphics memory-related problems, GEM        identified common code between drivers and created a support library to        share it. GEM has simpler initialization and execution requirements than -      TTM, but has no video RAM management capabitilies and is thus limited to +      TTM, but has no video RAM management capabilities and is thus limited to        UMA devices.      </para>      <sect2> @@ -697,55 +739,16 @@ char *date;</synopsis>            respectively. The conversion is handled by the DRM core without any            driver-specific support.          </para> -        <para> -          Similar to global names, GEM file descriptors are also used to share GEM -          objects across processes. They offer additional security: as file -          descriptors must be explicitly sent over UNIX domain sockets to be shared -          between applications, they can't be guessed like the globally unique GEM -          names. -        </para> -        <para> -          Drivers that support GEM file descriptors, also known as the DRM PRIME -          API, must set the DRIVER_PRIME bit in the struct -          <structname>drm_driver</structname> -          <structfield>driver_features</structfield> field, and implement the -          <methodname>prime_handle_to_fd</methodname> and -          <methodname>prime_fd_to_handle</methodname> operations. -        </para> -        <para> -          <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev, -                            struct drm_file *file_priv, uint32_t handle, -                            uint32_t flags, int *prime_fd); -  int (*prime_fd_to_handle)(struct drm_device *dev, -                            struct drm_file *file_priv, int prime_fd, -                            uint32_t *handle);</synopsis> -          Those two operations convert a handle to a PRIME file descriptor and -          vice versa. Drivers must use the kernel dma-buf buffer sharing framework -          to manage the PRIME file descriptors. -        </para> -        <para> -          While non-GEM drivers must implement the operations themselves, GEM -          drivers must use the <function>drm_gem_prime_handle_to_fd</function> -          and <function>drm_gem_prime_fd_to_handle</function> helper functions. -          Those helpers rely on the driver -          <methodname>gem_prime_export</methodname> and -          <methodname>gem_prime_import</methodname> operations to create a dma-buf -          instance from a GEM object (dma-buf exporter role) and to create a GEM -          object from a dma-buf instance (dma-buf importer role). -        </para> -        <para> -          <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev, -                                       struct drm_gem_object *obj, -                                       int flags); -  struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, -                                              struct dma_buf *dma_buf);</synopsis> -          These two operations are mandatory for GEM drivers that support DRM -          PRIME. -        </para> -        <sect4> -          <title>DRM PRIME Helper Functions Reference</title> -!Pdrivers/gpu/drm/drm_prime.c PRIME Helpers -        </sect4> +	<para> +	  GEM also supports buffer sharing with dma-buf file descriptors through +	  PRIME. GEM-based drivers must use the provided helpers functions to +	  implement the exporting and importing correctly. See <xref linkend="drm-prime-support" />. +	  Since sharing file descriptors is inherently more secure than the +	  easily guessable and global GEM names it is the preferred buffer +	  sharing mechanism. Sharing buffers through GEM names is only supported +	  for legacy userspace. Furthermore PRIME also allows cross-device +	  buffer sharing since it is based on dma-bufs. +	</para>        </sect3>        <sect3 id="drm-gem-objects-mapping">          <title>GEM Objects Mapping</title> @@ -830,62 +833,6 @@ char *date;</synopsis>          </para>        </sect3>        <sect3> -        <title>Dumb GEM Objects</title> -        <para> -          The GEM API doesn't standardize GEM objects creation and leaves it to -          driver-specific ioctls. While not an issue for full-fledged graphics -          stacks that include device-specific userspace components (in libdrm for -          instance), this limit makes DRM-based early boot graphics unnecessarily -          complex. -        </para> -        <para> -          Dumb GEM objects partly alleviate the problem by providing a standard -          API to create dumb buffers suitable for scanout, which can then be used -          to create KMS frame buffers. -        </para> -        <para> -          To support dumb GEM objects drivers must implement the -          <methodname>dumb_create</methodname>, -          <methodname>dumb_destroy</methodname> and -          <methodname>dumb_map_offset</methodname> operations. -        </para> -        <itemizedlist> -          <listitem> -            <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev, -                     struct drm_mode_create_dumb *args);</synopsis> -            <para> -              The <methodname>dumb_create</methodname> operation creates a GEM -              object suitable for scanout based on the width, height and depth -              from the struct <structname>drm_mode_create_dumb</structname> -              argument. It fills the argument's <structfield>handle</structfield>, -              <structfield>pitch</structfield> and <structfield>size</structfield> -              fields with a handle for the newly created GEM object and its line -              pitch and size in bytes. -            </para> -          </listitem> -          <listitem> -            <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev, -                      uint32_t handle);</synopsis> -            <para> -              The <methodname>dumb_destroy</methodname> operation destroys a dumb -              GEM object created by <methodname>dumb_create</methodname>. -            </para> -          </listitem> -          <listitem> -            <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev, -                         uint32_t handle, uint64_t *offset);</synopsis> -            <para> -              The <methodname>dumb_map_offset</methodname> operation associates an -              mmap fake offset with the GEM object given by the handle and returns -              it. Drivers must use the -              <function>drm_gem_create_mmap_offset</function> function to -              associate the fake offset as described in -              <xref linkend="drm-gem-objects-mapping"/>. -            </para> -          </listitem> -        </itemizedlist> -      </sect3> -      <sect3>          <title>Memory Coherency</title>          <para>            When mapped to the device or used in a command buffer, backing pages @@ -924,7 +871,99 @@ char *date;</synopsis>            abstracted from the client in libdrm.          </para>        </sect3> -    </sect2> +      <sect3> +        <title>GEM Function Reference</title> +!Edrivers/gpu/drm/drm_gem.c +      </sect3> +      </sect2> +      <sect2> +	<title>VMA Offset Manager</title> +!Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager +!Edrivers/gpu/drm/drm_vma_manager.c +!Iinclude/drm/drm_vma_manager.h +      </sect2> +      <sect2 id="drm-prime-support"> +	<title>PRIME Buffer Sharing</title> +	<para> +	  PRIME is the cross device buffer sharing framework in drm, originally +	  created for the OPTIMUS range of multi-gpu platforms. To userspace +	  PRIME buffers are dma-buf based file descriptors. +	</para> +	<sect3> +	  <title>Overview and Driver Interface</title> +	  <para> +	    Similar to GEM global names, PRIME file descriptors are +	    also used to share buffer objects across processes. They offer +	    additional security: as file descriptors must be explicitly sent over +	    UNIX domain sockets to be shared between applications, they can't be +	    guessed like the globally unique GEM names. +	  </para> +	  <para> +	    Drivers that support the PRIME +	    API must set the DRIVER_PRIME bit in the struct +	    <structname>drm_driver</structname> +	    <structfield>driver_features</structfield> field, and implement the +	    <methodname>prime_handle_to_fd</methodname> and +	    <methodname>prime_fd_to_handle</methodname> operations. +	  </para> +	  <para> +	    <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev, +			  struct drm_file *file_priv, uint32_t handle, +			  uint32_t flags, int *prime_fd); +int (*prime_fd_to_handle)(struct drm_device *dev, +			  struct drm_file *file_priv, int prime_fd, +			  uint32_t *handle);</synopsis> +	    Those two operations convert a handle to a PRIME file descriptor and +	    vice versa. Drivers must use the kernel dma-buf buffer sharing framework +	    to manage the PRIME file descriptors. Similar to the mode setting +	    API PRIME is agnostic to the underlying buffer object manager, as +	    long as handles are 32bit unsigned integers. +	  </para> +	  <para> +	    While non-GEM drivers must implement the operations themselves, GEM +	    drivers must use the <function>drm_gem_prime_handle_to_fd</function> +	    and <function>drm_gem_prime_fd_to_handle</function> helper functions. +	    Those helpers rely on the driver +	    <methodname>gem_prime_export</methodname> and +	    <methodname>gem_prime_import</methodname> operations to create a dma-buf +	    instance from a GEM object (dma-buf exporter role) and to create a GEM +	    object from a dma-buf instance (dma-buf importer role). +	  </para> +	  <para> +	    <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev, +				     struct drm_gem_object *obj, +				     int flags); +struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, +					    struct dma_buf *dma_buf);</synopsis> +	    These two operations are mandatory for GEM drivers that support +	    PRIME. +	  </para> +	</sect3> +        <sect3> +          <title>PRIME Helper Functions</title> +!Pdrivers/gpu/drm/drm_prime.c PRIME Helpers +        </sect3> +      </sect2> +      <sect2> +	<title>PRIME Function References</title> +!Edrivers/gpu/drm/drm_prime.c +      </sect2> +      <sect2> +	<title>DRM MM Range Allocator</title> +	<sect3> +	  <title>Overview</title> +!Pdrivers/gpu/drm/drm_mm.c Overview +	</sect3> +	<sect3> +	  <title>LRU Scan/Eviction Support</title> +!Pdrivers/gpu/drm/drm_mm.c lru scan roaster +	</sect3> +      </sect2> +      <sect2> +	<title>DRM MM Range Allocator Function References</title> +!Edrivers/gpu/drm/drm_mm.c +!Iinclude/drm/drm_mm.h +      </sect2>    </sect1>    <!-- Internals: mode setting --> @@ -953,6 +992,11 @@ int max_width, max_height;</synopsis>        </listitem>      </itemizedlist>      <sect2> +      <title>Display Modes Function Reference</title> +!Iinclude/drm/drm_modes.h +!Edrivers/gpu/drm/drm_modes.c +    </sect2> +    <sect2>        <title>Frame Buffer Creation</title>        <synopsis>struct drm_framebuffer *(*fb_create)(struct drm_device *dev,  				     struct drm_file *file_priv, @@ -968,9 +1012,11 @@ int max_width, max_height;</synopsis>          Frame buffers rely on the underneath memory manager for low-level memory          operations. When creating a frame buffer applications pass a memory          handle (or a list of memory handles for multi-planar formats) through -        the <parameter>drm_mode_fb_cmd2</parameter> argument. This document -        assumes that the driver uses GEM, those handles thus reference GEM -        objects. +	the <parameter>drm_mode_fb_cmd2</parameter> argument. For drivers using +	GEM as their userspace buffer management interface this would be a GEM +	handle.  Drivers are however free to use their own backing storage object +	handles, e.g. vmwgfx directly exposes special TTM handles to userspace +	and so expects TTM handles in the create ioctl and not GEM handles.        </para>        <para>          Drivers must first validate the requested frame buffer parameters passed @@ -992,7 +1038,7 @@ int max_width, max_height;</synopsis>        </para>        <para> -	The initailization of the new framebuffer instance is finalized with a +	The initialization of the new framebuffer instance is finalized with a  	call to <function>drm_framebuffer_init</function> which takes a pointer  	to DRM frame buffer operations (struct  	<structname>drm_framebuffer_funcs</structname>). Note that this function @@ -1042,7 +1088,7 @@ int max_width, max_height;</synopsis>        <para>  	The lifetime of a drm framebuffer is controlled with a reference count,  	drivers can grab additional references with -	<function>drm_framebuffer_reference</function> </para> and drop them +	<function>drm_framebuffer_reference</function>and drop them  	again with <function>drm_framebuffer_unreference</function>. For  	driver-private framebuffers for which the last reference is never  	dropped (e.g. for the fbdev framebuffer when the struct @@ -1050,6 +1096,72 @@ int max_width, max_height;</synopsis>  	helper struct) drivers can manually clean up a framebuffer at module  	unload time with  	<function>drm_framebuffer_unregister_private</function>. +      </para> +    </sect2> +    <sect2> +      <title>Dumb Buffer Objects</title> +      <para> +	The KMS API doesn't standardize backing storage object creation and +	leaves it to driver-specific ioctls. Furthermore actually creating a +	buffer object even for GEM-based drivers is done through a +	driver-specific ioctl - GEM only has a common userspace interface for +	sharing and destroying objects. While not an issue for full-fledged +	graphics stacks that include device-specific userspace components (in +	libdrm for instance), this limit makes DRM-based early boot graphics +	unnecessarily complex. +      </para> +      <para> +        Dumb objects partly alleviate the problem by providing a standard +        API to create dumb buffers suitable for scanout, which can then be used +        to create KMS frame buffers. +      </para> +      <para> +        To support dumb objects drivers must implement the +        <methodname>dumb_create</methodname>, +        <methodname>dumb_destroy</methodname> and +        <methodname>dumb_map_offset</methodname> operations. +      </para> +      <itemizedlist> +        <listitem> +          <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev, +                   struct drm_mode_create_dumb *args);</synopsis> +          <para> +            The <methodname>dumb_create</methodname> operation creates a driver +	    object (GEM or TTM handle) suitable for scanout based on the +	    width, height and depth from the struct +	    <structname>drm_mode_create_dumb</structname> argument. It fills the +	    argument's <structfield>handle</structfield>, +	    <structfield>pitch</structfield> and <structfield>size</structfield> +	    fields with a handle for the newly created object and its line +            pitch and size in bytes. +          </para> +        </listitem> +        <listitem> +          <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev, +                    uint32_t handle);</synopsis> +          <para> +            The <methodname>dumb_destroy</methodname> operation destroys a dumb +            object created by <methodname>dumb_create</methodname>. +          </para> +        </listitem> +        <listitem> +          <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev, +                       uint32_t handle, uint64_t *offset);</synopsis> +          <para> +            The <methodname>dumb_map_offset</methodname> operation associates an +            mmap fake offset with the object given by the handle and returns +            it. Drivers must use the +            <function>drm_gem_create_mmap_offset</function> function to +            associate the fake offset as described in +            <xref linkend="drm-gem-objects-mapping"/>. +          </para> +        </listitem> +      </itemizedlist> +      <para> +        Note that dumb objects may not be used for gpu acceleration, as has been +	attempted on some ARM embedded platforms. Such drivers really must have +	a hardware-specific ioctl to allocate suitable buffer objects. +      </para>      </sect2>      <sect2>        <title>Output Polling</title> @@ -1110,7 +1222,7 @@ int max_width, max_height;</synopsis>            pointer to CRTC functions.          </para>        </sect3> -      <sect3> +      <sect3 id="drm-kms-crtcops">          <title>CRTC Operations</title>          <sect4>            <title>Set Configuration</title> @@ -1130,8 +1242,11 @@ int max_width, max_height;</synopsis>              This operation is called with the mode config lock held.            </para>            <note><para> -            FIXME: How should set_config interact with DPMS? If the CRTC is -            suspended, should it be resumed? +	    Note that the drm core has no notion of restoring the mode setting +	    state after resume, since all resume handling is in the full +	    responsibility of the driver. The common mode setting helper library +	    though provides a helper which can be used for this: +	    <function>drm_helper_resume_force_mode</function>.            </para></note>          </sect4>          <sect4> @@ -1248,15 +1363,47 @@ int max_width, max_height;</synopsis>  	optionally scale it to a destination size. The result is then blended  	with or overlayed on top of a CRTC.        </para> +      <para> +      The DRM core recognizes three types of planes: +      <itemizedlist> +        <listitem> +        DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.  Primary +        planes are the planes operated upon by by CRTC modesetting and flipping +        operations described in <xref linkend="drm-kms-crtcops"/>. +        </listitem> +        <listitem> +        DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.  Cursor +        planes are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and +        DRM_IOCTL_MODE_CURSOR2 ioctls. +        </listitem> +        <listitem> +        DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor planes. +        Some drivers refer to these types of planes as "sprites" internally. +        </listitem> +      </itemizedlist> +      For compatibility with legacy userspace, only overlay planes are made +      available to userspace by default.  Userspace clients may set the +      DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that +      they wish to receive a universal plane list containing all plane types. +      </para>        <sect3>          <title>Plane Initialization</title>          <para> -          Planes are optional. To create a plane, a KMS drivers allocates and +          To create a plane, a KMS drivers allocates and            zeroes an instances of struct <structname>drm_plane</structname>            (possibly as part of a larger structure) and registers it with a call -          to <function>drm_plane_init</function>. The function takes a bitmask +          to <function>drm_universal_plane_init</function>. The function takes a bitmask            of the CRTCs that can be associated with the plane, a pointer to the -          plane functions and a list of format supported formats. +          plane functions, a list of format supported formats, and the type of +          plane (primary, cursor, or overlay) being initialized. +        </para> +        <para> +          Cursor and overlay planes are optional.  All drivers should provide +          one primary plane per CRTC (although this requirement may change in +          the future); drivers that do not wish to provide special handling for +          primary planes may make use of the helper functions described in +          <xref linkend="drm-kms-planehelpers"/> to create and register a +          primary plane with standard capabilities.          </para>        </sect3>        <sect3> @@ -1680,6 +1827,12 @@ void intel_crt_init(struct drm_device *dev)        <title>KMS API Functions</title>  !Edrivers/gpu/drm/drm_crtc.c      </sect2> +    <sect2> +      <title>KMS Locking</title> +!Pdrivers/gpu/drm/drm_modeset_lock.c kms locking +!Iinclude/drm/drm_modeset_lock.h +!Edrivers/gpu/drm/drm_modeset_lock.c +    </sect2>    </sect1>    <!-- Internals: kms helper functions --> @@ -1687,7 +1840,7 @@ void intel_crt_init(struct drm_device *dev)    <sect1>      <title>Mode Setting Helper Functions</title>      <para> -      The CRTC, encoder and connector functions provided by the drivers +      The plane, CRTC, encoder and connector functions provided by the drivers        implement the DRM API. They're called by the DRM core and ioctl handlers        to handle device state changes and configuration request. As implementing        those functions often requires logic not specific to drivers, mid-layer @@ -1695,8 +1848,8 @@ void intel_crt_init(struct drm_device *dev)      </para>      <para>        The DRM core contains one mid-layer implementation. The mid-layer provides -      implementations of several CRTC, encoder and connector functions (called -      from the top of the mid-layer) that pre-process requests and call +      implementations of several plane, CRTC, encoder and connector functions +      (called from the top of the mid-layer) that pre-process requests and call        lower-level functions provided by the driver (at the bottom of the        mid-layer). For instance, the        <function>drm_crtc_helper_set_config</function> function can be used to @@ -1784,8 +1937,8 @@ void intel_crt_init(struct drm_device *dev)            <para>              The function filters out modes larger than              <parameter>max_width</parameter> and <parameter>max_height</parameter> -            if specified. It then calls the connector -            <methodname>mode_valid</methodname> helper operation for  each mode in +            if specified. It then calls the optional connector +            <methodname>mode_valid</methodname> helper operation for each mode in              the probed list to check whether the mode is valid for the connector.            </para>          </listitem> @@ -2134,7 +2287,7 @@ void intel_crt_init(struct drm_device *dev)              set the <structfield>display_info</structfield>              <structfield>width_mm</structfield> and              <structfield>height_mm</structfield> fields if they haven't been set -            already (for instance at initilization time when a fixed-size panel is +            already (for instance at initialization time when a fixed-size panel is              attached to the connector). The mode <structfield>width_mm</structfield>              and <structfield>height_mm</structfield> fields are only used internally              during EDID parsing and should not be set when creating modes manually. @@ -2146,7 +2299,7 @@ void intel_crt_init(struct drm_device *dev)            <para>              Verify whether a mode is valid for the connector. Return MODE_OK for              supported modes and one of the enum drm_mode_status values (MODE_*) -            for unsupported modes. This operation is mandatory. +            for unsupported modes. This operation is optional.            </para>            <para>              As the mode rejection reason is currently not used beside for @@ -2168,6 +2321,11 @@ void intel_crt_init(struct drm_device *dev)  !Edrivers/gpu/drm/drm_crtc_helper.c      </sect2>      <sect2> +      <title>Output Probing Helper Functions Reference</title> +!Pdrivers/gpu/drm/drm_probe_helper.c output probing helper overview +!Edrivers/gpu/drm/drm_probe_helper.c +    </sect2> +    <sect2>        <title>fbdev Helper Functions Reference</title>  !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers  !Edrivers/gpu/drm/drm_fb_helper.c @@ -2196,10 +2354,19 @@ void intel_crt_init(struct drm_device *dev)  !Edrivers/gpu/drm/drm_flip_work.c      </sect2>      <sect2> -      <title>VMA Offset Manager</title> -!Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager -!Edrivers/gpu/drm/drm_vma_manager.c -!Iinclude/drm/drm_vma_manager.h +      <title>HDMI Infoframes Helper Reference</title> +      <para> +	Strictly speaking this is not a DRM helper library but generally useable +	by any driver interfacing with HDMI outputs like v4l or alsa drivers. +	But it nicely fits into the overall topic of mode setting helper +	libraries and hence is also included here. +      </para> +!Iinclude/linux/hdmi.h +!Edrivers/video/hdmi.c +    </sect2> +    <sect2> +      <title id="drm-kms-planehelpers">Plane Helper Reference</title> +!Edrivers/gpu/drm/drm_plane_helper.c Plane Helpers      </sect2>    </sect1> @@ -2223,7 +2390,7 @@ void intel_crt_init(struct drm_device *dev)        first create properties and then create and associate individual instances        of those properties to objects. A property can be instantiated multiple        times and associated with different objects. Values are stored in property -      instances, and all other property information are stored in the propery +      instances, and all other property information are stored in the property        and shared between all instances of the property.      </para>      <para> @@ -2317,6 +2484,863 @@ void intel_crt_init(struct drm_device *dev)        pointer to the target object, a pointer to the previously created property        and an initial instance value.      </para> +    <sect2> +	<title>Existing KMS Properties</title> +	<para> +	The following table gives description of drm properties exposed by various +	modules/drivers. +	</para> +	<table border="1" cellpadding="0" cellspacing="0"> +	<tbody> +	<tr style="font-weight: bold;"> +	<td valign="top" >Owner Module/Drivers</td> +	<td valign="top" >Group</td> +	<td valign="top" >Property Name</td> +	<td valign="top" >Type</td> +	<td valign="top" >Property Values</td> +	<td valign="top" >Object attached</td> +	<td valign="top" >Description/Restrictions</td> +	</tr> +	<tr> +	<td rowspan="20" valign="top" >DRM</td> +	<td rowspan="2" valign="top" >Generic</td> +	<td valign="top" >“EDID”</td> +	<td valign="top" >BLOB | IMMUTABLE</td> +	<td valign="top" >0</td> +	<td valign="top" >Connector</td> +	<td valign="top" >Contains id of edid blob ptr object.</td> +	</tr> +	<tr> +	<td valign="top" >“DPMS”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ “On”, “Standby”, “Suspend”, “Off” }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >Contains DPMS operation mode value.</td> +	</tr> +	<tr> +	<td rowspan="1" valign="top" >Plane</td> +	<td valign="top" >“type”</td> +	<td valign="top" >ENUM | IMMUTABLE</td> +	<td valign="top" >{ "Overlay", "Primary", "Cursor" }</td> +	<td valign="top" >Plane</td> +	<td valign="top" >Plane type</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >DVI-I</td> +	<td valign="top" >“subconnector”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ “Unknown”, “DVI-D”, “DVI-A” }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“select subconnector”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ “Automatic”, “DVI-D”, “DVI-A” }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="13" valign="top" >TV</td> +	<td valign="top" >“subconnector”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "Unknown", "Composite", "SVIDEO", "Component", "SCART" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“select subconnector”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "Automatic", "Composite", "SVIDEO", "Component", "SCART" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“left margin”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“right margin”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“top margin”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“bottom margin”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“brightness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“contrast”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker reduction”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“overscan”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“saturation”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hue”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >Optional</td> +	<td valign="top" >“scaling mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“dirty”</td> +	<td valign="top" >ENUM | IMMUTABLE</td> +	<td valign="top" >{ "Off", "On", "Annotate" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="21" valign="top" >i915</td> +	<td rowspan="3" valign="top" >Generic</td> +	<td valign="top" >"Broadcast RGB"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "Automatic", "Full", "Limited 16:235" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“audio”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "force-dvi", "off", "auto", "on" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Standard name as in DRM</td> +	<td valign="top" >Standard type as in DRM</td> +	<td valign="top" >Standard value as in DRM</td> +	<td valign="top" >Standard Object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="17" valign="top" >SDVO-TV</td> +	<td valign="top" >“mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"left_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"right_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"top_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"bottom_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hpos”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“vpos”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“contrast”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“saturation”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hue”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“sharpness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter_adaptive”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter_2d”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“tv_chroma_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“tv_luma_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“dot_crawl”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >SDVO-TV/LVDS</td> +	<td valign="top" >“brightness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="3" valign="top" >CDV gma-500</td> +	<td rowspan="3" valign="top" >Generic</td> +	<td valign="top" >"Broadcast RGB"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ “Full”, “Limited 16:235” }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"Broadcast RGB"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ “off”, “auto”, “on” }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Standard name as in DRM</td> +	<td valign="top" >Standard type as in DRM</td> +	<td valign="top" >Standard value as in DRM</td> +	<td valign="top" >Standard Object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="20" valign="top" >Poulsbo</td> +	<td rowspan="2" valign="top" >Generic</td> +	<td valign="top" >“backlight”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=100</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Standard name as in DRM</td> +	<td valign="top" >Standard type as in DRM</td> +	<td valign="top" >Standard value as in DRM</td> +	<td valign="top" >Standard Object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="17" valign="top" >SDVO-TV</td> +	<td valign="top" >“mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"left_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"right_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"top_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"bottom_margin"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hpos”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“vpos”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“contrast”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“saturation”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hue”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“sharpness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter_adaptive”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“flicker_filter_2d”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“tv_chroma_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“tv_luma_filter”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“dot_crawl”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >SDVO-TV/LVDS</td> +	<td valign="top" >“brightness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max= SDVO dependent</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="11" valign="top" >armada</td> +	<td rowspan="2" valign="top" >CRTC</td> +	<td valign="top" >"CSC_YUV"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "Auto" , "CCIR601", "CCIR709" }</td> +	<td valign="top" >CRTC</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"CSC_RGB"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "Auto", "Computer system", "Studio" }</td> +	<td valign="top" >CRTC</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="9" valign="top" >Overlay</td> +	<td valign="top" >"colorkey"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0xffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey_min"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0xffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey_max"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0xffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey_val"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0xffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey_alpha"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0xffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey_mode"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "disabled", "Y component", "U component" +	, "V component", "RGB", “R component", "G component", "B component" }</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"brightness"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=256 + 255</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"contrast"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0x7fff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"saturation"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0x7fff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >exynos</td> +	<td valign="top" >CRTC</td> +	<td valign="top" >“mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "normal", "blank" }</td> +	<td valign="top" >CRTC</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Overlay</td> +	<td valign="top" >“zpos”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=MAX_PLANE-1</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="3" valign="top" >i2c/ch7006_drv</td> +	<td valign="top" >Generic</td> +	<td valign="top" >“scale”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=2</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >TV</td> +	<td valign="top" >Standard names as in DRM</td> +	<td valign="top" >Standard types as in DRM</td> +	<td valign="top" >Standard Values as in DRM</td> +	<td valign="top" >Standard object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "PAL", "PAL-M","PAL-N"}, ”PAL-Nc" +	, "PAL-60", "NTSC-M", "NTSC-J" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="16" valign="top" >nouveau</td> +	<td rowspan="6" valign="top" >NV10 Overlay</td> +	<td valign="top" >"colorkey"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0x01ffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“contrast”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=8192-1</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“brightness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1024</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“hue”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=359</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“saturation”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=8192-1</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“iturbt_709”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >Nv04 Overlay</td> +	<td valign="top" >“colorkey”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0x01ffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“brightness”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1024</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="7" valign="top" >Display</td> +	<td valign="top" >“dithering mode”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "auto", "off", "on" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“dithering depth”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "auto", "off", "on", "static 2x2", "dynamic 2x2", "temporal" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“underscan”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "auto", "6 bpc", "8 bpc" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“underscan hborder”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=128</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“underscan vborder”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=128</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“vibrant hue”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=180</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“color vibrance”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=200</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Generic</td> +	<td valign="top" >Standard name as in DRM</td> +	<td valign="top" >Standard type as in DRM</td> +	<td valign="top" >Standard value as in DRM</td> +	<td valign="top" >Standard Object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="2" valign="top" >omap</td> +	<td rowspan="2" valign="top" >Generic</td> +	<td valign="top" >“rotation”</td> +	<td valign="top" >BITMASK</td> +	<td valign="top" >{ 0, "rotate-0" }, +	{ 1, "rotate-90" }, +	{ 2, "rotate-180" }, +	{ 3, "rotate-270" }, +	{ 4, "reflect-x" }, +	{ 5, "reflect-y" }</td> +	<td valign="top" >CRTC, Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >“zorder”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=3</td> +	<td valign="top" >CRTC, Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >qxl</td> +	<td valign="top" >Generic</td> +	<td valign="top" >“hotplug_mode_update"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="10" valign="top" >radeon</td> +	<td valign="top" >DVI-I</td> +	<td valign="top" >“coherent”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >DAC enable load detect</td> +	<td valign="top" >“load detection”</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=1</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >TV Standard</td> +	<td valign="top" >"tv standard"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "ntsc", "pal", "pal-m", "pal-60", "ntsc-j" +	, "scart-pal", "pal-cn", "secam" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >legacy TMDS PLL detect</td> +	<td valign="top" >"tmds_pll"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "driver", "bios" }</td> +	<td valign="top" >-</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="3" valign="top" >Underscan</td> +	<td valign="top" >"underscan"</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "off", "on", "auto" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"underscan hborder"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=128</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"underscan vborder"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=128</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Audio</td> +	<td valign="top" >“audio”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "off", "on", "auto" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >FMT Dithering</td> +	<td valign="top" >“dither”</td> +	<td valign="top" >ENUM</td> +	<td valign="top" >{ "off", "on" }</td> +	<td valign="top" >Connector</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >Generic</td> +	<td valign="top" >Standard name as in DRM</td> +	<td valign="top" >Standard type as in DRM</td> +	<td valign="top" >Standard value as in DRM</td> +	<td valign="top" >Standard Object as in DRM</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td rowspan="3" valign="top" >rcar-du</td> +	<td rowspan="3" valign="top" >Generic</td> +	<td valign="top" >"alpha"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=255</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"colorkey"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=0, Max=0x01ffffff</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	<tr> +	<td valign="top" >"zpos"</td> +	<td valign="top" >RANGE</td> +	<td valign="top" >Min=1, Max=7</td> +	<td valign="top" >Plane</td> +	<td valign="top" >TBD</td> +	</tr> +	</tbody> +	</table> +    </sect2>    </sect1>    <!-- Internals: vertical blanking --> @@ -2394,6 +3418,10 @@ void (*disable_vblank) (struct drm_device *dev, int crtc);</synopsis>        with a call to <function>drm_vblank_cleanup</function> in the driver        <methodname>unload</methodname> operation handler.      </para> +    <sect2> +      <title>Vertical Blanking and Interrupt Handling Functions Reference</title> +!Edrivers/gpu/drm/drm_irq.c +    </sect2>    </sect1>    <!-- Internals: open/close, file operations and ioctls --> @@ -2561,42 +3589,44 @@ int num_ioctls;</synopsis>        </para>      </sect2>    </sect1> -    <sect1> -    <title>Command submission & fencing</title> +    <title>Legacy Support Code</title>      <para> -      This should cover a few device-specific command submission -      implementations. +      The section very briefly covers some of the old legacy support code which +      is only used by old DRM drivers which have done a so-called shadow-attach +      to the underlying device instead of registering as a real driver. This +      also includes some of the old generic buffer management and command +      submission code. Do not use any of this in new and modern drivers.      </para> -  </sect1> -  <!-- Internals: suspend/resume --> - -  <sect1> -    <title>Suspend/Resume</title> -    <para> -      The DRM core provides some suspend/resume code, but drivers wanting full -      suspend/resume support should provide save() and restore() functions. -      These are called at suspend, hibernate, or resume time, and should perform -      any state save or restore required by your device across suspend or -      hibernate states. -    </para> -    <synopsis>int (*suspend) (struct drm_device *, pm_message_t state); -int (*resume) (struct drm_device *);</synopsis> -    <para> -      Those are legacy suspend and resume methods. New driver should use the -      power management interface provided by their bus type (usually through -      the struct <structname>device_driver</structname> dev_pm_ops) and set -      these methods to NULL. -    </para> -  </sect1> +    <sect2> +      <title>Legacy Suspend/Resume</title> +      <para> +	The DRM core provides some suspend/resume code, but drivers wanting full +	suspend/resume support should provide save() and restore() functions. +	These are called at suspend, hibernate, or resume time, and should perform +	any state save or restore required by your device across suspend or +	hibernate states. +      </para> +      <synopsis>int (*suspend) (struct drm_device *, pm_message_t state); +  int (*resume) (struct drm_device *);</synopsis> +      <para> +	Those are legacy suspend and resume methods which +	<emphasis>only</emphasis> work with the legacy shadow-attach driver +	registration functions. New driver should use the power management +	interface provided by their bus type (usually through +	the struct <structname>device_driver</structname> dev_pm_ops) and set +	these methods to NULL. +      </para> +    </sect2> -  <sect1> -    <title>DMA services</title> -    <para> -      This should cover how DMA mapping etc. is supported by the core. -      These functions are deprecated and should not be used. -    </para> +    <sect2> +      <title>Legacy DMA Services</title> +      <para> +	This should cover how DMA mapping etc. is supported by the core. +	These functions are deprecated and should not be used. +      </para> +    </sect2>    </sect1>    </chapter> @@ -2658,8 +3688,8 @@ int (*resume) (struct drm_device *);</synopsis>          DRM core provides multiple character-devices for user-space to use.          Depending on which device is opened, user-space can perform a different          set of operations (mainly ioctls). The primary node is always created -        and called <term>card<num></term>. Additionally, a currently -        unused control node, called <term>controlD<num></term> is also +        and called card<num>. Additionally, a currently +        unused control node, called controlD<num> is also          created. The primary node provides all legacy operations and          historically was the only interface used by userspace. With KMS, the          control node was introduced. However, the planned KMS control interface @@ -2674,21 +3704,21 @@ int (*resume) (struct drm_device *);</synopsis>          nodes were introduced. Render nodes solely serve render clients, that          is, no modesetting or privileged ioctls can be issued on render nodes.          Only non-global rendering commands are allowed. If a driver supports -        render nodes, it must advertise it via the <term>DRIVER_RENDER</term> +        render nodes, it must advertise it via the DRIVER_RENDER          DRM driver capability. If not supported, the primary node must be used          for render clients together with the legacy drmAuth authentication          procedure.        </para>        <para>          If a driver advertises render node support, DRM core will create a -        separate render node called <term>renderD<num></term>. There will +        separate render node called renderD<num>. There will          be one render node per device. No ioctls except  PRIME-related ioctls -        will be allowed on this node. Especially <term>GEM_OPEN</term> will be +        will be allowed on this node. Especially GEM_OPEN will be          explicitly prohibited. Render nodes are designed to avoid the          buffer-leaks, which occur if clients guess the flink names or mmap          offsets on the legacy interface. Additionally to this basic interface,          drivers must mark their driver-dependent render-only ioctls as -        <term>DRM_RENDER_ALLOW</term> so render clients can use them. Driver +        DRM_RENDER_ALLOW so render clients can use them. Driver          authors must be careful not to allow any privileged ioctls on render          nodes.        </para> @@ -2734,30 +3764,182 @@ int (*resume) (struct drm_device *);</synopsis>              <term>DRM_IOCTL_MODESET_CTL</term>              <listitem>                <para> -                This should be called by application level drivers before and -                after mode setting, since on many devices the vertical blank -                counter is reset at that time.  Internally, the DRM snapshots -                the last vblank count when the ioctl is called with the -                _DRM_PRE_MODESET command, so that the counter won't go backwards -                (which is dealt with when _DRM_POST_MODESET is used). +		This was only used for user-mode-settind drivers around +		modesetting changes to allow the kernel to update the vblank +		interrupt after mode setting, since on many devices the vertical +		blank counter is reset to 0 at some point during modeset. Modern +		drivers should not call this any more since with kernel mode +		setting it is a no-op.                </para>              </listitem>            </varlistentry>          </variablelist> -<!--!Edrivers/char/drm/drm_irq.c-->        </para>      </sect1>    </chapter> +</part> +<part id="drmDrivers"> +  <title>DRM Drivers</title> -  <!-- API reference --> +  <partintro> +    <para> +      This second part of the DRM Developer's Guide documents driver code, +      implementation details and also all the driver-specific userspace +      interfaces. Especially since all hardware-acceleration interfaces to +      userspace are driver specific for efficiency and other reasons these +      interfaces can be rather substantial. Hence every driver has its own +      chapter. +    </para> +  </partintro> -  <appendix id="drmDriverApi"> -    <title>DRM Driver API</title> +  <chapter id="drmI915"> +    <title>drm/i915 Intel GFX Driver</title>      <para> -      Include auto-generated API reference here (need to reference it -      from paragraphs above too). +      The drm/i915 driver supports all (with the exception of some very early +      models) integrated GFX chipsets with both Intel display and rendering +      blocks. This excludes a set of SoC platforms with an SGX rendering unit, +      those have basic support through the gma500 drm driver.      </para> -  </appendix> +    <sect1> +      <title>Display Hardware Handling</title> +      <para> +        This section covers everything related to the display hardware including +        the mode setting infrastructure, plane, sprite and cursor handling and +        display, output probing and related topics. +      </para> +      <sect2> +        <title>Mode Setting Infrastructure</title> +        <para> +          The i915 driver is thus far the only DRM driver which doesn't use the +          common DRM helper code to implement mode setting sequences. Thus it +          has its own tailor-made infrastructure for executing a display +          configuration change. +        </para> +      </sect2> +      <sect2> +        <title>Plane Configuration</title> +        <para> +	  This section covers plane configuration and composition with the +	  primary plane, sprites, cursors and overlays. This includes the +	  infrastructure to do atomic vsync'ed updates of all this state and +	  also tightly coupled topics like watermark setup and computation, +	  framebuffer compression and panel self refresh. +        </para> +      </sect2> +      <sect2> +        <title>Output Probing</title> +        <para> +	  This section covers output probing and related infrastructure like the +	  hotplug interrupt storm detection and mitigation code. Note that the +	  i915 driver still uses most of the common DRM helper code for output +	  probing, so those sections fully apply. +        </para> +      </sect2> +      <sect2> +        <title>DPIO</title> +!Pdrivers/gpu/drm/i915/i915_reg.h DPIO +	<table id="dpiox2"> +	  <title>Dual channel PHY (VLV/CHV)</title> +	  <tgroup cols="8"> +	    <colspec colname="c0" /> +	    <colspec colname="c1" /> +	    <colspec colname="c2" /> +	    <colspec colname="c3" /> +	    <colspec colname="c4" /> +	    <colspec colname="c5" /> +	    <colspec colname="c6" /> +	    <colspec colname="c7" /> +	    <spanspec spanname="ch0" namest="c0" nameend="c3" /> +	    <spanspec spanname="ch1" namest="c4" nameend="c7" /> +	    <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" /> +	    <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" /> +	    <spanspec spanname="ch1pcs01" namest="c4" nameend="c5" /> +	    <spanspec spanname="ch1pcs23" namest="c6" nameend="c7" /> +	    <thead> +	      <row> +		<entry spanname="ch0">CH0</entry> +		<entry spanname="ch1">CH1</entry> +	      </row> +	    </thead> +	    <tbody valign="top" align="center"> +	      <row> +		<entry spanname="ch0">CMN/PLL/REF</entry> +		<entry spanname="ch1">CMN/PLL/REF</entry> +	      </row> +	      <row> +		<entry spanname="ch0pcs01">PCS01</entry> +		<entry spanname="ch0pcs23">PCS23</entry> +		<entry spanname="ch1pcs01">PCS01</entry> +		<entry spanname="ch1pcs23">PCS23</entry> +	      </row> +	      <row> +		<entry>TX0</entry> +		<entry>TX1</entry> +		<entry>TX2</entry> +		<entry>TX3</entry> +		<entry>TX0</entry> +		<entry>TX1</entry> +		<entry>TX2</entry> +		<entry>TX3</entry> +	      </row> +	      <row> +		<entry spanname="ch0">DDI0</entry> +		<entry spanname="ch1">DDI1</entry> +	      </row> +	    </tbody> +	  </tgroup> +	</table> +	<table id="dpiox1"> +	  <title>Single channel PHY (CHV)</title> +	  <tgroup cols="4"> +	    <colspec colname="c0" /> +	    <colspec colname="c1" /> +	    <colspec colname="c2" /> +	    <colspec colname="c3" /> +	    <spanspec spanname="ch0" namest="c0" nameend="c3" /> +	    <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" /> +	    <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" /> +	    <thead> +	      <row> +		<entry spanname="ch0">CH0</entry> +	      </row> +	    </thead> +	    <tbody valign="top" align="center"> +	      <row> +		<entry spanname="ch0">CMN/PLL/REF</entry> +	      </row> +	      <row> +		<entry spanname="ch0pcs01">PCS01</entry> +		<entry spanname="ch0pcs23">PCS23</entry> +	      </row> +	      <row> +		<entry>TX0</entry> +		<entry>TX1</entry> +		<entry>TX2</entry> +		<entry>TX3</entry> +	      </row> +	      <row> +		<entry spanname="ch0">DDI2</entry> +	      </row> +	    </tbody> +	  </tgroup> +	</table> +      </sect2> +    </sect1> +    <sect1> +      <title>Memory Management and Command Submission</title> +      <para> +	This sections covers all things related to the GEM implementation in the +	i915 driver. +      </para> +      <sect2> +        <title>Batchbuffer Parsing</title> +!Pdrivers/gpu/drm/i915/i915_cmd_parser.c batch buffer command parser +!Idrivers/gpu/drm/i915/i915_cmd_parser.c +      </sect2> +    </sect1> +  </chapter> +</part>  </book> diff --git a/Documentation/DocBook/filesystems.tmpl b/Documentation/DocBook/filesystems.tmpl index 25b58efd955..bcdfdb9a927 100644 --- a/Documentation/DocBook/filesystems.tmpl +++ b/Documentation/DocBook/filesystems.tmpl @@ -62,7 +62,7 @@  !Efs/mpage.c  !Efs/namei.c  !Efs/buffer.c -!Efs/bio.c +!Eblock/bio.c  !Efs/seq_file.c  !Efs/filesystems.c  !Efs/fs-writeback.c @@ -91,7 +91,6 @@       <title>The Filesystem for Exporting Kernel Objects</title>  !Efs/sysfs/file.c  !Efs/sysfs/symlink.c -!Efs/sysfs/bin.c    </chapter>    <chapter id="debugfs"> diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl index 4017f147ba2..2c425d70f7e 100644 --- a/Documentation/DocBook/gadget.tmpl +++ b/Documentation/DocBook/gadget.tmpl @@ -708,7 +708,7 @@ hardware level details could be very different.  <para>Systems need specialized hardware support to implement OTG,  notably including a special <emphasis>Mini-AB</emphasis> jack -and associated transciever to support <emphasis>Dual-Role</emphasis> +and associated transceiver to support <emphasis>Dual-Role</emphasis>  operation:  they can act either as a host, using the standard  Linux-USB host side driver stack, diff --git a/Documentation/DocBook/genericirq.tmpl b/Documentation/DocBook/genericirq.tmpl index d16d21b7a3b..59fb5c07754 100644 --- a/Documentation/DocBook/genericirq.tmpl +++ b/Documentation/DocBook/genericirq.tmpl @@ -87,7 +87,7 @@    <chapter id="rationale">      <title>Rationale</title>  	<para> -	The original implementation of interrupt handling in Linux is using +	The original implementation of interrupt handling in Linux uses  	the __do_IRQ() super-handler, which is able to deal with every  	type of interrupt logic.  	</para> @@ -111,19 +111,19 @@  	</itemizedlist>  	</para>  	<para> -	This split implementation of highlevel IRQ handlers allows us to +	This split implementation of high-level IRQ handlers allows us to  	optimize the flow of the interrupt handling for each specific -	interrupt type. This reduces complexity in that particular codepath +	interrupt type. This reduces complexity in that particular code path  	and allows the optimized handling of a given type.  	</para>  	<para>  	The original general IRQ implementation used hw_interrupt_type  	structures and their ->ack(), ->end() [etc.] callbacks to  	differentiate the flow control in the super-handler. This leads to -	a mix of flow logic and lowlevel hardware logic, and it also leads -	to unnecessary code duplication: for example in i386, there is a -	ioapic_level_irq and a ioapic_edge_irq irq-type which share many -	of the lowlevel details but have different flow handling. +	a mix of flow logic and low-level hardware logic, and it also leads +	to unnecessary code duplication: for example in i386, there is an +	ioapic_level_irq and an ioapic_edge_irq IRQ-type which share many +	of the low-level details but have different flow handling.  	</para>  	<para>  	A more natural abstraction is the clean separation of the @@ -132,23 +132,23 @@  	<para>  	Analysing a couple of architecture's IRQ subsystem implementations  	reveals that most of them can use a generic set of 'irq flow' -	methods and only need to add the chip level specific code. +	methods and only need to add the chip-level specific code.  	The separation is also valuable for (sub)architectures -	which need specific quirks in the irq flow itself but not in the -	chip-details - and thus provides a more transparent IRQ subsystem +	which need specific quirks in the IRQ flow itself but not in the +	chip details - and thus provides a more transparent IRQ subsystem  	design.  	</para>  	<para> -	Each interrupt descriptor is assigned its own highlevel flow +	Each interrupt descriptor is assigned its own high-level flow  	handler, which is normally one of the generic -	implementations. (This highlevel flow handler implementation also +	implementations. (This high-level flow handler implementation also  	makes it simple to provide demultiplexing handlers which can be  	found in embedded platforms on various architectures.)  	</para>  	<para>  	The separation makes the generic interrupt handling layer more  	flexible and extensible. For example, an (sub)architecture can -	use a generic irq-flow implementation for 'level type' interrupts +	use a generic IRQ-flow implementation for 'level type' interrupts  	and add a (sub)architecture specific 'edge type' implementation.  	</para>  	<para> @@ -172,9 +172,9 @@      <para>  	There are three main levels of abstraction in the interrupt code:  	<orderedlist> -	  <listitem><para>Highlevel driver API</para></listitem> -	  <listitem><para>Highlevel IRQ flow handlers</para></listitem> -	  <listitem><para>Chiplevel hardware encapsulation</para></listitem> +	  <listitem><para>High-level driver API</para></listitem> +	  <listitem><para>High-level IRQ flow handlers</para></listitem> +	  <listitem><para>Chip-level hardware encapsulation</para></listitem>  	</orderedlist>      </para>      <sect1 id="Interrupt_control_flow"> @@ -182,23 +182,23 @@  	<para>  	Each interrupt is described by an interrupt descriptor structure  	irq_desc. The interrupt is referenced by an 'unsigned int' numeric -	value which selects the corresponding interrupt decription structure +	value which selects the corresponding interrupt description structure  	in the descriptor structures array.  	The descriptor structure contains status information and pointers  	to the interrupt flow method and the interrupt chip structure  	which are assigned to this interrupt.  	</para>  	<para> -	Whenever an interrupt triggers, the lowlevel arch code calls into -	the generic interrupt code by calling desc->handle_irq(). -	This highlevel IRQ handling function only uses desc->irq_data.chip +	Whenever an interrupt triggers, the low-level architecture code calls +	into the generic interrupt code by calling desc->handle_irq(). +	This high-level IRQ handling function only uses desc->irq_data.chip  	primitives referenced by the assigned chip descriptor structure.  	</para>      </sect1>      <sect1 id="Highlevel_Driver_API"> -	<title>Highlevel Driver API</title> +	<title>High-level Driver API</title>  	<para> -	  The highlevel Driver API consists of following functions: +	  The high-level Driver API consists of following functions:  	  <itemizedlist>  	  <listitem><para>request_irq()</para></listitem>  	  <listitem><para>free_irq()</para></listitem> @@ -216,7 +216,7 @@  	</para>      </sect1>      <sect1 id="Highlevel_IRQ_flow_handlers"> -	<title>Highlevel IRQ flow handlers</title> +	<title>High-level IRQ flow handlers</title>  	<para>  	  The generic layer provides a set of pre-defined irq-flow methods:  	  <itemizedlist> @@ -228,7 +228,7 @@  	  <listitem><para>handle_edge_eoi_irq</para></listitem>  	  <listitem><para>handle_bad_irq</para></listitem>  	  </itemizedlist> -	  The interrupt flow handlers (either predefined or architecture +	  The interrupt flow handlers (either pre-defined or architecture  	  specific) are assigned to specific interrupts by the architecture  	  either during bootup or during device initialization.  	</para> @@ -297,7 +297,7 @@ desc->irq_data.chip->irq_unmask();  		<para>  		handle_fasteoi_irq provides a generic implementation  		for interrupts, which only need an EOI at the end of -		the handler +		the handler.  		</para>  		<para>  		The following control flow is implemented (simplified excerpt): @@ -394,7 +394,7 @@ if (desc->irq_data.chip->irq_eoi)  	The generic functions are intended for 'clean' architectures and chips,  	which have no platform-specific IRQ handling quirks. If an architecture  	needs to implement quirks on the 'flow' level then it can do so by -	overriding the highlevel irq-flow handler. +	overriding the high-level irq-flow handler.  	</para>  	</sect2>  	<sect2 id="Delayed_interrupt_disable"> @@ -419,9 +419,9 @@ if (desc->irq_data.chip->irq_eoi)  	</sect2>      </sect1>      <sect1 id="Chiplevel_hardware_encapsulation"> -	<title>Chiplevel hardware encapsulation</title> +	<title>Chip-level hardware encapsulation</title>  	<para> -	The chip level hardware descriptor structure irq_chip +	The chip-level hardware descriptor structure irq_chip  	contains all the direct chip relevant functions, which  	can be utilized by the irq flow implementations.  	  <itemizedlist> @@ -429,14 +429,14 @@ if (desc->irq_data.chip->irq_eoi)  	  <listitem><para>irq_mask_ack() - Optional, recommended for performance</para></listitem>  	  <listitem><para>irq_mask()</para></listitem>  	  <listitem><para>irq_unmask()</para></listitem> -	  <listitem><para>irq_eoi() - Optional, required for eoi flow handlers</para></listitem> +	  <listitem><para>irq_eoi() - Optional, required for EOI flow handlers</para></listitem>  	  <listitem><para>irq_retrigger() - Optional</para></listitem>  	  <listitem><para>irq_set_type() - Optional</para></listitem>  	  <listitem><para>irq_set_wake() - Optional</para></listitem>  	  </itemizedlist>  	These primitives are strictly intended to mean what they say: ack means  	ACK, masking means masking of an IRQ line, etc. It is up to the flow -	handler(s) to use these basic units of lowlevel functionality. +	handler(s) to use these basic units of low-level functionality.  	</para>      </sect1>    </chapter> @@ -445,7 +445,7 @@ if (desc->irq_data.chip->irq_eoi)       <title>__do_IRQ entry point</title>       <para>  	The original implementation __do_IRQ() was an alternative entry -	point for all types of interrupts. It not longer exists. +	point for all types of interrupts. It no longer exists.       </para>       <para>  	This handler turned out to be not suitable for all @@ -468,11 +468,11 @@ if (desc->irq_data.chip->irq_eoi)    <chapter id="genericchip">       <title>Generic interrupt chip</title>       <para> -       To avoid copies of identical implementations of irq chips the +       To avoid copies of identical implementations of IRQ chips the         core provides a configurable generic interrupt chip -       implementation. Developers should check carefuly whether the +       implementation. Developers should check carefully whether the         generic chip fits their needs before implementing the same -       functionality slightly different themself. +       functionality slightly differently themselves.       </para>  !Ekernel/irq/generic-chip.c    </chapter> diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index f75ab4c1b28..ecfd0ea4066 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl @@ -109,6 +109,7 @@ X!Ilib/string.c       <sect1><title>The Slab Cache</title>  !Iinclude/linux/slab.h  !Emm/slab.c +!Emm/util.c       </sect1>       <sect1><title>User Space Memory Access</title>  !Iarch/x86/include/asm/uaccess_32.h diff --git a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl index d0758b241b2..e84f09467cd 100644 --- a/Documentation/DocBook/kernel-hacking.tmpl +++ b/Documentation/DocBook/kernel-hacking.tmpl @@ -671,7 +671,7 @@ printk(KERN_INFO "my ip: %pI4\n", &ipaddress);    <sect1 id="routines-local-irqs">     <title><function>local_irq_save()</function>/<function>local_irq_restore()</function> -    <filename class="headerfile">include/asm/system.h</filename> +    <filename class="headerfile">include/linux/irqflags.h</filename>     </title>     <para> @@ -850,16 +850,6 @@ printk(KERN_INFO "my ip: %pI4\n", &ipaddress);      <returnvalue>-ERESTARTSYS</returnvalue> if a signal is received.      The <function>wait_event()</function> version ignores signals.     </para> -   <para> -   Do not use the <function>sleep_on()</function> function family - -   it is very easy to accidentally introduce races; almost certainly -   one of the <function>wait_event()</function> family will do, or a -   loop around <function>schedule_timeout()</function>. If you choose -   to loop around <function>schedule_timeout()</function> remember -   you must set the task state (with  -   <function>set_current_state()</function>) on each iteration to avoid -   busy-looping. -   </para>    </sect1> diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 09e884e5b9f..e584ee12a1e 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl @@ -1760,7 +1760,7 @@ as it would be on UP.  </para>  <para> -There is a furthur optimization possible here: remember our original +There is a further optimization possible here: remember our original  cache code, where there were no reference counts and the caller simply  held the lock whenever using the object?  This is still possible: if  you hold the lock, no one can delete the object, so you don't need to @@ -1958,7 +1958,7 @@ machines due to caching.    <chapter id="apiref-mutex">     <title>Mutex API reference</title>  !Iinclude/linux/mutex.h -!Ekernel/mutex.c +!Ekernel/locking/mutex.c    </chapter>    <chapter id="apiref-futex"> diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index deb71baed32..d7fcdc5a437 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl @@ -677,7 +677,7 @@ and other resources, etc.  	<listitem>  	<para> -	ATA_QCFLAG_ACTIVE is clared from qc->flags. +	ATA_QCFLAG_ACTIVE is cleared from qc->flags.  	</para>  	</listitem> @@ -708,7 +708,7 @@ and other resources, etc.  	   <listitem>  	   <para> -	   qc->waiting is claread & completed (in that order). +	   qc->waiting is cleared & completed (in that order).  	   </para>  	   </listitem> @@ -1163,7 +1163,7 @@ and other resources, etc.  	<para>  	Once sense data is acquired, this type of errors can be -	handled similary to other SCSI errors.  Note that sense data +	handled similarly to other SCSI errors.  Note that sense data  	may indicate ATA bus error (e.g. Sense Key 04h HARDWARE ERROR  	&& ASC/ASCQ 47h/00h SCSI PARITY ERROR).  In such  	cases, the error should be considered as an ATA bus error and diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index f9fd615427f..639e7485796 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -195,15 +195,15 @@ DVB_DOCUMENTED = \  #  install_media_images = \ -	$(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api +	$(Q)-cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api  $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64  	$(Q)base64 -d $< >$@  $(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES)  	@$($(quiet)gen_xml) -	@(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/) -	@(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/) +	@(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/v4l/*xml $(MEDIA_OBJ_DIR)/) +	@(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/dvb/*xml $(MEDIA_OBJ_DIR)/)  $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/uapi/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml  	@$($(quiet)gen_xml) diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml index 86de89cfbd6..c8683d66f05 100644 --- a/Documentation/DocBook/media/dvb/demux.xml +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -1042,7 +1042,14 @@ role="subsection"><title>DMX_ADD_PID</title>  </para>  <informaltable><tgroup cols="1"><tbody><row><entry   align="char"> -<para>This ioctl is undocumented. Documentation is welcome.</para> +<para>This ioctl call allows to add multiple PIDs to a transport stream filter +previously set up with DMX_SET_PES_FILTER and output equal to DMX_OUT_TSDEMUX_TAP. +</para></entry></row><row><entry align="char"><para> +It is used by readers of /dev/dvb/adapterX/demuxY. +</para></entry></row><row><entry align="char"><para> +It may be called at any time, i.e. before or after the first filter on the +shared file descriptor was started. It makes it possible to record multiple +services without the need to de-multiplex or re-multiplex TS packets.</para>  </entry>   </row></tbody></tgroup></informaltable>  <para>SYNOPSIS @@ -1075,7 +1082,7 @@ role="subsection"><title>DMX_ADD_PID</title>  </para>  </entry><entry   align="char"> -<para>Undocumented.</para> +<para>PID number to be filtered.</para>  </entry>   </row></tbody></tgroup></informaltable>  &return-value-dvb; @@ -1087,7 +1094,15 @@ role="subsection"><title>DMX_REMOVE_PID</title>  </para>  <informaltable><tgroup cols="1"><tbody><row><entry   align="char"> -<para>This ioctl is undocumented. Documentation is welcome.</para> +<para>This ioctl call allows to remove a PID when multiple PIDs are set on a +transport stream filter, e. g. a filter previously set up with output equal to +DMX_OUT_TSDEMUX_TAP, created via either DMX_SET_PES_FILTER or DMX_ADD_PID. +</para></entry></row><row><entry align="char"><para> +It is used by readers of /dev/dvb/adapterX/demuxY. +</para></entry></row><row><entry align="char"><para> +It may be called at any time, i.e. before or after the first filter on the +shared file descriptor was started. It makes it possible to record multiple +services without the need to de-multiplex or re-multiplex TS packets.</para>  </entry>   </row></tbody></tgroup></informaltable>  <para>SYNOPSIS @@ -1120,7 +1135,7 @@ role="subsection"><title>DMX_REMOVE_PID</title>  </para>  </entry><entry   align="char"> -<para>Undocumented.</para> +<para>PID of the PES filter to be removed.</para>  </entry>   </row></tbody></tgroup></informaltable>  &return-value-dvb; diff --git a/Documentation/DocBook/media/dvb/dvbapi.xml b/Documentation/DocBook/media/dvb/dvbapi.xml index 0197bcc7842..4c15396c67e 100644 --- a/Documentation/DocBook/media/dvb/dvbapi.xml +++ b/Documentation/DocBook/media/dvb/dvbapi.xml @@ -18,7 +18,7 @@  <firstname>Mauro</firstname>  <othername role="mi">Carvalho</othername>  <surname>Chehab</surname> -<affiliation><address><email>mchehab@redhat.com</email></address></affiliation> +<affiliation><address><email>m.chehab@samsung.com</email></address></affiliation>  <contrib>Ported document to Docbook XML.</contrib>  </author>  </authorgroup> @@ -28,7 +28,7 @@  	<holder>Convergence GmbH</holder>  </copyright>  <copyright> -	<year>2009-2012</year> +	<year>2009-2014</year>  	<holder>Mauro Carvalho Chehab</holder>  </copyright> diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index a9b15e34c5b..24c22cabc66 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -196,7 +196,7 @@ get/set up to 64 properties. The actual meaning of each property is described on  		<para>1)For satellital delivery systems, it is measured in kHz.  			For the other ones, it is measured in Hz.</para>  		<para>2)For ISDB-T, the channels are usually transmitted with an offset of 143kHz. -			E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of +			E.g. a valid frequency could be 474143 kHz. The stepping is bound to the bandwidth of  			the channel which is 6MHz.</para>  		<para>3)As in ISDB-Tsb the channel consists of only one or three segments the diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 0d6e81bd9ed..8a6a6ff27af 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -744,7 +744,7 @@ typedef enum fe_hierarchy {  </para>  <informaltable><tgroup cols="1"><tbody><row><entry   align="char"> -<para>int ioctl(int fd, int request = <link linkend="FE_READ_SNR">FE_READ_SNR</link>, int16_t +<para>int ioctl(int fd, int request = <link linkend="FE_READ_SNR">FE_READ_SNR</link>, uint16_t   ⋆snr);</para>  </entry>   </row></tbody></tgroup></informaltable> @@ -766,7 +766,7 @@ typedef enum fe_hierarchy {  </entry>   </row><row><entry   align="char"> -<para>int16_t *snr</para> +<para>uint16_t *snr</para>  </entry><entry   align="char">  <para>The signal-to-noise ratio is stored into *snr.</para> @@ -791,7 +791,7 @@ typedef enum fe_hierarchy {  <informaltable><tgroup cols="1"><tbody><row><entry   align="char">  <para>int ioctl( int fd, int request = - <link linkend="FE_READ_SIGNAL_STRENGTH">FE_READ_SIGNAL_STRENGTH</link>, int16_t ⋆strength);</para> + <link linkend="FE_READ_SIGNAL_STRENGTH">FE_READ_SIGNAL_STRENGTH</link>, uint16_t ⋆strength);</para>  </entry>   </row></tbody></tgroup></informaltable> @@ -814,7 +814,7 @@ typedef enum fe_hierarchy {  </entry>   </row><row><entry   align="char"> -<para>int16_t *strength</para> +<para>uint16_t *strength</para>  </entry><entry   align="char">  <para>The signal strength value is stored into *strength.</para> diff --git a/Documentation/DocBook/media/v4l/common.xml b/Documentation/DocBook/media/v4l/common.xml index 1ddf354aa99..71f6bf9e735 100644 --- a/Documentation/DocBook/media/v4l/common.xml +++ b/Documentation/DocBook/media/v4l/common.xml @@ -38,70 +38,41 @@ the basic concepts applicable to all devices.</para>        <para>V4L2 drivers are implemented as kernel modules, loaded  manually by the system administrator or automatically when a device is -first opened. The driver modules plug into the "videodev" kernel +first discovered. The driver modules plug into the "videodev" kernel  module. It provides helper functions and a common application  interface specified in this document.</para>        <para>Each driver thus loaded registers one or more device nodes -with major number 81 and a minor number between 0 and 255. Assigning -minor numbers to V4L2 devices is entirely up to the system administrator, -this is primarily intended to solve conflicts between devices.<footnote> -	  <para>Access permissions are associated with character -device special files, hence we must ensure device numbers cannot -change with the module load order. To this end minor numbers are no -longer automatically assigned by the "videodev" module as in V4L but -requested by the driver. The defaults will suffice for most people -unless two drivers compete for the same minor numbers.</para> -	</footnote> The module options to select minor numbers are named -after the device special file with a "_nr" suffix. For example "video_nr" -for <filename>/dev/video</filename> video capture devices. The number is -an offset to the base minor number associated with the device type. -<footnote> -	  <para>In earlier versions of the V4L2 API the module options -where named after the device special file with a "unit_" prefix, expressing -the minor number itself, not an offset. Rationale for this change is unknown. -Lastly the naming and semantics are just a convention among driver writers, -the point to note is that minor numbers are not supposed to be hardcoded -into drivers.</para> -	</footnote> When the driver supports multiple devices of the same -type more than one minor number can be assigned, separated by commas: -<informalexample> +with major number 81 and a minor number between 0 and 255. Minor numbers +are allocated dynamically unless the kernel is compiled with the kernel +option CONFIG_VIDEO_FIXED_MINOR_RANGES. In that case minor numbers are +allocated in ranges depending on the device node type (video, radio, etc.).</para> + +      <para>Many drivers support "video_nr", "radio_nr" or "vbi_nr" +module options to select specific video/radio/vbi node numbers. This allows +the user to request that the device node is named e.g. /dev/video5 instead +of leaving it to chance. When the driver supports multiple devices of the same +type more than one device node number can be assigned, separated by commas: +	<informalexample>  	  <screen> -> insmod mydriver.o video_nr=0,1 radio_nr=0,1</screen> +> modprobe mydriver video_nr=0,1 radio_nr=0,1</screen>  	</informalexample></para>        <para>In <filename>/etc/modules.conf</filename> this may be  written as: <informalexample>  	  <screen> -alias char-major-81-0 mydriver -alias char-major-81-1 mydriver -alias char-major-81-64 mydriver              <co id="alias" /> -options mydriver video_nr=0,1 radio_nr=0,1   <co id="options" /> +options mydriver video_nr=0,1 radio_nr=0,1  	  </screen> -	  <calloutlist> -	    <callout arearefs="alias"> -	      <para>When an application attempts to open a device -special file with major number 81 and minor number 0, 1, or 64, load -"mydriver" (and the "videodev" module it depends upon).</para> -	    </callout> -	    <callout arearefs="options"> -	      <para>Register the first two video capture devices with -minor number 0 and 1 (base number is 0), the first two radio device -with minor number 64 and 65 (base 64).</para> -	    </callout> -	  </calloutlist> -	</informalexample> When no minor number is given as module -option the driver supplies a default. <xref linkend="devices" /> -recommends the base minor numbers to be used for the various device -types. Obviously minor numbers must be unique. When the number is -already in use the <emphasis>offending device</emphasis> will not be -registered. <!-- Blessed by Linus Torvalds on -linux-kernel@vger.kernel.org, 2002-11-20. --></para> - -      <para>By convention system administrators create various -character device special files with these major and minor numbers in -the <filename>/dev</filename> directory. The names recommended for the -different V4L2 device types are listed in <xref linkend="devices" />. +	</informalexample> When no device node number is given as module +option the driver supplies a default.</para> + +      <para>Normally udev will create the device nodes in /dev automatically +for you. If udev is not installed, then you need to enable the +CONFIG_VIDEO_FIXED_MINOR_RANGES kernel option in order to be able to correctly +relate a minor number to a device node number. I.e., you need to be certain +that minor number 5 maps to device node name video5. With this kernel option +different device types have different minor number ranges. These ranges are +listed in <xref linkend="devices" />.  </para>        <para>The creation of character special files (with @@ -110,85 +81,66 @@ devices cannot be opened by major and minor number. That means  applications cannot <emphasis>reliable</emphasis> scan for loaded or  installed drivers. The user must enter a device name, or the  application can try the conventional device names.</para> - -      <para>Under the device filesystem (devfs) the minor number -options are ignored. V4L2 drivers (or by proxy the "videodev" module) -automatically create the required device files in the -<filename>/dev/v4l</filename> directory using the conventional device -names above.</para>      </section>      <section id="related">        <title>Related Devices</title> -      <para>Devices can support several related functions. For example -video capturing, video overlay and VBI capturing are related because -these functions share, amongst other, the same video input and tuner -frequency. V4L and earlier versions of V4L2 used the same device name -and minor number for video capturing and overlay, but different ones -for VBI. Experience showed this approach has several problems<footnote> -	  <para>Given a device file name one cannot reliable find -related devices. For once names are arbitrary and in a system with -multiple devices, where only some support VBI capturing, a -<filename>/dev/video2</filename> is not necessarily related to -<filename>/dev/vbi2</filename>. The V4L -<constant>VIDIOCGUNIT</constant> ioctl would require a search for a -device file with a particular major and minor number.</para> -	</footnote>, and to make things worse the V4L videodev module -used to prohibit multiple opens of a device.</para> - -      <para>As a remedy the present version of the V4L2 API relaxed the -concept of device types with specific names and minor numbers. For -compatibility with old applications drivers must still register different -minor numbers to assign a default function to the device. But if related -functions are supported by the driver they must be available under all -registered minor numbers. The desired function can be selected after -opening the device as described in <xref linkend="devices" />.</para> - -      <para>Imagine a driver supporting video capturing, video -overlay, raw VBI capturing, and FM radio reception. It registers three -devices with minor number 0, 64 and 224 (this numbering scheme is -inherited from the V4L API). Regardless if -<filename>/dev/video</filename> (81, 0) or -<filename>/dev/vbi</filename> (81, 224) is opened the application can -select any one of the video capturing, overlay or VBI capturing -functions. Without programming (e. g. reading from the device -with <application>dd</application> or <application>cat</application>) -<filename>/dev/video</filename> captures video images, while -<filename>/dev/vbi</filename> captures raw VBI data. -<filename>/dev/radio</filename> (81, 64) is invariable a radio device, -unrelated to the video functions. Being unrelated does not imply the -devices can be used at the same time, however. The &func-open; -function may very well return an &EBUSY;.</para> +      <para>Devices can support several functions. For example +video capturing, VBI capturing and radio support.</para> + +      <para>The V4L2 API creates different nodes for each of these functions.</para> + +      <para>The V4L2 API was designed with the idea that one device node could support +all functions. However, in practice this never worked: this 'feature' +was never used by applications and many drivers did not support it and if +they did it was certainly never tested. In addition, switching a device +node between different functions only works when using the streaming I/O +API, not with the read()/write() API.</para> + +      <para>Today each device node supports just one function.</para>        <para>Besides video input or output the hardware may also  support audio sampling or playback. If so, these functions are -implemented as OSS or ALSA PCM devices and eventually OSS or ALSA -audio mixer. The V4L2 API makes no provisions yet to find these -related devices. If you have an idea please write to the linux-media -mailing list: &v4l-ml;.</para> +implemented as ALSA PCM devices with optional ALSA audio mixer +devices.</para> + +      <para>One problem with all these devices is that the V4L2 API +makes no provisions to find these related devices. Some really +complex devices use the Media Controller (see <xref linkend="media_controller" />) +which can be used for this purpose. But most drivers do not use it, +and while some code exists that uses sysfs to discover related devices +(see libmedia_dev in the <ulink url="http://git.linuxtv.org/v4l-utils/">v4l-utils</ulink> +git repository), there is no library yet that can provide a single API towards +both Media Controller-based devices and devices that do not use the Media Controller. +If you want to work on this please write to the linux-media mailing list: &v4l-ml;.</para>      </section>      <section>        <title>Multiple Opens</title> -      <para>In general, V4L2 devices can be opened more than once. +      <para>V4L2 devices can be opened more than once.<footnote><para> +There are still some old and obscure drivers that have not been updated to +allow for multiple opens. This implies that for such drivers &func-open; can +return an &EBUSY; when the device is already in use.</para></footnote>  When this is supported by the driver, users can for example start a  "panel" application to change controls like brightness or audio  volume, while another application captures video and audio. In other words, panel -applications are comparable to an OSS or ALSA audio mixer application. -When a device supports multiple functions like capturing and overlay -<emphasis>simultaneously</emphasis>, multiple opens allow concurrent -use of the device by forked processes or specialized applications.</para> - -      <para>Multiple opens are optional, although drivers should -permit at least concurrent accesses without data exchange, &ie; panel -applications. This implies &func-open; can return an &EBUSY; when the -device is already in use, as well as &func-ioctl; functions initiating -data exchange (namely the &VIDIOC-S-FMT; ioctl), and the &func-read; -and &func-write; functions.</para> - -      <para>Mere opening a V4L2 device does not grant exclusive +applications are comparable to an ALSA audio mixer application. +Just opening a V4L2 device should not change the state of the device.<footnote> +<para>Unfortunately, opening a radio device often switches the state of the +device to radio mode in many drivers. This behavior should be fixed eventually +as it violates the V4L2 specification.</para></footnote></para> + +      <para>Once an application has allocated the memory buffers needed for +streaming data (by calling the &VIDIOC-REQBUFS; or &VIDIOC-CREATE-BUFS; ioctls, +or implicitly by calling the &func-read; or &func-write; functions) that +application (filehandle) becomes the owner of the device. It is no longer +allowed to make changes that would affect the buffer sizes (e.g. by calling +the &VIDIOC-S-FMT; ioctl) and other applications are no longer allowed to allocate +buffers or start or stop streaming. The &EBUSY; will be returned instead.</para> + +      <para>Merely opening a V4L2 device does not grant exclusive  access.<footnote>  	  <para>Drivers could recognize the  <constant>O_EXCL</constant> open flag. Presently this is not required, @@ -206,12 +158,7 @@ additional access privileges using the priority mechanism described in        <para>V4L2 drivers should not support multiple applications  reading or writing the same data stream on a device by copying  buffers, time multiplexing or similar means. This is better handled by -a proxy application in user space. When the driver supports stream -sharing anyway it must be implemented transparently. The V4L2 API does -not specify how conflicts are solved. <!-- For example O_EXCL when the -application does not want to be preempted, PROT_READ mmapped buffers -which can be mapped twice, what happens when image formats do not -match etc.--></para> +a proxy application in user space.</para>      </section>      <section> @@ -240,15 +187,15 @@ methods</link> supported by the device.</para>      <para>Starting with kernel version 3.1, VIDIOC-QUERYCAP will return the  V4L2 API version used by the driver, with generally matches the Kernel version. -There's no need of using &VIDIOC-QUERYCAP; to check if an specific ioctl is -supported, the V4L2 core now returns ENOIOCTLCMD if a driver doesn't provide +There's no need of using &VIDIOC-QUERYCAP; to check if a specific ioctl is +supported, the V4L2 core now returns ENOTTY if a driver doesn't provide  support for an ioctl.</para>      <para>Other features can be queried  by calling the respective ioctl, for example &VIDIOC-ENUMINPUT;  to learn about the number, types and names of video connectors on the  device. Although abstraction is a major objective of this API, the -ioctl also allows driver specific applications to reliable identify +&VIDIOC-QUERYCAP; ioctl also allows driver specific applications to reliably identify  the driver.</para>      <para>All V4L2 drivers must support @@ -278,9 +225,7 @@ Applications requiring a different priority will usually call  the &VIDIOC-QUERYCAP; ioctl.</para>      <para>Ioctls changing driver properties, such as &VIDIOC-S-INPUT;, -return an &EBUSY; after another application obtained higher priority. -An event mechanism to notify applications about asynchronous property -changes has been proposed but not added yet.</para> +return an &EBUSY; after another application obtained higher priority.</para>    </section>    <section id="video"> @@ -288,9 +233,9 @@ changes has been proposed but not added yet.</para>      <para>Video inputs and outputs are physical connectors of a  device. These can be for example RF connectors (antenna/cable), CVBS -a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI -capture devices have inputs, output devices have outputs, at least one -each. Radio devices have no video inputs or outputs.</para> +a.k.a. Composite Video, S-Video or RGB connectors. Video and VBI +capture devices have inputs. Video and VBI output devices have outputs, +at least one each. Radio devices have no video inputs or outputs.</para>      <para>To learn about the number and attributes of the  available inputs and outputs applications can enumerate them with the @@ -299,30 +244,13 @@ available inputs and outputs applications can enumerate them with the  ioctl also contains signal status information applicable when the  current video input is queried.</para> -    <para>The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctl return the +    <para>The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctls return the  index of the current video input or output. To select a different  input or output applications call the &VIDIOC-S-INPUT; and -&VIDIOC-S-OUTPUT; ioctl. Drivers must implement all the input ioctls +&VIDIOC-S-OUTPUT; ioctls. Drivers must implement all the input ioctls  when the device has one or more inputs, all the output ioctls when the  device has one or more outputs.</para> -    <!-- -    <figure id=io-tree> -      <title>Input and output enumeration is the root of most device properties.</title> -      <mediaobject> -	<imageobject> -	  <imagedata fileref="links.pdf" format="ps" /> -	</imageobject> -	<imageobject> -	  <imagedata fileref="links.gif" format="gif" /> -	</imageobject> -	<textobject> -	  <phrase>Links between various device property structures.</phrase> -	</textobject> -      </mediaobject> -    </figure> -    --> -      <example>        <title>Information about the current video input</title> @@ -330,20 +258,20 @@ device has one or more outputs.</para>  &v4l2-input; input;  int index; -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &index)) { -	perror ("VIDIOC_G_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-G-INPUT;, &index)) { +	perror("VIDIOC_G_INPUT"); +	exit(EXIT_FAILURE);  } -memset (&input, 0, sizeof (input)); +memset(&input, 0, sizeof(input));  input.index = index; -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { -	perror ("VIDIOC_ENUMINPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-ENUMINPUT;, &input)) { +	perror("VIDIOC_ENUMINPUT"); +	exit(EXIT_FAILURE);  } -printf ("Current input: %s\n", input.name); +printf("Current input: %s\n", input.name);        </programlisting>      </example> @@ -355,9 +283,9 @@ int index;  index = 0; -if (-1 == ioctl (fd, &VIDIOC-S-INPUT;, &index)) { -	perror ("VIDIOC_S_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-S-INPUT;, &index)) { +	perror("VIDIOC_S_INPUT"); +	exit(EXIT_FAILURE);  }        </programlisting>      </example> @@ -397,7 +325,7 @@ available inputs and outputs applications can enumerate them with the  also contains signal status information applicable when the current  audio input is queried.</para> -    <para>The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctl report +    <para>The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctls report  the current audio input and output, respectively. Note that, unlike  &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; these ioctls return a structure  as <constant>VIDIOC_ENUMAUDIO</constant> and @@ -408,11 +336,11 @@ applications call the &VIDIOC-S-AUDIO; ioctl. To select an audio  output (which presently has no changeable properties) applications  call the &VIDIOC-S-AUDOUT; ioctl.</para> -    <para>Drivers must implement all input ioctls when the device -has one or more inputs, all output ioctls when the device has one -or more outputs. When the device has any audio inputs or outputs the -driver must set the <constant>V4L2_CAP_AUDIO</constant> flag in the -&v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl.</para> +    <para>Drivers must implement all audio input ioctls when the device +has multiple selectable audio inputs, all audio output ioctls when the +device has multiple selectable audio outputs. When the device has any +audio inputs or outputs the driver must set the <constant>V4L2_CAP_AUDIO</constant> +flag in the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl.</para>      <example>        <title>Information about the current audio input</title> @@ -420,14 +348,14 @@ driver must set the <constant>V4L2_CAP_AUDIO</constant> flag in the        <programlisting>  &v4l2-audio; audio; -memset (&audio, 0, sizeof (audio)); +memset(&audio, 0, sizeof(audio)); -if (-1 == ioctl (fd, &VIDIOC-G-AUDIO;, &audio)) { -	perror ("VIDIOC_G_AUDIO"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-G-AUDIO;, &audio)) { +	perror("VIDIOC_G_AUDIO"); +	exit(EXIT_FAILURE);  } -printf ("Current input: %s\n", audio.name); +printf("Current input: %s\n", audio.name);        </programlisting>      </example> @@ -437,13 +365,13 @@ printf ("Current input: %s\n", audio.name);        <programlisting>  &v4l2-audio; audio; -memset (&audio, 0, sizeof (audio)); /* clear audio.mode, audio.reserved */ +memset(&audio, 0, sizeof(audio)); /* clear audio.mode, audio.reserved */  audio.index = 0; -if (-1 == ioctl (fd, &VIDIOC-S-AUDIO;, &audio)) { -	perror ("VIDIOC_S_AUDIO"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-S-AUDIO;, &audio)) { +	perror("VIDIOC_S_AUDIO"); +	exit(EXIT_FAILURE);  }        </programlisting>      </example> @@ -468,7 +396,7 @@ the tuner.</para>  video inputs.</para>        <para>To query and change tuner properties applications use the -&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The +&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctls, respectively. The  &v4l2-tuner; returned by <constant>VIDIOC_G_TUNER</constant> also  contains signal status information applicable when the tuner of the  current video or radio input is queried. Note that @@ -533,7 +461,7 @@ standards or variations of standards. Each video input and output may  support another set of standards. This set is reported by the  <structfield>std</structfield> field of &v4l2-input; and  &v4l2-output; returned by the &VIDIOC-ENUMINPUT; and -&VIDIOC-ENUMOUTPUT; ioctl, respectively.</para> +&VIDIOC-ENUMOUTPUT; ioctls, respectively.</para>      <para>V4L2 defines one bit for each analog video standard  currently in use worldwide, and sets aside bits for driver defined @@ -564,28 +492,10 @@ automatically.</para>      <para>To query and select the standard used by the current video  input or output applications call the &VIDIOC-G-STD; and  &VIDIOC-S-STD; ioctl, respectively. The <emphasis>received</emphasis> -standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note that the parameter of all these ioctls is a pointer to a &v4l2-std-id; type (a standard set), <emphasis>not</emphasis> an index into the standard enumeration.<footnote> -	<para>An alternative to the current scheme is to use pointers -to indices as arguments of <constant>VIDIOC_G_STD</constant> and -<constant>VIDIOC_S_STD</constant>, the &v4l2-input; and -&v4l2-output; <structfield>std</structfield> field would be a set of -indices like <structfield>audioset</structfield>.</para> -	<para>Indices are consistent with the rest of the API -and identify the standard unambiguously. In the present scheme of -things an enumerated standard is looked up by &v4l2-std-id;. Now the -standards supported by the inputs of a device can overlap. Just -assume the tuner and composite input in the example above both -exist on a device. An enumeration of "PAL-B/G", "PAL-H/I" suggests -a choice which does not exist. We cannot merge or omit sets, because -applications would be unable to find the standards reported by -<constant>VIDIOC_G_STD</constant>. That leaves separate enumerations -for each input. Also selecting a standard by &v4l2-std-id; can be -ambiguous. Advantage of this method is that applications need not -identify the standard indirectly, after enumerating.</para><para>So in -summary, the lookup itself is unavoidable. The difference is only -whether the lookup is necessary to find an enumerated standard or to -switch to a standard by &v4l2-std-id;.</para> -      </footnote> Drivers must implement all video standard ioctls +standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note that the +parameter of all these ioctls is a pointer to a &v4l2-std-id; type +(a standard set), <emphasis>not</emphasis> an index into the standard +enumeration. Drivers must implement all video standard ioctls  when the device has one or more video inputs or outputs.</para>      <para>Special rules apply to devices such as USB cameras where the notion of video @@ -604,17 +514,10 @@ to zero and the <constant>VIDIOC_G_STD</constant>,  <constant>VIDIOC_S_STD</constant>,  <constant>VIDIOC_QUERYSTD</constant> and  <constant>VIDIOC_ENUMSTD</constant> ioctls shall return the -&ENOTTY;.<footnote> -	<para>See <xref linkend="buffer" /> for a rationale.</para> +&ENOTTY; or the &EINVAL;.</para>  	<para>Applications can make use of the <xref linkend="input-capabilities" /> and  <xref linkend="output-capabilities"/> flags to determine whether the video standard ioctls -are available for the device.</para> - -	<para>See <xref linkend="buffer" /> for a rationale. Probably -even USB cameras follow some well known video standard. It might have -been better to explicitly indicate elsewhere if a device cannot live -up to normal expectations, instead of this exception.</para> -	    </footnote></para> +can be used with the given input or output.</para>      <example>        <title>Information about the current video standard</title> @@ -623,22 +526,22 @@ up to normal expectations, instead of this exception.</para>  &v4l2-std-id; std_id;  &v4l2-standard; standard; -if (-1 == ioctl (fd, &VIDIOC-G-STD;, &std_id)) { +if (-1 == ioctl(fd, &VIDIOC-G-STD;, &std_id)) {  	/* Note when VIDIOC_ENUMSTD always returns ENOTTY this  	   is no video device or it falls under the USB exception,  	   and VIDIOC_G_STD returning ENOTTY is no error. */ -	perror ("VIDIOC_G_STD"); -	exit (EXIT_FAILURE); +	perror("VIDIOC_G_STD"); +	exit(EXIT_FAILURE);  } -memset (&standard, 0, sizeof (standard)); +memset(&standard, 0, sizeof(standard));  standard.index = 0; -while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { +while (0 == ioctl(fd, &VIDIOC-ENUMSTD;, &standard)) {  	if (standard.id & std_id) { -	       printf ("Current video standard: %s\n", standard.name); -	       exit (EXIT_SUCCESS); +	       printf("Current video standard: %s\n", standard.name); +	       exit(EXIT_SUCCESS);  	}  	standard.index++; @@ -648,8 +551,8 @@ while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) {     empty unless this device falls under the USB exception. */  if (errno == EINVAL || standard.index == 0) { -	perror ("VIDIOC_ENUMSTD"); -	exit (EXIT_FAILURE); +	perror("VIDIOC_ENUMSTD"); +	exit(EXIT_FAILURE);  }        </programlisting>      </example> @@ -662,26 +565,26 @@ input</title>  &v4l2-input; input;  &v4l2-standard; standard; -memset (&input, 0, sizeof (input)); +memset(&input, 0, sizeof(input)); -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { -	perror ("VIDIOC_G_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-G-INPUT;, &input.index)) { +	perror("VIDIOC_G_INPUT"); +	exit(EXIT_FAILURE);  } -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { -	perror ("VIDIOC_ENUM_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-ENUMINPUT;, &input)) { +	perror("VIDIOC_ENUM_INPUT"); +	exit(EXIT_FAILURE);  } -printf ("Current input %s supports:\n", input.name); +printf("Current input %s supports:\n", input.name); -memset (&standard, 0, sizeof (standard)); +memset(&standard, 0, sizeof(standard));  standard.index = 0; -while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { +while (0 == ioctl(fd, &VIDIOC-ENUMSTD;, &standard)) {  	if (standard.id & input.std) -		printf ("%s\n", standard.name); +		printf("%s\n", standard.name);  	standard.index++;  } @@ -690,8 +593,8 @@ while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) {     empty unless this device falls under the USB exception. */  if (errno != EINVAL || standard.index == 0) { -	perror ("VIDIOC_ENUMSTD"); -	exit (EXIT_FAILURE); +	perror("VIDIOC_ENUMSTD"); +	exit(EXIT_FAILURE);  }        </programlisting>      </example> @@ -703,21 +606,21 @@ if (errno != EINVAL || standard.index == 0) {  &v4l2-input; input;  &v4l2-std-id; std_id; -memset (&input, 0, sizeof (input)); +memset(&input, 0, sizeof(input)); -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { -	perror ("VIDIOC_G_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-G-INPUT;, &input.index)) { +	perror("VIDIOC_G_INPUT"); +	exit(EXIT_FAILURE);  } -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { -	perror ("VIDIOC_ENUM_INPUT"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-ENUMINPUT;, &input)) { +	perror("VIDIOC_ENUM_INPUT"); +	exit(EXIT_FAILURE);  }  if (0 == (input.std & V4L2_STD_PAL_BG)) { -	fprintf (stderr, "Oops. B/G PAL is not supported.\n"); -	exit (EXIT_FAILURE); +	fprintf(stderr, "Oops. B/G PAL is not supported.\n"); +	exit(EXIT_FAILURE);  }  /* Note this is also supposed to work when only B @@ -725,9 +628,9 @@ if (0 == (input.std & V4L2_STD_PAL_BG)) {  std_id = V4L2_STD_PAL_BG; -if (-1 == ioctl (fd, &VIDIOC-S-STD;, &std_id)) { -	perror ("VIDIOC_S_STD"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, &VIDIOC-S-STD;, &std_id)) { +	perror("VIDIOC_S_STD"); +	exit(EXIT_FAILURE);  }        </programlisting>      </example> @@ -740,26 +643,25 @@ corresponding video timings. Today there are many more different hardware interf  such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry  video signals and there is a need to extend the API to select the video timings  for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to -the limited bits available, a new set of IOCTLs was added to set/get video timings at -the input and output: </para><itemizedlist> -	<listitem> -	<para>DV Timings: This will allow applications to define detailed -video timings for the interface. This includes parameters such as width, height, -polarities, frontporch, backporch etc. The <filename>linux/v4l2-dv-timings.h</filename> +the limited bits available, a new set of ioctls was added to set/get video timings at +the input and output.</para> + +	<para>These ioctls deal with the detailed digital video timings that define +each video format. This includes parameters such as the active video width and height, +signal polarities, frontporches, backporches, sync widths etc. The <filename>linux/v4l2-dv-timings.h</filename>  header can be used to get the timings of the formats in the <xref linkend="cea861" /> and  <xref linkend="vesadmt" /> standards.  	</para> -	</listitem> -	</itemizedlist> -	<para>To enumerate and query the attributes of the DV timings supported by a device, + +	<para>To enumerate and query the attributes of the DV timings supported by a device  	applications use the &VIDIOC-ENUM-DV-TIMINGS; and &VIDIOC-DV-TIMINGS-CAP; ioctls. -	To set DV timings for the device, applications use the +	To set DV timings for the device applications use the  &VIDIOC-S-DV-TIMINGS; ioctl and to get current DV timings they use the  &VIDIOC-G-DV-TIMINGS; ioctl. To detect the DV timings as seen by the video receiver applications  use the &VIDIOC-QUERY-DV-TIMINGS; ioctl.</para>  	<para>Applications can make use of the <xref linkend="input-capabilities" /> and -<xref linkend="output-capabilities"/> flags to decide what ioctls are available to set the -video timings for the device.</para> +<xref linkend="output-capabilities"/> flags to determine whether the digital video ioctls +can be used with the given input or output.</para>    </section>    &sub-controls; diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 0c7195e3e09..eee6f0f4aa4 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -397,7 +397,7 @@ linkend="control" />.</para>        <para>The <structfield>depth</structfield> (average number of  bits per pixel) of a video image is implied by the selected image -format. V4L2 does not explicitely provide such information assuming +format. V4L2 does not explicitly provide such information assuming  applications recognizing the format are aware of the image depth and  others need not know. The <structfield>palette</structfield> field  moved into the &v4l2-pix-format;:<informaltable> @@ -2523,6 +2523,28 @@ that used it. It was originally scheduled for removal in 2.6.35.        </orderedlist>      </section> +    <section> +      <title>V4L2 in Linux 3.14</title> +      <orderedlist> +        <listitem> +		<para> In struct <structname>v4l2_rect</structname>, the type +of <structfield>width</structfield> and <structfield>height</structfield> +fields changed from _s32 to _u32. +	  </para> +        </listitem> +      </orderedlist> +    </section> + +    <section> +      <title>V4L2 in Linux 3.15</title> +      <orderedlist> +        <listitem> +	  <para>Added Software Defined Radio (SDR) Interface. +	  </para> +        </listitem> +      </orderedlist> +    </section> +      <section id="other">        <title>Relation of V4L2 to other Linux multimedia APIs</title> @@ -2639,6 +2661,9 @@ ioctls.</para>          <listitem>  	  <para>Exporting DMABUF files using &VIDIOC-EXPBUF; ioctl.</para>          </listitem> +        <listitem> +	  <para>Software Defined Radio (SDR) Interface, <xref linkend="sdr" />.</para> +        </listitem>        </itemizedlist>      </section> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 7a3b49b3cc3..47198eef75a 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>  VBV buffer control.</entry>  	      </row> +		  <row><entry></entry></row> +	      <row id="v4l2-mpeg-video-hor-search-range"> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant> </entry> +		<entry>integer</entry> +	      </row> +		<row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set +horizontal search range for motion estimation module in video encoder.</entry> +	      </row> + +		 <row><entry></entry></row> +	      <row id="v4l2-mpeg-video-vert-search-range"> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant> </entry> +		<entry>integer</entry> +	      </row> +		<row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set +vertical search range for motion estimation module in video encoder.</entry> +	      </row> +  	      <row><entry></entry></row>  	      <row>  		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant> </entry> @@ -3161,6 +3181,47 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame.</entry>  		</entrytbl>  	      </row> +	      <row><entry></entry></row> +	      <row> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_MIN_QP</constant></entry> +		<entry>integer</entry> +	      </row> +	      <row><entry spanname="descr">Minimum quantization parameter for VP8.</entry> +	      </row> + +	      <row><entry></entry></row> +	      <row> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_MAX_QP</constant></entry> +		<entry>integer</entry> +	      </row> +	      <row><entry spanname="descr">Maximum quantization parameter for VP8.</entry> +	      </row> + +	      <row><entry></entry></row> +	      <row> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP</constant> </entry> +		<entry>integer</entry> +	      </row> +	      <row><entry spanname="descr">Quantization parameter for an I frame for VP8.</entry> +	      </row> + +	      <row><entry></entry></row> +	      <row> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP</constant> </entry> +		<entry>integer</entry> +	      </row> +	      <row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry> +	      </row> + +	      <row><entry></entry></row> +	      <row> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_PROFILE</constant> </entry> +		<entry>integer</entry> +	      </row> +	      <row><entry spanname="descr">Select the desired profile for VPx encoder. +Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 and 3.</entry> +	      </row> +            <row><entry></entry></row>          </tbody>        </tgroup> @@ -4329,6 +4390,24 @@ interface and may change in the future.</para>      		  <entry>The flash controller has detected a short or open      		  circuit condition on the indicator LED.</entry>      		</row> +		<row> +		  <entry><constant>V4L2_FLASH_FAULT_UNDER_VOLTAGE</constant></entry> +		  <entry>Flash controller voltage to the flash LED +		  has been below the minimum limit specific to the flash +		  controller.</entry> +		</row> +		<row> +		  <entry><constant>V4L2_FLASH_FAULT_INPUT_VOLTAGE</constant></entry> +		  <entry>The input voltage of the flash controller is below +		  the limit under which strobing the flash at full current +		  will not be possible.The condition persists until this flag +		  is no longer set.</entry> +		</row> +		<row> +		  <entry><constant>V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE</constant></entry> +		  <entry>The temperature of the LED has exceeded its +		  allowed upper limit.</entry> +		</row>      	      </tbody>      	    </entrytbl>      	  </row> @@ -4930,4 +5009,142 @@ defines possible values for de-emphasis. Here they are:</entry>        </table>        </section> + +    <section id="rf-tuner-controls"> +      <title>RF Tuner Control Reference</title> + +      <para> +The RF Tuner (RF_TUNER) class includes controls for common features of devices +having RF tuner. +      </para> +      <para> +In this context, RF tuner is radio receiver circuit between antenna and +demodulator. It receives radio frequency (RF) from the antenna and converts that +received signal to lower intermediate frequency (IF) or baseband frequency (BB). +Tuners that could do baseband output are often called Zero-IF tuners. Older +tuners were typically simple PLL tuners inside a metal box, whilst newer ones +are highly integrated chips without a metal box "silicon tuners". These controls +are mostly applicable for new feature rich silicon tuners, just because older +tuners does not have much adjustable features. +      </para> +      <para> +For more information about RF tuners see +<ulink url="http://en.wikipedia.org/wiki/Tuner_%28radio%29">Tuner (radio)</ulink> +and +<ulink url="http://en.wikipedia.org/wiki/RF_front_end">RF front end</ulink> +from Wikipedia. +      </para> + +      <table pgwide="1" frame="none" id="rf-tuner-control-id"> +        <title>RF_TUNER Control IDs</title> + +        <tgroup cols="4"> +          <colspec colname="c1" colwidth="1*" /> +          <colspec colname="c2" colwidth="6*" /> +          <colspec colname="c3" colwidth="2*" /> +          <colspec colname="c4" colwidth="6*" /> +          <spanspec namest="c1" nameend="c2" spanname="id" /> +          <spanspec namest="c2" nameend="c4" spanname="descr" /> +          <thead> +            <row> +              <entry spanname="id" align="left">ID</entry> +              <entry align="left">Type</entry> +            </row> +            <row rowsep="1"> +              <entry spanname="descr" align="left">Description</entry> +            </row> +          </thead> +          <tbody valign="top"> +            <row><entry></entry></row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_CLASS</constant> </entry> +              <entry>class</entry> +            </row><row><entry spanname="descr">The RF_TUNER class +descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a +description of this control class.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_BANDWIDTH_AUTO</constant> </entry> +              <entry>boolean</entry> +            </row> +            <row> +              <entry spanname="descr">Enables/disables tuner radio channel +bandwidth configuration. In automatic mode bandwidth configuration is performed +by the driver.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_BANDWIDTH</constant> </entry> +              <entry>integer</entry> +            </row> +            <row> +              <entry spanname="descr">Filter(s) on tuner signal path are used to +filter signal according to receiving party needs. Driver configures filters to +fulfill desired bandwidth requirement. Used when V4L2_CID_RF_TUNER_BANDWIDTH_AUTO is not +set. Unit is in Hz. The range and step are driver-specific.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_LNA_GAIN_AUTO</constant> </entry> +              <entry>boolean</entry> +            </row> +            <row> +              <entry spanname="descr">Enables/disables LNA automatic gain control (AGC)</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO</constant> </entry> +              <entry>boolean</entry> +            </row> +            <row> +              <entry spanname="descr">Enables/disables mixer automatic gain control (AGC)</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_IF_GAIN_AUTO</constant> </entry> +              <entry>boolean</entry> +            </row> +            <row> +              <entry spanname="descr">Enables/disables IF automatic gain control (AGC)</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_LNA_GAIN</constant> </entry> +              <entry>integer</entry> +            </row> +            <row> +              <entry spanname="descr">LNA (low noise amplifier) gain is first +gain stage on the RF tuner signal path. It is located very close to tuner +antenna input. Used when <constant>V4L2_CID_RF_TUNER_LNA_GAIN_AUTO</constant> is not set. +The range and step are driver-specific.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_MIXER_GAIN</constant> </entry> +              <entry>integer</entry> +            </row> +            <row> +              <entry spanname="descr">Mixer gain is second gain stage on the RF +tuner signal path. It is located inside mixer block, where RF signal is +down-converted by the mixer. Used when <constant>V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO</constant> +is not set. The range and step are driver-specific.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_IF_GAIN</constant> </entry> +              <entry>integer</entry> +            </row> +            <row> +              <entry spanname="descr">IF gain is last gain stage on the RF tuner +signal path. It is located on output of RF tuner. It controls signal level of +intermediate frequency output or baseband output. Used when +<constant>V4L2_CID_RF_TUNER_IF_GAIN_AUTO</constant> is not set. The range and step are +driver-specific.</entry> +            </row> +            <row> +              <entry spanname="id"><constant>V4L2_CID_RF_TUNER_PLL_LOCK</constant> </entry> +              <entry>boolean</entry> +            </row> +            <row> +              <entry spanname="descr">Is synthesizer PLL locked? RF tuner is +receiving given frequency when that control is set. This is a read-only control. +</entry> +            </row> +          </tbody> +        </tgroup> +      </table> +    </section>  </section> diff --git a/Documentation/DocBook/media/v4l/dev-osd.xml b/Documentation/DocBook/media/v4l/dev-osd.xml index dd91d6134e8..54853329140 100644 --- a/Documentation/DocBook/media/v4l/dev-osd.xml +++ b/Documentation/DocBook/media/v4l/dev-osd.xml @@ -56,18 +56,18 @@ framebuffer device.</para>  unsigned int i;  int fb_fd; -if (-1 == ioctl (fd, VIDIOC_G_FBUF, &fbuf)) { -	perror ("VIDIOC_G_FBUF"); -	exit (EXIT_FAILURE); +if (-1 == ioctl(fd, VIDIOC_G_FBUF, &fbuf)) { +	perror("VIDIOC_G_FBUF"); +	exit(EXIT_FAILURE);  } -for (i = 0; i > 30; ++i) { +for (i = 0; i < 30; i++) {  	char dev_name[16];  	struct fb_fix_screeninfo si; -	snprintf (dev_name, sizeof (dev_name), "/dev/fb%u", i); +	snprintf(dev_name, sizeof(dev_name), "/dev/fb%u", i); -	fb_fd = open (dev_name, O_RDWR); +	fb_fd = open(dev_name, O_RDWR);  	if (-1 == fb_fd) {  		switch (errno) {  		case ENOENT: /* no such file */ @@ -75,19 +75,19 @@ for (i = 0; i > 30; ++i) {  			continue;  		default: -			perror ("open"); -			exit (EXIT_FAILURE); +			perror("open"); +			exit(EXIT_FAILURE);  		}  	} -	if (0 == ioctl (fb_fd, FBIOGET_FSCREENINFO, &si)) { -		if (si.smem_start == (unsigned long) fbuf.base) +	if (0 == ioctl(fb_fd, FBIOGET_FSCREENINFO, &si)) { +		if (si.smem_start == (unsigned long)fbuf.base)  			break;  	} else {  		/* Apparently not a framebuffer device. */  	} -	close (fb_fd); +	close(fb_fd);  	fb_fd = -1;  } diff --git a/Documentation/DocBook/media/v4l/dev-overlay.xml b/Documentation/DocBook/media/v4l/dev-overlay.xml index 40d1d768143..cc6e0c5c960 100644 --- a/Documentation/DocBook/media/v4l/dev-overlay.xml +++ b/Documentation/DocBook/media/v4l/dev-overlay.xml @@ -346,17 +346,14 @@ rectangle, in pixels.</entry>  rectangle, in pixels. Offsets increase to the right and down.</entry>  	  </row>  	  <row> -	    <entry>__s32</entry> +	    <entry>__u32</entry>  	    <entry><structfield>width</structfield></entry>  	    <entry>Width of the rectangle, in pixels.</entry>  	  </row>  	  <row> -	    <entry>__s32</entry> +	    <entry>__u32</entry>  	    <entry><structfield>height</structfield></entry> -	    <entry>Height of the rectangle, in pixels. Width and -height cannot be negative, the fields are signed for hysterical -reasons. <!-- video4linux-list@redhat.com on 22 Oct 2002 subject -"Re:[V4L][patches!] Re:v4l2/kernel-2.5" --></entry> +	    <entry>Height of the rectangle, in pixels.</entry>  	  </row>  	</tbody>        </tgroup> diff --git a/Documentation/DocBook/media/v4l/dev-sdr.xml b/Documentation/DocBook/media/v4l/dev-sdr.xml new file mode 100644 index 00000000000..dc14804f543 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-sdr.xml @@ -0,0 +1,110 @@ +  <title>Software Defined Radio Interface (SDR)</title> + +  <note> +    <title>Experimental</title> +    <para>This is an <link linkend="experimental"> experimental </link> +    interface and may change in the future.</para> +  </note> + +  <para> +SDR is an abbreviation of Software Defined Radio, the radio device +which uses application software for modulation or demodulation. This interface +is intended for controlling and data streaming of such devices. +  </para> + +  <para> +SDR devices are accessed through character device special files named +<filename>/dev/swradio0</filename> to <filename>/dev/swradio255</filename> +with major number 81 and dynamically allocated minor numbers 0 to 255. +  </para> + +  <section> +    <title>Querying Capabilities</title> + +    <para> +Devices supporting the SDR receiver interface set the +<constant>V4L2_CAP_SDR_CAPTURE</constant> and +<constant>V4L2_CAP_TUNER</constant> flag in the +<structfield>capabilities</structfield> field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. That flag means the device has an +Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver. +At least one of the read/write, streaming or asynchronous I/O methods must +be supported. +    </para> +  </section> + +  <section> +    <title>Supplemental Functions</title> + +    <para> +SDR devices can support <link linkend="control">controls</link>, and must +support the <link linkend="tuner">tuner</link> ioctls. Tuner ioctls are used +for setting the ADC sampling rate (sampling frequency) and the possible RF tuner +frequency. +    </para> + +    <para> +The <constant>V4L2_TUNER_ADC</constant> tuner type is used for ADC tuners, and +the <constant>V4L2_TUNER_RF</constant> tuner type is used for RF tuners. The +tuner index of the RF tuner (if any) must always follow the ADC tuner index. +Normally the ADC tuner is #0 and the RF tuner is #1. +    </para> + +    <para> +The &VIDIOC-S-HW-FREQ-SEEK; ioctl is not supported. +    </para> +  </section> + +  <section> +    <title>Data Format Negotiation</title> + +    <para> +The SDR capture device uses the <link linkend="format">format</link> ioctls to +select the capture format. Both the sampling resolution and the data streaming +format are bound to that selectable format. In addition to the basic +<link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl +must be supported as well. +    </para> + +    <para> +To use the <link linkend="format">format</link> ioctls applications set the +<structfield>type</structfield> field of a &v4l2-format; to +<constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant> and use the &v4l2-sdr-format; +<structfield>sdr</structfield> member of the <structfield>fmt</structfield> +union as needed per the desired operation. +Currently only the <structfield>pixelformat</structfield> field of +&v4l2-sdr-format; is used. The content of that field is the V4L2 fourcc code +of the data format. +    </para> + +    <table pgwide="1" frame="none" id="v4l2-sdr-format"> +      <title>struct <structname>v4l2_sdr_format</structname></title> +      <tgroup cols="3"> +        &cs-str; +        <tbody valign="top"> +          <row> +            <entry>__u32</entry> +            <entry><structfield>pixelformat</structfield></entry> +            <entry> +The data format or type of compression, set by the application. This is a +little endian <link linkend="v4l2-fourcc">four character code</link>. +V4L2 defines SDR formats in <xref linkend="sdr-formats" />. +           </entry> +          </row> +          <row> +            <entry>__u8</entry> +            <entry><structfield>reserved[28]</structfield></entry> +            <entry>This array is reserved for future extensions. +Drivers and applications must set it to zero.</entry> +          </row> +        </tbody> +      </tgroup> +    </table> + +    <para> +An SDR device may support <link linkend="rw">read/write</link> +and/or streaming (<link linkend="mmap">memory mapping</link> +or <link linkend="userp">user pointer</link>) I/O. +    </para> + +  </section> diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index 2c4c068dde8..a086a5db7a1 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -125,7 +125,7 @@ location of the buffers in device memory can be determined with 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 +&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 @@ -339,8 +339,8 @@ returns immediately with an &EAGAIN; when no buffer is available. The  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> +<structfield>timestamp</structfield> of captured or outputted buffers. +</para>      <para>Drivers implementing memory mapping I/O must  support the <constant>VIDIOC_REQBUFS</constant>, @@ -457,7 +457,7 @@ 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> +or outputted buffers.</para>      <para>Drivers implementing user pointer I/O must  support the <constant>VIDIOC_REQBUFS</constant>, @@ -620,8 +620,7 @@ returns immediately with an &EAGAIN; when no buffer is available. The  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> +<structfield>timestamp</structfield> of captured or outputted buffers.</para>      <para>Drivers implementing DMABUF importing I/O must support the  <constant>VIDIOC_REQBUFS</constant>, <constant>VIDIOC_QBUF</constant>, @@ -654,38 +653,19 @@ 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> +    <para>Dequeued video buffers come with timestamps. The driver +    decides at which part of the frame and with which clock the +    timestamp is taken. Please see flags in the masks +    <constant>V4L2_BUF_FLAG_TIMESTAMP_MASK</constant> and +    <constant>V4L2_BUF_FLAG_TSTAMP_SRC_MASK</constant> in <xref +    linkend="buffer-flags" />. These flags are always valid and constant +    across all buffers during the whole video stream. Changes in these +    flags may take place as a side effect of &VIDIOC-S-INPUT; or +    &VIDIOC-S-OUTPUT; however. The +    <constant>V4L2_BUF_FLAG_TIMESTAMP_COPY</constant> timestamp type +    which is used by e.g. on mem-to-mem devices is an exception to the +    rule: the timestamp source flags are copied from the OUTPUT video +    buffer to the CAPTURE video buffer.</para>      <table frame="none" pgwide="1" id="v4l2-buffer">        <title>struct <structname>v4l2_buffer</structname></title> @@ -696,10 +676,11 @@ hence time of day.</para>  	    <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> +	    <entry>Number of the buffer, set by the application except +when calling &VIDIOC-DQBUF;, then it is set by the driver. +This field can range from zero to the number of buffers allocated +with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>), +plus any buffers allocated with &VIDIOC-CREATE-BUFS; minus one.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> @@ -718,7 +699,12 @@ linkend="v4l2-buf-type" /></entry>  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> +refers to an input stream, applications when it refers to an output stream. +If the application sets this to 0 for an output stream, then +<structfield>bytesused</structfield> will be set to the size of the +buffer (see the <structfield>length</structfield> field of this struct) by +the driver. For multiplanar formats this field is ignored and the +<structfield>planes</structfield> pointer is used instead.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> @@ -735,7 +721,7 @@ linkend="buffer-flags" />.</entry>  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> +applications when it refers to an output stream.</entry>  	  </row>  	  <row>  	    <entry>struct timeval</entry> @@ -745,15 +731,13 @@ applications when an output stream.</entry>  	    byte was captured, as returned by the  	    <function>clock_gettime()</function> function for the relevant  	    clock id; see <constant>V4L2_BUF_FLAG_TIMESTAMP_*</constant> in -	    <xref linkend="buffer-flags" />. 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 +	    <xref linkend="buffer-flags" />. For output streams the driver +	    stores the time at which the last 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> +	    clock. For output streams that use <constant>V4L2_BUF_FLAG_TIMESTAMP_COPY</constant> +	    the application has to fill in the timestamp which will be copied +	    by the driver to the capture stream.</para></entry>  	  </row>  	  <row>  	    <entry>&v4l2-timecode;</entry> @@ -846,7 +830,8 @@ is the file descriptor associated with a DMABUF buffer.</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 the application sets +	    single-planar API. This is set by the driver based on the calls to +	    &VIDIOC-REQBUFS; and/or &VIDIOC-CREATE-BUFS;. For the multi-planar API the application sets  	    this to the number of elements in the <structfield>planes</structfield>  	    array. The driver will fill in the actual number of valid elements in  	    that array. @@ -880,13 +865,19 @@ should set this to 0.</entry>  	    <entry><structfield>bytesused</structfield></entry>  	    <entry></entry>  	    <entry>The number of bytes occupied by data in the plane -	    (its payload).</entry> +	      (its payload). Drivers must set this field when <structfield>type</structfield> +	      refers to an input stream, applications when it refers to an output stream. +	      If the application sets this to 0 for an output stream, then +	      <structfield>bytesused</structfield> will be set to the size of the +	      plane (see the <structfield>length</structfield> field of this struct) +	      by the driver.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry>  	    <entry><structfield>length</structfield></entry>  	    <entry></entry> -	    <entry>Size in bytes of the plane (not its payload).</entry> +	    <entry>Size in bytes of the plane (not its payload). This is set by the driver +	    based on the calls to &VIDIOC-REQBUFS; and/or &VIDIOC-CREATE-BUFS;.</entry>  	  </row>  	  <row>  	    <entry>union</entry> @@ -925,7 +916,9 @@ should set this to 0.</entry>  	    <entry>__u32</entry>  	    <entry><structfield>data_offset</structfield></entry>  	    <entry></entry> -	    <entry>Offset in bytes to video data in the plane, if applicable. +	    <entry>Offset in bytes to video data in the plane. +	      Drivers must set this field when <structfield>type</structfield> +	      refers to an input stream, applications when it refers to an output stream.  	    </entry>  	  </row>  	  <row> @@ -1005,6 +998,12 @@ should set this to 0.</entry>  	    <entry>Buffer for video output overlay (OSD), see <xref  		linkend="osd" />.</entry>  	  </row> +	  <row> +	    <entry><constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant></entry> +	    <entry>11</entry> +	    <entry>Buffer for Software Defined Radio (SDR), see <xref +		linkend="sdr" />.</entry> +	  </row>  	</tbody>        </tgroup>      </table> @@ -1016,7 +1015,7 @@ should set this to 0.</entry>  	<tbody valign="top">  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_MAPPED</constant></entry> -	    <entry>0x0001</entry> +	    <entry>0x00000001</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 @@ -1026,7 +1025,7 @@ Drivers set or clear this flag when the  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_QUEUED</constant></entry> -	    <entry>0x0002</entry> +	    <entry>0x00000002</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 @@ -1039,7 +1038,7 @@ cleared.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_DONE</constant></entry> -	    <entry>0x0004</entry> +	    <entry>0x00000004</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 @@ -1049,11 +1048,11 @@ 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> +state, in the application domain so to say.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry> -	    <entry>0x0040</entry> +	    <entry>0x00000040</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 @@ -1063,35 +1062,43 @@ state, in the application domain to say so.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry> -	    <entry>0x0008</entry> +	    <entry>0x00000008</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> +key frame (or field), &ie; can be decompressed on its own. Also know as +an I-frame.  Applications can set this bit when <structfield>type</structfield> +refers to an output stream.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_PFRAME</constant></entry> -	    <entry>0x0010</entry> +	    <entry>0x00000010</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> +previous key frame. Applications can set this bit when <structfield>type</structfield> +refers to an output stream.</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> +	    <entry>0x00000020</entry> +	    <entry>Similar to <constant>V4L2_BUF_FLAG_KEYFRAME</constant> +this flags a bi-directional predicted frame or field which contains only +the differences between the current frame and both the preceding and following +key frames to specify its content. Applications can set this bit when +<structfield>type</structfield> refers to an output stream.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_TIMECODE</constant></entry> -	    <entry>0x0100</entry> +	    <entry>0x00000100</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> +ioctl is called.  Applications can set this bit and the corresponding +<structfield>timecode</structfield> structure when <structfield>type</structfield> +refers to an output stream.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_PREPARED</constant></entry> -	    <entry>0x0400</entry> +	    <entry>0x00000400</entry>  	    <entry>The buffer has been prepared for I/O and can be queued by the  application. Drivers set or clear this flag when the  <link linkend="vidioc-querybuf">VIDIOC_QUERYBUF</link>, <link @@ -1101,7 +1108,7 @@ application. Drivers set or clear this flag when the  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_NO_CACHE_INVALIDATE</constant></entry> -	    <entry>0x0800</entry> +	    <entry>0x00000800</entry>  	    <entry>Caches do not have to be invalidated for this buffer.  Typically applications shall use this flag if the data captured in the buffer  is not going to be touched by the CPU, instead the buffer will, probably, be @@ -1110,7 +1117,7 @@ passed on to a DMA-capable hardware unit for further processing or output.  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_NO_CACHE_CLEAN</constant></entry> -	    <entry>0x1000</entry> +	    <entry>0x00001000</entry>  	    <entry>Caches do not have to be cleaned for this buffer.  Typically applications shall use this flag for output buffers if the data  in this buffer has not been created by the CPU but by some DMA-capable unit, @@ -1118,7 +1125,7 @@ in which case caches have not been used.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_MASK</constant></entry> -	    <entry>0xe000</entry> +	    <entry>0x0000e000</entry>  	    <entry>Mask for timestamp types below. To test the  	    timestamp type, mask out bits not belonging to timestamp  	    type by performing a logical and operation with buffer @@ -1126,7 +1133,7 @@ in which case caches have not been used.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN</constant></entry> -	    <entry>0x0000</entry> +	    <entry>0x00000000</entry>  	    <entry>Unknown timestamp type. This type is used by  	    drivers before Linux 3.9 and may be either monotonic (see  	    below) or realtime (wall clock). Monotonic clock has been @@ -1139,7 +1146,7 @@ in which case caches have not been used.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC</constant></entry> -	    <entry>0x2000</entry> +	    <entry>0x00002000</entry>  	    <entry>The buffer timestamp has been taken from the  	    <constant>CLOCK_MONOTONIC</constant> clock. To access the  	    same clock outside V4L2, use @@ -1147,10 +1154,42 @@ in which case caches have not been used.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_BUF_FLAG_TIMESTAMP_COPY</constant></entry> -	    <entry>0x4000</entry> +	    <entry>0x00004000</entry>  	    <entry>The CAPTURE buffer timestamp has been taken from the  	    corresponding OUTPUT buffer. This flag applies only to mem2mem devices.</entry>  	  </row> +	  <row> +	    <entry><constant>V4L2_BUF_FLAG_TSTAMP_SRC_MASK</constant></entry> +	    <entry>0x00070000</entry> +	    <entry>Mask for timestamp sources below. The timestamp source +	    defines the point of time the timestamp is taken in relation to +	    the frame. Logical 'and' operation between the +	    <structfield>flags</structfield> field and +	    <constant>V4L2_BUF_FLAG_TSTAMP_SRC_MASK</constant> produces the +	    value of the timestamp source. Applications must set the timestamp +	    source when <structfield>type</structfield> refers to an output stream +	    and <constant>V4L2_BUF_FLAG_TIMESTAMP_COPY</constant> is set.</entry> +	  </row> +	  <row> +	    <entry><constant>V4L2_BUF_FLAG_TSTAMP_SRC_EOF</constant></entry> +	    <entry>0x00000000</entry> +	    <entry>End Of Frame. The buffer timestamp has been taken +	    when the last pixel of the frame has been received or the +	    last pixel of the frame has been transmitted. In practice, +	    software generated timestamps will typically be read from +	    the clock a small amount of time after the last pixel has +	    been received or transmitten, depending on the system and +	    other activity in it.</entry> +	  </row> +	  <row> +	    <entry><constant>V4L2_BUF_FLAG_TSTAMP_SRC_SOE</constant></entry> +	    <entry>0x00010000</entry> +	    <entry>Start Of Exposure. The buffer timestamp has been +	    taken when the exposure of the frame has begun. This is +	    only valid for the +	    <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant> buffer +	    type.</entry> +	  </row>  	</tbody>        </tgroup>      </table> @@ -1440,10 +1479,9 @@ or application, depending on data direction, must set &v4l2-buffer;  <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> +the &v4l2-buffer; <structfield>sequence</structfield> field. This format +cannot be selected when using the read/write I/O method since there +is no way to communicate if a field was a top or bottom field.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_FIELD_INTERLACED_TB</constant></entry> diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml index 355df43badc..74fb394ec66 100644 --- a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml @@ -79,13 +79,13 @@  	    <entry>Entity id, set by the application.</entry>  	  </row>  	  <row> -	    <entry>struct &media-pad-desc;</entry> +	    <entry>&media-pad-desc;</entry>  	    <entry>*<structfield>pads</structfield></entry>  	    <entry>Pointer to a pads array allocated by the application. Ignored  	    if NULL.</entry>  	  </row>  	  <row> -	    <entry>struct &media-link-desc;</entry> +	    <entry>&media-link-desc;</entry>  	    <entry>*<structfield>links</structfield></entry>  	    <entry>Pointer to a links array allocated by the application. Ignored  	    if NULL.</entry> @@ -134,6 +134,15 @@  	    <entry>Output pad, relative to the entity. Output pads source data  	    and are origins of links.</entry>  	  </row> +	  <row> +	    <entry><constant>MEDIA_PAD_FL_MUST_CONNECT</constant></entry> +	    <entry>If this flag is set and the pad is linked to any other +	    pad, then at least one of those links must be enabled for the +	    entity to be able to stream. There could be temporary reasons +	    (e.g. device configuration dependent) for the pad to need +	    enabled links even when this flag isn't set; the absence of the +	    flag doesn't imply there is none.</entry> +	  </row>  	</tbody>        </tgroup>      </table> @@ -144,12 +153,12 @@          &cs-str;  	<tbody valign="top">  	  <row> -	    <entry>struct &media-pad-desc;</entry> +	    <entry>&media-pad-desc;</entry>  	    <entry><structfield>source</structfield></entry>  	    <entry>Pad at the origin of this link.</entry>  	  </row>  	  <row> -	    <entry>struct &media-pad-desc;</entry> +	    <entry>&media-pad-desc;</entry>  	    <entry><structfield>sink</structfield></entry>  	    <entry>Pad at the target of this link.</entry>  	  </row> diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv16m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv16m.xml index c51d5a4cda0..fb2b5e35d66 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-nv16m.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-nv16m.xml @@ -12,18 +12,17 @@        <refsect1>  	<title>Description</title> -	<para>This is a multi-planar, two-plane version of the YUV 4:2:0 format. +	<para>This is a multi-planar, two-plane version of the YUV 4:2:2 format.  The three components are separated into two sub-images or planes.  <constant>V4L2_PIX_FMT_NV16M</constant> differs from <constant>V4L2_PIX_FMT_NV16  </constant> in that the two planes are non-contiguous in memory, i.e. the chroma -plane does not necessarily immediately follows the luma plane. +plane does not necessarily immediately follow the luma plane.  The luminance data occupies the first plane. The Y plane has one byte per pixel.  In the second plane there is chrominance data with alternating chroma samples.  The CbCr plane is the same width and height, in bytes, as the Y plane. -Each CbCr pair belongs to four pixels. For example, +Each CbCr pair belongs to two pixels. For example,  Cb<subscript>0</subscript>/Cr<subscript>0</subscript> belongs to -Y'<subscript>00</subscript>, Y'<subscript>01</subscript>, -Y'<subscript>10</subscript>, Y'<subscript>11</subscript>. +Y'<subscript>00</subscript>, Y'<subscript>01</subscript>.  <constant>V4L2_PIX_FMT_NV61M</constant> is the same as <constant>V4L2_PIX_FMT_NV16M</constant>  except the Cb and Cr bytes are swapped, the CrCb plane starts with a Cr byte.</para> diff --git a/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml index 166c8d65e4f..e1c4f8b4c0b 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml @@ -121,14 +121,14 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry><constant>V4L2_PIX_FMT_RGB332</constant></entry>  	    <entry>'RGB1'</entry>  	    <entry></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry>  	    <entry>r<subscript>2</subscript></entry>  	    <entry>r<subscript>1</subscript></entry>  	    <entry>r<subscript>0</subscript></entry> +	    <entry>g<subscript>2</subscript></entry> +	    <entry>g<subscript>1</subscript></entry> +	    <entry>g<subscript>0</subscript></entry> +	    <entry>b<subscript>1</subscript></entry> +	    <entry>b<subscript>0</subscript></entry>  	  </row>  	  <row id="V4L2-PIX-FMT-RGB444">  	    <entry><constant>V4L2_PIX_FMT_RGB444</constant></entry> @@ -159,18 +159,18 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry>g<subscript>2</subscript></entry>  	    <entry>g<subscript>1</subscript></entry>  	    <entry>g<subscript>0</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>a</entry>  	    <entry>b<subscript>4</subscript></entry>  	    <entry>b<subscript>3</subscript></entry>  	    <entry>b<subscript>2</subscript></entry>  	    <entry>b<subscript>1</subscript></entry>  	    <entry>b<subscript>0</subscript></entry> +	    <entry></entry> +	    <entry>a</entry> +	    <entry>r<subscript>4</subscript></entry> +	    <entry>r<subscript>3</subscript></entry> +	    <entry>r<subscript>2</subscript></entry> +	    <entry>r<subscript>1</subscript></entry> +	    <entry>r<subscript>0</subscript></entry>  	    <entry>g<subscript>4</subscript></entry>  	    <entry>g<subscript>3</subscript></entry>  	  </row> @@ -181,17 +181,17 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry>g<subscript>2</subscript></entry>  	    <entry>g<subscript>1</subscript></entry>  	    <entry>g<subscript>0</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry>  	    <entry>b<subscript>4</subscript></entry>  	    <entry>b<subscript>3</subscript></entry>  	    <entry>b<subscript>2</subscript></entry>  	    <entry>b<subscript>1</subscript></entry>  	    <entry>b<subscript>0</subscript></entry> +	    <entry></entry> +	    <entry>r<subscript>4</subscript></entry> +	    <entry>r<subscript>3</subscript></entry> +	    <entry>r<subscript>2</subscript></entry> +	    <entry>r<subscript>1</subscript></entry> +	    <entry>r<subscript>0</subscript></entry>  	    <entry>g<subscript>5</subscript></entry>  	    <entry>g<subscript>4</subscript></entry>  	    <entry>g<subscript>3</subscript></entry> @@ -201,32 +201,32 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry>'RGBQ'</entry>  	    <entry></entry>  	    <entry>a</entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry>  	    <entry>r<subscript>4</subscript></entry>  	    <entry>r<subscript>3</subscript></entry>  	    <entry>r<subscript>2</subscript></entry>  	    <entry>r<subscript>1</subscript></entry>  	    <entry>r<subscript>0</subscript></entry> -	  </row> -	  <row id="V4L2-PIX-FMT-RGB565X"> -	    <entry><constant>V4L2_PIX_FMT_RGB565X</constant></entry> -	    <entry>'RGBR'</entry> +	    <entry>g<subscript>4</subscript></entry> +	    <entry>g<subscript>3</subscript></entry>  	    <entry></entry> +	    <entry>g<subscript>2</subscript></entry> +	    <entry>g<subscript>1</subscript></entry> +	    <entry>g<subscript>0</subscript></entry>  	    <entry>b<subscript>4</subscript></entry>  	    <entry>b<subscript>3</subscript></entry>  	    <entry>b<subscript>2</subscript></entry>  	    <entry>b<subscript>1</subscript></entry>  	    <entry>b<subscript>0</subscript></entry> +	  </row> +	  <row id="V4L2-PIX-FMT-RGB565X"> +	    <entry><constant>V4L2_PIX_FMT_RGB565X</constant></entry> +	    <entry>'RGBR'</entry> +	    <entry></entry> +	    <entry>r<subscript>4</subscript></entry> +	    <entry>r<subscript>3</subscript></entry> +	    <entry>r<subscript>2</subscript></entry> +	    <entry>r<subscript>1</subscript></entry> +	    <entry>r<subscript>0</subscript></entry>  	    <entry>g<subscript>5</subscript></entry>  	    <entry>g<subscript>4</subscript></entry>  	    <entry>g<subscript>3</subscript></entry> @@ -234,11 +234,11 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry>g<subscript>2</subscript></entry>  	    <entry>g<subscript>1</subscript></entry>  	    <entry>g<subscript>0</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> +	    <entry>b<subscript>4</subscript></entry> +	    <entry>b<subscript>3</subscript></entry> +	    <entry>b<subscript>2</subscript></entry> +	    <entry>b<subscript>1</subscript></entry> +	    <entry>b<subscript>0</subscript></entry>  	  </row>  	  <row id="V4L2-PIX-FMT-BGR666">  	    <entry><constant>V4L2_PIX_FMT_BGR666</constant></entry> @@ -385,6 +385,15 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry><constant>V4L2_PIX_FMT_RGB32</constant></entry>  	    <entry>'RGB4'</entry>  	    <entry></entry> +	    <entry>a<subscript>7</subscript></entry> +	    <entry>a<subscript>6</subscript></entry> +	    <entry>a<subscript>5</subscript></entry> +	    <entry>a<subscript>4</subscript></entry> +	    <entry>a<subscript>3</subscript></entry> +	    <entry>a<subscript>2</subscript></entry> +	    <entry>a<subscript>1</subscript></entry> +	    <entry>a<subscript>0</subscript></entry> +	    <entry></entry>  	    <entry>r<subscript>7</subscript></entry>  	    <entry>r<subscript>6</subscript></entry>  	    <entry>r<subscript>5</subscript></entry> @@ -411,25 +420,16 @@ colorspace <constant>V4L2_COLORSPACE_SRGB</constant>.</para>  	    <entry>b<subscript>2</subscript></entry>  	    <entry>b<subscript>1</subscript></entry>  	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>a<subscript>7</subscript></entry> -	    <entry>a<subscript>6</subscript></entry> -	    <entry>a<subscript>5</subscript></entry> -	    <entry>a<subscript>4</subscript></entry> -	    <entry>a<subscript>3</subscript></entry> -	    <entry>a<subscript>2</subscript></entry> -	    <entry>a<subscript>1</subscript></entry> -	    <entry>a<subscript>0</subscript></entry>  	  </row>  	</tbody>        </tgroup>      </table> -    <para>Bit 7 is the most significant bit. The value of a = alpha +    <para>Bit 7 is the most significant bit. The value of the a = alpha  bits is undefined when reading from the driver, ignored when writing  to the driver, except when alpha blending has been negotiated for a  <link linkend="overlay">Video Overlay</link> or <link linkend="osd"> -Video Output Overlay</link> or when alpha component has been configured +Video Output Overlay</link> or when the alpha component has been configured  for a <link linkend="capture">Video Capture</link> by means of <link  linkend="v4l2-alpha-component"> <constant>V4L2_CID_ALPHA_COMPONENT  </constant> </link> control.</para> @@ -512,421 +512,6 @@ image</title>        </formalpara>      </example> -    <important> -      <para>Drivers may interpret these formats differently.</para> -    </important> - -    <para>Some RGB formats above are uncommon and were probably -defined in error. Drivers may interpret them as in <xref -	linkend="rgb-formats-corrected" />.</para> - -    <table pgwide="1" frame="none" id="rgb-formats-corrected"> -      <title>Packed RGB Image Formats (corrected)</title> -      <tgroup cols="37" align="center"> -	<colspec colname="id" align="left" /> -	<colspec colname="fourcc" /> -	<colspec colname="bit" /> - -	<colspec colnum="4" colname="b07" align="center" /> -	<colspec colnum="5" colname="b06" align="center" /> -	<colspec colnum="6" colname="b05" align="center" /> -	<colspec colnum="7" colname="b04" align="center" /> -	<colspec colnum="8" colname="b03" align="center" /> -	<colspec colnum="9" colname="b02" align="center" /> -	<colspec colnum="10" colname="b01" align="center" /> -	<colspec colnum="11" colname="b00" align="center" /> - -	<colspec colnum="13" colname="b17" align="center" /> -	<colspec colnum="14" colname="b16" align="center" /> -	<colspec colnum="15" colname="b15" align="center" /> -	<colspec colnum="16" colname="b14" align="center" /> -	<colspec colnum="17" colname="b13" align="center" /> -	<colspec colnum="18" colname="b12" align="center" /> -	<colspec colnum="19" colname="b11" align="center" /> -	<colspec colnum="20" colname="b10" align="center" /> - -	<colspec colnum="22" colname="b27" align="center" /> -	<colspec colnum="23" colname="b26" align="center" /> -	<colspec colnum="24" colname="b25" align="center" /> -	<colspec colnum="25" colname="b24" align="center" /> -	<colspec colnum="26" colname="b23" align="center" /> -	<colspec colnum="27" colname="b22" align="center" /> -	<colspec colnum="28" colname="b21" align="center" /> -	<colspec colnum="29" colname="b20" align="center" /> - -	<colspec colnum="31" colname="b37" align="center" /> -	<colspec colnum="32" colname="b36" align="center" /> -	<colspec colnum="33" colname="b35" align="center" /> -	<colspec colnum="34" colname="b34" align="center" /> -	<colspec colnum="35" colname="b33" align="center" /> -	<colspec colnum="36" colname="b32" align="center" /> -	<colspec colnum="37" colname="b31" align="center" /> -	<colspec colnum="38" colname="b30" align="center" /> - -	<spanspec namest="b07" nameend="b00" spanname="b0" /> -	<spanspec namest="b17" nameend="b10" spanname="b1" /> -	<spanspec namest="b27" nameend="b20" spanname="b2" /> -	<spanspec namest="b37" nameend="b30" spanname="b3" /> -	<thead> -	  <row> -	    <entry>Identifier</entry> -	    <entry>Code</entry> -	    <entry> </entry> -	    <entry spanname="b0">Byte 0 in memory</entry> -	    <entry spanname="b1">Byte 1</entry> -	    <entry spanname="b2">Byte 2</entry> -	    <entry spanname="b3">Byte 3</entry> -	  </row> -	  <row> -	    <entry> </entry> -	    <entry> </entry> -	    <entry>Bit</entry> -	    <entry>7</entry> -	    <entry>6</entry> -	    <entry>5</entry> -	    <entry>4</entry> -	    <entry>3</entry> -	    <entry>2</entry> -	    <entry>1</entry> -	    <entry>0</entry> -	    <entry> </entry> -	    <entry>7</entry> -	    <entry>6</entry> -	    <entry>5</entry> -	    <entry>4</entry> -	    <entry>3</entry> -	    <entry>2</entry> -	    <entry>1</entry> -	    <entry>0</entry> -	    <entry> </entry> -	    <entry>7</entry> -	    <entry>6</entry> -	    <entry>5</entry> -	    <entry>4</entry> -	    <entry>3</entry> -	    <entry>2</entry> -	    <entry>1</entry> -	    <entry>0</entry> -	    <entry> </entry> -	    <entry>7</entry> -	    <entry>6</entry> -	    <entry>5</entry> -	    <entry>4</entry> -	    <entry>3</entry> -	    <entry>2</entry> -	    <entry>1</entry> -	    <entry>0</entry> -	  </row> -	</thead> -	<tbody valign="top"> -	  <row><!-- id="V4L2-PIX-FMT-RGB332" --> -	    <entry><constant>V4L2_PIX_FMT_RGB332</constant></entry> -	    <entry>'RGB1'</entry> -	    <entry></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB444" --> -	    <entry><constant>V4L2_PIX_FMT_RGB444</constant></entry> -	    <entry>'R444'</entry> -	    <entry></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>a<subscript>3</subscript></entry> -	    <entry>a<subscript>2</subscript></entry> -	    <entry>a<subscript>1</subscript></entry> -	    <entry>a<subscript>0</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB555" --> -	    <entry><constant>V4L2_PIX_FMT_RGB555</constant></entry> -	    <entry>'RGBO'</entry> -	    <entry></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>a</entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB565" --> -	    <entry><constant>V4L2_PIX_FMT_RGB565</constant></entry> -	    <entry>'RGBP'</entry> -	    <entry></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB555X" --> -	    <entry><constant>V4L2_PIX_FMT_RGB555X</constant></entry> -	    <entry>'RGBQ'</entry> -	    <entry></entry> -	    <entry>a</entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB565X" --> -	    <entry><constant>V4L2_PIX_FMT_RGB565X</constant></entry> -	    <entry>'RGBR'</entry> -	    <entry></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-BGR666" --> -	    <entry><constant>V4L2_PIX_FMT_BGR666</constant></entry> -	    <entry>'BGRH'</entry> -	    <entry></entry> -	    <entry>b<subscript>5</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry>r<subscript>5</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	    <entry></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-BGR24" --> -	    <entry><constant>V4L2_PIX_FMT_BGR24</constant></entry> -	    <entry>'BGR3'</entry> -	    <entry></entry> -	    <entry>b<subscript>7</subscript></entry> -	    <entry>b<subscript>6</subscript></entry> -	    <entry>b<subscript>5</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>7</subscript></entry> -	    <entry>g<subscript>6</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>r<subscript>7</subscript></entry> -	    <entry>r<subscript>6</subscript></entry> -	    <entry>r<subscript>5</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB24" --> -	    <entry><constant>V4L2_PIX_FMT_RGB24</constant></entry> -	    <entry>'RGB3'</entry> -	    <entry></entry> -	    <entry>r<subscript>7</subscript></entry> -	    <entry>r<subscript>6</subscript></entry> -	    <entry>r<subscript>5</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>7</subscript></entry> -	    <entry>g<subscript>6</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>b<subscript>7</subscript></entry> -	    <entry>b<subscript>6</subscript></entry> -	    <entry>b<subscript>5</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-BGR32" --> -	    <entry><constant>V4L2_PIX_FMT_BGR32</constant></entry> -	    <entry>'BGR4'</entry> -	    <entry></entry> -	    <entry>b<subscript>7</subscript></entry> -	    <entry>b<subscript>6</subscript></entry> -	    <entry>b<subscript>5</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>7</subscript></entry> -	    <entry>g<subscript>6</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>r<subscript>7</subscript></entry> -	    <entry>r<subscript>6</subscript></entry> -	    <entry>r<subscript>5</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>a<subscript>7</subscript></entry> -	    <entry>a<subscript>6</subscript></entry> -	    <entry>a<subscript>5</subscript></entry> -	    <entry>a<subscript>4</subscript></entry> -	    <entry>a<subscript>3</subscript></entry> -	    <entry>a<subscript>2</subscript></entry> -	    <entry>a<subscript>1</subscript></entry> -	    <entry>a<subscript>0</subscript></entry> -	  </row> -	  <row><!-- id="V4L2-PIX-FMT-RGB32" --> -	    <entry><constant>V4L2_PIX_FMT_RGB32</constant></entry> -	    <entry>'RGB4'</entry> -	    <entry></entry> -	    <entry>a<subscript>7</subscript></entry> -	    <entry>a<subscript>6</subscript></entry> -	    <entry>a<subscript>5</subscript></entry> -	    <entry>a<subscript>4</subscript></entry> -	    <entry>a<subscript>3</subscript></entry> -	    <entry>a<subscript>2</subscript></entry> -	    <entry>a<subscript>1</subscript></entry> -	    <entry>a<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>r<subscript>7</subscript></entry> -	    <entry>r<subscript>6</subscript></entry> -	    <entry>r<subscript>5</subscript></entry> -	    <entry>r<subscript>4</subscript></entry> -	    <entry>r<subscript>3</subscript></entry> -	    <entry>r<subscript>2</subscript></entry> -	    <entry>r<subscript>1</subscript></entry> -	    <entry>r<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>g<subscript>7</subscript></entry> -	    <entry>g<subscript>6</subscript></entry> -	    <entry>g<subscript>5</subscript></entry> -	    <entry>g<subscript>4</subscript></entry> -	    <entry>g<subscript>3</subscript></entry> -	    <entry>g<subscript>2</subscript></entry> -	    <entry>g<subscript>1</subscript></entry> -	    <entry>g<subscript>0</subscript></entry> -	    <entry></entry> -	    <entry>b<subscript>7</subscript></entry> -	    <entry>b<subscript>6</subscript></entry> -	    <entry>b<subscript>5</subscript></entry> -	    <entry>b<subscript>4</subscript></entry> -	    <entry>b<subscript>3</subscript></entry> -	    <entry>b<subscript>2</subscript></entry> -	    <entry>b<subscript>1</subscript></entry> -	    <entry>b<subscript>0</subscript></entry> -	  </row> -	</tbody> -      </tgroup> -    </table> -      <para>A test utility to determine which RGB formats a driver  actually supports is available from the LinuxTV v4l-dvb repository.  See &v4l-dvb; for access instructions.</para> diff --git a/Documentation/DocBook/media/v4l/pixfmt-sdr-cu08.xml b/Documentation/DocBook/media/v4l/pixfmt-sdr-cu08.xml new file mode 100644 index 00000000000..2d80104c178 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sdr-cu08.xml @@ -0,0 +1,44 @@ +<refentry id="V4L2-SDR-FMT-CU08"> +  <refmeta> +    <refentrytitle>V4L2_SDR_FMT_CU8 ('CU08')</refentrytitle> +    &manvol; +  </refmeta> +    <refnamediv> +      <refname> +        <constant>V4L2_SDR_FMT_CU8</constant> +      </refname> +      <refpurpose>Complex unsigned 8-bit IQ sample</refpurpose> +    </refnamediv> +    <refsect1> +      <title>Description</title> +      <para> +This format contains sequence of complex number samples. Each complex number +consist two parts, called In-phase and Quadrature (IQ). Both I and Q are +represented as a 8 bit unsigned number. I value comes first and Q value after +that. +      </para> +    <example> +      <title><constant>V4L2_SDR_FMT_CU8</constant> 1 sample</title> +      <formalpara> +        <title>Byte Order.</title> +        <para>Each cell is one byte. +          <informaltable frame="none"> +            <tgroup cols="2" align="center"> +              <colspec align="left" colwidth="2*" /> +              <tbody valign="top"> +                <row> +                  <entry>start + 0:</entry> +                  <entry>I'<subscript>0</subscript></entry> +                </row> +                <row> +                  <entry>start + 1:</entry> +                  <entry>Q'<subscript>0</subscript></entry> +                </row> +              </tbody> +            </tgroup> +          </informaltable> +        </para> +      </formalpara> +    </example> +  </refsect1> +</refentry> diff --git a/Documentation/DocBook/media/v4l/pixfmt-sdr-cu16le.xml b/Documentation/DocBook/media/v4l/pixfmt-sdr-cu16le.xml new file mode 100644 index 00000000000..26288ffa907 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sdr-cu16le.xml @@ -0,0 +1,46 @@ +<refentry id="V4L2-SDR-FMT-CU16LE"> +  <refmeta> +    <refentrytitle>V4L2_SDR_FMT_CU16LE ('CU16')</refentrytitle> +    &manvol; +  </refmeta> +    <refnamediv> +      <refname> +        <constant>V4L2_SDR_FMT_CU16LE</constant> +      </refname> +      <refpurpose>Complex unsigned 16-bit little endian IQ sample</refpurpose> +    </refnamediv> +    <refsect1> +      <title>Description</title> +      <para> +This format contains sequence of complex number samples. Each complex number +consist two parts, called In-phase and Quadrature (IQ). Both I and Q are +represented as a 16 bit unsigned little endian number. I value comes first +and Q value after that. +      </para> +    <example> +      <title><constant>V4L2_SDR_FMT_CU16LE</constant> 1 sample</title> +      <formalpara> +        <title>Byte Order.</title> +        <para>Each cell is one byte. +          <informaltable frame="none"> +            <tgroup cols="3" align="center"> +              <colspec align="left" colwidth="2*" /> +              <tbody valign="top"> +                <row> +                  <entry>start + 0:</entry> +                  <entry>I'<subscript>0[7:0]</subscript></entry> +                  <entry>I'<subscript>0[15:8]</subscript></entry> +                </row> +                <row> +                  <entry>start + 2:</entry> +                  <entry>Q'<subscript>0[7:0]</subscript></entry> +                  <entry>Q'<subscript>0[15:8]</subscript></entry> +                </row> +              </tbody> +            </tgroup> +          </informaltable> +        </para> +      </formalpara> +    </example> +  </refsect1> +</refentry> diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 72d72bd67d0..91dcbc84f3f 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -25,7 +25,12 @@ capturing and output, for overlay frame buffer formats see also  	<row>  	  <entry>__u32</entry>  	  <entry><structfield>height</structfield></entry> -	  <entry>Image height in pixels.</entry> +	  <entry>Image height in pixels. If <structfield>field</structfield> is +	  one of <constant>V4L2_FIELD_TOP</constant>, <constant>V4L2_FIELD_BOTTOM</constant> +	  or <constant>V4L2_FIELD_ALTERNATE</constant> then height refers to the +	  number of lines in the field, otherwise it refers to the number of +	  lines in the frame (which is twice the field height for interlaced +	  formats).</entry>  	</row>  	<row>  	  <entry spanname="hspan">Applications set these fields to @@ -54,7 +59,7 @@ linkend="reserved-formats" /></entry>  can request to capture or output only the top or bottom field, or both  fields interlaced or sequentially stored in one buffer or alternating  in separate buffers. Drivers return the actual field order selected. -For details see <xref linkend="field-order" />.</entry> +For more details on fields see <xref linkend="field-order" />.</entry>  	</row>  	<row>  	  <entry>__u32</entry> @@ -81,7 +86,10 @@ plane and is divided by the same factor as the  example the Cb and Cr planes of a YUV 4:2:0 image have half as many  padding bytes following each line as the Y plane. To avoid ambiguities  drivers must return a <structfield>bytesperline</structfield> value -rounded up to a multiple of the scale factor.</para></entry> +rounded up to a multiple of the scale factor.</para> +<para>For compressed formats the <structfield>bytesperline</structfield> +value makes no sense. Applications and drivers must set this to 0 in +that case.</para></entry>  	</row>  	<row>  	  <entry>__u32</entry> @@ -97,7 +105,8 @@ hold an image.</entry>  	  <entry>&v4l2-colorspace;</entry>  	  <entry><structfield>colorspace</structfield></entry>  	  <entry>This information supplements the -<structfield>pixelformat</structfield> and must be set by the driver, +<structfield>pixelformat</structfield> and must be set by the driver for +capture streams and by the application for output streams,  see <xref linkend="colorspaces" />.</entry>  	</row>  	<row> @@ -135,7 +144,7 @@ set this field to zero.</entry>            <entry>__u16</entry>            <entry><structfield>bytesperline</structfield></entry>            <entry>Distance in bytes between the leftmost pixels in two adjacent -            lines.</entry> +            lines. See &v4l2-pix-format;.</entry>          </row>          <row>            <entry>__u16</entry> @@ -154,12 +163,12 @@ set this field to zero.</entry>          <row>            <entry>__u32</entry>            <entry><structfield>width</structfield></entry> -          <entry>Image width in pixels.</entry> +          <entry>Image width in pixels. See &v4l2-pix-format;.</entry>          </row>          <row>            <entry>__u32</entry>            <entry><structfield>height</structfield></entry> -          <entry>Image height in pixels.</entry> +          <entry>Image height in pixels. See &v4l2-pix-format;.</entry>          </row>          <row>            <entry>__u32</entry> @@ -763,7 +772,7 @@ extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see  	  </row>  	  <row id="V4L2-PIX-FMT-H264-MVC">  		<entry><constant>V4L2_PIX_FMT_H264_MVC</constant></entry> -		<entry>'MVC'</entry> +		<entry>'M264'</entry>  		<entry>H264 MVC video elementary stream.</entry>  	  </row>  	  <row id="V4L2-PIX-FMT-H263"> @@ -803,7 +812,7 @@ extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see  	  </row>  	  <row id="V4L2-PIX-FMT-VP8">  		<entry><constant>V4L2_PIX_FMT_VP8</constant></entry> -		<entry>'VP8'</entry> +		<entry>'VP80'</entry>  		<entry>VP8 video elementary stream.</entry>  	  </row>  	</tbody> @@ -811,6 +820,17 @@ extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see      </table>    </section> +  <section id="sdr-formats"> +    <title>SDR Formats</title> + +    <para>These formats are used for <link linkend="sdr">SDR Capture</link> +interface only.</para> + +    &sub-sdr-cu08; +    &sub-sdr-cu16le; + +  </section> +    <section id="pixfmt-reserved">      <title>Reserved Format Identifiers</title> diff --git a/Documentation/DocBook/media/v4l/remote_controllers.xml b/Documentation/DocBook/media/v4l/remote_controllers.xml index 160e464d44b..5124a6c4daa 100644 --- a/Documentation/DocBook/media/v4l/remote_controllers.xml +++ b/Documentation/DocBook/media/v4l/remote_controllers.xml @@ -1,10 +1,152 @@ +<partinfo> +<authorgroup> +<author> +<firstname>Mauro</firstname> +<surname>Chehab</surname> +<othername role="mi">Carvalho</othername> +<affiliation><address><email>m.chehab@samsung.com</email></address></affiliation> +<contrib>Initial version.</contrib> +</author> +</authorgroup> +<copyright> +	<year>2009-2014</year> +        <holder>Mauro Carvalho Chehab</holder> +</copyright> + +<revhistory> +<!-- Put document revisions here, newest first. --> +<revision> +<revnumber>3.15</revnumber> +<date>2014-02-06</date> +<authorinitials>mcc</authorinitials> +<revremark>Added the interface description and the RC sysfs class description.</revremark> +</revision> +<revision> +<revnumber>1.0</revnumber> +<date>2009-09-06</date> +<authorinitials>mcc</authorinitials> +<revremark>Initial revision</revremark> +</revision> +</revhistory> +</partinfo> + + <title>Remote Controller API</title> + <chapter id="remote_controllers"> +  <title>Remote Controllers</title> +  <section id="Remote_controllers_Intro">  <title>Introduction</title>  <para>Currently, most analog and digital devices have a Infrared input for remote controllers. Each  manufacturer has their own type of control. It is not rare for the same manufacturer to ship different  types of controls, depending on the device.</para> +<para>A Remote Controller interface is mapped as a normal evdev/input interface, just like a keyboard or a mouse. +So, it uses all ioctls already defined for any other input devices.</para> +<para>However, remove controllers are more flexible than a normal input device, as the IR +receiver (and/or transmitter) can be used in conjunction with a wide variety of different IR remotes.</para> +<para>In order to allow flexibility, the Remote Controller subsystem allows controlling the +RC-specific attributes via <link linkend="remote_controllers_sysfs_nodes">the sysfs class nodes</link>.</para> +</section> + +<section id="remote_controllers_sysfs_nodes"> +<title>Remote Controller's sysfs nodes</title> +<para>As defined at <constant>Documentation/ABI/testing/sysfs-class-rc</constant>, those are the sysfs nodes that control the Remote Controllers:</para> + +<section id="sys_class_rc"> +<title>/sys/class/rc/</title> +<para>The <constant>/sys/class/rc/</constant> class sub-directory belongs to the Remote Controller +core and provides a sysfs interface for configuring infrared remote controller receivers. +</para> + +</section> +<section id="sys_class_rc_rcN"> +<title>/sys/class/rc/rcN/</title> +<para>A <constant>/sys/class/rc/rcN</constant> directory is created for each remote +  control receiver device where N is the number of the receiver.</para> + +</section> +<section id="sys_class_rc_rcN_protocols"> +<title>/sys/class/rc/rcN/protocols</title> +<para>Reading this file returns a list of available protocols, something like:</para> +<para><constant>rc5 [rc6] nec jvc [sony]</constant></para> +<para>Enabled protocols are shown in [] brackets.</para> +<para>Writing "+proto" will add a protocol to the list of enabled protocols.</para> +<para>Writing "-proto" will remove a protocol from the list of enabled protocols.</para> +<para>Writing "proto" will enable only "proto".</para> +<para>Writing "none" will disable all protocols.</para> +<para>Write fails with EINVAL if an invalid protocol combination or unknown protocol name is used.</para> + +</section> +<section id="sys_class_rc_rcN_filter"> +<title>/sys/class/rc/rcN/filter</title> +<para>Sets the scancode filter expected value.</para> +<para>Use in combination with <constant>/sys/class/rc/rcN/filter_mask</constant> to set the +expected value of the bits set in the filter mask. +If the hardware supports it then scancodes which do not match +the filter will be ignored. Otherwise the write will fail with +an error.</para> +<para>This value may be reset to 0 if the current protocol is altered.</para> + +</section> +<section id="sys_class_rc_rcN_filter_mask"> +<title>/sys/class/rc/rcN/filter_mask</title> +<para>Sets the scancode filter mask of bits to compare. +Use in combination with <constant>/sys/class/rc/rcN/filter</constant> to set the bits +of the scancode which should be compared against the expected +value. A value of 0 disables the filter to allow all valid +scancodes to be processed.</para> +<para>If the hardware supports it then scancodes which do not match +the filter will be ignored. Otherwise the write will fail with +an error.</para> +<para>This value may be reset to 0 if the current protocol is altered.</para> + +</section> +<section id="sys_class_rc_rcN_wakeup_protocols"> +<title>/sys/class/rc/rcN/wakeup_protocols</title> +<para>Reading this file returns a list of available protocols to use for the +wakeup filter, something like:</para> +<para><constant>rc5 rc6 nec jvc [sony]</constant></para> +<para>The enabled wakeup protocol is shown in [] brackets.</para> +<para>Writing "+proto" will add a protocol to the list of enabled wakeup +protocols.</para> +<para>Writing "-proto" will remove a protocol from the list of enabled wakeup +protocols.</para> +<para>Writing "proto" will use "proto" for wakeup events.</para> +<para>Writing "none" will disable wakeup.</para> +<para>Write fails with EINVAL if an invalid protocol combination or unknown +protocol name is used, or if wakeup is not supported by the hardware.</para> + +</section> +<section id="sys_class_rc_rcN_wakeup_filter"> +<title>/sys/class/rc/rcN/wakeup_filter</title> +<para>Sets the scancode wakeup filter expected value. +Use in combination with <constant>/sys/class/rc/rcN/wakeup_filter_mask</constant> to +set the expected value of the bits set in the wakeup filter mask +to trigger a system wake event.</para> +<para>If the hardware supports it and wakeup_filter_mask is not 0 then +scancodes which match the filter will wake the system from e.g. +suspend to RAM or power off. +Otherwise the write will fail with an error.</para> +<para>This value may be reset to 0 if the wakeup protocol is altered.</para> + +</section> +<section id="sys_class_rc_rcN_wakeup_filter_mask"> +<title>/sys/class/rc/rcN/wakeup_filter_mask</title> +<para>Sets the scancode wakeup filter mask of bits to compare. +Use in combination with <constant>/sys/class/rc/rcN/wakeup_filter</constant> to set +the bits of the scancode which should be compared against the +expected value to trigger a system wake event.</para> +<para>If the hardware supports it and wakeup_filter_mask is not 0 then +scancodes which match the filter will wake the system from e.g. +suspend to RAM or power off. +Otherwise the write will fail with an error.</para> +<para>This value may be reset to 0 if the wakeup protocol is altered.</para> +</section> +</section> + +<section id="Remote_controllers_tables"> +<title>Remote controller tables</title>  <para>Unfortunately, for several years, there was no effort to create uniform IR keycodes for  different devices.  This caused the same IR keyname to be mapped completely differently on  different IR devices. This resulted that the same IR keyname to be mapped completely different on @@ -175,3 +317,4 @@ keymapping.</para>  </section>  &sub-lirc_device_interface; +</chapter> diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index f72c1cc93a9..b2d5a0363cb 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -89,7 +89,7 @@        <constant>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</constant>.        </para> -      <para>The following tables list existing packet RGB formats.</para> +      <para>The following tables list existing packed RGB formats.</para>        <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-rgb">  	<title>RGB formats</title> @@ -615,7 +615,7 @@  	</mediaobject>        </figure> -      <para>The following table lists existing packet Bayer formats. The data +      <para>The following table lists existing packed Bayer formats. The data        organization is given as an example for the first pixel only.</para>        <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-bayer"> @@ -1178,7 +1178,7 @@        U, Y, V, Y order will be named <constant>V4L2_MBUS_FMT_UYVY8_2X8</constant>.        </para> -	<para><xref linkend="v4l2-mbus-pixelcode-yuv8"/> list existing packet YUV +	<para><xref linkend="v4l2-mbus-pixelcode-yuv8"/> lists existing packed YUV  	formats and describes the organization of each pixel data in each sample.  	When a format pattern is split across multiple samples each of the samples  	in the pattern is described.</para> @@ -1898,6 +1898,134 @@  	      <entry>y<subscript>1</subscript></entry>  	      <entry>y<subscript>0</subscript></entry>  	    </row> +	    <row id="V4L2-MBUS-FMT-UYVY10-2X10"> +	      <entry>V4L2_MBUS_FMT_UYVY10_2X10</entry> +	      <entry>0x2018</entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-VYUY10-2X10"> +	      <entry>V4L2_MBUS_FMT_VYUY10_2X10</entry> +	      <entry>0x2019</entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-22; +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row>  	    <row id="V4L2-MBUS-FMT-YUYV10-2X10">  	      <entry>V4L2_MBUS_FMT_YUYV10_2X10</entry>  	      <entry>0x200b</entry> @@ -2308,6 +2436,110 @@  	      <entry>v<subscript>1</subscript></entry>  	      <entry>v<subscript>0</subscript></entry>  	    </row> +	    <row id="V4L2-MBUS-FMT-UYVY10-1X20"> +	      <entry>V4L2_MBUS_FMT_UYVY10_1X20</entry> +	      <entry>0x201a</entry> +	      <entry></entry> +	      &dash-ent-12; +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-12; +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-VYUY10-1X20"> +	      <entry>V4L2_MBUS_FMT_VYUY10_1X20</entry> +	      <entry>0x201b</entry> +	      <entry></entry> +	      &dash-ent-12; +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-12; +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row>  	    <row id="V4L2-MBUS-FMT-YUYV10-1X20">  	      <entry>V4L2_MBUS_FMT_YUYV10_1X20</entry>  	      <entry>0x200d</entry> @@ -2486,6 +2718,691 @@  	      <entry>v<subscript>1</subscript></entry>  	      <entry>v<subscript>0</subscript></entry>  	    </row> +	    <row id="V4L2-MBUS-FMT-UYVY12-2X12"> +	      <entry>V4L2_MBUS_FMT_UYVY12_2X12</entry> +	      <entry>0x201c</entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-VYUY12-2X12"> +	      <entry>V4L2_MBUS_FMT_VYUY12_2X12</entry> +	      <entry>0x201d</entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-YUYV12-2X12"> +	      <entry>V4L2_MBUS_FMT_YUYV12_2X12</entry> +	      <entry>0x201e</entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-YVYU12-2X12"> +	      <entry>V4L2_MBUS_FMT_YVYU12_2X12</entry> +	      <entry>0x201f</entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-20; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-UYVY12-1X24"> +	      <entry>V4L2_MBUS_FMT_UYVY12_1X24</entry> +	      <entry>0x2020</entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-VYUY12-1X24"> +	      <entry>V4L2_MBUS_FMT_VYUY12_1X24</entry> +	      <entry>0x2021</entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-YUYV12-1X24"> +	      <entry>V4L2_MBUS_FMT_YUYV12_1X24</entry> +	      <entry>0x2022</entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row id="V4L2-MBUS-FMT-YVYU12-1X24"> +	      <entry>V4L2_MBUS_FMT_YVYU12_1X24</entry> +	      <entry>0x2023</entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	      <entry>v<subscript>11</subscript></entry> +	      <entry>v<subscript>10</subscript></entry> +	      <entry>v<subscript>9</subscript></entry> +	      <entry>v<subscript>8</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry></entry> +	      &dash-ent-8; +	      <entry>y<subscript>11</subscript></entry> +	      <entry>y<subscript>10</subscript></entry> +	      <entry>y<subscript>9</subscript></entry> +	      <entry>y<subscript>8</subscript></entry> +	      <entry>y<subscript>7</subscript></entry> +	      <entry>y<subscript>6</subscript></entry> +	      <entry>y<subscript>5</subscript></entry> +	      <entry>y<subscript>4</subscript></entry> +	      <entry>y<subscript>3</subscript></entry> +	      <entry>y<subscript>2</subscript></entry> +	      <entry>y<subscript>1</subscript></entry> +	      <entry>y<subscript>0</subscript></entry> +	      <entry>u<subscript>11</subscript></entry> +	      <entry>u<subscript>10</subscript></entry> +	      <entry>u<subscript>9</subscript></entry> +	      <entry>u<subscript>8</subscript></entry> +	      <entry>u<subscript>7</subscript></entry> +	      <entry>u<subscript>6</subscript></entry> +	      <entry>u<subscript>5</subscript></entry> +	      <entry>u<subscript>4</subscript></entry> +	      <entry>u<subscript>3</subscript></entry> +	      <entry>u<subscript>2</subscript></entry> +	      <entry>u<subscript>1</subscript></entry> +	      <entry>u<subscript>0</subscript></entry> +	    </row> +	  </tbody> +	</tgroup> +      </table> +    </section> + +    <section> +      <title>HSV/HSL Formats</title> + +      <para>Those formats transfer pixel data as RGB values in a cylindrical-coordinate +      system using Hue-Saturation-Value or Hue-Saturation-Lightness components. The +      format code is made of the following information. +      <itemizedlist> +	<listitem><para>The hue, saturation, value or lightness and optional alpha +	components order code, as encoded in a pixel sample. The only currently +	supported value is AHSV. +	</para></listitem> +	<listitem><para>The number of bits per component, for each component. The values +	can be different for all components. The only currently supported value is 8888. +	</para></listitem> +	<listitem><para>The number of bus samples per pixel. Pixels that are wider than +	the bus width must be transferred in multiple samples. The only currently +	supported value is 1.</para></listitem> +	<listitem><para>The bus width.</para></listitem> +	<listitem><para>For formats where the total number of bits per pixel is smaller +	than the number of bus samples per pixel times the bus width, a padding +	value stating if the bytes are padded in their most high order bits +	(PADHI) or low order bits (PADLO).</para></listitem> +	<listitem><para>For formats where the number of bus samples per pixel is larger +	than 1, an endianness value stating if the pixel is transferred MSB first +	(BE) or LSB first (LE).</para></listitem> +      </itemizedlist> +      </para> + +      <para>The following table lists existing HSV/HSL formats.</para> + +      <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-hsv"> +	<title>HSV/HSL formats</title> +	<tgroup cols="27"> +	  <colspec colname="id" align="left" /> +	  <colspec colname="code" align="center"/> +	  <colspec colname="bit" /> +	  <colspec colnum="4" colname="b31" align="center" /> +	  <colspec colnum="5" colname="b20" align="center" /> +	  <colspec colnum="6" colname="b29" align="center" /> +	  <colspec colnum="7" colname="b28" align="center" /> +	  <colspec colnum="8" colname="b27" align="center" /> +	  <colspec colnum="9" colname="b26" align="center" /> +	  <colspec colnum="10" colname="b25" align="center" /> +	  <colspec colnum="11" colname="b24" align="center" /> +	  <colspec colnum="12" colname="b23" align="center" /> +	  <colspec colnum="13" colname="b22" align="center" /> +	  <colspec colnum="14" colname="b21" align="center" /> +	  <colspec colnum="15" colname="b20" align="center" /> +	  <colspec colnum="16" colname="b19" align="center" /> +	  <colspec colnum="17" colname="b18" align="center" /> +	  <colspec colnum="18" colname="b17" align="center" /> +	  <colspec colnum="19" colname="b16" align="center" /> +	  <colspec colnum="20" colname="b15" align="center" /> +	  <colspec colnum="21" colname="b14" align="center" /> +	  <colspec colnum="22" colname="b13" align="center" /> +	  <colspec colnum="23" colname="b12" align="center" /> +	  <colspec colnum="24" colname="b11" align="center" /> +	  <colspec colnum="25" colname="b10" align="center" /> +	  <colspec colnum="26" colname="b09" align="center" /> +	  <colspec colnum="27" colname="b08" align="center" /> +	  <colspec colnum="28" colname="b07" align="center" /> +	  <colspec colnum="29" colname="b06" align="center" /> +	  <colspec colnum="30" colname="b05" align="center" /> +	  <colspec colnum="31" colname="b04" align="center" /> +	  <colspec colnum="32" colname="b03" align="center" /> +	  <colspec colnum="33" colname="b02" align="center" /> +	  <colspec colnum="34" colname="b01" align="center" /> +	  <colspec colnum="35" colname="b00" align="center" /> +	  <spanspec namest="b31" nameend="b00" spanname="b0" /> +	  <thead> +	    <row> +	      <entry>Identifier</entry> +	      <entry>Code</entry> +	      <entry></entry> +	      <entry spanname="b0">Data organization</entry> +	    </row> +	    <row> +	      <entry></entry> +	      <entry></entry> +	      <entry>Bit</entry> +	      <entry>31</entry> +	      <entry>30</entry> +	      <entry>29</entry> +	      <entry>28</entry> +	      <entry>27</entry> +	      <entry>26</entry> +	      <entry>25</entry> +	      <entry>24</entry> +	      <entry>23</entry> +	      <entry>22</entry> +	      <entry>21</entry> +	      <entry>20</entry> +	      <entry>19</entry> +	      <entry>18</entry> +	      <entry>17</entry> +	      <entry>16</entry> +	      <entry>15</entry> +	      <entry>14</entry> +	      <entry>13</entry> +	      <entry>12</entry> +	      <entry>11</entry> +	      <entry>10</entry> +	      <entry>9</entry> +	      <entry>8</entry> +	      <entry>7</entry> +	      <entry>6</entry> +	      <entry>5</entry> +	      <entry>4</entry> +	      <entry>3</entry> +	      <entry>2</entry> +	      <entry>1</entry> +	      <entry>0</entry> +	    </row> +	  </thead> +	  <tbody valign="top"> +	    <row id="V4L2-MBUS-FMT-AHSV8888-1X32"> +	      <entry>V4L2_MBUS_FMT_AHSV8888_1X32</entry> +	      <entry>0x6001</entry> +	      <entry></entry> +	      <entry>a<subscript>7</subscript></entry> +	      <entry>a<subscript>6</subscript></entry> +	      <entry>a<subscript>5</subscript></entry> +	      <entry>a<subscript>4</subscript></entry> +	      <entry>a<subscript>3</subscript></entry> +	      <entry>a<subscript>2</subscript></entry> +	      <entry>a<subscript>1</subscript></entry> +	      <entry>a<subscript>0</subscript></entry> +	      <entry>h<subscript>7</subscript></entry> +	      <entry>h<subscript>6</subscript></entry> +	      <entry>h<subscript>5</subscript></entry> +	      <entry>h<subscript>4</subscript></entry> +	      <entry>h<subscript>3</subscript></entry> +	      <entry>h<subscript>2</subscript></entry> +	      <entry>h<subscript>1</subscript></entry> +	      <entry>h<subscript>0</subscript></entry> +	      <entry>s<subscript>7</subscript></entry> +	      <entry>s<subscript>6</subscript></entry> +	      <entry>s<subscript>5</subscript></entry> +	      <entry>s<subscript>4</subscript></entry> +	      <entry>s<subscript>3</subscript></entry> +	      <entry>s<subscript>2</subscript></entry> +	      <entry>s<subscript>1</subscript></entry> +	      <entry>s<subscript>0</subscript></entry> +	      <entry>v<subscript>7</subscript></entry> +	      <entry>v<subscript>6</subscript></entry> +	      <entry>v<subscript>5</subscript></entry> +	      <entry>v<subscript>4</subscript></entry> +	      <entry>v<subscript>3</subscript></entry> +	      <entry>v<subscript>2</subscript></entry> +	      <entry>v<subscript>1</subscript></entry> +	      <entry>v<subscript>0</subscript></entry> +	    </row>  	  </tbody>  	</tgroup>        </table> diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 8469fe13945..b445161b912 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -70,7 +70,7 @@ MPEG stream embedded, sliced VBI data format in this specification.  Remote Controller chapter.</contrib>  	<affiliation>  	  <address> -	    <email>mchehab@redhat.com</email> +	    <email>m.chehab@samsung.com</email>  	  </address>  	</affiliation>        </author> @@ -107,6 +107,16 @@ Remote Controller chapter.</contrib>  	  </address>  	</affiliation>        </author> +      <author> +	<firstname>Antti</firstname> +	<surname>Palosaari</surname> +	<contrib>SDR API.</contrib> +	<affiliation> +	  <address> +	    <email>crope@iki.fi</email> +	  </address> +	</affiliation> +      </author>      </authorgroup>      <copyright> @@ -125,6 +135,7 @@ Remote Controller chapter.</contrib>        <year>2011</year>        <year>2012</year>        <year>2013</year> +      <year>2014</year>        <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin  Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab,  	Pawel Osciak</holder> @@ -141,6 +152,24 @@ structs, ioctls) must be noted in more detail in the history chapter  applications. -->        <revision> +	<revnumber>3.15</revnumber> +	<date>2014-02-03</date> +	<authorinitials>hv, ap</authorinitials> +	<revremark>Update several sections of "Common API Elements": "Opening and Closing Devices" +"Querying Capabilities", "Application Priority", "Video Inputs and Outputs", "Audio Inputs and Outputs" +"Tuners and Modulators", "Video Standards" and "Digital Video (DV) Timings". Added SDR API. +	</revremark> +      </revision> + +      <revision> +	<revnumber>3.14</revnumber> +	<date>2013-11-25</date> +	<authorinitials>rr</authorinitials> +	<revremark>Set width and height as unsigned on v4l2_rect. +	</revremark> +      </revision> + +      <revision>  	<revnumber>3.11</revnumber>  	<date>2013-05-26</date>  	<authorinitials>hv</authorinitials> @@ -501,7 +530,7 @@ and discussions on the V4L mailing list.</revremark>  </partinfo>  <title>Video for Linux Two API Specification</title> - <subtitle>Revision 3.11</subtitle> + <subtitle>Revision 3.14</subtitle>    <chapter id="common">      &sub-common; @@ -529,6 +558,7 @@ and discussions on the V4L mailing list.</revremark>      <section id="ttx"> &sub-dev-teletext; </section>      <section id="radio"> &sub-dev-radio; </section>      <section id="rds"> &sub-dev-rds; </section> +    <section id="sdr"> &sub-dev-sdr; </section>      <section id="event"> &sub-dev-event; </section>      <section id="subdev"> &sub-dev-subdev; </section>    </chapter> @@ -577,6 +607,7 @@ and discussions on the V4L mailing list.</revremark>      &sub-g-crop;      &sub-g-ctrl;      &sub-g-dv-timings; +    &sub-g-edid;      &sub-g-enc-index;      &sub-g-ext-ctrls;      &sub-g-fbuf; @@ -608,7 +639,6 @@ and discussions on the V4L mailing list.</revremark>      &sub-subdev-enum-frame-size;      &sub-subdev-enum-mbus-code;      &sub-subdev-g-crop; -    &sub-subdev-g-edid;      &sub-subdev-g-fmt;      &sub-subdev-g-frame-interval;      &sub-subdev-g-selection; diff --git a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml index bf7cc979fdf..1f5ed64cd75 100644 --- a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml @@ -133,18 +133,14 @@ rectangle, in pixels.</entry>  rectangle, in pixels.</entry>  	  </row>  	  <row> -	    <entry>__s32</entry> +	    <entry>__u32</entry>  	    <entry><structfield>width</structfield></entry>  	    <entry>Width of the rectangle, in pixels.</entry>  	  </row>  	  <row> -	    <entry>__s32</entry> +	    <entry>__u32</entry>  	    <entry><structfield>height</structfield></entry> -	    <entry>Height of the rectangle, in pixels. Width -and height cannot be negative, the fields are signed for -hysterical reasons. <!-- video4linux-list@redhat.com -on 22 Oct 2002 subject "Re:[V4L][patches!] Re:v4l2/kernel-2.5" --> -</entry> +	    <entry>Height of the rectangle, in pixels.</entry>  	  </row>  	</tbody>        </tgroup> diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml index 89891adb928..820f86e8744 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml @@ -242,6 +242,22 @@        </tgroup>      </table> +    <table frame="none" pgwide="1" id="v4l2-event-src-change"> +      <title>struct <structname>v4l2_event_src_change</structname></title> +      <tgroup cols="3"> +	&cs-str; +	<tbody valign="top"> +	  <row> +	    <entry>__u32</entry> +	    <entry><structfield>changes</structfield></entry> +	    <entry> +	      A bitmask that tells what has changed. See <xref linkend="src-changes-flags" />. +	    </entry> +	  </row> +	</tbody> +      </tgroup> +    </table> +      <table pgwide="1" frame="none" id="changes-flags">        <title>Changes</title>        <tgroup cols="3"> @@ -270,6 +286,23 @@  	</tbody>        </tgroup>      </table> + +    <table pgwide="1" frame="none" id="src-changes-flags"> +      <title>Source Changes</title> +      <tgroup cols="3"> +	&cs-def; +	<tbody valign="top"> +	  <row> +	    <entry><constant>V4L2_EVENT_SRC_CH_RESOLUTION</constant></entry> +	    <entry>0x0001</entry> +	    <entry>This event gets triggered when a resolution change is +	    detected at an input. This can come from an input connector or +	    from a video decoder. +	    </entry> +	  </row> +	</tbody> +      </tgroup> +    </table>    </refsect1>    <refsect1>      &return-value; diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml index cd7720d404e..28a8c1e1c70 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml @@ -1,11 +1,12 @@  <refentry id="vidioc-dv-timings-cap">    <refmeta> -    <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP</refentrytitle> +    <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</refentrytitle>      &manvol;    </refmeta>    <refnamediv>      <refname>VIDIOC_DV_TIMINGS_CAP</refname> +    <refname>VIDIOC_SUBDEV_DV_TIMINGS_CAP</refname>      <refpurpose>The capabilities of the Digital Video receiver/transmitter</refpurpose>    </refnamediv> @@ -33,7 +34,7 @@        <varlistentry>  	<term><parameter>request</parameter></term>  	<listitem> -	  <para>VIDIOC_DV_TIMINGS_CAP</para> +	  <para>VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</para>  	</listitem>        </varlistentry>        <varlistentry> @@ -54,10 +55,19 @@        interface and may change in the future.</para>      </note> -    <para>To query the capabilities of the DV receiver/transmitter applications can call -this ioctl and the driver will fill in the structure. Note that drivers may return +    <para>To query the capabilities of the DV receiver/transmitter applications +can call the <constant>VIDIOC_DV_TIMINGS_CAP</constant> ioctl on a video node +and the driver will fill in the structure. Note that drivers may return  different values after switching the video input or output.</para> +    <para>When implemented by the driver DV capabilities of subdevices can be +queried by calling the <constant>VIDIOC_SUBDEV_DV_TIMINGS_CAP</constant> ioctl +directly on a subdevice node. The capabilities are specific to inputs (for DV +receivers) or outputs (for DV transmitters), applications must specify the +desired pad number in the &v4l2-dv-timings-cap; <structfield>pad</structfield> +field. Attempts to query capabilities on a pad that doesn't support them will +return an &EINVAL;.</para> +      <table pgwide="1" frame="none" id="v4l2-bt-timings-cap">        <title>struct <structname>v4l2_bt_timings_cap</structname></title>        <tgroup cols="3"> @@ -127,7 +137,14 @@ different values after switching the video input or output.</para>  	  </row>  	  <row>  	    <entry>__u32</entry> -	    <entry><structfield>reserved</structfield>[3]</entry> +	    <entry><structfield>pad</structfield></entry> +	    <entry>Pad number as reported by the media controller API. This field +	    is only used when operating on a subdevice node. When operating on a +	    video node applications must set this field to zero.</entry> +	  </row> +	  <row> +	    <entry>__u32</entry> +	    <entry><structfield>reserved</structfield>[2]</entry>  	    <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>  	  </row>  	  <row> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml index b3e17c1dfaf..b9fdfeacdbc 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml @@ -1,11 +1,12 @@  <refentry id="vidioc-enum-dv-timings">    <refmeta> -    <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS</refentrytitle> +    <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refentrytitle>      &manvol;    </refmeta>    <refnamediv>      <refname>VIDIOC_ENUM_DV_TIMINGS</refname> +    <refname>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refname>      <refpurpose>Enumerate supported Digital Video timings</refpurpose>    </refnamediv> @@ -33,7 +34,7 @@        <varlistentry>  	<term><parameter>request</parameter></term>  	<listitem> -	  <para>VIDIOC_ENUM_DV_TIMINGS</para> +	  <para>VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</para>  	</listitem>        </varlistentry>        <varlistentry> @@ -61,14 +62,21 @@ standards or even custom timings that are not in this list.</para>      <para>To query the available timings, applications initialize the  <structfield>index</structfield> field and zero the reserved array of &v4l2-enum-dv-timings; -and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an +and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl on a video node with a +pointer to this structure. Drivers fill the rest of the structure or return an  &EINVAL; when the index is out of bounds. To enumerate all supported DV timings,  applications shall begin at index zero, incrementing by one until the  driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a  different set of DV timings after switching the video input or  output.</para> +    <para>When implemented by the driver DV timings of subdevices can be queried +by calling the <constant>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</constant> ioctl directly +on a subdevice node. The DV timings are specific to inputs (for DV receivers) or +outputs (for DV transmitters), applications must specify the desired pad number +in the &v4l2-enum-dv-timings; <structfield>pad</structfield> field. Attempts to +enumerate timings on a pad that doesn't support them will return an &EINVAL;.</para> +      <table pgwide="1" frame="none" id="v4l2-enum-dv-timings">        <title>struct <structname>v4l2_enum_dv_timings</structname></title>        <tgroup cols="3"> @@ -82,8 +90,16 @@ application.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> -	    <entry><structfield>reserved</structfield>[3]</entry> -	    <entry>Reserved for future extensions. Drivers must set the array to zero.</entry> +	    <entry><structfield>pad</structfield></entry> +	    <entry>Pad number as reported by the media controller API. This field +	    is only used when operating on a subdevice node. When operating on a +	    video node applications must set this field to zero.</entry> +	  </row> +	  <row> +	    <entry>__u32</entry> +	    <entry><structfield>reserved</structfield>[2]</entry> +	    <entry>Reserved for future extensions. Drivers and applications must +	    set the array to zero.</entry>  	  </row>  	  <row>  	    <entry>&v4l2-dv-timings;</entry> @@ -103,7 +119,7 @@ application.</entry>  	<term><errorcode>EINVAL</errorcode></term>  	<listitem>  	  <para>The &v4l2-enum-dv-timings; <structfield>index</structfield> -is out of bounds.</para> +is out of bounds or the <structfield>pad</structfield> number is invalid.</para>  	</listitem>        </varlistentry>        <varlistentry> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml index 6541ba0175e..4e8ea65f728 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml @@ -100,7 +100,7 @@ See <xref linkend="v4l2-tuner-type" /></entry>  	    <entry><structfield>capability</structfield></entry>  	    <entry spanname="hspan">The tuner/modulator capability flags for  this frequency band, see <xref linkend="tuner-capability" />. The <constant>V4L2_TUNER_CAP_LOW</constant> -capability must be the same for all frequency bands of the selected tuner/modulator. +or <constant>V4L2_TUNER_CAP_1HZ</constant> capability must be the same for all frequency bands of the selected tuner/modulator.  So either all bands have that capability set, or none of them have that capability.</entry>  	  </row>  	  <row> @@ -109,7 +109,8 @@ So either all bands have that capability set, or none of them have that capabili  	    <entry spanname="hspan">The lowest tunable frequency in  units of 62.5 kHz, or if the <structfield>capability</structfield>  flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. A 1 Hz unit is used when the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> @@ -117,7 +118,8 @@ Hz, for this frequency band.</entry>  	    <entry spanname="hspan">The highest tunable frequency in  units of 62.5 kHz, or if the <structfield>capability</structfield>  flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. A 1 Hz unit is used when the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml index e287c8fc803..4165e7bfa4f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml +++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml @@ -73,7 +73,8 @@ range from zero to the maximal number of valid planes for the currently active  format. For the single-planar API, applications must set <structfield> plane  </structfield> to zero.  Additional flags may be posted in the <structfield>  flags </structfield> field.  Refer to a manual for open() for details. -Currently only O_CLOEXEC is supported.  All other fields must be set to zero. +Currently only O_CLOEXEC, O_RDONLY, O_WRONLY, and O_RDWR are supported.  All +other fields must be set to zero.  In the case of multi-planar API, every plane is exported separately using  multiple <constant> VIDIOC_EXPBUF </constant> calls. </para> @@ -170,8 +171,9 @@ multi-planar API. Otherwise this value must be set to zero. </entry>  	    <entry>__u32</entry>  	    <entry><structfield>flags</structfield></entry>  	    <entry>Flags for the newly created file, currently only <constant> -O_CLOEXEC </constant> is supported, refer to the manual of open() for more -details.</entry> +O_CLOEXEC </constant>, <constant>O_RDONLY</constant>, <constant>O_WRONLY +</constant>, and <constant>O_RDWR</constant> are supported, refer to the manual +of open() for more details.</entry>  	  </row>  	  <row>  	    <entry>__s32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-edid.xml b/Documentation/DocBook/media/v4l/vidioc-g-edid.xml index bbd18f0e6ed..ce4563b8713 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-edid.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-edid.xml @@ -1,12 +1,12 @@ -<refentry id="vidioc-subdev-g-edid"> +<refentry id="vidioc-g-edid">    <refmeta> -    <refentrytitle>ioctl VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID</refentrytitle> +    <refentrytitle>ioctl VIDIOC_G_EDID, VIDIOC_S_EDID</refentrytitle>      &manvol;    </refmeta>    <refnamediv> -    <refname>VIDIOC_SUBDEV_G_EDID</refname> -    <refname>VIDIOC_SUBDEV_S_EDID</refname> +    <refname>VIDIOC_G_EDID</refname> +    <refname>VIDIOC_S_EDID</refname>      <refpurpose>Get or set the EDID of a video receiver/transmitter</refpurpose>    </refnamediv> @@ -16,7 +16,7 @@  	<funcdef>int <function>ioctl</function></funcdef>  	<paramdef>int <parameter>fd</parameter></paramdef>  	<paramdef>int <parameter>request</parameter></paramdef> -	<paramdef>struct v4l2_subdev_edid *<parameter>argp</parameter></paramdef> +	<paramdef>struct v4l2_edid *<parameter>argp</parameter></paramdef>        </funcprototype>      </funcsynopsis>      <funcsynopsis> @@ -24,7 +24,7 @@  	<funcdef>int <function>ioctl</function></funcdef>  	<paramdef>int <parameter>fd</parameter></paramdef>  	<paramdef>int <parameter>request</parameter></paramdef> -	<paramdef>const struct v4l2_subdev_edid *<parameter>argp</parameter></paramdef> +	<paramdef>const struct v4l2_edid *<parameter>argp</parameter></paramdef>        </funcprototype>      </funcsynopsis>    </refsynopsisdiv> @@ -42,7 +42,7 @@        <varlistentry>  	<term><parameter>request</parameter></term>  	<listitem> -	  <para>VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID</para> +	  <para>VIDIOC_G_EDID, VIDIOC_S_EDID</para>  	</listitem>        </varlistentry>        <varlistentry> @@ -56,12 +56,20 @@    <refsect1>      <title>Description</title> -    <para>These ioctls can be used to get or set an EDID associated with an input pad -    from a receiver or an output pad of a transmitter subdevice.</para> +    <para>These ioctls can be used to get or set an EDID associated with an input +    from a receiver or an output of a transmitter device. They can be +    used with subdevice nodes (/dev/v4l-subdevX) or with video nodes (/dev/videoX).</para> + +    <para>When used with video nodes the <structfield>pad</structfield> field represents the +    input (for video capture devices) or output (for video output devices) index as +    is returned by &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; respectively. When used +    with subdevice nodes the <structfield>pad</structfield> field represents the +    input or output pad of the subdevice. If there is no EDID support for the given +    <structfield>pad</structfield> value, then the &EINVAL; will be returned.</para>      <para>To get the EDID data the application has to fill in the <structfield>pad</structfield>,      <structfield>start_block</structfield>, <structfield>blocks</structfield> and <structfield>edid</structfield> -    fields and call <constant>VIDIOC_SUBDEV_G_EDID</constant>. The current EDID from block +    fields and call <constant>VIDIOC_G_EDID</constant>. The current EDID from block      <structfield>start_block</structfield> and of size <structfield>blocks</structfield>      will be placed in the memory <structfield>edid</structfield> points to. The <structfield>edid</structfield>      pointer must point to memory at least <structfield>blocks</structfield> * 128 bytes @@ -91,15 +99,17 @@      data in some way. In any case, the end result is the same: the EDID is no longer available.      </para> -    <table pgwide="1" frame="none" id="v4l2-subdev-edid"> -      <title>struct <structname>v4l2_subdev_edid</structname></title> +    <table pgwide="1" frame="none" id="v4l2-edid"> +      <title>struct <structname>v4l2_edid</structname></title>        <tgroup cols="3">          &cs-str;  	<tbody valign="top">  	  <row>  	    <entry>__u32</entry>  	    <entry><structfield>pad</structfield></entry> -	    <entry>Pad for which to get/set the EDID blocks.</entry> +	    <entry>Pad for which to get/set the EDID blocks. When used with a video device +	    node the pad represents the input or output index as returned by +	    &VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; respectively.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index b3bb9575b2e..e9f6735c082 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -327,7 +327,12 @@ These controls are described in <xref  These controls are described in <xref  		linkend="fm-rx-controls" />.</entry>  	  </row> - +	  <row> +	    <entry><constant>V4L2_CTRL_CLASS_RF_TUNER</constant></entry> +	    <entry>0xa20000</entry> +	    <entry>The class containing RF tuner controls. +These controls are described in <xref linkend="rf-tuner-controls" />.</entry> +	  </row>  	</tbody>        </tgroup>      </table> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml index ee8f56e1bac..4fe19a7a9a3 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml @@ -172,6 +172,13 @@ capture and output devices.</entry>  	  </row>  	  <row>  	    <entry></entry> +	    <entry>&v4l2-sdr-format;</entry> +	    <entry><structfield>sdr</structfield></entry> +	    <entry>Definition of a data format, see +<xref linkend="pixfmt" />, used by SDR capture devices.</entry> +	  </row> +	  <row> +	    <entry></entry>  	    <entry>__u8</entry>  	    <entry><structfield>raw_data</structfield>[200]</entry>  	    <entry>Place holder for future extensions.</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml index c7a1c462e72..d1034fb61d1 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml @@ -109,9 +109,10 @@ See <xref linkend="v4l2-tuner-type" /></entry>  	    <entry>__u32</entry>  	    <entry><structfield>frequency</structfield></entry>  	    <entry>Tuning frequency in units of 62.5 kHz, or if the -&v4l2-tuner; or &v4l2-modulator; <structfield>capabilities</structfield> flag +&v4l2-tuner; or &v4l2-modulator; <structfield>capability</structfield> flag  <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz. A 1 Hz unit is used when the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml index 7f4ac7e41fa..7068b599a00 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml @@ -113,7 +113,8 @@ change for example with the current video standard.</entry>  	    <entry>The lowest tunable frequency in units of 62.5  KHz, or if the <structfield>capability</structfield> flag  <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> @@ -121,7 +122,8 @@ Hz.</entry>  	    <entry>The highest tunable frequency in units of 62.5  KHz, or if the <structfield>capability</structfield> flag  <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry>  	  </row>  	  <row>  	    <entry>__u32</entry> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml index 6cc82010c73..b0d865933da 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml @@ -134,7 +134,9 @@ the structure refers to a radio tuner the  	    <entry spanname="hspan">The lowest tunable frequency in  units of 62.5 kHz, or if the <structfield>capability</structfield>  flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then  <structfield>rangelow</structfield> is the lowest frequency  of all the frequency bands.</entry>  	  </row> @@ -144,7 +146,9 @@ of all the frequency bands.</entry>  	    <entry spanname="hspan">The highest tunable frequency in  units of 62.5 kHz, or if the <structfield>capability</structfield>  flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then  <structfield>rangehigh</structfield> is the highest frequency  of all the frequency bands.</entry>  	  </row> @@ -270,7 +274,7 @@ applications must set the array to zero.</entry>  	    <entry><constant>V4L2_TUNER_CAP_LOW</constant></entry>  	    <entry>0x0001</entry>  	    <entry>When set, tuning frequencies are expressed in units of -62.5 Hz, otherwise in units of 62.5 kHz.</entry> +62.5 Hz instead of 62.5 kHz.</entry>  	  </row>  	  <row>  	    <entry><constant>V4L2_TUNER_CAP_NORM</constant></entry> @@ -360,6 +364,11 @@ radio tuners.</entry>  	<entry>The range to search when using the hardware seek functionality  	is programmable, see &VIDIOC-S-HW-FREQ-SEEK; for details.</entry>  	  </row> +	  <row> +	<entry><constant>V4L2_TUNER_CAP_1HZ</constant></entry> +	<entry>0x1000</entry> +	<entry>When set, tuning frequencies are expressed in units of 1 Hz instead of 62.5 kHz.</entry> +	  </row>  	</tbody>        </tgroup>      </table> diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index d5a3c97b206..370d49d6fb6 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -296,6 +296,12 @@ modulator programming see  <xref linkend="tuner" />.</entry>  	  </row>  	  <row> +	    <entry><constant>V4L2_CAP_SDR_CAPTURE</constant></entry> +	    <entry>0x00100000</entry> +	    <entry>The device supports the +<link linkend="sdr">SDR Capture</link> interface.</entry> +	  </row> +	  <row>  	    <entry><constant>V4L2_CAP_READWRITE</constant></entry>  	    <entry>0x01000000</entry>  	    <entry>The device supports the <link diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml index 5b379e75219..a5fc4c4880f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml @@ -121,7 +121,9 @@ field and the &v4l2-tuner; <structfield>index</structfield> field.</entry>  	    <entry>If non-zero, the lowest tunable frequency of the band to  search in units of 62.5 kHz, or if the &v4l2-tuner;  <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz.  If <structfield>rangelow</structfield> is zero a reasonable default value  is used.</entry>  	  </row> @@ -131,7 +133,9 @@ is used.</entry>  	    <entry>If non-zero, the highest tunable frequency of the band to  search in units of 62.5 kHz, or if the &v4l2-tuner;  <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz.  If <structfield>rangehigh</structfield> is zero a reasonable default value  is used.</entry>  	  </row> diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml b/Documentation/DocBook/media/v4l/vidioc-streamon.xml index 716ea15e54a..df2c63d07ba 100644 --- a/Documentation/DocBook/media/v4l/vidioc-streamon.xml +++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml @@ -52,16 +52,24 @@      <para>The <constant>VIDIOC_STREAMON</constant> and  <constant>VIDIOC_STREAMOFF</constant> ioctl start and stop the capture  or output process during streaming (<link linkend="mmap">memory -mapping</link> or <link linkend="userp">user pointer</link>) I/O.</para> +mapping</link>, <link linkend="userp">user pointer</link> or +<link linkend="dmabuf">DMABUF</link>) I/O.</para> -    <para>Specifically the capture hardware is disabled and no input +    <para>Capture hardware is disabled and no input  buffers are filled (if there are any empty buffers in the incoming  queue) until <constant>VIDIOC_STREAMON</constant> has been called. -Accordingly the output hardware is disabled, no video signal is +Output hardware is disabled and no video signal is  produced until <constant>VIDIOC_STREAMON</constant> has been called. -The ioctl will succeed only when at least one output buffer is in the +The ioctl will succeed when at least one output buffer is in the  incoming queue.</para> +    <para>Memory-to-memory devices will not start until +<constant>VIDIOC_STREAMON</constant> has been called for both the capture +and output stream types.</para> + +    <para>If <constant>VIDIOC_STREAMON</constant> fails then any already +queued buffers will remain queued.</para> +      <para>The <constant>VIDIOC_STREAMOFF</constant> ioctl, apart of  aborting or finishing any DMA in progress, unlocks any user pointer  buffers locked in physical memory, and it removes all buffers from the @@ -70,14 +78,22 @@ dequeued yet will be lost, likewise all images enqueued for output but  not transmitted yet. I/O returns to the same state as after calling  &VIDIOC-REQBUFS; and can be restarted accordingly.</para> +    <para>If buffers have been queued with &VIDIOC-QBUF; and +<constant>VIDIOC_STREAMOFF</constant> is called without ever having +called <constant>VIDIOC_STREAMON</constant>, then those queued buffers +will also be removed from the incoming queue and all are returned to the +same state as after calling &VIDIOC-REQBUFS; and can be restarted +accordingly.</para> +      <para>Both ioctls take a pointer to an integer, the desired buffer or  stream type. This is the same as &v4l2-requestbuffers;  <structfield>type</structfield>.</para>      <para>If <constant>VIDIOC_STREAMON</constant> is called when streaming  is already in progress, or if <constant>VIDIOC_STREAMOFF</constant> is called -when streaming is already stopped, then the ioctl does nothing and 0 is -returned.</para> +when streaming is already stopped, then 0 is returned. Nothing happens in the +case of <constant>VIDIOC_STREAMON</constant>, but <constant>VIDIOC_STREAMOFF</constant> +will return queued buffers to their starting state as mentioned above.</para>      <para>Note that applications can be preempted for unknown periods right  before or after the <constant>VIDIOC_STREAMON</constant> or @@ -93,7 +109,7 @@ synchronize with other events.</para>        <varlistentry>  	<term><errorcode>EINVAL</errorcode></term>  	<listitem> -	  <para>The buffer<structfield>type</structfield> is not supported, +	  <para>The buffer <structfield>type</structfield> is not supported,  	  or no buffers have been allocated (memory mapping) or enqueued  	  (output) yet.</para>  	</listitem> diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml index 5c70b616d81..17efa870d4d 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml @@ -155,6 +155,26 @@  	    </entry>  	  </row>  	  <row> +	    <entry><constant>V4L2_EVENT_SOURCE_CHANGE</constant></entry> +	    <entry>5</entry> +	    <entry> +	      <para>This event is triggered when a source parameter change is +	       detected during runtime by the video device. It can be a +	       runtime resolution change triggered by a video decoder or the +	       format change happening on an input connector. +	       This event requires that the <structfield>id</structfield> +	       matches the input index (when used with a video device node) +	       or the pad index (when used with a subdevice node) from which +	       you want to receive events.</para> + +              <para>This event has a &v4l2-event-src-change; associated +	      with it. The <structfield>changes</structfield> bitfield denotes +	      what has changed for the subscribed pad. If multiple events +	      occurred before application could dequeue them, then the changes +	      will have the ORed value of all the events generated.</para> +	    </entry> +	  </row> +	  <row>  	    <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>  	    <entry>0x08000000</entry>  	    <entry>Base event number for driver-private events.</entry> diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index 4c8d282545a..03f9a1f8d41 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl @@ -34,22 +34,20 @@  <book id="media_api">  <bookinfo> -<title>LINUX MEDIA INFRASTRUCTURE API</title> - -<copyright> -	<year>2009-2012</year> -	<holder>LinuxTV Developers</holder> -</copyright> - -<legalnotice> - -<para>Permission is granted to copy, distribute and/or modify -this document under the terms of the GNU Free Documentation License, -Version 1.1 or any later version published by the Free Software -Foundation. A copy of the license is included in the chapter entitled -"GNU Free Documentation License"</para> -</legalnotice> - +	<title>LINUX MEDIA INFRASTRUCTURE API</title> + +	<copyright> +		<year>2009-2014</year> +		<holder>LinuxTV Developers</holder> +	</copyright> + +	<legalnotice> +		<para>Permission is granted to copy, distribute and/or modify +		this document under the terms of the GNU Free Documentation License, +		Version 1.1 or any later version published by the Free Software +		Foundation. A copy of the license is included in the chapter entitled +		"GNU Free Documentation License"</para> +	</legalnotice>  </bookinfo>  <toc></toc> <!-- autogenerated --> @@ -58,72 +56,32 @@ Foundation. A copy of the license is included in the chapter entitled  	<title>Introduction</title>  	<para>This document covers the Linux Kernel to Userspace API's used by -		video and radio straming devices, including video cameras, +		video and radio streaming devices, including video cameras,  		analog and digital TV receiver cards, AM/FM receiver cards, -		streaming capture devices.</para> +		streaming capture and output devices, codec devices and remote +		controllers.</para>  	<para>It is divided into four parts.</para> -	<para>The first part covers radio, capture, -		cameras and analog TV devices.</para> +	<para>The first part covers radio, video capture and output, +		cameras, analog TV devices and codecs.</para>  	<para>The second part covers the  		API used for digital TV and Internet reception via one of the  		several digital tv standards. While it is called as DVB API,  		in fact it covers several different video standards including  		DVB-T, DVB-S, DVB-C and ATSC. The API is currently being updated -		to documment support also for DVB-S2, ISDB-T and ISDB-S.</para> +		to document support also for DVB-S2, ISDB-T and ISDB-S.</para>  	<para>The third part covers the Remote Controller API.</para>  	<para>The fourth part covers the Media Controller API.</para>  	<para>For additional information and for the latest development code,  		see: <ulink url="http://linuxtv.org">http://linuxtv.org</ulink>.</para>  	<para>For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: <ulink url="http://vger.kernel.org/vger-lists.html#linux-media">Linux Media Mailing List (LMML).</ulink>.</para> -  </preface> -<part id="v4l2spec"> -&sub-v4l2; -</part> -<part id="dvbapi"> -&sub-dvbapi; -</part> -<part id="v4ldvb_common"> -<partinfo> -<authorgroup> -<author> -<firstname>Mauro</firstname> -<surname>Chehab</surname> -<othername role="mi">Carvalho</othername> -<affiliation><address><email>mchehab@redhat.com</email></address></affiliation> -<contrib>Initial version.</contrib> -</author> -</authorgroup> -<copyright> -	<year>2009-2012</year> -	<holder>Mauro Carvalho Chehab</holder> -</copyright> - -<revhistory> -<!-- Put document revisions here, newest first. --> -<revision> -<revnumber>1.0.0</revnumber> -<date>2009-09-06</date> -<authorinitials>mcc</authorinitials> -<revremark>Initial revision</revremark> -</revision> -</revhistory> -</partinfo> - -<title>Remote Controller API</title> -<chapter id="remote_controllers"> -&sub-remote_controllers; -</chapter> -</part> -<part id="media_common"> -&sub-media-controller; -</part> - -<chapter id="gen_errors"> -&sub-gen-errors; -</chapter> +<part id="v4l2spec">&sub-v4l2;</part> +<part id="dvbapi">&sub-dvbapi;</part> +<part id="remotes">&sub-remote_controllers;</part> +<part id="media_common">&sub-media-controller;</part> +<chapter id="gen_errors">&sub-gen-errors;</chapter>  &sub-fdl-appendix; diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index a248f42a121..7da8f0402af 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl @@ -91,7 +91,7 @@  		<listitem><para>  	  	[MTD Interface]</para><para>  		These functions provide the interface to the MTD kernel API.  -		They are not replacable and provide functionality +		They are not replaceable and provide functionality  		which is complete hardware independent.  		</para></listitem>  		<listitem><para> @@ -100,14 +100,14 @@  		</para></listitem>  		<listitem><para>  	  	[GENERIC]</para><para> -		Generic functions are not replacable and provide functionality +		Generic functions are not replaceable and provide functionality  		which is complete hardware independent.  		</para></listitem>  		<listitem><para>  	  	[DEFAULT]</para><para>  		Default functions provide hardware related functionality which is suitable  		for most of the implementations. These functions can be replaced by the -		board driver if neccecary. Those functions are called via pointers in the +		board driver if necessary. Those functions are called via pointers in the  		NAND chip description structure. The board driver can set the functions which  		should be replaced by board dependent functions before calling nand_scan().  		If the function pointer is NULL on entry to nand_scan() then the pointer @@ -264,7 +264,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd)  			is set up nand_scan() is called. This function tries to  			detect and identify then chip. If a chip is found all the  			internal data fields are initialized accordingly. -			The structure(s) have to be zeroed out first and then filled with the neccecary  +			The structure(s) have to be zeroed out first and then filled with the necessary  			information about the device.  		</para>  		<programlisting> @@ -327,7 +327,7 @@ module_init(board_init);  	<sect1 id="Exit_function">  		<title>Exit function</title>  		<para> -			The exit function is only neccecary if the driver is +			The exit function is only necessary if the driver is  			compiled as a module. It releases all resources which  			are held by the chip driver and unregisters the partitions  			in the MTD layer. @@ -494,7 +494,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  				in this case. See rts_from4.c and diskonchip.c for   				implementation reference. In those cases we must also  				use bad block tables on FLASH, because the ECC layout is -				interferring with the bad block marker positions. +				interfering with the bad block marker positions.  				See bad block table support for details.  			</para>  		</sect2> @@ -542,7 +542,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  		<para>	  			nand_scan() calls the function nand_default_bbt().   			nand_default_bbt() selects appropriate default -			bad block table desriptors depending on the chip information +			bad block table descriptors depending on the chip information  			which was retrieved by nand_scan().  		</para>  		<para> @@ -554,7 +554,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  		<sect2 id="Flash_based_tables">  			<title>Flash based tables</title>  			<para> -				It may be desired or neccecary to keep a bad block table in FLASH.  +				It may be desired or necessary to keep a bad block table in FLASH.  				For AG-AND chips this is mandatory, as they have no factory marked  				bad blocks. They have factory marked good blocks. The marker pattern  				is erased when the block is erased to be reused. So in case of @@ -565,10 +565,10 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  				of the blocks.  			</para>  			<para> -				The blocks in which the tables are stored are procteted against +				The blocks in which the tables are stored are protected against  				accidental access by marking them bad in the memory bad block  				table. The bad block table management functions are allowed -				to circumvernt this protection. +				to circumvent this protection.  			</para>  			<para>  				The simplest way to activate the FLASH based bad block table support  @@ -592,7 +592,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  				User defined tables are created by filling out a   				nand_bbt_descr structure and storing the pointer in the  				nand_chip structure member bbt_td before calling nand_scan().  -				If a mirror table is neccecary a second structure must be +				If a mirror table is necessary a second structure must be  				created and a pointer to this structure must be stored  				in bbt_md inside the nand_chip structure. If the bbt_md   				member is set to NULL then only the main table is used @@ -666,7 +666,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)  				<para>  				For automatic placement some blocks must be reserved for  				bad block table storage. The number of reserved blocks is defined  -				in the maxblocks member of the babd block table description structure. +				in the maxblocks member of the bad block table description structure.  				Reserving 4 blocks for mirrored tables should be a reasonable number.   				This also limits the number of blocks which are scanned for the bad  				block table ident pattern. @@ -1068,11 +1068,11 @@ in this page</entry>    <chapter id="filesystems">       	<title>Filesystem support</title>  	<para> -		The NAND driver provides all neccecary functions for a +		The NAND driver provides all necessary functions for a  		filesystem via the MTD interface.  	</para>  	<para> -		Filesystems must be aware of the NAND pecularities and +		Filesystems must be aware of the NAND peculiarities and  		restrictions. One major restrictions of NAND Flash is, that you cannot   		write as often as you want to a page. The consecutive writes to a page,   		before erasing it again, are restricted to 1-3 writes, depending on the  @@ -1222,9 +1222,7 @@ in this page</entry>  #define NAND_BBT_VERSION	0x00000100  /* Create a bbt if none axists */  #define NAND_BBT_CREATE		0x00000200 -/* Search good / bad pattern through all pages of a block */ -#define NAND_BBT_SCANALLPAGES	0x00000400 -/* Write bbt if neccecary */ +/* Write bbt if necessary */  #define NAND_BBT_WRITE		0x00001000  /* Read and write back block contents when writing bbt */  #define NAND_BBT_SAVECONTENT	0x00002000 diff --git a/Documentation/DocBook/regulator.tmpl b/Documentation/DocBook/regulator.tmpl index 346e552fa2c..3b08a085d2c 100644 --- a/Documentation/DocBook/regulator.tmpl +++ b/Documentation/DocBook/regulator.tmpl @@ -155,7 +155,7 @@         release regulators.  Functions are         provided to <link linkend='API-regulator-enable'>enable</link>         and <link linkend='API-regulator-disable'>disable</link> the -       reguator and to get and set the runtime parameters of the +       regulator and to get and set the runtime parameters of the         regulator.       </para>       <para> diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index 95618159e29..bbe9c1fd5ce 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl @@ -766,10 +766,10 @@ framework to set up sysfs files for this region. Simply leave it alone.  	<para>  	The dynamic memory regions will be allocated when the UIO device file,  	<varname>/dev/uioX</varname> is opened. -	Simiar to static memory resources, the memory region information for +	Similar to static memory resources, the memory region information for  	dynamic regions is then visible via sysfs at  	<varname>/sys/class/uio/uioX/maps/mapY/*</varname>. -	The dynmaic memory regions will be freed when the UIO device file is +	The dynamic memory regions will be freed when the UIO device file is  	closed. When no processes are holding the device file open, the address  	returned to userspace is ~0.  	</para> diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl index 8d57c1888dc..85fc0e28576 100644 --- a/Documentation/DocBook/usb.tmpl +++ b/Documentation/DocBook/usb.tmpl @@ -153,7 +153,7 @@  	<listitem><para>The Linux USB API supports synchronous calls for  	control and bulk messages. -	It also supports asynchnous calls for all kinds of data transfer, +	It also supports asynchronous calls for all kinds of data transfer,  	using request structures called "URBs" (USB Request Blocks).  	</para></listitem> diff --git a/Documentation/DocBook/w1.tmpl b/Documentation/DocBook/w1.tmpl new file mode 100644 index 00000000000..b0228d4c81b --- /dev/null +++ b/Documentation/DocBook/w1.tmpl @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" +	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> + +<book id="w1id"> +  <bookinfo> +    <title>W1: Dallas' 1-wire bus</title> + +    <authorgroup> +      <author> +        <firstname>David</firstname> +        <surname>Fries</surname> +        <affiliation> +          <address> +            <email>David@Fries.net</email> +          </address> +        </affiliation> +      </author> + +    </authorgroup> + +    <copyright> +      <year>2013</year> +      <!-- +      <holder></holder> +      --> +    </copyright> + +    <legalnotice> +      <para> +        This documentation is free software; you can redistribute +        it and/or modify it under the terms of the GNU General Public +        License version 2. +      </para> + +      <para> +        This program is distributed in the hope that it will be +        useful, but WITHOUT ANY WARRANTY; without even the implied +        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +        For more details see the file COPYING in the source +        distribution of Linux. +      </para> +    </legalnotice> +  </bookinfo> + +  <toc></toc> + +  <chapter id="w1_internal"> +    <title>W1 API internal to the kernel</title> + +    <sect1 id="w1_internal_api"> +      <title>W1 API internal to the kernel</title> +      <sect2 id="w1.h"> +        <title>drivers/w1/w1.h</title> +        <para>W1 core functions.</para> +!Idrivers/w1/w1.h +      </sect2> + +      <sect2 id="w1.c"> +        <title>drivers/w1/w1.c</title> +        <para>W1 core functions.</para> +!Idrivers/w1/w1.c +      </sect2> + +      <sect2 id="w1_family.h"> +        <title>drivers/w1/w1_family.h</title> +        <para>Allows registering device family operations.</para> +!Idrivers/w1/w1_family.h +      </sect2> + +      <sect2 id="w1_family.c"> +        <title>drivers/w1/w1_family.c</title> +        <para>Allows registering device family operations.</para> +!Edrivers/w1/w1_family.c +      </sect2> + +      <sect2 id="w1_int.c"> +        <title>drivers/w1/w1_int.c</title> +        <para>W1 internal initialization for master devices.</para> +!Edrivers/w1/w1_int.c +      </sect2> + +      <sect2 id="w1_netlink.h"> +        <title>drivers/w1/w1_netlink.h</title> +        <para>W1 external netlink API structures and commands.</para> +!Idrivers/w1/w1_netlink.h +      </sect2> + +      <sect2 id="w1_io.c"> +        <title>drivers/w1/w1_io.c</title> +        <para>W1 input/output.</para> +!Edrivers/w1/w1_io.c +!Idrivers/w1/w1_io.c +      </sect2> + +    </sect1> + + +  </chapter> + +</book> diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 06741e92598..6f639d9530b 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -468,8 +468,6 @@                    return err;            } -          snd_card_set_dev(card, &pci->dev); -            *rchip = chip;            return 0;    } @@ -492,7 +490,8 @@            }            /* (2) */ -          err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); +          err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                             0, &card);            if (err < 0)                    return err; @@ -591,7 +590,8 @@    struct snd_card *card;    int err;    .... -  err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); +  err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                     0, &card);  ]]>              </programlisting>            </informalexample> @@ -809,28 +809,34 @@        <para>          As mentioned above, to create a card instance, call -      <function>snd_card_create()</function>. +      <function>snd_card_new()</function>.          <informalexample>            <programlisting>  <![CDATA[    struct snd_card *card;    int err; -  err = snd_card_create(index, id, module, extra_size, &card); +  err = snd_card_new(&pci->dev, index, id, module, extra_size, &card);  ]]>            </programlisting>          </informalexample>        </para>        <para> -        The function takes five arguments, the card-index number, the -        id string, the module pointer (usually +        The function takes six arguments: the parent device pointer, +        the card-index number, the id string, the module pointer (usually          <constant>THIS_MODULE</constant>),          the size of extra-data space, and the pointer to return the          card instance.  The extra_size argument is used to          allocate card->private_data for the          chip-specific data.  Note that these data -        are allocated by <function>snd_card_create()</function>. +        are allocated by <function>snd_card_new()</function>. +      </para> + +      <para> +	The first argument, the pointer of struct +	<structname>device</structname>, specifies the parent device. +	For PCI devices, typically &pci-> is passed there.        </para>      </section> @@ -916,16 +922,16 @@        </para>        <section id="card-management-chip-specific-snd-card-new"> -        <title>1. Allocating via <function>snd_card_create()</function>.</title> +        <title>1. Allocating via <function>snd_card_new()</function>.</title>          <para>            As mentioned above, you can pass the extra-data-length -	  to the 4th argument of <function>snd_card_create()</function>, i.e. +	  to the 5th argument of <function>snd_card_new()</function>, i.e.            <informalexample>              <programlisting>  <![CDATA[ -  err = snd_card_create(index[dev], id[dev], THIS_MODULE, -                        sizeof(struct mychip), &card); +  err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                     sizeof(struct mychip), &card);  ]]>              </programlisting>            </informalexample> @@ -954,7 +960,7 @@          <para>            After allocating a card instance via -          <function>snd_card_create()</function> (with +          <function>snd_card_new()</function> (with            <constant>0</constant> on the 4th arg), call            <function>kzalloc()</function>.  @@ -963,7 +969,8 @@  <![CDATA[    struct snd_card *card;    struct mychip *chip; -  err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); +  err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                     0, &card);    .....    chip = kzalloc(sizeof(*chip), GFP_KERNEL);  ]]> @@ -1170,8 +1177,6 @@                    return err;            } -          snd_card_set_dev(card, &pci->dev); -            *rchip = chip;            return 0;    }         @@ -1526,30 +1531,6 @@      </section> -    <section id="pci-resource-device-struct"> -      <title>Registration of Device Struct</title> -      <para> -	At some point, typically after calling <function>snd_device_new()</function>, -	you need to register the struct <structname>device</structname> of the chip -	you're handling for udev and co.  ALSA provides a macro for compatibility with -	older kernels.  Simply call like the following: -        <informalexample> -          <programlisting> -<![CDATA[ -  snd_card_set_dev(card, &pci->dev); -]]> -          </programlisting> -        </informalexample> -	so that it stores the PCI's device pointer to the card.  This will be -	referred by ALSA core functions later when the devices are registered. -      </para> -      <para> -	In the case of non-PCI, pass the proper device struct pointer of the BUS -	instead.  (In the case of legacy ISA without PnP, you don't have to do -	anything.) -      </para> -    </section> -      <section id="pci-resource-entries">        <title>PCI Entries</title>        <para> @@ -5715,7 +5696,7 @@ struct _snd_pcm_runtime {  	suspending the PCM operations via  	<function>snd_pcm_suspend_all()</function> or  	<function>snd_pcm_suspend()</function>.  It means that the PCM -	streams are already stoppped when the register snapshot is +	streams are already stopped when the register snapshot is  	taken.  But, remember that you don't have to restart the PCM  	stream in the resume callback. It'll be restarted via   	trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant> @@ -5740,7 +5721,8 @@ struct _snd_pcm_runtime {            struct mychip *chip;            int err;            .... -          err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); +          err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                             0, &card);            ....            chip = kzalloc(sizeof(*chip), GFP_KERNEL);            .... @@ -5752,7 +5734,7 @@ struct _snd_pcm_runtime {        </informalexample>  	When you created the chip data with -	<function>snd_card_create()</function>, it's anyway accessible +	<function>snd_card_new()</function>, it's anyway accessible  	via <structfield>private_data</structfield> field.        <informalexample> @@ -5766,8 +5748,8 @@ struct _snd_pcm_runtime {            struct mychip *chip;            int err;            .... -          err = snd_card_create(index[dev], id[dev], THIS_MODULE, -                                sizeof(struct mychip), &card); +          err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, +                             sizeof(struct mychip), &card);            ....            chip = card->private_data;            .... diff --git a/Documentation/DocBook/writing_musb_glue_layer.tmpl b/Documentation/DocBook/writing_musb_glue_layer.tmpl new file mode 100644 index 00000000000..837eca77f27 --- /dev/null +++ b/Documentation/DocBook/writing_musb_glue_layer.tmpl @@ -0,0 +1,873 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" +	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> + +<book id="Writing-MUSB-Glue-Layer"> + <bookinfo> +  <title>Writing an MUSB Glue Layer</title> + +  <authorgroup> +   <author> +    <firstname>Apelete</firstname> +    <surname>Seketeli</surname> +    <affiliation> +     <address> +      <email>apelete at seketeli.net</email> +     </address> +    </affiliation> +   </author> +  </authorgroup> + +  <copyright> +   <year>2014</year> +   <holder>Apelete Seketeli</holder> +  </copyright> + +  <legalnotice> +   <para> +     This documentation is free software; you can redistribute it +     and/or modify it under the terms of the GNU General Public +     License as published by the Free Software Foundation; either +     version 2 of the License, or (at your option) any later version. +   </para> + +   <para> +     This documentation is distributed in the hope that it will be +     useful, but WITHOUT ANY WARRANTY; without even the implied +     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +     See the GNU General Public License for more details. +   </para> + +   <para> +     You should have received a copy of the GNU General Public License +     along with this documentation; if not, write to the Free Software +     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +     02111-1307 USA +   </para> + +   <para> +     For more details see the file COPYING in the Linux kernel source +     tree. +   </para> +  </legalnotice> + </bookinfo> + +<toc></toc> + +  <chapter id="introduction"> +    <title>Introduction</title> +    <para> +      The Linux MUSB subsystem is part of the larger Linux USB +      subsystem. It provides support for embedded USB Device Controllers +      (UDC) that do not use Universal Host Controller Interface (UHCI) +      or Open Host Controller Interface (OHCI). +    </para> +    <para> +      Instead, these embedded UDC rely on the USB On-the-Go (OTG) +      specification which they implement at least partially. The silicon +      reference design used in most cases is the Multipoint USB +      Highspeed Dual-Role Controller (MUSB HDRC) found in the Mentor +      Graphics Inventra™ design. +    </para> +    <para> +      As a self-taught exercise I have written an MUSB glue layer for +      the Ingenic JZ4740 SoC, modelled after the many MUSB glue layers +      in the kernel source tree. This layer can be found at +      drivers/usb/musb/jz4740.c. In this documentation I will walk +      through the basics of the jz4740.c glue layer, explaining the +      different pieces and what needs to be done in order to write your +      own device glue layer. +    </para> +  </chapter> + +  <chapter id="linux-musb-basics"> +    <title>Linux MUSB Basics</title> +    <para> +      To get started on the topic, please read USB On-the-Go Basics (see +      Resources) which provides an introduction of USB OTG operation at +      the hardware level. A couple of wiki pages by Texas Instruments +      and Analog Devices also provide an overview of the Linux kernel +      MUSB configuration, albeit focused on some specific devices +      provided by these companies. Finally, getting acquainted with the +      USB specification at USB home page may come in handy, with +      practical instance provided through the Writing USB Device Drivers +      documentation (again, see Resources). +    </para> +    <para> +      Linux USB stack is a layered architecture in which the MUSB +      controller hardware sits at the lowest. The MUSB controller driver +      abstract the MUSB controller hardware to the Linux USB stack. +    </para> +    <programlisting> +      ------------------------ +      |                      | <------- drivers/usb/gadget +      | Linux USB Core Stack | <------- drivers/usb/host +      |                      | <------- drivers/usb/core +      ------------------------ +                 ⬍ +     -------------------------- +     |                        | <------ drivers/usb/musb/musb_gadget.c +     | MUSB Controller driver | <------ drivers/usb/musb/musb_host.c +     |                        | <------ drivers/usb/musb/musb_core.c +     -------------------------- +                 ⬍ +  --------------------------------- +  | MUSB Platform Specific Driver | +  |                               | <-- drivers/usb/musb/jz4740.c +  |       aka "Glue Layer"        | +  --------------------------------- +                 ⬍ +  --------------------------------- +  |   MUSB Controller Hardware    | +  --------------------------------- +    </programlisting> +    <para> +      As outlined above, the glue layer is actually the platform +      specific code sitting in between the controller driver and the +      controller hardware. +    </para> +    <para> +      Just like a Linux USB driver needs to register itself with the +      Linux USB subsystem, the MUSB glue layer needs first to register +      itself with the MUSB controller driver. This will allow the +      controller driver to know about which device the glue layer +      supports and which functions to call when a supported device is +      detected or released; remember we are talking about an embedded +      controller chip here, so no insertion or removal at run-time. +    </para> +    <para> +      All of this information is passed to the MUSB controller driver +      through a platform_driver structure defined in the glue layer as: +    </para> +    <programlisting linenumbering="numbered"> +static struct platform_driver jz4740_driver = { +	.probe		= jz4740_probe, +	.remove		= jz4740_remove, +	.driver		= { +		.name	= "musb-jz4740", +	}, +}; +    </programlisting> +    <para> +      The probe and remove function pointers are called when a matching +      device is detected and, respectively, released. The name string +      describes the device supported by this glue layer. In the current +      case it matches a platform_device structure declared in +      arch/mips/jz4740/platform.c. Note that we are not using device +      tree bindings here. +    </para> +    <para> +      In order to register itself to the controller driver, the glue +      layer goes through a few steps, basically allocating the +      controller hardware resources and initialising a couple of +      circuits. To do so, it needs to keep track of the information used +      throughout these steps. This is done by defining a private +      jz4740_glue structure: +    </para> +    <programlisting linenumbering="numbered"> +struct jz4740_glue { +	struct device           *dev; +	struct platform_device  *musb; +	struct clk		*clk; +}; +    </programlisting> +    <para> +      The dev and musb members are both device structure variables. The +      first one holds generic information about the device, since it's +      the basic device structure, and the latter holds information more +      closely related to the subsystem the device is registered to. The +      clk variable keeps information related to the device clock +      operation. +    </para> +    <para> +      Let's go through the steps of the probe function that leads the +      glue layer to register itself to the controller driver. +    </para> +    <para> +      N.B.: For the sake of readability each function will be split in +      logical parts, each part being shown as if it was independent from +      the others. +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_probe(struct platform_device *pdev) +{ +	struct platform_device		*musb; +	struct jz4740_glue		*glue; +	struct clk                      *clk; +	int				ret; + +	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); +	if (!glue) +		return -ENOMEM; + +	musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); +	if (!musb) { +		dev_err(&pdev->dev, "failed to allocate musb device\n"); +		return -ENOMEM; +	} + +	clk = devm_clk_get(&pdev->dev, "udc"); +	if (IS_ERR(clk)) { +		dev_err(&pdev->dev, "failed to get clock\n"); +		ret = PTR_ERR(clk); +		goto err_platform_device_put; +	} + +	ret = clk_prepare_enable(clk); +	if (ret) { +		dev_err(&pdev->dev, "failed to enable clock\n"); +		goto err_platform_device_put; +	} + +	musb->dev.parent		= &pdev->dev; + +	glue->dev			= &pdev->dev; +	glue->musb			= musb; +	glue->clk			= clk; + +	return 0; + +err_platform_device_put: +	platform_device_put(musb); +	return ret; +} +    </programlisting> +    <para> +      The first few lines of the probe function allocate and assign the +      glue, musb and clk variables. The GFP_KERNEL flag (line 8) allows +      the allocation process to sleep and wait for memory, thus being +      usable in a blocking situation. The PLATFORM_DEVID_AUTO flag (line +      12) allows automatic allocation and management of device IDs in +      order to avoid device namespace collisions with explicit IDs. With +      devm_clk_get() (line 18) the glue layer allocates the clock -- the +      <literal>devm_</literal> prefix indicates that clk_get() is +      managed: it automatically frees the allocated clock resource data +      when the device is released -- and enable it. +    </para> +    <para> +      Then comes the registration steps: +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_probe(struct platform_device *pdev) +{ +	struct musb_hdrc_platform_data	*pdata = &jz4740_musb_platform_data; + +	pdata->platform_ops		= &jz4740_musb_ops; + +	platform_set_drvdata(pdev, glue); + +	ret = platform_device_add_resources(musb, pdev->resource, +					    pdev->num_resources); +	if (ret) { +		dev_err(&pdev->dev, "failed to add resources\n"); +		goto err_clk_disable; +	} + +	ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); +	if (ret) { +		dev_err(&pdev->dev, "failed to add platform_data\n"); +		goto err_clk_disable; +	} + +	return 0; + +err_clk_disable: +	clk_disable_unprepare(clk); +err_platform_device_put: +	platform_device_put(musb); +	return ret; +} +    </programlisting> +    <para> +      The first step is to pass the device data privately held by the +      glue layer on to the controller driver through +      platform_set_drvdata() (line 7). Next is passing on the device +      resources information, also privately held at that point, through +      platform_device_add_resources() (line 9). +    </para> +    <para> +      Finally comes passing on the platform specific data to the +      controller driver (line 16). Platform data will be discussed in +      <link linkend="device-platform-data">Chapter 4</link>, but here +      we are looking at the platform_ops function pointer (line 5) in +      musb_hdrc_platform_data structure (line 3).  This function +      pointer allows the MUSB controller driver to know which function +      to call for device operation: +    </para> +    <programlisting linenumbering="numbered"> +static const struct musb_platform_ops jz4740_musb_ops = { +	.init		= jz4740_musb_init, +	.exit		= jz4740_musb_exit, +}; +    </programlisting> +    <para> +      Here we have the minimal case where only init and exit functions +      are called by the controller driver when needed. Fact is the +      JZ4740 MUSB controller is a basic controller, lacking some +      features found in other controllers, otherwise we may also have +      pointers to a few other functions like a power management function +      or a function to switch between OTG and non-OTG modes, for +      instance. +    </para> +    <para> +      At that point of the registration process, the controller driver +      actually calls the init function: +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_musb_init(struct musb *musb) +{ +	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); +	if (!musb->xceiv) { +		pr_err("HS UDC: no transceiver configured\n"); +		return -ENODEV; +	} + +	/* Silicon does not implement ConfigData register. +	 * Set dyn_fifo to avoid reading EP config from hardware. +	 */ +	musb->dyn_fifo = true; + +	musb->isr = jz4740_musb_interrupt; + +	return 0; +} +    </programlisting> +    <para> +      The goal of jz4740_musb_init() is to get hold of the transceiver +      driver data of the MUSB controller hardware and pass it on to the +      MUSB controller driver, as usual. The transceiver is the circuitry +      inside the controller hardware responsible for sending/receiving +      the USB data. Since it is an implementation of the physical layer +      of the OSI model, the transceiver is also referred to as PHY. +    </para> +    <para> +      Getting hold of the MUSB PHY driver data is done with +      usb_get_phy() which returns a pointer to the structure +      containing the driver instance data. The next couple of +      instructions (line 12 and 14) are used as a quirk and to setup +      IRQ handling respectively. Quirks and IRQ handling will be +      discussed later in <link linkend="device-quirks">Chapter +      5</link> and <link linkend="handling-irqs">Chapter 3</link>. +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_musb_exit(struct musb *musb) +{ +	usb_put_phy(musb->xceiv); + +	return 0; +} +    </programlisting> +    <para> +      Acting as the counterpart of init, the exit function releases the +      MUSB PHY driver when the controller hardware itself is about to be +      released. +    </para> +    <para> +      Again, note that init and exit are fairly simple in this case due +      to the basic set of features of the JZ4740 controller hardware. +      When writing an musb glue layer for a more complex controller +      hardware, you might need to take care of more processing in those +      two functions. +    </para> +    <para> +      Returning from the init function, the MUSB controller driver jumps +      back into the probe function: +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_probe(struct platform_device *pdev) +{ +	ret = platform_device_add(musb); +	if (ret) { +		dev_err(&pdev->dev, "failed to register musb device\n"); +		goto err_clk_disable; +	} + +	return 0; + +err_clk_disable: +	clk_disable_unprepare(clk); +err_platform_device_put: +	platform_device_put(musb); +	return ret; +} +    </programlisting> +    <para> +      This is the last part of the device registration process where the +      glue layer adds the controller hardware device to Linux kernel +      device hierarchy: at this stage, all known information about the +      device is passed on to the Linux USB core stack. +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_remove(struct platform_device *pdev) +{ +	struct jz4740_glue	*glue = platform_get_drvdata(pdev); + +	platform_device_unregister(glue->musb); +	clk_disable_unprepare(glue->clk); + +	return 0; +} +    </programlisting> +    <para> +      Acting as the counterpart of probe, the remove function unregister +      the MUSB controller hardware (line 5) and disable the clock (line +      6), allowing it to be gated. +    </para> +  </chapter> + +  <chapter id="handling-irqs"> +    <title>Handling IRQs</title> +    <para> +      Additionally to the MUSB controller hardware basic setup and +      registration, the glue layer is also responsible for handling the +      IRQs: +    </para> +    <programlisting linenumbering="numbered"> +static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) +{ +	unsigned long   flags; +	irqreturn_t     retval = IRQ_NONE; +	struct musb     *musb = __hci; + +	spin_lock_irqsave(&musb->lock, flags); + +	musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); +	musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); +	musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); + +	/* +	 * The controller is gadget only, the state of the host mode IRQ bits is +	 * undefined. Mask them to make sure that the musb driver core will +	 * never see them set +	 */ +	musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | +	    MUSB_INTR_RESET | MUSB_INTR_SOF; + +	if (musb->int_usb || musb->int_tx || musb->int_rx) +		retval = musb_interrupt(musb); + +	spin_unlock_irqrestore(&musb->lock, flags); + +	return retval; +} +    </programlisting> +    <para> +      Here the glue layer mostly has to read the relevant hardware +      registers and pass their values on to the controller driver which +      will handle the actual event that triggered the IRQ. +    </para> +    <para> +      The interrupt handler critical section is protected by the +      spin_lock_irqsave() and counterpart spin_unlock_irqrestore() +      functions (line 7 and 24 respectively), which prevent the +      interrupt handler code to be run by two different threads at the +      same time. +    </para> +    <para> +      Then the relevant interrupt registers are read (line 9 to 11): +    </para> +    <itemizedlist> +      <listitem> +        <para> +          MUSB_INTRUSB: indicates which USB interrupts are currently +          active, +        </para> +      </listitem> +      <listitem> +        <para> +          MUSB_INTRTX: indicates which of the interrupts for TX +          endpoints are currently active, +        </para> +      </listitem> +      <listitem> +        <para> +          MUSB_INTRRX: indicates which of the interrupts for TX +          endpoints are currently active. +        </para> +      </listitem> +    </itemizedlist> +    <para> +      Note that musb_readb() is used to read 8-bit registers at most, +      while musb_readw() allows us to read at most 16-bit registers. +      There are other functions that can be used depending on the size +      of your device registers. See musb_io.h for more information. +    </para> +    <para> +      Instruction on line 18 is another quirk specific to the JZ4740 +      USB device controller, which will be discussed later in <link +      linkend="device-quirks">Chapter 5</link>. +    </para> +    <para> +      The glue layer still needs to register the IRQ handler though. +      Remember the instruction on line 14 of the init function: +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_musb_init(struct musb *musb) +{ +	musb->isr = jz4740_musb_interrupt; + +	return 0; +} +    </programlisting> +    <para> +      This instruction sets a pointer to the glue layer IRQ handler +      function, in order for the controller hardware to call the handler +      back when an IRQ comes from the controller hardware. The interrupt +      handler is now implemented and registered. +    </para> +  </chapter> + +  <chapter id="device-platform-data"> +    <title>Device Platform Data</title> +    <para> +      In order to write an MUSB glue layer, you need to have some data +      describing the hardware capabilities of your controller hardware, +      which is called the platform data. +    </para> +    <para> +      Platform data is specific to your hardware, though it may cover a +      broad range of devices, and is generally found somewhere in the +      arch/ directory, depending on your device architecture. +    </para> +    <para> +      For instance, platform data for the JZ4740 SoC is found in +      arch/mips/jz4740/platform.c. In the platform.c file each device of +      the JZ4740 SoC is described through a set of structures. +    </para> +    <para> +      Here is the part of arch/mips/jz4740/platform.c that covers the +      USB Device Controller (UDC): +    </para> +    <programlisting linenumbering="numbered"> +/* USB Device Controller */ +struct platform_device jz4740_udc_xceiv_device = { +	.name = "usb_phy_gen_xceiv", +	.id   = 0, +}; + +static struct resource jz4740_udc_resources[] = { +	[0] = { +		.start = JZ4740_UDC_BASE_ADDR, +		.end   = JZ4740_UDC_BASE_ADDR + 0x10000 - 1, +		.flags = IORESOURCE_MEM, +	}, +	[1] = { +		.start = JZ4740_IRQ_UDC, +		.end   = JZ4740_IRQ_UDC, +		.flags = IORESOURCE_IRQ, +		.name  = "mc", +	}, +}; + +struct platform_device jz4740_udc_device = { +	.name = "musb-jz4740", +	.id   = -1, +	.dev  = { +		.dma_mask          = &jz4740_udc_device.dev.coherent_dma_mask, +		.coherent_dma_mask = DMA_BIT_MASK(32), +	}, +	.num_resources = ARRAY_SIZE(jz4740_udc_resources), +	.resource      = jz4740_udc_resources, +}; +    </programlisting> +    <para> +      The jz4740_udc_xceiv_device platform device structure (line 2) +      describes the UDC transceiver with a name and id number. +    </para> +    <para> +      At the time of this writing, note that +      "usb_phy_gen_xceiv" is the specific name to be used for +      all transceivers that are either built-in with reference USB IP or +      autonomous and doesn't require any PHY programming. You will need +      to set CONFIG_NOP_USB_XCEIV=y in the kernel configuration to make +      use of the corresponding transceiver driver. The id field could be +      set to -1 (equivalent to PLATFORM_DEVID_NONE), -2 (equivalent to +      PLATFORM_DEVID_AUTO) or start with 0 for the first device of this +      kind if we want a specific id number. +    </para> +    <para> +      The jz4740_udc_resources resource structure (line 7) defines the +      UDC registers base addresses. +    </para> +    <para> +      The first array (line 9 to 11) defines the UDC registers base +      memory addresses: start points to the first register memory +      address, end points to the last register memory address and the +      flags member defines the type of resource we are dealing with. So +      IORESOURCE_MEM is used to define the registers memory addresses. +      The second array (line 14 to 17) defines the UDC IRQ registers +      addresses. Since there is only one IRQ register available for the +      JZ4740 UDC, start and end point at the same address. The +      IORESOURCE_IRQ flag tells that we are dealing with IRQ resources, +      and the name "mc" is in fact hard-coded in the MUSB core +      in order for the controller driver to retrieve this IRQ resource +      by querying it by its name. +    </para> +    <para> +      Finally, the jz4740_udc_device platform device structure (line 21) +      describes the UDC itself. +    </para> +    <para> +      The "musb-jz4740" name (line 22) defines the MUSB +      driver that is used for this device; remember this is in fact +      the name that we used in the jz4740_driver platform driver +      structure in <link linkend="linux-musb-basics">Chapter +      2</link>. The id field (line 23) is set to -1 (equivalent to +      PLATFORM_DEVID_NONE) since we do not need an id for the device: +      the MUSB controller driver was already set to allocate an +      automatic id in <link linkend="linux-musb-basics">Chapter +      2</link>. In the dev field we care for DMA related information +      here. The dma_mask field (line 25) defines the width of the DMA +      mask that is going to be used, and coherent_dma_mask (line 26) +      has the same purpose but for the alloc_coherent DMA mappings: in +      both cases we are using a 32 bits mask. Then the resource field +      (line 29) is simply a pointer to the resource structure defined +      before, while the num_resources field (line 28) keeps track of +      the number of arrays defined in the resource structure (in this +      case there were two resource arrays defined before). +    </para> +    <para> +      With this quick overview of the UDC platform data at the arch/ +      level now done, let's get back to the MUSB glue layer specific +      platform data in drivers/usb/musb/jz4740.c: +    </para> +    <programlisting linenumbering="numbered"> +static struct musb_hdrc_config jz4740_musb_config = { +	/* Silicon does not implement USB OTG. */ +	.multipoint = 0, +	/* Max EPs scanned, driver will decide which EP can be used. */ +	.num_eps    = 4, +	/* RAMbits needed to configure EPs from table */ +	.ram_bits   = 9, +	.fifo_cfg = jz4740_musb_fifo_cfg, +	.fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg), +}; + +static struct musb_hdrc_platform_data jz4740_musb_platform_data = { +	.mode   = MUSB_PERIPHERAL, +	.config = &jz4740_musb_config, +}; +    </programlisting> +    <para> +      First the glue layer configures some aspects of the controller +      driver operation related to the controller hardware specifics. +      This is done through the jz4740_musb_config musb_hdrc_config +      structure. +    </para> +    <para> +      Defining the OTG capability of the controller hardware, the +      multipoint member (line 3) is set to 0 (equivalent to false) +      since the JZ4740 UDC is not OTG compatible. Then num_eps (line +      5) defines the number of USB endpoints of the controller +      hardware, including endpoint 0: here we have 3 endpoints + +      endpoint 0. Next is ram_bits (line 7) which is the width of the +      RAM address bus for the MUSB controller hardware. This +      information is needed when the controller driver cannot +      automatically configure endpoints by reading the relevant +      controller hardware registers. This issue will be discussed when +      we get to device quirks in <link linkend="device-quirks">Chapter +      5</link>. Last two fields (line 8 and 9) are also about device +      quirks: fifo_cfg points to the USB endpoints configuration table +      and fifo_cfg_size keeps track of the size of the number of +      entries in that configuration table. More on that later in <link +      linkend="device-quirks">Chapter 5</link>. +    </para> +    <para> +      Then this configuration is embedded inside +      jz4740_musb_platform_data musb_hdrc_platform_data structure (line +      11): config is a pointer to the configuration structure itself, +      and mode tells the controller driver if the controller hardware +      may be used as MUSB_HOST only, MUSB_PERIPHERAL only or MUSB_OTG +      which is a dual mode. +    </para> +    <para> +      Remember that jz4740_musb_platform_data is then used to convey +      platform data information as we have seen in the probe function +      in <link linkend="linux-musb-basics">Chapter 2</link> +    </para> +  </chapter> + +  <chapter id="device-quirks"> +    <title>Device Quirks</title> +    <para> +      Completing the platform data specific to your device, you may also +      need to write some code in the glue layer to work around some +      device specific limitations. These quirks may be due to some +      hardware bugs, or simply be the result of an incomplete +      implementation of the USB On-the-Go specification. +    </para> +    <para> +      The JZ4740 UDC exhibits such quirks, some of which we will discuss +      here for the sake of insight even though these might not be found +      in the controller hardware you are working on. +    </para> +    <para> +      Let's get back to the init function first: +    </para> +    <programlisting linenumbering="numbered"> +static int jz4740_musb_init(struct musb *musb) +{ +	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); +	if (!musb->xceiv) { +		pr_err("HS UDC: no transceiver configured\n"); +		return -ENODEV; +	} + +	/* Silicon does not implement ConfigData register. +	 * Set dyn_fifo to avoid reading EP config from hardware. +	 */ +	musb->dyn_fifo = true; + +	musb->isr = jz4740_musb_interrupt; + +	return 0; +} +    </programlisting> +    <para> +      Instruction on line 12 helps the MUSB controller driver to work +      around the fact that the controller hardware is missing registers +      that are used for USB endpoints configuration. +    </para> +    <para> +      Without these registers, the controller driver is unable to read +      the endpoints configuration from the hardware, so we use line 12 +      instruction to bypass reading the configuration from silicon, and +      rely on a hard-coded table that describes the endpoints +      configuration instead: +    </para> +    <programlisting linenumbering="numbered"> +static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = { +{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, +{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, +{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, }, +}; +    </programlisting> +    <para> +      Looking at the configuration table above, we see that each +      endpoints is described by three fields: hw_ep_num is the endpoint +      number, style is its direction (either FIFO_TX for the controller +      driver to send packets in the controller hardware, or FIFO_RX to +      receive packets from hardware), and maxpacket defines the maximum +      size of each data packet that can be transmitted over that +      endpoint. Reading from the table, the controller driver knows that +      endpoint 1 can be used to send and receive USB data packets of 512 +      bytes at once (this is in fact a bulk in/out endpoint), and +      endpoint 2 can be used to send data packets of 64 bytes at once +      (this is in fact an interrupt endpoint). +    </para> +    <para> +      Note that there is no information about endpoint 0 here: that one +      is implemented by default in every silicon design, with a +      predefined configuration according to the USB specification. For +      more examples of endpoint configuration tables, see musb_core.c. +    </para> +    <para> +      Let's now get back to the interrupt handler function: +    </para> +    <programlisting linenumbering="numbered"> +static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci) +{ +	unsigned long   flags; +	irqreturn_t     retval = IRQ_NONE; +	struct musb     *musb = __hci; + +	spin_lock_irqsave(&musb->lock, flags); + +	musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); +	musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); +	musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); + +	/* +	 * The controller is gadget only, the state of the host mode IRQ bits is +	 * undefined. Mask them to make sure that the musb driver core will +	 * never see them set +	 */ +	musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME | +	    MUSB_INTR_RESET | MUSB_INTR_SOF; + +	if (musb->int_usb || musb->int_tx || musb->int_rx) +		retval = musb_interrupt(musb); + +	spin_unlock_irqrestore(&musb->lock, flags); + +	return retval; +} +    </programlisting> +    <para> +      Instruction on line 18 above is a way for the controller driver to +      work around the fact that some interrupt bits used for USB host +      mode operation are missing in the MUSB_INTRUSB register, thus left +      in an undefined hardware state, since this MUSB controller +      hardware is used in peripheral mode only. As a consequence, the +      glue layer masks these missing bits out to avoid parasite +      interrupts by doing a logical AND operation between the value read +      from MUSB_INTRUSB and the bits that are actually implemented in +      the register. +    </para> +    <para> +      These are only a couple of the quirks found in the JZ4740 USB +      device controller. Some others were directly addressed in the MUSB +      core since the fixes were generic enough to provide a better +      handling of the issues for others controller hardware eventually. +    </para> +  </chapter> + +  <chapter id="conclusion"> +    <title>Conclusion</title> +    <para> +      Writing a Linux MUSB glue layer should be a more accessible task, +      as this documentation tries to show the ins and outs of this +      exercise. +    </para> +    <para> +      The JZ4740 USB device controller being fairly simple, I hope its +      glue layer serves as a good example for the curious mind. Used +      with the current MUSB glue layers, this documentation should +      provide enough guidance to get started; should anything gets out +      of hand, the linux-usb mailing list archive is another helpful +      resource to browse through. +    </para> +  </chapter> + +  <chapter id="acknowledgements"> +    <title>Acknowledgements</title> +    <para> +      Many thanks to Lars-Peter Clausen and Maarten ter Huurne for +      answering my questions while I was writing the JZ4740 glue layer +      and for helping me out getting the code in good shape. +    </para> +    <para> +      I would also like to thank the Qi-Hardware community at large for +      its cheerful guidance and support. +    </para> +  </chapter> + +  <chapter id="resources"> +    <title>Resources</title> +    <para> +      USB Home Page: +      <ulink url="http://www.usb.org">http://www.usb.org</ulink> +    </para> +    <para> +      linux-usb Mailing List Archives: +      <ulink url="http://marc.info/?l=linux-usb">http://marc.info/?l=linux-usb</ulink> +    </para> +    <para> +      USB On-the-Go Basics: +      <ulink url="http://www.maximintegrated.com/app-notes/index.mvp/id/1822">http://www.maximintegrated.com/app-notes/index.mvp/id/1822</ulink> +    </para> +    <para> +      Writing USB Device Drivers: +      <ulink url="https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html">https://www.kernel.org/doc/htmldocs/writing_usb_driver/index.html</ulink> +    </para> +    <para> +      Texas Instruments USB Configuration Wiki Page: +      <ulink url="http://processors.wiki.ti.com/index.php/Usbgeneralpage">http://processors.wiki.ti.com/index.php/Usbgeneralpage</ulink> +    </para> +    <para> +      Analog Devices Blackfin MUSB Configuration: +      <ulink url="http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb">http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb</ulink> +    </para> +  </chapter> + +</book>  | 
